add Cycles related Functions to XFima Parser ...

This commit is contained in:
2025-10-28 13:49:58 +03:30
parent d86a1b6428
commit 7960b76510
4 changed files with 5659 additions and 101 deletions
+153 -5
View File
@@ -111,6 +111,7 @@ input bool showMABand = true; // Show MA Band
input bool showHKBand = true; // Show HK Band
input bool showATRBand = true; // Show ATR Band
input bool showZigZag = true; // Show ZigZag
input bool showCyclesMa = true; // Show Cycles MA
input bool showFiboZone = true; // Show Fibo Zone
//
@@ -424,7 +425,6 @@ double atrBandLowerBuffer[];
#property indicator_color18 clrOrange
#property indicator_width18 2
//
#define scMaBufferIndex 25
double scMaBuffer[];
@@ -434,7 +434,7 @@ double scMaBuffer[];
#property indicator_label19 "SCMA"
#property indicator_type19 DRAW_LINE
#property indicator_color19 clrChocolate
#property indicator_style19 STYLE_DASHDOT
#property indicator_style19 STYLE_DASHDOTDOT
#property indicator_width19 2
//
@@ -446,7 +446,7 @@ double mcMaBuffer[];
#property indicator_label20 "MCMA"
#property indicator_type20 DRAW_LINE
#property indicator_color20 clrChocolate
#property indicator_style20 STYLE_DASHDOT
#property indicator_style20 STYLE_DASHDOTDOT
#property indicator_width20 2
//
@@ -458,7 +458,7 @@ double lcMaBuffer[];
#property indicator_label21 "LCMA"
#property indicator_type21 DRAW_LINE
#property indicator_color21 clrChocolate
#property indicator_style21 STYLE_DASHDOT
#property indicator_style21 STYLE_DASHDOTDOT
#property indicator_width21 2
//
@@ -470,7 +470,7 @@ double hcMaBuffer[];
#property indicator_label22 "HCMA"
#property indicator_type22 DRAW_LINE
#property indicator_color22 clrChocolate
#property indicator_style22 STYLE_DASHDOT
#property indicator_style22 STYLE_DASHDOTDOT
#property indicator_width22 2
//
@@ -1461,6 +1461,69 @@ void DefineBuffers()
ArraySetAsSeries(atrBandRawLowerBuffer, true);
SetIndexBuffer(atrBandRawLowerBufferIndex, atrBandRawLowerBuffer, INDICATOR_CALCULATIONS);
//
// MA State ...
//
// SC ...
//
ArraySetAsSeries(scMaBuffer, true);
SetIndexBuffer(scMaBufferIndex, scMaBuffer, INDICATOR_DATA);
//
PlotIndexSetInteger(scMaBufferPlotIndex, PLOT_SHOW_DATA, showCyclesMa);
PlotIndexSetDouble(scMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
//
ArraySetAsSeries(scMaStateBuffer, true);
SetIndexBuffer(scMaStateBufferIndex, scMaStateBuffer, INDICATOR_CALCULATIONS);
//
// SC ...
//
ArraySetAsSeries(mcMaBuffer, true);
SetIndexBuffer(mcMaBufferIndex, mcMaBuffer, INDICATOR_DATA);
//
PlotIndexSetInteger(mcMaBufferPlotIndex, PLOT_SHOW_DATA, showCyclesMa);
PlotIndexSetDouble(mcMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
//
ArraySetAsSeries(scMaStateBuffer, true);
SetIndexBuffer(mcMaStateBufferIndex, mcMaStateBuffer, INDICATOR_CALCULATIONS);
//
// LC ...
//
ArraySetAsSeries(lcMaBuffer, true);
SetIndexBuffer(lcMaBufferIndex, lcMaBuffer, INDICATOR_DATA);
//
PlotIndexSetInteger(lcMaBufferPlotIndex, PLOT_SHOW_DATA, showCyclesMa);
PlotIndexSetDouble(lcMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
//
ArraySetAsSeries(lcMaStateBuffer, true);
SetIndexBuffer(lcMaStateBufferIndex, lcMaStateBuffer, INDICATOR_CALCULATIONS);
//
// HC ...
//
ArraySetAsSeries(hcMaBuffer, true);
SetIndexBuffer(hcMaBufferIndex, hcMaBuffer, INDICATOR_DATA);
//
PlotIndexSetInteger(hcMaBufferPlotIndex, PLOT_SHOW_DATA, showCyclesMa);
PlotIndexSetDouble(hcMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
//
ArraySetAsSeries(hcMaStateBuffer, true);
SetIndexBuffer(hcMaStateBufferIndex, hcMaStateBuffer, INDICATOR_CALCULATIONS);
//
}
@@ -1929,6 +1992,19 @@ void CalculateValues(
tickVolume //
);
//
// Cycles MA Calculation ...
CalculateCyclesMA(
barIndex,
prevCalculated,
ratesTotal,
open,
high,
close,
low,
tickVolume //
);
//
// Fast MA ...
double iFastMa = maFastBuffer[barIndex];
@@ -2765,6 +2841,78 @@ void CalculateCyclesMA(
startCalculationForLastBars > 0
? barIndex == startCalculationForLastBars
: barIndex == firstBarIndex;
//
// Retrieve Indexed Bar Price for MA States Checking ...
ENUM_X_PRICE iPriceType = X_PRICE_CLOSE;
double iPrice = GetAppliedPrice(
iPriceType,
open,
high,
low,
close,
barIndex //
);
//
// SC ...
double iSCMa = scMaBuffer[barIndex];
double iSCMaColor = iPrice > iSCMa
? bullishColorIDX
: iPrice < iSCMa
? bearishColorIDX
: neuturalColorIDX;
double iSCMaState = iPrice > iSCMa
? bullishState
: iPrice < iSCMa
? bearishState
: neuturalState;
scMaStateBuffer[barIndex] = iSCMaState;
//
// MC ...
double iMCMa = mcMaBuffer[barIndex];
double iMCMaColor = iPrice > iMCMa
? bullishColorIDX
: iPrice < iMCMa
? bearishColorIDX
: neuturalColorIDX;
double iMCMaState = iPrice > iMCMa
? bullishState
: iPrice < iMCMa
? bearishState
: neuturalState;
mcMaStateBuffer[barIndex] = iMCMaState;
//
// LC ...
double iLCMa = lcMaBuffer[barIndex];
double iLCMaColor = iPrice > iLCMa
? bullishColorIDX
: iPrice < iLCMa
? bearishColorIDX
: neuturalColorIDX;
double iLCMaState = iPrice > iLCMa
? bullishState
: iPrice < iLCMa
? bearishState
: neuturalState;
lcMaStateBuffer[barIndex] = iLCMaState;
//
// HC ...
double iHCMa = hcMaBuffer[barIndex];
double iHCMaColor = iPrice > iHCMa
? bullishColorIDX
: iPrice < iHCMa
? bearishColorIDX
: neuturalColorIDX;
double iHCMaState = iPrice > iHCMa
? bullishState
: iPrice < iHCMa
? bearishState
: neuturalState;
hcMaStateBuffer[barIndex] = iHCMaState;
}
//