Hi.. Please help me my EA can't open any trades when I run it in strategy tester. I'm using this EA for Boom and Crash

Khuman Bakhramirad  
//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2020, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#include<Trade\Trade.mqh>
CTrade trade;
void OnTick()
  {
   string signal = "";

   double Ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
   double Bid = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);

   double PriceArray[];

   ArraySetAsSeries(PriceArray,true);

   int MacDefinition = iMACD(_Symbol,_Period,12,25,9,PRICE_CLOSE);

   CopyBuffer(MacDefinition,0,0,3,PriceArray);

   double MACD_Value = (PriceArray[0]);
   double LastMACD_Value = (PriceArray[1]);

   if(MACD_Value > 0 && LastMACD_Value < 0)
      signal = "BUY";


   if(MACD_Value < 0 && LastMACD_Value > 0)
      signal = "SELL";


   if(signal == "BUY" && PositionsTotal() < 1)
      trade.Buy(0.2,NULL,Ask,0,(Ask+150 * _Point), NULL);



   if(signal == "SELL" && PositionsTotal() > 1)
      trade.Sell(0.2,NULL,Bid,0,(Bid-150  * _Point), NULL);

   Comment("The Current Signal is", signal);
  }
//+------------------------------------------------------------------+

you have to use "double" not "float"

Vladimir Karputov  
Bobby_kabhuru1 :
***

Use the button to insert the code Code

You can also attach a file using the button Attach file

Bobby_kabhuru1  
Vladimir Karputov:

Use the button to insert the code

You can also attach a file using the button

Okay Thanks let me attach..

#include<Trade\Trade.mqh>
CTrade trade;
void OnTick()
  {
   string signal = "";
   
   double Ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
   double Bid = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
   
   double PriceArray[];
   
   ArraySetAsSeries(PriceArray,true);
   
   int MacDefinition = iMACD(_Symbol,_Period,12,25,9,PRICE_CLOSE);
   
   CopyBuffer(MacDefinition,0,0,3,PriceArray);
   
   double MACD_Value = (PriceArray[0]);
   double LastMACD_Value = (PriceArray[1]);
   
   if(MACD_Value > 0 && LastMACD_Value < 0)
   signal = "BUY";
   
   
   if(MACD_Value < 0 && LastMACD_Value > 0)
   signal = "SELL";
    
   
  if(signal == "BUY" && PositionsTotal() < 1)
   trade.Buy(0.2,NULL,Ask,0,(Ask+150 * _Point), NULL);
   
   
   
   if(signal == "SELL" && PositionsTotal() > 1)
   trade.Sell(0.2,NULL,Bid,0,(Bid-150  * _Point), NULL);
   
   Comment("The Current Signal is", signal);
  }

Vladimir Karputov  
Bobby_kabhuru1 :

Okay Thanks let me attach..

You make one and the same mistake - you create an indicator handle ON EVERY TICK !!! This is mistake!!!

Transfer the creation of the indicator handle to OnInit ().

Bobby_kabhuru1  
Vladimir Karputov:

You make one and the same mistake - you create an indicator handle ON EVERY TICK !!! This is mistake!!!

Transfer the creation of the indicator handle to OnInit ().

Hi Vladimir,

Which one is the indicator handle? Please help me,.. I'm a newbie..

Thanks in advance : )

Bobby_kabhuru1  
Vladimir Karputov:

Your homework is to study the iMACD Help.

Based on the help it is CORRECT to create an indicator handle.

Okay. Thanks a lot.
Reason: