Hi Wayne,
The markets I trade are very illiquid between the StartTime and EndTime and the charts often print prices which are not truely obtainable, therefore I dont want the strategy to execute between these hours so the "if ((hour(0) * 100) + minute(0) < StartTime || (hour(0) * 100) + minute(0) > EndTime) return;" line is doing its job!
As for the dayFlag, yeah that makes total sense, although I have included "if (getCurrentBarIndex() == 0) return; " in the code so it will not be working in realtime, so is that still applicable?
Im sorry, I don't quite follow you regarding the variables. Do they need to be defined in the preMain as "bYLong1 = null" rathwe than "bYLong1 = false?"
I have experimented with the code, and forced the bYLong1 and bYLong2 variables to be true. I had hoped that this would then lead onto the
[php]
if (bYLong1 == true && bYLong2 == true && bYLong3 == false && bYLong4 == false)
{
if (high(0)> nYPrice-Sup1)
{
nOExitPrice = nYPrice-Sup1;
Strategy.doSell("Overnight Exit L2 Signal", Strategy.LIMIT, Strategy.THISBAR, Strategy.ALL, nOExitPrice);
drawShape(Shape.DIAMOND, AboveBar2, Color.green);
bYLong1 = false; bYLong2 = false; bYLong3 = false; bYLong4 = false;
}
}
code in the "Overnight Exit Logic" section being executed (wanting the code to exit a position from the previous day that was held overnight to exit at Yesterdays Open price - Sup1) but this did not happen.
I then removed the "if (bYLong1 == true && bYLong2 == true && bYLong3 == false && bYLong4 == false)" condition from the above code, but it still did not execute the exit so Im now doubting if the problem lies within these variables.
I also tried removing the "if (Strategy.isInTrade())" conditions from the overnight exit logic as I thought maybe the EFS strategy object resets itself automatically back to flat at the start of a new day, but that didn't seem to get the code to execute either.
I hope I am explaining this well enough for you to make sense of it?! Again, thanks in advance for any further help... this one has really got me scratching my head!!
Daniel
The markets I trade are very illiquid between the StartTime and EndTime and the charts often print prices which are not truely obtainable, therefore I dont want the strategy to execute between these hours so the "if ((hour(0) * 100) + minute(0) < StartTime || (hour(0) * 100) + minute(0) > EndTime) return;" line is doing its job!
As for the dayFlag, yeah that makes total sense, although I have included "if (getCurrentBarIndex() == 0) return; " in the code so it will not be working in realtime, so is that still applicable?
Im sorry, I don't quite follow you regarding the variables. Do they need to be defined in the preMain as "bYLong1 = null" rathwe than "bYLong1 = false?"
I have experimented with the code, and forced the bYLong1 and bYLong2 variables to be true. I had hoped that this would then lead onto the
[php]
if (bYLong1 == true && bYLong2 == true && bYLong3 == false && bYLong4 == false)
{
if (high(0)> nYPrice-Sup1)
{
nOExitPrice = nYPrice-Sup1;
Strategy.doSell("Overnight Exit L2 Signal", Strategy.LIMIT, Strategy.THISBAR, Strategy.ALL, nOExitPrice);
drawShape(Shape.DIAMOND, AboveBar2, Color.green);
bYLong1 = false; bYLong2 = false; bYLong3 = false; bYLong4 = false;
}
}
code in the "Overnight Exit Logic" section being executed (wanting the code to exit a position from the previous day that was held overnight to exit at Yesterdays Open price - Sup1) but this did not happen.
I then removed the "if (bYLong1 == true && bYLong2 == true && bYLong3 == false && bYLong4 == false)" condition from the above code, but it still did not execute the exit so Im now doubting if the problem lies within these variables.
I also tried removing the "if (Strategy.isInTrade())" conditions from the overnight exit logic as I thought maybe the EFS strategy object resets itself automatically back to flat at the start of a new day, but that didn't seem to get the code to execute either.
I hope I am explaining this well enough for you to make sense of it?! Again, thanks in advance for any further help... this one has really got me scratching my head!!
Daniel
Comment