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
+584 -94
View File
@@ -61,32 +61,40 @@ enum ENUM_XFIMA_BUFFERS
XFIMA_PB_BAND_LOWER_LINE = 22, XFIMA_PB_BAND_LOWER_LINE = 22,
XFIMA_ATR_BAND_UPPER_LINE = 23, XFIMA_ATR_BAND_UPPER_LINE = 23,
XFIMA_ATR_BAND_LOWER_LINE = 24, XFIMA_ATR_BAND_LOWER_LINE = 24,
XFIMA_SC_MA_LINE = 25,
XFIMA_MC_MA_LINE = 26,
XFIMA_LC_MA_LINE = 27,
XFIMA_HC_MA_LINE = 28,
// //
// Data Buffers ... // Data Buffers ...
XFIMA_MA_FAST_STATE_LINE = 25, XFIMA_MA_FAST_STATE_LINE = 29,
XFIMA_MA_SLOW_STATE_LINE = 26, XFIMA_MA_SLOW_STATE_LINE = 30,
XFIMA_SAR_STATE_LINE = 27, XFIMA_SAR_STATE_LINE = 31,
XFIMA_SC_HH_LINE = 28, XFIMA_SC_HH_LINE = 32,
XFIMA_SC_LL_LINE = 29, XFIMA_SC_LL_LINE = 33,
XFIMA_MC_HH_LINE = 30, XFIMA_MC_HH_LINE = 34,
XFIMA_MC_LL_LINE = 31, XFIMA_MC_LL_LINE = 35,
XFIMA_LC_HH_LINE = 32, XFIMA_LC_HH_LINE = 36,
XFIMA_LC_LL_LINE = 33, XFIMA_LC_LL_LINE = 37,
XFIMA_HC_HH_LINE = 34, XFIMA_HC_HH_LINE = 38,
XFIMA_HC_LL_LINE = 35, XFIMA_HC_LL_LINE = 39,
XFIMA_ZIGZAG_HIGHS_LINE = 36, XFIMA_ZIGZAG_HIGHS_LINE = 40,
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 37, XFIMA_ZIGZAG_HIGHS_TIME_LINE = 41,
XFIMA_ZIGZAG_LOWS_LINE = 38, XFIMA_ZIGZAG_LOWS_LINE = 42,
XFIMA_ZIGZAG_LOWS_TIME_LINE = 39, XFIMA_ZIGZAG_LOWS_TIME_LINE = 43,
XFIMA_HK_RAW_OPEN_LINE = 40, XFIMA_HK_RAW_OPEN_LINE = 44,
XFIMA_HK_RAW_HIGH_LINE = 41, XFIMA_HK_RAW_HIGH_LINE = 45,
XFIMA_HK_RAW_LOW_LINE = 42, XFIMA_HK_RAW_LOW_LINE = 46,
XFIMA_HK_RAW_CLOSE_LINE = 43, XFIMA_HK_RAW_CLOSE_LINE = 47,
XFIMA_PB_BAND_RAW_UPPER_LINE = 44, XFIMA_PB_BAND_RAW_UPPER_LINE = 48,
XFIMA_PB_BAND_RAW_LOWER_LINE = 45, XFIMA_PB_BAND_RAW_LOWER_LINE = 49,
XFIMA_ATR_LINE = 46, XFIMA_ATR_LINE = 50,
XFIMA_ATR_BAND_RAW_UPPER_LINE = 47, XFIMA_ATR_BAND_RAW_UPPER_LINE = 51,
XFIMA_ATR_BAND_RAW_LOWER_LINE = 48, XFIMA_ATR_BAND_RAW_LOWER_LINE = 52,
XFIMA_SC_MA_STATE_LINE = 53,
XFIMA_MC_MA_STATE_LINE = 54,
XFIMA_LC_MA_STATE_LINE = 55,
XFIMA_HC_MA_STATE_LINE = 56,
}; };
// //
@@ -144,6 +152,7 @@ struct XFIMAInputs
bool showHKBand; // Show HK Band bool showHKBand; // Show HK Band
bool showATRBand; // Show ATR Band bool showATRBand; // Show ATR Band
bool showZigZag; // Show ZigZag bool showZigZag; // Show ZigZag
bool showCyclesMa; // Show Cycles MA
bool showFiboZone; // Show Fibo Zone bool showFiboZone; // Show Fibo Zone
int startCalculationForLastBars; // Calculate Last n Bars int startCalculationForLastBars; // Calculate Last n Bars
int sarArrowCode; // Parabolic SAR Arrow Code int sarArrowCode; // Parabolic SAR Arrow Code
@@ -219,6 +228,7 @@ struct XFIMAInputs
showHKBand = true; // Show HK Band showHKBand = true; // Show HK Band
showATRBand = true; // Show ATR Band showATRBand = true; // Show ATR Band
showZigZag = true; // Show ZigZag showZigZag = true; // Show ZigZag
showCyclesMa = true; // Show Cycles MA
showFiboZone = true; // Show Fibo Zone showFiboZone = true; // Show Fibo Zone
startCalculationForLastBars = 1500; // Calculate Last n Bars startCalculationForLastBars = 1500; // Calculate Last n Bars
sarArrowCode = 159; // Parabolic SAR Arrow Code sarArrowCode = 159; // Parabolic SAR Arrow Code
@@ -240,6 +250,7 @@ struct XFIMAInputs
showHKBand = false; showHKBand = false;
showATRBand = false; showATRBand = false;
showZigZag = false; showZigZag = false;
showCyclesMa = true;
showFiboZone = false; showFiboZone = false;
} }
@@ -312,22 +323,34 @@ struct XFIMAConditions
// //
// Buffers ... // Buffers ...
double maFastBuffer[]; double maFastBuffer[];
double maFastColorBuffer[];
double maFastStateBuffer[];
double maSlowBuffer[]; double maSlowBuffer[];
double maSlowColorBuffer[];
double maSlowStateBuffer[];
double maBandUpperBuffer[];
double maBandLowerBuffer[];
double sarBuffer[]; double sarBuffer[];
double sarColorBuffer[];
double sarStateBuffer[];
double peakBuffer[]; double peakBuffer[];
double valeBuffer[]; double valeBuffer[];
double fiboUpperBuffer[]; double fiboUpperBuffer[];
double fiboMiddleBuffer[]; double fiboMiddleBuffer[];
double fiboLowerBuffer[]; double fiboLowerBuffer[];
double zigzagBuffer[]; double zigzagBuffer[];
double maBandUpperBuffer[];
double maBandLowerBuffer[];
double hkOpenBuffer[];
double hkHighBuffer[];
double hkLowBuffer[];
double hkCloseBuffer[];
double hkColorBuffer[];
double hkBandUpperBuffer[];
double hkBandLowerBuffer[];
double pbBandUpperBuffer[];
double pbBandLowerBuffer[];
double atrBandUpperBuffer[];
double atrBandLowerBuffer[];
double scMaBuffer[];
double mcMaBuffer[];
double lcMaBuffer[];
double hcMaBuffer[];
double maFastStateBuffer[];
double maSlowStateBuffer[];
double sarStateBuffer[];
double sHHBuffer[]; double sHHBuffer[];
double sLLBuffer[]; double sLLBuffer[];
double mHHBuffer[]; double mHHBuffer[];
@@ -336,15 +359,19 @@ struct XFIMAConditions
double lLLBuffer[]; double lLLBuffer[];
double hHHBuffer[]; double hHHBuffer[];
double hLLBuffer[]; double hLLBuffer[];
double highsBuffer[]; double hkRawHighBuffer[];
double highsTimeBuffer[]; double hkRawOpenBuffer[];
double lowsBuffer[]; double hkRawLowBuffer[];
double lowsTimeBuffer[]; double hkRawCloseBuffer[];
double hkOpenBuffer[]; double pbBandRawUpperBuffer[];
double hkHighBuffer[]; double pbBandRawLowerBuffer[];
double hkLowBuffer[]; double atrBuffer[];
double hkCloseBuffer[]; double atrBandRawUpperBuffer[];
double hkColorBuffer[]; double atrBandRawLowerBuffer[];
double scMaStateBuffer[];
double mcMaStateBuffer[];
double lcMaStateBuffer[];
double hcMaStateBuffer[];
// //
// Conditions ... // Conditions ...
@@ -376,43 +403,59 @@ struct XFIMAConditions
// Buffers ... // Buffers ...
// //
SpecifiedClean(bars); XClean(bars);
// //
SpecifiedClean(maFastBuffer); XClean(maFastBuffer);
SpecifiedClean(maFastColorBuffer); XClean(maSlowBuffer);
SpecifiedClean(maFastStateBuffer); XClean(sarBuffer);
SpecifiedClean(maSlowBuffer); XClean(peakBuffer);
SpecifiedClean(maSlowColorBuffer); XClean(valeBuffer);
SpecifiedClean(maSlowStateBuffer); XClean(fiboUpperBuffer);
SpecifiedClean(maBandUpperBuffer); XClean(fiboMiddleBuffer);
SpecifiedClean(maBandLowerBuffer); XClean(fiboLowerBuffer);
SpecifiedClean(sarBuffer); XClean(zigzagBuffer);
SpecifiedClean(sarColorBuffer); XClean(maBandUpperBuffer);
SpecifiedClean(sarStateBuffer); XClean(maBandLowerBuffer);
SpecifiedClean(peakBuffer); XClean(hkOpenBuffer);
SpecifiedClean(valeBuffer); XClean(hkHighBuffer);
SpecifiedClean(fiboUpperBuffer); XClean(hkLowBuffer);
SpecifiedClean(fiboMiddleBuffer); XClean(hkCloseBuffer);
SpecifiedClean(fiboLowerBuffer); XClean(hkColorBuffer);
SpecifiedClean(zigzagBuffer); XClean(hkBandUpperBuffer);
SpecifiedClean(sHHBuffer); XClean(hkBandLowerBuffer);
SpecifiedClean(sLLBuffer); XClean(pbBandUpperBuffer);
SpecifiedClean(mHHBuffer); XClean(pbBandLowerBuffer);
SpecifiedClean(mLLBuffer); XClean(atrBandUpperBuffer);
SpecifiedClean(lHHBuffer); XClean(atrBandLowerBuffer);
SpecifiedClean(lLLBuffer); XClean(scMaBuffer);
SpecifiedClean(hHHBuffer); XClean(mcMaBuffer);
SpecifiedClean(hLLBuffer); XClean(lcMaBuffer);
SpecifiedClean(highsBuffer); XClean(hcMaBuffer);
SpecifiedClean(highsTimeBuffer); XClean(maFastStateBuffer);
SpecifiedClean(lowsBuffer); XClean(maSlowStateBuffer);
SpecifiedClean(lowsTimeBuffer); XClean(sarStateBuffer);
SpecifiedClean(hkOpenBuffer); XClean(sHHBuffer);
SpecifiedClean(hkHighBuffer); XClean(sLLBuffer);
SpecifiedClean(hkLowBuffer); XClean(mHHBuffer);
SpecifiedClean(hkCloseBuffer); XClean(mLLBuffer);
SpecifiedClean(hkColorBuffer); XClean(lHHBuffer);
XClean(lLLBuffer);
XClean(hHHBuffer);
XClean(hLLBuffer);
XClean(hkRawHighBuffer);
XClean(hkRawOpenBuffer);
XClean(hkRawLowBuffer);
XClean(hkRawCloseBuffer);
XClean(pbBandRawUpperBuffer);
XClean(pbBandRawLowerBuffer);
XClean(atrBuffer);
XClean(atrBandRawUpperBuffer);
XClean(atrBandRawLowerBuffer);
XClean(scMaStateBuffer);
XClean(mcMaStateBuffer);
XClean(lcMaStateBuffer);
XClean(hcMaStateBuffer);
// //
// Conditions ... // Conditions ...
@@ -422,22 +465,34 @@ struct XFIMAConditions
// //
ArraySetAsSeries(maFastBuffer, true); ArraySetAsSeries(maFastBuffer, true);
ArraySetAsSeries(maFastColorBuffer, true);
ArraySetAsSeries(maFastStateBuffer, true);
ArraySetAsSeries(maSlowBuffer, true); ArraySetAsSeries(maSlowBuffer, true);
ArraySetAsSeries(maSlowColorBuffer, true);
ArraySetAsSeries(maSlowStateBuffer, true);
ArraySetAsSeries(maBandUpperBuffer, true);
ArraySetAsSeries(maBandLowerBuffer, true);
ArraySetAsSeries(sarBuffer, true); ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(sarColorBuffer, true);
ArraySetAsSeries(sarStateBuffer, true);
ArraySetAsSeries(peakBuffer, true); ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true); ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(fiboUpperBuffer, true); ArraySetAsSeries(fiboUpperBuffer, true);
ArraySetAsSeries(fiboMiddleBuffer, true); ArraySetAsSeries(fiboMiddleBuffer, true);
ArraySetAsSeries(fiboLowerBuffer, true); ArraySetAsSeries(fiboLowerBuffer, true);
ArraySetAsSeries(zigzagBuffer, false); // Fix this ... ArraySetAsSeries(zigzagBuffer, true);
ArraySetAsSeries(maBandUpperBuffer, true);
ArraySetAsSeries(maBandLowerBuffer, true);
ArraySetAsSeries(hkOpenBuffer, true);
ArraySetAsSeries(hkHighBuffer, true);
ArraySetAsSeries(hkLowBuffer, true);
ArraySetAsSeries(hkCloseBuffer, true);
ArraySetAsSeries(hkColorBuffer, true);
ArraySetAsSeries(hkBandUpperBuffer, true);
ArraySetAsSeries(hkBandLowerBuffer, true);
ArraySetAsSeries(pbBandUpperBuffer, true);
ArraySetAsSeries(pbBandLowerBuffer, true);
ArraySetAsSeries(atrBandUpperBuffer, true);
ArraySetAsSeries(atrBandLowerBuffer, true);
ArraySetAsSeries(scMaBuffer, true);
ArraySetAsSeries(mcMaBuffer, true);
ArraySetAsSeries(lcMaBuffer, true);
ArraySetAsSeries(hcMaBuffer, true);
ArraySetAsSeries(maFastStateBuffer, true);
ArraySetAsSeries(maSlowStateBuffer, true);
ArraySetAsSeries(sarStateBuffer, true);
ArraySetAsSeries(sHHBuffer, true); ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true); ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true); ArraySetAsSeries(mHHBuffer, true);
@@ -446,15 +501,19 @@ struct XFIMAConditions
ArraySetAsSeries(lLLBuffer, true); ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true); ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true); ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(highsBuffer, true); ArraySetAsSeries(hkRawHighBuffer, true);
ArraySetAsSeries(highsTimeBuffer, true); ArraySetAsSeries(hkRawOpenBuffer, true);
ArraySetAsSeries(lowsBuffer, true); ArraySetAsSeries(hkRawLowBuffer, true);
ArraySetAsSeries(lowsTimeBuffer, true); ArraySetAsSeries(hkRawCloseBuffer, true);
ArraySetAsSeries(hkOpenBuffer, true); ArraySetAsSeries(pbBandRawUpperBuffer, true);
ArraySetAsSeries(hkHighBuffer, true); ArraySetAsSeries(pbBandRawLowerBuffer, true);
ArraySetAsSeries(hkLowBuffer, true); ArraySetAsSeries(atrBuffer, true);
ArraySetAsSeries(hkCloseBuffer, true); ArraySetAsSeries(atrBandRawUpperBuffer, true);
ArraySetAsSeries(hkColorBuffer, true); ArraySetAsSeries(atrBandRawLowerBuffer, true);
ArraySetAsSeries(scMaStateBuffer, true);
ArraySetAsSeries(mcMaStateBuffer, true);
ArraySetAsSeries(lcMaStateBuffer, true);
ArraySetAsSeries(hcMaStateBuffer, true);
// //
ZeroMemory(this); ZeroMemory(this);
@@ -743,6 +802,62 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.maSlowStateBuffer // conditions.maSlowStateBuffer //
); );
//
CopySCMA(
zIndex,
loopback,
conditions.scMaBuffer //
);
//
CopySCMAState(
zIndex,
loopback,
conditions.scMaStateBuffer //
);
//
CopyMCMA(
zIndex,
loopback,
conditions.mcMaBuffer //
);
//
CopyMCMAState(
zIndex,
loopback,
conditions.mcMaStateBuffer //
);
//
CopyLCMA(
zIndex,
loopback,
conditions.lcMaBuffer //
);
//
CopyLCMAState(
zIndex,
loopback,
conditions.lcMaStateBuffer //
);
//
CopyHCMA(
zIndex,
loopback,
conditions.hcMaBuffer //
);
//
CopyHCMAState(
zIndex,
loopback,
conditions.hcMaStateBuffer //
);
// //
CopyMABandUpper( CopyMABandUpper(
zIndex, zIndex,
@@ -897,6 +1012,34 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.hkCloseBuffer // conditions.hkCloseBuffer //
); );
//
CopyHKRawOpen(
zIndex,
loopback,
conditions.hkRawOpenBuffer //
);
//
CopyHKRawHigh(
zIndex,
loopback,
conditions.hkRawHighBuffer //
);
//
CopyHKRawLow(
zIndex,
loopback,
conditions.hkRawLowBuffer //
);
//
CopyHKRawClose(
zIndex,
loopback,
conditions.hkRawCloseBuffer //
);
// //
CopyHKColor( CopyHKColor(
zIndex, zIndex,
@@ -904,6 +1047,86 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.hkColorBuffer // conditions.hkColorBuffer //
); );
//
CopyHKBandUpper(
zIndex,
loopback,
conditions.hkBandUpperBuffer //
);
//
CopyHKBandLower(
zIndex,
loopback,
conditions.hkBandLowerBuffer //
);
//
CopyPBBandUpper(
zIndex,
loopback,
conditions.pbBandUpperBuffer //
);
//
CopyPBBandLower(
zIndex,
loopback,
conditions.pbBandLowerBuffer //
);
//
CopyPBRawBandUpper(
zIndex,
loopback,
conditions.pbBandRawUpperBuffer //
);
//
CopyPBRawBandLower(
zIndex,
loopback,
conditions.pbBandRawLowerBuffer //
);
//
CopyATRBandUpper(
zIndex,
loopback,
conditions.atrBandUpperBuffer //
);
//
CopyATRBandLower(
zIndex,
loopback,
conditions.atrBandLowerBuffer //
);
//
CopyATR(
zIndex,
loopback,
conditions.atrBuffer //
);
//
CopyATRRawBandUpper(
zIndex,
loopback,
conditions.atrBandRawUpperBuffer //
);
//
CopyATRRawBandLower(
zIndex,
loopback,
conditions.atrBandRawLowerBuffer //
);
//
// //
// Conditions ... // Conditions ...
@@ -1682,6 +1905,273 @@ class XCXFIMAHelper : public XCBaseHelper
// //
// CYCLES Range ... // CYCLES Range ...
//
// MAs ...
//
// SC MA ...
//
double GetSCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_SC_MA_LINE,
barIndex //
);
}
//
int CopySCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_SC_MA_LINE,
start,
count,
asSeries //
);
}
//
// SC MA State ...
//
double GetSCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_SC_MA_STATE_LINE,
barIndex //
);
}
//
int CopySCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_SC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// MC MA ...
//
double GetMCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_MC_MA_LINE,
barIndex //
);
}
//
int CopyMCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_MC_MA_LINE,
start,
count,
asSeries //
);
}
//
// MC MA State ...
//
double GetMCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_MC_MA_STATE_LINE,
barIndex //
);
}
//
int CopyMCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_MC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// LC MA ...
//
double GetLCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_LC_MA_LINE,
barIndex //
);
}
//
int CopyLCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_LC_MA_LINE,
start,
count,
asSeries //
);
}
//
// LC MA State ...
//
double GetLCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_LC_MA_STATE_LINE,
barIndex //
);
}
//
int CopyLCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_LC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// HC MA ...
//
double GetHCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_HC_MA_LINE,
barIndex //
);
}
//
int CopyHCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_HC_MA_LINE,
start,
count,
asSeries //
);
}
//
// HC MA State ...
//
double GetHCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_HC_MA_STATE_LINE,
barIndex //
);
}
//
int CopyHCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_HC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
// //
// SHORT ... // SHORT ...
+153 -5
View File
@@ -111,6 +111,7 @@ input bool showMABand = true; // Show MA Band
input bool showHKBand = true; // Show HK Band input bool showHKBand = true; // Show HK Band
input bool showATRBand = true; // Show ATR Band input bool showATRBand = true; // Show ATR Band
input bool showZigZag = true; // Show ZigZag input bool showZigZag = true; // Show ZigZag
input bool showCyclesMa = true; // Show Cycles MA
input bool showFiboZone = true; // Show Fibo Zone input bool showFiboZone = true; // Show Fibo Zone
// //
@@ -424,7 +425,6 @@ double atrBandLowerBuffer[];
#property indicator_color18 clrOrange #property indicator_color18 clrOrange
#property indicator_width18 2 #property indicator_width18 2
// //
#define scMaBufferIndex 25 #define scMaBufferIndex 25
double scMaBuffer[]; double scMaBuffer[];
@@ -434,7 +434,7 @@ double scMaBuffer[];
#property indicator_label19 "SCMA" #property indicator_label19 "SCMA"
#property indicator_type19 DRAW_LINE #property indicator_type19 DRAW_LINE
#property indicator_color19 clrChocolate #property indicator_color19 clrChocolate
#property indicator_style19 STYLE_DASHDOT #property indicator_style19 STYLE_DASHDOTDOT
#property indicator_width19 2 #property indicator_width19 2
// //
@@ -446,7 +446,7 @@ double mcMaBuffer[];
#property indicator_label20 "MCMA" #property indicator_label20 "MCMA"
#property indicator_type20 DRAW_LINE #property indicator_type20 DRAW_LINE
#property indicator_color20 clrChocolate #property indicator_color20 clrChocolate
#property indicator_style20 STYLE_DASHDOT #property indicator_style20 STYLE_DASHDOTDOT
#property indicator_width20 2 #property indicator_width20 2
// //
@@ -458,7 +458,7 @@ double lcMaBuffer[];
#property indicator_label21 "LCMA" #property indicator_label21 "LCMA"
#property indicator_type21 DRAW_LINE #property indicator_type21 DRAW_LINE
#property indicator_color21 clrChocolate #property indicator_color21 clrChocolate
#property indicator_style21 STYLE_DASHDOT #property indicator_style21 STYLE_DASHDOTDOT
#property indicator_width21 2 #property indicator_width21 2
// //
@@ -470,7 +470,7 @@ double hcMaBuffer[];
#property indicator_label22 "HCMA" #property indicator_label22 "HCMA"
#property indicator_type22 DRAW_LINE #property indicator_type22 DRAW_LINE
#property indicator_color22 clrChocolate #property indicator_color22 clrChocolate
#property indicator_style22 STYLE_DASHDOT #property indicator_style22 STYLE_DASHDOTDOT
#property indicator_width22 2 #property indicator_width22 2
// //
@@ -1461,6 +1461,69 @@ void DefineBuffers()
ArraySetAsSeries(atrBandRawLowerBuffer, true); ArraySetAsSeries(atrBandRawLowerBuffer, true);
SetIndexBuffer(atrBandRawLowerBufferIndex, atrBandRawLowerBuffer, INDICATOR_CALCULATIONS); 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 // tickVolume //
); );
//
// Cycles MA Calculation ...
CalculateCyclesMA(
barIndex,
prevCalculated,
ratesTotal,
open,
high,
close,
low,
tickVolume //
);
// //
// Fast MA ... // Fast MA ...
double iFastMa = maFastBuffer[barIndex]; double iFastMa = maFastBuffer[barIndex];
@@ -2765,6 +2841,78 @@ void CalculateCyclesMA(
startCalculationForLastBars > 0 startCalculationForLastBars > 0
? barIndex == startCalculationForLastBars ? barIndex == startCalculationForLastBars
: barIndex == firstBarIndex; : 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;
} }
// //
File diff suppressed because it is too large Load Diff
@@ -287,6 +287,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
drawLeg = true; drawLeg = true;
drawZones = true; drawZones = true;
drawIZones = true; drawIZones = true;
drawTrends = true;
drawSCTrend = true;
drawMCTrend = true;
drawLCTrend = true;
drawHCTrend = true;
drawSupport = true; drawSupport = true;
drawISupport = true; drawISupport = true;
drawOrderFlow = true; drawOrderFlow = true;
@@ -604,6 +609,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
// //
ManageLeg(bar); ManageLeg(bar);
ManageTrends(bar);
ManageZones(p2Bar); ManageZones(p2Bar);
ManageIZones(p2Bar); ManageIZones(p2Bar);
ManageOrderFlow(p3Bar); ManageOrderFlow(p3Bar);
@@ -1364,6 +1370,160 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
} }
} }
//
// Trends ...
//
XTrend scTrend;
XTrend mcTrend;
XTrend lcTrend;
XTrend hcTrend;
//
bool drawTrends;
bool drawSCTrend;
bool drawMCTrend;
bool drawLCTrend;
bool drawHCTrend;
//
bool HasTrend()
{
//
bool result =
HasSCTrend() ||
HasMCTrend() ||
HasLCTrend() ||
HasHCTrend();
//
return result;
}
//
bool HasSCTrend()
{
return scTrend.IsValid() &&
scTrend.HasTrend();
}
//
bool HasMCTrend()
{
return mcTrend.IsValid() &&
mcTrend.HasTrend();
}
//
bool HasLCTrend()
{
return lcTrend.IsValid() &&
lcTrend.HasTrend();
}
//
bool HasHCTrend()
{
return hcTrend.IsValid() &&
hcTrend.HasTrend();
}
//
void DrawTrends()
{
//
if (!drawTrends || !HasTrend())
{
return;
}
//
// SC ...
if (drawSCTrend && HasSCTrend())
{
poiDrawer.DrawTrendLine(scTrend, structureDrawConfig.drawConfig);
}
//
// MC ...
if (drawMCTrend && HasMCTrend())
{
poiDrawer.DrawTrendLine(mcTrend, structureDrawConfig.drawConfig);
}
//
// LC ...
if (drawLCTrend && HasLCTrend())
{
poiDrawer.DrawTrendLine(lcTrend, structureDrawConfig.drawConfig);
}
//
// HC ...
if (drawHCTrend && HasHCTrend())
{
poiDrawer.DrawTrendLine(hcTrend, structureDrawConfig.drawConfig);
}
}
//
void ManageTrends(XOHCL &bar)
{
//
// Validate ...
bool has = bar.IsValid();
if (!has)
{
return;
}
//
XTrend tmpTrend;
//
// SC ...
tmpTrend.Clean();
has = fimaParser.HasSCTrend(tmpTrend, bar.Index());
if (has)
{
scTrend = tmpTrend;
}
//
// MC ...
tmpTrend.Clean();
has = fimaParser.HasMCTrend(tmpTrend, bar.Index());
if (has)
{
mcTrend = tmpTrend;
}
//
// LC ...
tmpTrend.Clean();
has = fimaParser.HasLCTrend(tmpTrend, bar.Index());
if (has)
{
lcTrend = tmpTrend;
}
//
// HC ...
tmpTrend.Clean();
has = fimaParser.HasHCTrend(tmpTrend, bar.Index());
if (has)
{
hcTrend = tmpTrend;
}
//
DrawTrends();
//
// Cleanup ...
tmpTrend.Clean();
}
// //
// Implementing Strategies ... // Implementing Strategies ...
@@ -1422,6 +1582,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
drawLeg = false; drawLeg = false;
drawZones = false; drawZones = false;
drawIZones = false; drawIZones = false;
drawTrends = false;
drawSCTrend = false;
drawMCTrend = false;
drawLCTrend = false;
drawHCTrend = false;
drawSupport = false; drawSupport = false;
drawISupport = false; drawISupport = false;
drawOrderFlow = false; drawOrderFlow = false;