When I run the formula below, the entry and exit prices are different when I run a Backtest vs an Exploration. I'm making progress slowly with Amibroker and things like this make me realize how little I know.
Can somebody explain why the exit and entry prices are different?
Both tests done with: 1sec database, 5-min Periodicity,
I'm using the 5-min TimeFrameSet for other things not related to this particular question. It doesn't impact the backtest/exploration results so I just left it in.
Also... I understand that ExRem is not recommended in Backtesting, I ran the backtest with and without ExRem but it didn't make any difference in the outcome.
myTimeFrame = in5Minute; SetTradeDelays(0,0,0,0); MA1 = 106 ; MA2 = 16 ; // Optimize( "description", default, min , max, step ) //MA1 = Optimize("MA1",1,1,120,5); //MA2 = Optimize("MA2",1,1,25,5); TimeFrameSet(myTimeFrame); ema1 = EMA( O, MA1 ); ema2 = EMA( O, MA2 ); TimeFrameRestore(); Buy = Cross( TimeFrameExpand(ema1, myTimeFrame, expandLast), TimeFrameExpand(ema2, myTimeFrame, expandLast) ); Sell = Cross( TimeFrameExpand(ema2, myTimeFrame, expandLast), TimeFrameExpand(ema1, myTimeFrame, expandLast) ); Short = Sell; Cover = Buy; Buy = ExRem( Buy, Sell ); Sell = ExRem( Sell, Buy ); Short = ExRem( Short, Cover ); Cover = ExRem( Cover, Short ); Filter = (Buy OR Sell); //Filter = 1; AddColumn(Open, "Open", 1.2); AddColumn(Buy, "Buy", 1.2); AddColumn(Sell, "Sell", 1.2); AddColumn(Cover, "Cover", 1.2); AddColumn(Short, "Short", 1.2); AddColumn(BarIndex(), "BarIndex");
Result of Backtest
Result of Exploration