Don't know why, but when you change the exit to @ market, it seems to solve the problem without affecting the results greatly.
I think that its a bug in the TS coding where if you happen to get 2 signals generated at the same price on the same bar, it only prints one signal. This means that our results still hold up.
I think that its a bug in the TS coding where if you happen to get 2 signals generated at the same price on the same bar, it only prints one signal. This means that our results still hold up.
Inserted Code
inputs: dollarStop(500), emaLength(10), exitEMALength(50);
{$1600 stop for the USDCHF, $1200 stop for the GBPUSD}
vars: upperEMA(0), lowerEMA(0), totTr(0), prof(0), tradeStr(""), middleEMA(0), breakEvenEngageL(FALSE), breakEvenEngageS(FALSE), numContracts(0);
upperEMA = xaverage(high,emaLength)[1] of data2; {data2 is daily}
lowerEMA = xaverage(low,emaLength)[1] of data2;
middleEMA = xaverage(open,emaLength) of data2;
numContracts = 1; {intPortion(((20000 + NetProfit)*.10)/1400);}
{************************************************* ********SELL SIGNAL******************************************** **************}
if marketPosition > -1 and high crosses above upperEMA then sell numContracts contract at upperEMA limit;
{************************************************* ************************************************** ***************************}
{************************************************* *********BUY SIGNAL******************************************** **************}
if marketPosition < 1 and low crosses below lowerEMA then buy numContracts contract at lowerEMA limit;
{************************************************* ************************************************** ***************************}
{************************************************* ********EXIT SIGNALS******************************************* **************}
if marketPosition = 1 and high > upperEMA then exitLong ("LX Target1") at market;
if marketPosition = -1 and low < lowerEMA then exitShort ("SX Target1") at market;
{************************************************* ************************************************** **************************}
if marketPosition > -1 then breakEvenEngageS = FALSE;
if marketPosition < 1 then breakEvenEngageL = FALSE;
if marketPosition = 1 and high crosses above middleEMA then breakEvenEngageL = TRUE;
if marketPosition = -1 and low crosses below middleEMA then breakEvenEngageS = TRUE;
if breakEvenEngageS = TRUE then exitShort ("SX BE") at entryPrice stop;
if breakEvenEngageL = TRUE then exitLong ("LX BE") at entryPrice stop;
setStopContract;
setStopLoss(dollarStop);