last works and apply fix on ZigZag Reading ...
This commit is contained in:
@@ -42,29 +42,31 @@ enum ENUM_XFIMA_BUFFERS
|
||||
XFIMA_SAR_STATE_LINE = 14,
|
||||
XFIMA_PEAK_LINE = 6,
|
||||
XFIMA_VALE_LINE = 7,
|
||||
XFIMA_FINO_UPPER_LINE = 8,
|
||||
XFIMA_FINO_MIDDLE_LINE = 9,
|
||||
XFIMA_FINO_LOWER_LINE = 10,
|
||||
XFIMA_FIBO_UPPER_LINE = 8,
|
||||
XFIMA_FIBO_MIDDLE_LINE = 9,
|
||||
XFIMA_FIBO_LOWER_LINE = 10,
|
||||
XFIMA_ZIGZAG_LINE = 11,
|
||||
XFIMA_ZIGZAG_HIGHS_LINE = 23,
|
||||
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 24,
|
||||
XFIMA_ZIGZAG_LOWS_LINE = 25,
|
||||
XFIMA_ZIGZAG_LOWS_TIME_LINE = 26,
|
||||
// 12 Ma Fast State
|
||||
// 13 Ma Slow State
|
||||
// 14 Sar State
|
||||
XFIMA_SC_HH_LINE = 15,
|
||||
XFIMA_SC_LL_LINE = 16,
|
||||
XFIMA_MC_HH_LINE = 17,
|
||||
XFIMA_MC_LL_LINE = 18,
|
||||
XFIMA_LC_HH_LINE = 19,
|
||||
XFIMA_LC_LL_LINE = 20,
|
||||
XFIMA_HC_HH_LINE = 21,
|
||||
XFIMA_HC_LL_LINE = 22,
|
||||
// 23 ZigZag Highs
|
||||
// 24 ZigZag Highs Time
|
||||
// 25 ZigZag Lows
|
||||
// 26 ZigZag Lows Time
|
||||
XFIMA_MA_BAND_UPPER_LINE = 12,
|
||||
XFIMA_MA_BAND_LOWER_LINE = 13,
|
||||
XFIMA_ZIGZAG_HIGHS_LINE = 25,
|
||||
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 26,
|
||||
XFIMA_ZIGZAG_LOWS_LINE = 27,
|
||||
XFIMA_ZIGZAG_LOWS_TIME_LINE = 28,
|
||||
// 14 Ma Fast State
|
||||
// 15 Ma Slow State
|
||||
// 16 Sar State
|
||||
XFIMA_SC_HH_LINE = 17,
|
||||
XFIMA_SC_LL_LINE = 18,
|
||||
XFIMA_MC_HH_LINE = 19,
|
||||
XFIMA_MC_LL_LINE = 20,
|
||||
XFIMA_LC_HH_LINE = 21,
|
||||
XFIMA_LC_LL_LINE = 22,
|
||||
XFIMA_HC_HH_LINE = 23,
|
||||
XFIMA_HC_LL_LINE = 24,
|
||||
// 25 ZigZag Highs
|
||||
// 26 ZigZag Highs Time
|
||||
// 27 ZigZag Lows
|
||||
// 28 ZigZag Lows Time
|
||||
};
|
||||
|
||||
//
|
||||
@@ -95,6 +97,7 @@ struct XFIMAInputs
|
||||
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
||||
int maFastLength; // Fast MA Length
|
||||
int maSlowLength; // Slow MA Length
|
||||
int maBandLength; // MA Band Length
|
||||
int zigzagDepth; // ZigZag Depth
|
||||
int zigzagDeviation; // ZigZag Deviation
|
||||
int zigzagBackStep; // ZigZag Back Step
|
||||
@@ -107,6 +110,7 @@ struct XFIMAInputs
|
||||
bool showSAR; // Show Sar
|
||||
bool showMAFast; // Show MA Fast
|
||||
bool showMASlow; // Show MA Slow
|
||||
bool showMABand; // Show MA Band
|
||||
bool showZigZag; // Show ZigZag
|
||||
bool showFiboZone; // Show Fibo Zone
|
||||
int startCalculationForLastBars; // Calculate Last n Bars
|
||||
@@ -156,6 +160,7 @@ struct XFIMAInputs
|
||||
maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||
maFastLength = 7; // Fast MA Length
|
||||
maSlowLength = 20; // Slow MA Length
|
||||
maBandLength = 7; // MA Band Length
|
||||
zigzagDepth = 12; // ZigZag Depth
|
||||
zigzagDeviation = 5; // ZigZag Deviation
|
||||
zigzagBackStep = 3; // ZigZag Back Step
|
||||
@@ -168,6 +173,7 @@ struct XFIMAInputs
|
||||
showSAR = true; // Show Sar
|
||||
showMAFast = true; // Show MA Fast
|
||||
showMASlow = true; // Show MA Slow
|
||||
showMABand = true; // Show MA Band
|
||||
showZigZag = true; // Show ZigZag
|
||||
showFiboZone = true; // Show Fibo Zone
|
||||
startCalculationForLastBars = 1500; // Calculate Last n Bars
|
||||
@@ -185,6 +191,7 @@ struct XFIMAInputs
|
||||
showSAR = false;
|
||||
showMAFast = false;
|
||||
showMASlow = false;
|
||||
showMABand = false;
|
||||
showZigZag = false;
|
||||
showFiboZone = false;
|
||||
}
|
||||
@@ -202,6 +209,7 @@ struct XFIMAInputs
|
||||
// MA ...
|
||||
maFastLength >= 2 &&
|
||||
maSlowLength >= 2 &&
|
||||
maBandLength >= 2 &&
|
||||
maSlowLength > maFastLength &&
|
||||
//
|
||||
// SAR ...
|
||||
@@ -256,6 +264,8 @@ struct XFIMAConditions
|
||||
double maSlowBuffer[];
|
||||
double maSlowColorBuffer[];
|
||||
double maSlowStateBuffer[];
|
||||
double maBandUpperBuffer[];
|
||||
double maBandLowerBuffer[];
|
||||
double sarBuffer[];
|
||||
double sarColorBuffer[];
|
||||
double sarStateBuffer[];
|
||||
@@ -317,6 +327,8 @@ struct XFIMAConditions
|
||||
SpecifiedClean(maSlowBuffer);
|
||||
SpecifiedClean(maSlowColorBuffer);
|
||||
SpecifiedClean(maSlowStateBuffer);
|
||||
SpecifiedClean(maBandUpperBuffer);
|
||||
SpecifiedClean(maBandLowerBuffer);
|
||||
SpecifiedClean(sarBuffer);
|
||||
SpecifiedClean(sarColorBuffer);
|
||||
SpecifiedClean(sarStateBuffer);
|
||||
@@ -352,6 +364,8 @@ struct XFIMAConditions
|
||||
ArraySetAsSeries(maSlowBuffer, true);
|
||||
ArraySetAsSeries(maSlowColorBuffer, true);
|
||||
ArraySetAsSeries(maSlowStateBuffer, true);
|
||||
ArraySetAsSeries(maBandUpperBuffer, true);
|
||||
ArraySetAsSeries(maBandLowerBuffer, true);
|
||||
ArraySetAsSeries(sarBuffer, true);
|
||||
ArraySetAsSeries(sarColorBuffer, true);
|
||||
ArraySetAsSeries(sarStateBuffer, true);
|
||||
@@ -360,7 +374,7 @@ struct XFIMAConditions
|
||||
ArraySetAsSeries(fiboUpperBuffer, true);
|
||||
ArraySetAsSeries(fiboMiddleBuffer, true);
|
||||
ArraySetAsSeries(fiboLowerBuffer, true);
|
||||
ArraySetAsSeries(zigzagBuffer, true);
|
||||
ArraySetAsSeries(zigzagBuffer, false); // Fix this ...
|
||||
ArraySetAsSeries(sHHBuffer, true);
|
||||
ArraySetAsSeries(sLLBuffer, true);
|
||||
ArraySetAsSeries(mHHBuffer, true);
|
||||
@@ -442,6 +456,8 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
double maSlowBuffer[];
|
||||
double maSlowColorBuffer[];
|
||||
double maSlowStateBuffer[];
|
||||
double maBandUpperBuffer[];
|
||||
double maBandLowerBuffer[];
|
||||
double sarBuffer[];
|
||||
double sarColorBuffer[];
|
||||
double sarStateBuffer[];
|
||||
@@ -509,6 +525,8 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
ArraySetAsSeries(maSlowBuffer, true);
|
||||
ArraySetAsSeries(maSlowColorBuffer, true);
|
||||
ArraySetAsSeries(maSlowStateBuffer, true);
|
||||
ArraySetAsSeries(maBandUpperBuffer, true);
|
||||
ArraySetAsSeries(maBandLowerBuffer, true);
|
||||
ArraySetAsSeries(sarBuffer, true);
|
||||
ArraySetAsSeries(sarColorBuffer, true);
|
||||
ArraySetAsSeries(sarStateBuffer, true);
|
||||
@@ -517,7 +535,7 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
ArraySetAsSeries(fiboUpperBuffer, true);
|
||||
ArraySetAsSeries(fiboMiddleBuffer, true);
|
||||
ArraySetAsSeries(fiboLowerBuffer, true);
|
||||
ArraySetAsSeries(zigzagBuffer, true);
|
||||
ArraySetAsSeries(zigzagBuffer, false); // TODO: FIX This ...
|
||||
ArraySetAsSeries(sHHBuffer, true);
|
||||
ArraySetAsSeries(sLLBuffer, true);
|
||||
ArraySetAsSeries(mHHBuffer, true);
|
||||
@@ -559,6 +577,7 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
mInputs.maAppliedTo,
|
||||
mInputs.maFastLength,
|
||||
mInputs.maSlowLength,
|
||||
mInputs.maBandLength,
|
||||
mInputs.zigzagDepth,
|
||||
mInputs.zigzagDeviation,
|
||||
mInputs.zigzagBackStep,
|
||||
@@ -569,6 +588,7 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
mInputs.showSAR,
|
||||
mInputs.showMAFast,
|
||||
mInputs.showMASlow,
|
||||
mInputs.showMABand,
|
||||
mInputs.showZigZag,
|
||||
mInputs.showFiboZone,
|
||||
mInputs.startCalculationForLastBars,
|
||||
@@ -715,6 +735,20 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
conditions.maSlowStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyMABandUpper(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.maBandUpperBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyMABandLower(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.maBandLowerBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopySar(
|
||||
zIndex,
|
||||
@@ -1045,6 +1079,110 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Upper MA ...
|
||||
|
||||
//
|
||||
double GetMABandUpper(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(maBandUpperBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return maBandUpperBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyMABandUpper(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
maBandUpperBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Lower MA ...
|
||||
|
||||
//
|
||||
double GetMABandLower(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(maBandLowerBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return maBandLowerBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyMABandLower(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
maBandLowerBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
@@ -1427,7 +1565,18 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
// Calculate(barIndex);
|
||||
SpecifiedClean(zigzagBuffer);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_ZIGZAG_LINE,
|
||||
barIndex,
|
||||
1,
|
||||
zigzagBuffer //
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
int count = ArraySize(zigzagBuffer);
|
||||
@@ -1450,7 +1599,18 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
// Calculate(start);
|
||||
SpecifiedClean(zigzagBuffer);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_ZIGZAG_LINE,
|
||||
start,
|
||||
0,
|
||||
zigzagBuffer //
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
@@ -1976,6 +2136,24 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
maSlowStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_MA_BAND_UPPER_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maBandUpperBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_MA_BAND_LOWER_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maBandLowerBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
@@ -2024,7 +2202,7 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_FINO_UPPER_LINE,
|
||||
XFIMA_FIBO_UPPER_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
fiboUpperBuffer //
|
||||
@@ -2033,7 +2211,7 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_FINO_MIDDLE_LINE,
|
||||
XFIMA_FIBO_MIDDLE_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
fiboMiddleBuffer //
|
||||
@@ -2042,7 +2220,7 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XFIMA_FINO_LOWER_LINE,
|
||||
XFIMA_FIBO_LOWER_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
fiboLowerBuffer //
|
||||
@@ -2207,6 +2385,18 @@ class XCXFIMAHelper : public XCBaseHelper
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maBandUpperBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maBandLowerBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
sarBuffer,
|
||||
|
||||
Reference in New Issue
Block a user