mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-19 15:28:06 +00:00
refactor: enums
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
//| |
|
//| |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2025, xxxxxxxx"
|
#property copyright "Copyright 2025, xxxxxxxx"
|
||||||
#property version "3.22" // Fixed enum conflicts
|
#property version "3.10"
|
||||||
#property description "A professional, unified RSI with selectable price source, a flexible"
|
#property description "A professional, unified RSI with selectable price source (incl. Heikin Ashi),"
|
||||||
#property description "signal line (incl. SuperSmoother), and optional Bollinger Bands."
|
#property description "a flexible MA signal line, and optional Bollinger Bands."
|
||||||
|
|
||||||
#property indicator_separate_window
|
#property indicator_separate_window
|
||||||
#property indicator_buffers 4
|
#property indicator_buffers 4
|
||||||
@@ -51,15 +51,14 @@ enum ENUM_DISPLAY_MODE
|
|||||||
|
|
||||||
//--- Input Parameters ---
|
//--- Input Parameters ---
|
||||||
input group "RSI Settings"
|
input group "RSI Settings"
|
||||||
input int InpPeriodRSI = 14;
|
input int InpPeriodRSI = 14;
|
||||||
input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
|
input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
|
||||||
|
|
||||||
input group "Overlay Settings"
|
input group "Overlay Settings"
|
||||||
input ENUM_DISPLAY_MODE InpDisplayMode = DISPLAY_RSI_AND_BANDS;
|
input ENUM_DISPLAY_MODE InpDisplayMode = DISPLAY_RSI_AND_BANDS;
|
||||||
input int InpPeriodMA = 20;
|
input int InpPeriodMA = 20;
|
||||||
//--- UPDATED: Use the new, non-conflicting enum ---
|
input ENUM_MA_METHOD InpMethodMA = MODE_SMA;
|
||||||
input ENUM_SMOOTHING_METHOD InpMethodMA = SMOOTH_SMA;
|
input double InpBandsDev = 2.0;
|
||||||
input double InpBandsDev = 2.0;
|
|
||||||
|
|
||||||
//--- Indicator Buffers ---
|
//--- Indicator Buffers ---
|
||||||
double BufferRSI[], BufferSignalMA[], BufferUpperBand[], BufferLowerBand[];
|
double BufferRSI[], BufferSignalMA[], BufferUpperBand[], BufferLowerBand[];
|
||||||
@@ -76,6 +75,7 @@ int OnInit()
|
|||||||
SetIndexBuffer(1, BufferSignalMA, INDICATOR_DATA);
|
SetIndexBuffer(1, BufferSignalMA, INDICATOR_DATA);
|
||||||
SetIndexBuffer(2, BufferUpperBand, INDICATOR_DATA);
|
SetIndexBuffer(2, BufferUpperBand, INDICATOR_DATA);
|
||||||
SetIndexBuffer(3, BufferLowerBand, INDICATOR_DATA);
|
SetIndexBuffer(3, BufferLowerBand, INDICATOR_DATA);
|
||||||
|
|
||||||
ArraySetAsSeries(BufferRSI, false);
|
ArraySetAsSeries(BufferRSI, false);
|
||||||
ArraySetAsSeries(BufferSignalMA, false);
|
ArraySetAsSeries(BufferSignalMA, false);
|
||||||
ArraySetAsSeries(BufferUpperBand, false);
|
ArraySetAsSeries(BufferUpperBand, false);
|
||||||
@@ -83,9 +83,15 @@ int OnInit()
|
|||||||
|
|
||||||
//--- Dynamic Calculator Instantiation ---
|
//--- Dynamic Calculator Instantiation ---
|
||||||
if(InpSourcePrice <= PRICE_HA_CLOSE)
|
if(InpSourcePrice <= PRICE_HA_CLOSE)
|
||||||
|
{
|
||||||
g_calculator = new CRSIProCalculator_HA();
|
g_calculator = new CRSIProCalculator_HA();
|
||||||
|
IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("RSI Pro HA(%d)", InpPeriodRSI));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
g_calculator = new CRSIProCalculator();
|
g_calculator = new CRSIProCalculator();
|
||||||
|
IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("RSI Pro(%d)", InpPeriodRSI));
|
||||||
|
}
|
||||||
|
|
||||||
if(CheckPointer(g_calculator) == POINTER_INVALID ||
|
if(CheckPointer(g_calculator) == POINTER_INVALID ||
|
||||||
!g_calculator.Init(InpPeriodRSI, InpPeriodMA, InpMethodMA, InpBandsDev))
|
!g_calculator.Init(InpPeriodRSI, InpPeriodMA, InpMethodMA, InpBandsDev))
|
||||||
@@ -99,6 +105,7 @@ int OnInit()
|
|||||||
PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, draw_begin);
|
PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, draw_begin);
|
||||||
PlotIndexSetInteger(2, PLOT_DRAW_BEGIN, draw_begin);
|
PlotIndexSetInteger(2, PLOT_DRAW_BEGIN, draw_begin);
|
||||||
PlotIndexSetInteger(3, PLOT_DRAW_BEGIN, draw_begin);
|
PlotIndexSetInteger(3, PLOT_DRAW_BEGIN, draw_begin);
|
||||||
|
|
||||||
return(INIT_SUCCEEDED);
|
return(INIT_SUCCEEDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user