mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-18 23:08:07 +00:00
refactor: Adapted to new ATR Calculator
This commit is contained in:
@@ -4,9 +4,8 @@
|
|||||||
//| |
|
//| |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2025, xxxxxxxx"
|
#property copyright "Copyright 2025, xxxxxxxx"
|
||||||
#property version "5.01" // Corrected include paths and enum definitions
|
#property version "5.02" // Adapted to new ATR Calculator
|
||||||
#property description "Measures the trend activity of a VIDYA line with selectable"
|
#property description "Measures the trend activity of a VIDYA line with selectable sources."
|
||||||
#property description "price and ATR sources (Standard or Heikin Ashi)."
|
|
||||||
|
|
||||||
//--- Indicator Window and Plot Properties ---
|
//--- Indicator Window and Plot Properties ---
|
||||||
#property indicator_separate_window
|
#property indicator_separate_window
|
||||||
@@ -19,7 +18,6 @@
|
|||||||
#property indicator_minimum 0.0
|
#property indicator_minimum 0.0
|
||||||
#property indicator_maximum 0.5
|
#property indicator_maximum 0.5
|
||||||
|
|
||||||
//--- Include the calculator engine ---
|
|
||||||
#include <MyIncludes\VIDYA_TrendActivity_Calculator.mqh>
|
#include <MyIncludes\VIDYA_TrendActivity_Calculator.mqh>
|
||||||
|
|
||||||
//--- Input Parameters ---
|
//--- Input Parameters ---
|
||||||
@@ -29,17 +27,16 @@ input int InpPeriodEMA = 12;
|
|||||||
input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
|
input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
|
||||||
input group "Activity Calculation Settings"
|
input group "Activity Calculation Settings"
|
||||||
input int InpAtrPeriod = 14;
|
input int InpAtrPeriod = 14;
|
||||||
input ENUM_ATR_SOURCE InpAtrSource = ATR_SOURCE_STANDARD;
|
//--- UPDATED: Use the standard candle source enum ---
|
||||||
|
input ENUM_CANDLE_SOURCE InpAtrSource = CANDLE_STANDARD;
|
||||||
input int InpSmoothingPeriod = 5;
|
input int InpSmoothingPeriod = 5;
|
||||||
|
|
||||||
//--- Indicator Buffers ---
|
//--- Indicator Buffers ---
|
||||||
double BufferActivity[];
|
double BufferActivity[];
|
||||||
|
|
||||||
//--- Global calculator object (as a base class pointer) ---
|
//--- Global calculator object ---
|
||||||
CVIDYATrendActivityCalculator *g_calculator;
|
CVIDYATrendActivityCalculator *g_calculator;
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
|
||||||
//| Custom indicator initialization function. |
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
int OnInit()
|
int OnInit()
|
||||||
{
|
{
|
||||||
@@ -47,16 +44,11 @@ int OnInit()
|
|||||||
ArraySetAsSeries(BufferActivity, false);
|
ArraySetAsSeries(BufferActivity, false);
|
||||||
|
|
||||||
if(InpSourcePrice <= PRICE_HA_CLOSE)
|
if(InpSourcePrice <= PRICE_HA_CLOSE)
|
||||||
{
|
|
||||||
g_calculator = new CVIDYATrendActivityCalculator_HA();
|
g_calculator = new CVIDYATrendActivityCalculator_HA();
|
||||||
IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("VIDYA Activity HA(%d)", InpPeriodCMO));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
g_calculator = new CVIDYATrendActivityCalculator();
|
g_calculator = new CVIDYATrendActivityCalculator();
|
||||||
IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("VIDYA Activity(%d)", InpPeriodCMO));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//--- UPDATED: Pass the correct enum type ---
|
||||||
if(CheckPointer(g_calculator) == POINTER_INVALID || !g_calculator.Init(InpPeriodCMO, InpPeriodEMA, InpAtrPeriod, InpAtrSource, InpSmoothingPeriod))
|
if(CheckPointer(g_calculator) == POINTER_INVALID || !g_calculator.Init(InpPeriodCMO, InpPeriodEMA, InpAtrPeriod, InpAtrSource, InpSmoothingPeriod))
|
||||||
{
|
{
|
||||||
Print("Failed to create or initialize VIDYA Trend Activity Calculator object.");
|
Print("Failed to create or initialize VIDYA Trend Activity Calculator object.");
|
||||||
|
|||||||
Reference in New Issue
Block a user