StartDate = 2018;
EndDate = 2019;
BarPeriod = 5;
LookBack = 80*4*24; // ~ 4 months
MaxBars = 2000;
//series for different bands defined using global variables
while(asset(loop("EUR/USD", "USD/JPY")))
while(algo(loop("M5", "M15", "H1","H4", "H24")))
{
TimeFrame = 1;
vars Close = series(priceClose());
vars priceLows = series(priceLow());
vars priceHighs = series(priceHigh());
BBands((series(10*priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
upperBandM5 = series(rRealUpperBand/10);
lowerBandM5 = series(rRealLowerBand/10);
middleBandM5 = series(rRealMiddleBand/10);
widthM5 = (upperBandM5[1] - lowerBandM5[1])/middleBandM5[0];
if(Algo == "M15")
{
// BBands((series(10*priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
// upperBandM15 = series(rRealUpperBand/10);
// lowerBandM15 = series(rRealLowerBand/10);
// middleBandM15 = series(rRealMiddleBand/10);
// widthM15 = (upperBandM15[1] - lowerBandM15[1])/middleBandM15[0];
}
else if(Algo == "H1")
{
TimeFrame = H1;
BBands((series(10*priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
upperBandH1 = series(rRealUpperBand/10);
lowerBandH1 = series(rRealLowerBand/10);
middleBandH1 = series(rRealMiddleBand/10);
widthH1 = (upperBandH1[1] - lowerBandH1[1])/middleBandH1[0];
}
else if(Algo == "H4")
{
TimeFrame = H4; //4*4;
BBands((series(10*priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
upperBandH4 = series(rRealUpperBand/10);
lowerBandH4 = series(rRealLowerBand/10);
middleBandH4 = series(rRealMiddleBand/10);
widthH4 = (upperBandH4[1] - lowerBandH4[1])/middleBandH4[0];
}
else if(Algo == "H24")
{
TimeFrame = H4;
BBands((series(10*priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
upperBandH24 = series(rRealUpperBand/10);
lowerBandH24 = series(rRealLowerBand/10);
middleBandH24 = series(rRealMiddleBand/10);
widthH24 = (upperBandH24[1] - lowerBandH24[1])/middleBandH24[0];
}
if (crossOver(Close, upperBandH4)) //This causes Zorro to crash
{
LifeTime = 1;
enterShort();
}
}