Saving the current bar to a variable and adding one, would then make the if statement,
if(xCurrentBar == CurrentBar)
Print(CurrentBar.ToString()); Print(xCurrentBar.ToString());
Regarding how to convert the code I provided you to exit your position on the next bar rather than set a stop loss, you would want to use ExitLong/ExitShort methods for which are covered in the following section of our helpguide.
Please let us know if you need further assistance.
Leave a comment: