From 4d09583c0a0cd31e44c11b550ae4368bd831cf54 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Mon, 22 Sep 2025 19:22:05 +0200 Subject: [PATCH] new files added --- Indicators/MyIndicators/Fibonacci_WMA.mq5 | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Indicators/MyIndicators/Fibonacci_WMA.mq5 diff --git a/Indicators/MyIndicators/Fibonacci_WMA.mq5 b/Indicators/MyIndicators/Fibonacci_WMA.mq5 new file mode 100644 index 0000000..fa919a6 --- /dev/null +++ b/Indicators/MyIndicators/Fibonacci_WMA.mq5 @@ -0,0 +1,76 @@ +//+------------------------------------------------------------------+ +//| Fibonacci_WMA.mq5 | +//| Copyright 2025, xxxxxxxx| +//| | +//+------------------------------------------------------------------+ +#property copyright "Copyright 2025, xxxxxxxx" +#property version "2.00" +#property description "Fibonacci Weighted Moving Average." + +#property indicator_chart_window +#property indicator_buffers 1 +#property indicator_plots 1 + +#include + +//--- Plot 1: Fibonacci WMA Line +#property indicator_label1 "Fibonacci WMA" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrDodgerBlue +#property indicator_style1 STYLE_SOLID +#property indicator_width1 2 + +//--- Input Parameters --- +input int InpPeriod = 21; +input ENUM_APPLIED_PRICE InpSourcePrice = PRICE_CLOSE; + +//--- Indicator Buffers --- +double BufferWMA[]; + +//--- Global calculator object --- +CFibonacciWMACalculator *g_calculator; + +//+------------------------------------------------------------------+ +//| Custom indicator initialization function. | +//+------------------------------------------------------------------+ +int OnInit() + { + SetIndexBuffer(0, BufferWMA, INDICATOR_DATA); + ArraySetAsSeries(BufferWMA, false); + + g_calculator = new CFibonacciWMACalculator(); + if(CheckPointer(g_calculator) == POINTER_INVALID || !g_calculator.Init(InpPeriod)) + { + Print("Failed to initialize Fibonacci WMA Calculator."); + return(INIT_FAILED); + } + + int actual_period = InpPeriod > 40 ? 40 : InpPeriod; + PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, actual_period - 1); + IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("FibonacciWMA(%d)", InpPeriod)); + + return(INIT_SUCCEEDED); + } + +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function. | +//+------------------------------------------------------------------+ +void OnDeinit(const int reason) + { + if(CheckPointer(g_calculator) != POINTER_INVALID) + delete g_calculator; + } + +//+------------------------------------------------------------------+ +//| Custom indicator iteration function. | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, const int, const datetime&[], const double &open[], const double &high[], const double &low[], const double &close[], const long&[], const long&[], const int&[]) + { + if(CheckPointer(g_calculator) != POINTER_INVALID) + { + g_calculator.Calculate(rates_total, InpSourcePrice, open, high, low, close, BufferWMA); + } + return(rates_total); + } +//+------------------------------------------------------------------+ +//+------------------------------------------------------------------+