|
|
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
OP
Member
|
OP
Member
Joined: Nov 2013
Posts: 123
|
Hi, I am plotting some indicators and if I plot the EMA using this 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:
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: jcl]
#436867
02/04/14 15:19
02/04/14 15:19
|
Joined: Nov 2013
Posts: 123
Mithrandir77
OP
Member
|
OP
Member
Joined: Nov 2013
Posts: 123
|
Thanks! I thought since the manual says: 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:
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]
#436959
02/06/14 15:28
02/06/14 15:28
|
Joined: Jul 2000
Posts: 28,075 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 28,075
Frankfurt
|
|
|
|
|