I am constructing a strategy which will have as a component a statement that prevents entering for a certain number of bars after the initial entry.
The current way i am trying to achieve this is highlighted below.
protected override void Initialize()
{
double TradeSetOne = 0;
double TradeSetTwo = 0;
protected override void OnBarUpdate()
// Condition set 1
if (conditions
&& TradeSetOne == 0)
{
EnterLong:
TradeSetOne = 1;
}
if (conditions
&& BarsSinceExit() > 20
&& TradeSetOne == 1)
{
EnterLong:
}
I was just hoping if someone could point out why this is this case and what the solution could be.
Many Thanks for any help
4blue

Comment