From 5b51b75bda94bd9e836e1003d4d25ec2e9d2c53c Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Thu, 4 Sep 2025 16:46:21 +0200 Subject: [PATCH] new files added --- .../Expert/Signal/Signal_Supertrend.mqh | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Include/MyIncludes/Expert/Signal/Signal_Supertrend.mqh diff --git a/Include/MyIncludes/Expert/Signal/Signal_Supertrend.mqh b/Include/MyIncludes/Expert/Signal/Signal_Supertrend.mqh new file mode 100644 index 0000000..5539c4b --- /dev/null +++ b/Include/MyIncludes/Expert/Signal/Signal_Supertrend.mqh @@ -0,0 +1,66 @@ +//+------------------------------------------------------------------+ +//| Signal_Supertrend.mqh | +//| Signal module for the Supertrend_HeikinAshi indicator. | +//| Copyright 2025, xxxxxxxx | +//+------------------------------------------------------------------+ +#property copyright "Copyright 2025, xxxxxxxx" + +#include // Corrected path + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +class CSignalSupertrend : public CSignalBase + { +private: + int m_indicator_handle; + +public: + CSignalSupertrend(void); + ~CSignalSupertrend(void) {}; + + bool Init(string symbol, ENUM_TIMEFRAMES timeframe, int period, double multiplier); + virtual int GetSignal(int shift); + }; + +//+------------------------------------------------------------------+ +//| CSignalSupertrend: Constructor | +//+------------------------------------------------------------------+ +CSignalSupertrend::CSignalSupertrend(void) : m_indicator_handle(INVALID_HANDLE) + { + } + +//+------------------------------------------------------------------+ +//| CSignalSupertrend: Initialization | +//+------------------------------------------------------------------+ +bool CSignalSupertrend::Init(string symbol, ENUM_TIMEFRAMES timeframe, int period, double multiplier) + { + m_indicator_handle = iCustom(symbol, timeframe, "MyIndicators\\Supertrend_HeikinAshi", period, multiplier); + + if(m_indicator_handle == INVALID_HANDLE) + { + Print("CSignalSupertrend Error: Failed to create indicator handle."); + return false; + } + return true; + } + +//+------------------------------------------------------------------+ +//| CSignalSupertrend: Get the signal from the indicator | +//+------------------------------------------------------------------+ +int CSignalSupertrend::GetSignal(int shift) + { + double color_buffer[1]; + + if(CopyBuffer(m_indicator_handle, 1, shift, 1, color_buffer) <= 0) + return 0; + + if(color_buffer[0] == 0) + return 1; + if(color_buffer[0] == 1) + return -1; + + return 0; + } +//+------------------------------------------------------------------+ +//+------------------------------------------------------------------+