diff --git a/Include/MyIncludes/Symbol_Strength_Calculator.mqh b/Include/MyIncludes/Symbol_Strength_Calculator.mqh new file mode 100644 index 0000000..18207fd --- /dev/null +++ b/Include/MyIncludes/Symbol_Strength_Calculator.mqh @@ -0,0 +1,113 @@ +//+------------------------------------------------------------------+ +//| Symbol_Strength_Calculator.mqh | +//| VERSION 1.10: Robust data handling and synchronization. | +//| Copyright 2025, xxxxxxxx | +//+------------------------------------------------------------------+ +#property copyright "Copyright 2025, xxxxxxxx" + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +class CSymbolStrengthCalculator + { +private: + int m_period; + ENUM_TIMEFRAMES m_timeframe; + string m_symbols[]; + int m_symbol_count; + + double GetROC(string symbol, int index); + +public: + CSymbolStrengthCalculator(void) : m_symbol_count(0) {}; + ~CSymbolStrengthCalculator(void) {}; + + bool Init(int period, ENUM_TIMEFRAMES tf, const string &symbols[]); + void CalculateStep(int bar_index, double &strengths[]); + int GetCount() { return m_symbol_count; } + + //--- NEW: Check if data is ready for all symbols + bool IsDataReady(void); + }; + +//+------------------------------------------------------------------+ +bool CSymbolStrengthCalculator::Init(int period, ENUM_TIMEFRAMES tf, const string &symbols[]) + { + m_period = period; + m_timeframe = tf; + + m_symbol_count = ArraySize(symbols); + ArrayResize(m_symbols, m_symbol_count); + + for(int i=0; i