Having Issues Running A Tweaked Version Of Workshop4

Posted By: Gerald

Having Issues Running A Tweaked Version Of Workshop4 - 04/28/18 17:19

Hello All,

I am new to Zorro and the community and excited to dive in. I have about a year of programming experience and about 2 months of experience in the trading world.

So I've gone through all the basic workshops on the User Manual and was able to run every file successfully, but once I tried running Workshop4 with a few tweaks as well as linking to an OANDA practice account, I keep running into issues. Here is my tweaked version of the code:


// Trend Trading ///////////////////
#include <profile.c>

function run()
{

asset("USD/JPY");

BarPeriod = 60; // 4 hour bars
StartDate = 2010;
EndDate = 2017; // fixed simulation period
LookBack = 500;
Verbose = 2;
set(LOGFILE); // log all trades

vars Price = series(price());
vars Trend = series(LowPass(Price,500));

Stop = 4*ATR(100);

vars MMI_Raw = series(MMI(Price,300));
vars MMI_Smooth = series(LowPass(MMI_Raw,300));

if(falling(MMI_Smooth)) {
if(valley(Trend))
enterLong();
else if(peak(Trend))
enterShort();
}
}


The error I keep running to is:

Error 047: Not enough bars (65 missing)

What am I doing wrong? I've played with LookBack, although it doesn't make any sense to me to have to lower the value of it and no reason to increase it.

I've played around with StartDate and EndDate and that hasn't helped. And for some reason, whenever I would set it to (for example) 2015 - 2016, it would automatically show on Zorro that I requested 2015 - 2020... Not sure why it automatically just adds 5 years to StartDate.

Any help would be greatly appreciated. Thanks!
Posted By: jyd

Re: Having Issues Running A Tweaked Version Of Workshop4 - 04/30/18 01:20

Try to move your assert(..) line down to below Loopback line. The order of how you put together your code is important in Zorro coding. you might look into workshop 6 carefully to see how this is put together. good luck
© 2024 lite-C Forums