Have code with 2 instruments NQ as main intrument + ES:
Add("ES 09-16", PeriodType.Minute, BarsPeriod.Value);
if (Position.MarketPosition == MarketPosition.Flat && (Closes[0][0] - EtN) > 0 && (Closes[0][0] - EtN) > 5 ) { if (BarsInProgress == 0) EnterShort(5, "NQ"); if (BarsInProgress == 1) EnterLong(4, "ES"); }
I cant Exit them correctly:
if (BarsInProgress == 0) { if (CrossBelow(XXXXX, 0, 1) || CrossAbove(XXXXX, 0, 1)) { //if (BarsInProgress == 0) ExitLong("NQ"); //if (BarsInProgress == 1) ExitShort("NQ"); } } if (BarsInProgress == 1) { if (CrossBelow(XXXXXX, 0, 1) || CrossAbove(XXXXXX, 0, 1)) { //if (BarsInProgress == 0) ExitShort("ES"); //if (BarsInProgress == 1) ExitLong("ES"); } }
if (BarsInProgress == 0) { if (CrossBelow(XXXXX, 0, 1) || CrossAbove(XXXXX, 0, 1)) { ExitLong(); ExitShort(); } } if (BarsInProgress == 1) { if (CrossBelow(XXXXXX, 0, 1) || CrossAbove(XXXXXX, 0, 1)) { ExitShort(); ExitLong(); } }
Noone Exits or 1 Exit and another is not.
Comment