01-08-2019, 02:45 PM
Hey, I need a simple strategy code temple that I can add more conditions to, so please add notes in the code where needed. Right now I have this code.
if (CrossBelow(Close,ParabolicSAR1,1))
{EnterShort(Convert.ToInt32(DefaultQuantity), "");}
// Set 2
if (BarsSinceEntryExecution()==4)
{ExitShort(Convert.ToInt32(DefaultQuantity), "", "");}
Which I add the conditions I want, then when they are met it opens a position, then 4 bars have passed it closes the position. I need it to close the positions on 5 minute intervals instead of 4 bars have passed. So if the order was opened at 2:20 it closes at 2:25, if opened at 2:21 it closes at 2:25, if opened at 2:27 it closes at 2:30, if opened at 2:29 it closes at 2:30, and so on and so on.
if (CrossBelow(Close,ParabolicSAR1,1))
{EnterShort(Convert.ToInt32(DefaultQuantity), "");}
// Set 2
if (BarsSinceEntryExecution()==4)
{ExitShort(Convert.ToInt32(DefaultQuantity), "", "");}
Which I add the conditions I want, then when they are met it opens a position, then 4 bars have passed it closes the position. I need it to close the positions on 5 minute intervals instead of 4 bars have passed. So if the order was opened at 2:20 it closes at 2:25, if opened at 2:21 it closes at 2:25, if opened at 2:27 it closes at 2:30, if opened at 2:29 it closes at 2:30, and so on and so on.