From f776bf83d838e12d79768749670845e6ed14160a Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Fri, 6 Mar 2026 10:25:04 +0100 Subject: [PATCH] new files added --- .../MyIndicators/Quant/Hurst_Exponent_Pro.mq5 | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Indicators/MyIndicators/Quant/Hurst_Exponent_Pro.mq5 diff --git a/Indicators/MyIndicators/Quant/Hurst_Exponent_Pro.mq5 b/Indicators/MyIndicators/Quant/Hurst_Exponent_Pro.mq5 new file mode 100644 index 0000000..19aaa27 --- /dev/null +++ b/Indicators/MyIndicators/Quant/Hurst_Exponent_Pro.mq5 @@ -0,0 +1,130 @@ +//+------------------------------------------------------------------+ +//| Hurst_Exponent_Pro.mq5 | +//| Copyright 2026, xxxxxxxx| +//+------------------------------------------------------------------+ +#property copyright "Copyright 2026, xxxxxxxx" +#property version "2.10" // Single color line +#property description "Hurst Exponent - Fractal Market Analysis." +#property description "Supports Classic R/S and Robust DFA." + +#property indicator_separate_window +#property indicator_buffers 1 +#property indicator_plots 1 + +// Levels +#property indicator_level1 0.5 +#property indicator_level2 0.6 +#property indicator_level3 0.4 +#property indicator_levelcolor clrSilver +#property indicator_levelstyle STYLE_DOT +#property indicator_minimum 0.0 +#property indicator_maximum 1.0 + +// Plot: Hurst Line (Single Color) +#property indicator_label1 "Hurst" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrDeepSkyBlue +#property indicator_style1 STYLE_SOLID +#property indicator_width1 2 + +#include + +//--- Input Parameters +input group "Settings" +input int InpPeriod = 256; // Period for Analysis +input ENUM_HURST_METHOD InpMethod = METHOD_DFA; // Calculation Method +input ENUM_APPLIED_PRICE InpPrice = PRICE_CLOSE; + +//--- Buffers +double BufHurst[]; + +//--- Objects +CHurstCalculator *g_calc; +double g_price[]; + +//+------------------------------------------------------------------+ +//| Init | +//+------------------------------------------------------------------+ +int OnInit() + { + SetIndexBuffer(0, BufHurst, INDICATOR_DATA); + + string method_str = (InpMethod == METHOD_DFA) ? "DFA" : "R/S"; + string name = StringFormat("Hurst %s(%d)", method_str, InpPeriod); + IndicatorSetString(INDICATOR_SHORTNAME, name); + IndicatorSetInteger(INDICATOR_DIGITS, 3); + + g_calc = new CHurstCalculator(); + if(!g_calc.Init(InpPeriod, InpMethod)) + return INIT_FAILED; + + return(INIT_SUCCEEDED); + } + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void OnDeinit(const int r) + { + if(CheckPointer(g_calc)==POINTER_DYNAMIC) + delete g_calc; + } + +//+------------------------------------------------------------------+ +//| Calculate | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { + if(rates_total < InpPeriod + 10) + return 0; + + if(ArraySize(g_price) != rates_total) + ArrayResize(g_price, rates_total); + + int start_copy = (prev_calculated > 0) ? prev_calculated - 1 : 0; + for(int i=start_copy; i