Hi JCL and Co,
Thanks for your help in advance. I have added a time definition to the machine learning strategy in hopes it will only take in data only on the london session, however upon backtesting it is returning exactly the same results before. Leading me to think this isn't working properly.
Here is the code, please let me know if this is right-
///////////////////////////////////////////////////////////////////////
#include <r.h>
var change(int n)
{
return scale((priceClose(0) - priceClose(n))/priceClose(0),100)/100;
}
var range(int n)
{
return scale((HH(n) - LL(n))/priceClose(0),100)/100;
}
///////////////////////////////////////////////////////////////////////
function run()
{
StartDate = 20140601;
BarPeriod = 60; // 1 hour
LookBack = 100;
WFOPeriod = 252*24; // 1 year
DataSplit = 90;
NumCores = -1;
set(RULES|LOGFILE|TESTNOW|PLOTNOW);
Spread = RollLong = RollShort = Commission = Slippage = 0;
LifeTime = 3;
if(Train) Hedge = 2;
Trail = optimize(4,2,20) * ATR(50);
///////////////////////////////////////////////////////////
// skipping bars for a certain time period
static int BarsMissing = 0;
if(hour() >= 1600 and hour() <= 900) // 0 when the current bar has no price quotes
{
TimeFrame = 0; // set to zero when not in frame
BarsMissing++;
}
else if (hour() == 900 and minute() == 0 )
{
TimeFrame = -BarsMissing; // set TimeFrame to the negative number of skipped bars for ending the frame
BarsMissing = 17;
}
else
TimeFrame = 1; // Normal operation
{
if(adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4)) > 0.5)
enterLong();
if(adviseShort() > 0.5)
enterShort();
}
PlotWidth = 800;
PlotHeight1 = 340;
ColorUp = ColorDn = ColorWin = ColorLoss = 0;
}