Wrong Generated Bid Price ! what is this?

 

my MQL5 Code :

#include <Trade\Trade.mqh>
CTrade trade;

input int SmallMovingAverage = 20;
input int BigMovingAverage   = 50;

void OnTick()
  {
     double Ask     =    NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
     double Bid     =    NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
     
     string signal = "";
     
     double SmallMovingAverageArray[],BigMovingAverageArray[];
     
     int SmallMovingAverageDefinition = iMA(_Symbol,_Period,SmallMovingAverage,0,MODE_EMA,PRICE_CLOSE);
     int BigMovingAverageDefinition   = iMA(_Symbol,_Period,BigMovingAverage,0,MODE_EMA,PRICE_CLOSE);
     
     CopyBuffer(SmallMovingAverageDefinition,0,0,3,SmallMovingAverageArray);
     CopyBuffer(BigMovingAverageDefinition,0,0,3,BigMovingAverageArray);
     
     if((SmallMovingAverageArray[1] < BigMovingAverageArray[1])&&(SmallMovingAverageArray[2] > BigMovingAverageArray[2])) {
     signal = "BUY";
     }
     if((SmallMovingAverageArray[1] > BigMovingAverageArray[1])&&(SmallMovingAverageArray[2] < BigMovingAverageArray[2])) {
     signal = "SELL";
     }
     
     if(signal == "SELL") {
      CloseAllBuyPositions();
     }
     
     if(signal == "BUY" && PositionsTotal() < 1){
     trade.Buy(1,NULL,Ask,0,0,NULL);
     }
     
  }
  
void CloseAllBuyPositions(){
   for(int i=PositionsTotal()-1; i>=0; i--){
      int ticket = PositionGetTicket(i);
      int PositionDirection=PositionGetInteger(POSITION_TYPE);
      
      if (PositionDirection == POSITION_TYPE_BUY)
      trade.PositionClose(ticket);
      }

}

when run this get 2 error :

2020.01.19 21:24:46.895 Core 1  wrong generated bid price 2019.07.16 11:35:30 APP 0.00000 [40 bar open]

2020.01.19 21:29:02.200 history error 9 in undefined function


my Symbol Config:


{
"ConfigSymbols" : [
{
"Symbol" : "آپ",
"Path" : "TSE\\بورس\\رایانه و فعالیت‌های وابسته به آن\\آپ",
"ISIN" : "IRO1APPE0001",
"Category" : "",
"Exchange" : "",
"Description" : "آسان پرداخت پرشین",
"Basis" : "",
"Page" : "",
"CurrencyBase" : "RLS",
"CurrencyProfit" : "RLS",
"CurrencyMargin" : "RLS",
"ColorBackground" : "4278190080",
"Digits" : "0",
"Point" : "1.00000000",
"TickFlags" : "7",
"TickBookDepth" : "5",
"TickChartMode" : "1",
"TradeMode" : "4",
"TradeFlags" : "0",
"CalcMode" : "32",
"ExecMode" : "3",
"GTCMode" : "0",
"FillFlags" : "0",
"ExpirFlags" : "15",
"OrderFlags" : "127",
"Spread" : "0",
"TickValue" : "1.00000000",
"TickSize" : "1.00000000",
"ContractSize" : "1.00000000",
"StopsLevel" : "0",
"FreezeLevel" : "0",
"VolumeMin" : "10000",
"VolumeMinExt" : "100000000",
"VolumeMax" : "1000000000",
"VolumeMaxExt" : "10000000000000",
"VolumeStep" : "100",
"VolumeStepExt" : "1000000",
"VolumeLimit" : "100",
"VolumeLimitExt" : "1000000",
"MarginFlags" : "0",
"MarginInitial" : "0.00000000",
"MarginMaintenance" : "0.00000000",
"MarginInitialBuy" : "0.00000000",
"MarginInitialSell" : "0.00000000",
"MarginInitialBuyLimit" : "0.00000000",
"MarginInitialSellLimit" : "0.00000000",
"MarginInitialBuyStop" : "0.00000000",
"MarginInitialSellStop" : "0.00000000",
"MarginInitialBuyStopLimit" : "0.00000000",
"MarginInitialSellStopLimit" : "0.00000000",
"MarginMaintenanceBuy" : "0.00000000",
"MarginMaintenanceSell" : "0.00000000",
"MarginMaintenanceBuyLimit" : "0.00000000",
"MarginMaintenanceSellLimit" : "0.00000000",
"MarginMaintenanceBuyStop" : "0.00000000",
"MarginMaintenanceSellStop" : "0.00000000",
"MarginMaintenanceBuyStopLimit" : "0.00000000",
"MarginMaintenanceSellStopLimit" : "0.00000000",
"MarginLiquidity" : "0.00000000",
"MarginHedged" : "0.00000000",
"SwapMode" : "0",
"SwapLong" : "0.00",
"SwapShort" : "0.00",
"Swap3Day" : "3",
"TimeStart" : "0",
"TimeExpiration" : "0",
"SessionsQuotes" : [
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
]
],
"SessionsTrades" : [
[{
"Open" : "10",
"Close" : "1439"
}
],
[{
"Open" : "10",
"Close" : "1439"
}
],
[{
"Open" : "10",
"Close" : "1439"
}
],
[{
"Open" : "10",
"Close" : "1439"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "0",
"Close" : "1440"
}
],
[{
"Open" : "10",
"Close" : "1439"
}
]
],
"PriceSettle" : "0",
"PriceLimitMax" : "17884",
"PriceLimitMin" : "17884",
"PriceStrike" : "0",
"OptionMode" : "0",
"FaceValue" : "0.00",
"AccruedInterest" : "0.00",
"PricesAllowNegative" : "0",
"Formula" : "",
}
]
}


please help me,tnx!