Desperate "No trading operations" error - page 2

 
Juan Carlos Alarcon Ruiz #There was an error in some variable to analyze the volume and that has been solved. I have added a new Free margin control, even though I was already validating it. This seems to work now, which I celebrate. The problem I have is in the logic of the Expert Advisor to open operations, to do this I have to measure the size of the previous candle that must exceed a value and the variation of the Bollinger bands that must also exceed a coefficient. And this does not work when the validator tests it with other assets and timeframes, which is why it returns "No trading operations". They are not prohibited restrictions but programming logic. So how is this solved?

I understand... The value you are using as a reference for the size of the previous candles must be in points, right? Instead of points, test using a percentage of the ATR (current or daily timeframe) that should work for any symbol.

2. But, if using ATR reduces the EA's performance or if you want to continue using the points anyway, another solution would be to save two settings for your EA, leaving the most flexible one as the default, as in the example below:

//--- Global
enum ENUM_SET
  {
   SET_Auto   = 1,   // Automatic
   SET_BTCUSD = 2    // BTCUSD
  };

input ENUM_SET InpSettingsMode = SET_Auto;   // Settings Mode

//+--------------------------------------------------------------------------------------------------------------------+
//| Expert initialization function                                                                                     |
//+--------------------------------------------------------------------------------------------------------------------+
int OnInit()
  {

// . . .

//--- Get SYMBOL
   string SYMBOL = _Symbol;
   if(!StringToUpper(SYMBOL))
     {
      Print("Error getting current symbol name: ", GetLastError());
      return(INIT_FAILED);
     }

//--- Checks SETTINGS
   if((InpSettingsMode == SET_Auto && StringFind(SYMBOL, "BTCUSD") >= 0) || InpSettingsMode == SET_BTCUSD)
     {
      Setting_BTCUSD();
     }
   else
     {
      Setting_Auto();
     }

// . . .

//---
   return(INIT_SUCCEEDED);
  }
 
Vinicius Pereira De Oliveira #:

I understand... The value you are using as a reference for the size of the previous candles must be in points, right? Instead of points, test using a percentage of the ATR (current or daily timeframe) that should work for any symbol.

2. But, if using ATR reduces the EA's performance or if you want to continue using the points anyway, another solution would be to save two settings for your EA, leaving the most flexible one as the default, as in the example below:

Great idea Vinicius, thank you very much for your idea and your code. He has helped me!

 
Juan Carlos Alarcon Ruiz #Great idea Vinicius, thank you very much for your idea and your code. He has helped me!

You are welcome!! 👍