Market entry at price above candlestick high

 
      if (iLow(Symbol(),Aggregation,1)>iMA_(Symbol(), Aggregation, 15, 0, MODE_LWMA, PRICE_CLOSE, 1))
      if (iLow(Symbol(),Aggregation,2)>iMA_(Symbol(), Aggregation, 15, 0, MODE_LWMA, PRICE_CLOSE, 2))
      if (iLow(Symbol(),Aggregation,3)>iMA_(Symbol(), Aggregation, 15, 0, MODE_LWMA, PRICE_CLOSE, 3))
      if (iLow(Symbol(),Aggregation,3)>0.0)
      if (iMA_(Symbol(), Aggregation, 15, 0, MODE_LWMA, PRICE_CLOSE, 1)>iMA_(Symbol(), Aggregation, 15, 0, MODE_LWMA, PRICE_CLOSE, 2))
      if (iMA_(Symbol(), Aggregation, 40, 0, MODE_LWMA, PRICE_CLOSE, 1)>iMA_(Symbol(), Aggregation, 40, 0, MODE_LWMA, PRICE_CLOSE, 2))
      if (iMA_(Symbol(), Aggregation, 80, 0, MODE_LWMA, PRICE_CLOSE, 1)>iMA_(Symbol(), Aggregation, 80, 0, MODE_LWMA, PRICE_CLOSE, 2))
          golong_r1=true;

if (golong_r1 ) {
         Alert("golong");
         PlaySound("stops.wav");
         //if (close_on_reverse) closePosition(POSITION_TYPE_SELL);
         openBuy();
      }

void openBuy() {
   if (PositionsTotal() > 0) return;
   if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) return;
   ENUM_ORDER_TYPE side = ORDER_TYPE_BUY;
   double SL = 0;
   double TP = 0; 
   global_SL = SymbolInfoDouble(Symbol(), SYMBOL_ASK) + buy_stoploss*4*0.25;
   if (buy_stoploss > 0 && close_loss_in_pips)
      SL = SymbolInfoDouble(Symbol(), SYMBOL_ASK) - buy_stoploss*4*0.25; // here we multiply stoploss/takeprofit to 4 because of point step 0.25
   if (buy_takeprofit > 0 && close_profit_in_pips) 
      TP = SymbolInfoDouble(Symbol(), SYMBOL_ASK) + buy_takeprofit*4*0.25;
   trade.PositionOpen(Symbol(), side, getContracts(), SymbolInfoDouble(Symbol(), SYMBOL_ASK), SL, TP, "");
   return;
}
This may seem strange but I am seeing in backtesting a buy condition is occurring at a price higher than the candlestick high.  Has anyone seen this before and if so why is this happening?  I attach the image and snippet of code. Trading above price
 
In backtesting always, this bug is since years,somtimes i have this 10-20 pips above the candle in eurusd
 

amando:
In backtesting always, this bug is since years,somtimes i have this 10-20 pips above the candle in eurusd


Do the points and dollar values in the Backtest tab reflect this errant entry price?

 
dclark24:

Do the points and dollar values in the Backtest tab reflect this errant entry price?

How can backtesting be trusted even a little bit if it cant get this right? 
Reason: