jonesr227
09-12-2007, 01:34 AM
The following code backtests OK but in live simulated trading the initial 1 short contract gets reversed to 2 long contracts, whereas I expect that there to be only 1 long contract. The live simulation result is shown in attached graphic.
The relevant reversing code segment is given below. I don't see what is wrong with my code (especially since it backtests OK).
elseif (Position.MarketPosition == MarketPosition.Short)
{
sellsToday = true;
traded = true;
if (!buysToday)
{
bp = MIN(Low, BarsSinceEntry())[0] + diff;
ExitShortStop(bp);
if ( (ToTime(Time[0]) <= Time_RevEnd) && ShortRev )
{
EnterLongStop(bp, "SRev");
LongRev = false;
sellsToday = false;
}
}
}
The relevant reversing code segment is given below. I don't see what is wrong with my code (especially since it backtests OK).
elseif (Position.MarketPosition == MarketPosition.Short)
{
sellsToday = true;
traded = true;
if (!buysToday)
{
bp = MIN(Low, BarsSinceEntry())[0] + diff;
ExitShortStop(bp);
if ( (ToTime(Time[0]) <= Time_RevEnd) && ShortRev )
{
EnterLongStop(bp, "SRev");
LongRev = false;
sellsToday = false;
}
}
}