Experts: MarketPredictor for MetaTrader 5 - page 2

 

Thanks for the tips, the code has been in progress for 5 days, I have solved the problem with not setting any trades, I just want to make small updates :)

 

You need to make a new iteration

    // Adjust alpha based on volatility (ATR)
    double atr = iATR(_Symbol, PERIOD_CURRENT, period); // Calculate ATR
    if(atr > 0.0)
        alpha = atr * 0.1; // Set alpha proportional to volatility
    else
        alpha = inputAlpha; // Fallback to input value if ATR is unavailable

this code is not going to correctly calculate ATR

https://www.mql5.com/en/docs/indicators/iatr

Return Value

Returns the handle of a specified technical indicator


It returns the handle which is a code, and does not return ATR value

Documentation on MQL5: Technical Indicators / iATR
Documentation on MQL5: Technical Indicators / iATR
  • www.mql5.com
The function returns the handle of the Average True Range indicator. It has only one buffer. Parameters symbol [in] The symbol name of the security...