Plot nothing

Posted By: SFF

Plot nothing - 03/06/13 11:47

While debugging, this simple code plots nothing and I don't know why.
Why this happens. It is complied.

Code:
int trendPeriod = 1;


function run(){
	
  set(TICKS);

 
 
 vars ma = series(EMA(priceClose(),trendPeriod));
 

 
plot("Signal", ma[0], 0, RED);


}

Posted By: jcl

Re: Plot nothing - 03/06/13 11:56

I think that does not even compile, due to the missing series in the EMA call.
Posted By: SFF

Re: Plot nothing - 03/06/13 12:00

That is a newbie mistake.
Thank you.
Posted By: SFF

Re: Plot nothing - 03/06/13 12:10

When I set trendPeriod = 1, It says below.

Error 011: Function EMA called with invalid data.

Why this considered invalid?
Posted By: jcl

Re: Plot nothing - 03/06/13 14:07

Because Zorro uses the ta-lib indicators that are very complaining when fed with bad data. trendPeriod = 1 is not really invalid, but makes no sense either, therefore the error message.
Posted By: SFF

Re: Plot nothing - 03/09/13 05:18

This simple script only plots SMA, but don't enter although there is a clear signal on the chart.

Anything wrong?

Code:
int period=55;


function run(){

set(PLOTPRICE+PLOTNOW);
BarPeriod = 15;
LookBack = 500;
StartDate = 20121024;
NumDays = 55;

  set(TICKS);

TimeFrame = 1;
vars Close15 = series(priceClose());
vars tmp115 = series(SMA(Close15,period));


if(crossUnder(priceClose, tmp115))
enterShort();

plot("sma", tmp115[0], 0, RED);

}

© 2024 lite-C Forums