Gamestudio Links
Zorro Links
Newest Posts
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
Zorro version 3.0 prerelease!
by TipmyPip. 02/24/26 17:09
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
5 registered members (Martin_HH, TipmyPip, AndrewAMD, Grant, USER0328), 5,287 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Plotting ZMA and not getting what I expected #436762
02/01/14 15:33
02/01/14 15:33
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
Hi, I am plotting some indicators and if I plot the EMA using this code:

Code:
function run()
{  
  BarPeriod = 240;
  StartDate = 2010;
  set(TICKS); 	
  asset("EUR/USD");
  set(PLOTNOW);
  vars Price = series(price());
  var ema = EMA(Price,26);  
  plot("ZMA",ema,MAIN,RED); 
  plot("Price",Price[0],MAIN,BLACK);  
}



it plots:



But when using this code to plot ZMA:

Code:
function run()
{  
  BarPeriod = 240;
  StartDate = 2010;
  set(TICKS); 	
  asset("EUR/USD");
  set(PLOTNOW);
  vars Price = series(price());  
  var zma = ZMA(Price,0);
  plot("ZMA",zma,MAIN,RED); 
  plot("Price",Price[0],MAIN,BLACK);  
}



it plots:



What is wrong? I expected a line not those bars.

Also, what is the meaning of the numbers on top of the graph? (Op,Hi,Lo,CI,ZMA and Price), I did not find it in the documentation. Thanks beforehand!

Re: Plotting ZMA and not getting what I expected [Re: Mithrandir77] #436818
02/03/14 09:19
02/03/14 09:19
Joined: Jul 2000
Posts: 28,075
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,075
Frankfurt
Averages calculate the average over a given number of bars. An average of 0 bars makes not much sense and will produce strange results.

The numbers in the title have no particular meaning. They are the end values of the series and automatically printed by the charting library.

Re: Plotting ZMA and not getting what I expected [Re: jcl] #436867
02/04/14 15:19
02/04/14 15:19
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
Thanks! I thought since the manual says:

Quote:
TimePeriod The number of bars for the time period of the function, if any; or 0 for using a default period.


That "default period" was some arbitrary period ( greater than 0 of course).

Here is the corrected version:

Code:
function run()
{  
  BarPeriod = 240;
  StartDate = 2010;
  set(TICKS); 	
  asset("EUR/USD");
  set(PLOTNOW);
  vars Price = series(price());  
  var zma = ZMA(Price,DominantPeriod(Price,30));
  plot("ZMA",zma,MAIN,RED); 
  plot("Price",Price[0],MAIN,BLACK);  
}


Re: Plotting ZMA and not getting what I expected [Re: Mithrandir77] #436893
02/05/14 07:56
02/05/14 07:56
Joined: Jul 2000
Posts: 28,075
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,075
Frankfurt
Period 0 is only replaced when the indicator got a default period by its inventor, such as 21/9 for the MACD. Otherwise, 0 stays 0.

Re: Plotting ZMA and not getting what I expected [Re: jcl] #436944
02/06/14 04:13
02/06/14 04:13
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
Originally Posted By: jcl
Period 0 is only replaced when the indicator got a default period by its inventor, such as 21/9 for the MACD. Otherwise, 0 stays 0.


Thanks for the clarification. This should be in the documentation, particularly for people like me which come from the IT field and don't know much of financial indicators. Just a suggestion, I am not complaining! smile

Re: Plotting ZMA and not getting what I expected [Re: Mithrandir77] #436959
02/06/14 15:28
02/06/14 15:28
Joined: Jul 2000
Posts: 28,075
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,075
Frankfurt
Yes, will do.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1