add supports for VIDYA in xca and also it's helper and in xcaea ...

This commit is contained in:
2025-04-23 08:16:08 +03:30
parent f48d272bba
commit f648037c07
3 changed files with 540 additions and 17 deletions
+309 -5
View File
@@ -55,9 +55,11 @@ enum ENUM_X121_XCA_BUFFERS
X121_XCA_SWING_LOW_LINE = 22,
X121_XCA_SWING_HIGH_LINE = 23,
X121_XCA_TKI_LINE = 24,
X121_XCA_TREND_STATE_LINE = 26,
X121_XCA_KI_STATE_LINE = 27,
X121_XCA_TKI_STATE_LINE = 28,
X121_XCA_VIDYA_LINE = 26,
X121_XCA_TREND_STATE_LINE = 28,
X121_XCA_KI_STATE_LINE = 29,
X121_XCA_TKI_STATE_LINE = 30,
X121_XCA_VIDYA_STATE_LINE = 31,
};
//
@@ -111,6 +113,12 @@ struct X121XCAInputs
// KI ...
int kiLength; // KI Length
//
// VIDYA ...
int vidyaCMOLength; // CMO (Candle Momentum) Length
int vidyaEMALength; // EMA Length
ENUM_APPLIED_PRICE vidyaAppliedTo; // Applied To
//
// Swing Detection ...
int swingLength; // Length
@@ -130,6 +138,7 @@ struct X121XCAInputs
bool showSar; // Show Sar
bool showKI; // Show KI
bool showTKI; // Show TKI
bool showVidya; // Show Vidya
bool showTrend; // Show Trend
bool showSwings; // Show Swings
bool showFiboLevel1; // Show Fibo Level 1
@@ -208,6 +217,12 @@ struct X121XCAInputs
// KI ...
kiLength = 0; // KI Length
//
// VIDYA ...
vidyaCMOLength = 0;
vidyaEMALength = 0;
vidyaAppliedTo = PRICE_CLOSE;
//
// Swing Detection ...
swingLength = 0; // Length
@@ -227,6 +242,7 @@ struct X121XCAInputs
showSar = true; // Show Sar
showKI = true; // Show KI
showTKI = true; // Show TKI
showVidya = true; // Show Vidya
showTrend = true; // Show Trend
showSwings = true; // Show Swings
showFiboLevel1 = true; // Show Fibo Level 1
@@ -298,6 +314,12 @@ struct X121XCAInputs
// KI ...
kiLength = 26; // KI Length
//
// VIDYA ...
vidyaCMOLength = 20;
vidyaEMALength = 14;
vidyaAppliedTo = PRICE_CLOSE;
//
// Swing Detection ...
swingLength = 5; // Length
@@ -312,6 +334,7 @@ struct X121XCAInputs
showSar = true; // Show Sar
showKI = true; // Show KI
showTKI = true; // Show TKI
showVidya = true; // Show Vidya
showTrend = true; // Show Trend
showSwings = true; // Show Swings
showFiboLevel1 = true; // Show Fibo Level 1
@@ -349,6 +372,8 @@ struct X121XCAInputs
kiLength > 0 &&
swingLength > 0 &&
sarMax > sarStep &&
vidyaCMOLength > 0 &&
vidyaEMALength > 0 &&
//
// XCA ...
(IsValid(scMethod, scPeriod) &&
@@ -371,6 +396,8 @@ struct X121XCAInputs
//
result = MathMax(kiLength, swingLength);
result = MathMax(result, vidyaCMOLength);
result = MathMax(result, vidyaEMALength);
//
return result;
@@ -402,12 +429,14 @@ struct X121XCAConditions
double sarBuffer[];
double peakBuffer[];
double valeBuffer[];
double vidyaBuffer[];
double trendBuffer[];
double kiStateBuffer[];
double supportBuffer[];
double tkiStateBuffer[];
double swingLowBuffer[];
double swingHighBuffer[];
double vidyaStateBuffer[];
double resistanceBuffer[];
double peakGoldenBuffer[];
double valeGoldenBuffer[];
@@ -449,6 +478,21 @@ struct X121XCAConditions
bool isTKISwitchedToBullish;
bool isTKISwitchedToBearish;
//
// VIDYA ...
//
bool isVidyaRejectUp;
bool isVidyaRejectDown;
//
bool isVidyaBullish;
bool isVidyaBearish;
//
bool isVidyaSwitchedToBullish;
bool isVidyaSwitchedToBearish;
//
// SAR ...
@@ -596,6 +640,7 @@ struct X121XCAConditions
Clean(sarBuffer);
Clean(peakBuffer);
Clean(valeBuffer);
Clean(vidyaBuffer);
Clean(trendBuffer);
Clean(kiStateBuffer);
Clean(supportBuffer);
@@ -608,6 +653,7 @@ struct X121XCAConditions
Clean(fiboLevel1Buffer);
Clean(fiboLevel2Buffer);
Clean(fiboLevel3Buffer);
Clean(vidyaStateBuffer);
Clean(trendStateBuffer);
//
@@ -624,6 +670,7 @@ struct X121XCAConditions
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(vidyaBuffer, true);
ArraySetAsSeries(trendBuffer, true);
ArraySetAsSeries(kiStateBuffer, true);
ArraySetAsSeries(supportBuffer, true);
@@ -636,6 +683,7 @@ struct X121XCAConditions
ArraySetAsSeries(fiboLevel1Buffer, true);
ArraySetAsSeries(fiboLevel2Buffer, true);
ArraySetAsSeries(fiboLevel3Buffer, true);
ArraySetAsSeries(vidyaStateBuffer, true);
ArraySetAsSeries(trendStateBuffer, true);
//
@@ -671,6 +719,21 @@ struct X121XCAConditions
isTKISwitchedToBullish = false;
isTKISwitchedToBearish = false;
//
// VIDYA ...
//
isVidyaRejectUp = false;
isVidyaRejectDown = false;
//
isVidyaBullish = false;
isVidyaBearish = false;
//
isVidyaSwitchedToBullish = false;
isVidyaSwitchedToBearish = false;
//
// SAR ...
@@ -866,6 +929,37 @@ struct X121XCAConditions
bearishScore += minScore;
}
//
// VIDYA ...
//
if (isVidyaBullish)
{
bullishScore += minScore;
}
if (isVidyaRejectUp)
{
bullishScore += minScore;
}
if (isVidyaSwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isVidyaBearish)
{
bearishScore += minScore;
}
if (isVidyaRejectDown)
{
bearishScore += minScore;
}
if (isVidyaSwitchedToBearish)
{
bearishScore += minScore;
}
//
// SAR ...
@@ -1136,6 +1230,12 @@ struct X121XCAConditions
ToString("isTKIBearish", isTKIBearish, ignoreFalseConditions, separator) +
ToString("isTKISwitchedToBullish", isTKISwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isTKISwitchedToBearish", isTKISwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isVidyaRejectUp", isVidyaRejectUp, ignoreFalseConditions, separator) +
ToString("isVidyaRejectDown", isVidyaRejectDown, ignoreFalseConditions, separator) +
ToString("isVidyaBullish", isVidyaBullish, ignoreFalseConditions, separator) +
ToString("isVidyaBearish", isVidyaBearish, ignoreFalseConditions, separator) +
ToString("isVidyaSwitchedToBullish", isVidyaSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isVidyaSwitchedToBearish", isVidyaSwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) +
ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) +
@@ -1258,6 +1358,7 @@ class XCX121XCAHelper : public XCBaseHelper
Clean(sarBuffer);
Clean(peakBuffer);
Clean(valeBuffer);
Clean(vidyaBuffer);
Clean(trendBuffer);
Clean(kiStateBuffer);
Clean(supportBuffer);
@@ -1271,6 +1372,7 @@ class XCX121XCAHelper : public XCBaseHelper
Clean(fiboLevel2Buffer);
Clean(fiboLevel3Buffer);
Clean(trendStateBuffer);
Clean(vidyaStateBuffer);
}
//
@@ -1309,6 +1411,7 @@ class XCX121XCAHelper : public XCBaseHelper
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(vidyaBuffer, true);
ArraySetAsSeries(trendBuffer, true);
ArraySetAsSeries(kiStateBuffer, true);
ArraySetAsSeries(supportBuffer, true);
@@ -1321,6 +1424,7 @@ class XCX121XCAHelper : public XCBaseHelper
ArraySetAsSeries(fiboLevel1Buffer, true);
ArraySetAsSeries(fiboLevel2Buffer, true);
ArraySetAsSeries(fiboLevel3Buffer, true);
ArraySetAsSeries(vidyaStateBuffer, true);
ArraySetAsSeries(trendStateBuffer, true);
//
@@ -1356,6 +1460,10 @@ class XCX121XCAHelper : public XCBaseHelper
mInputs.sarMax,
"", // KI ...
mInputs.kiLength,
"", // VIDYA ...
mInputs.vidyaCMOLength,
mInputs.vidyaEMALength,
mInputs.vidyaAppliedTo,
"", // Swing Detection ...
mInputs.swingLength,
"", // Support and Resistance ...
@@ -1366,6 +1474,7 @@ class XCX121XCAHelper : public XCBaseHelper
mInputs.showSar,
mInputs.showKI,
mInputs.showTKI,
mInputs.showVidya,
mInputs.showTrend,
mInputs.showSwings,
mInputs.showFiboLevel1,
@@ -1630,6 +1739,110 @@ class XCX121XCAHelper : public XCBaseHelper
);
}
//
// VIDYA ...
//
double GetVidya(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(vidyaBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vidyaBuffer[barIndex];
}
//
int CopyVidya(
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,
vidyaBuffer,
buffer,
forceClean
//
);
}
//
// VIDYA STATE ...
//
double GetVidyaState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(vidyaStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vidyaStateBuffer[barIndex];
}
//
int CopyVidyaState(
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,
vidyaStateBuffer,
buffer,
forceClean
//
);
}
//
// SHORT ...
@@ -2889,6 +3102,20 @@ class XCX121XCAHelper : public XCBaseHelper
conditions.tkiStateBuffer //
);
//
CopyVidya(
zIndex,
loopback,
conditions.vidyaBuffer //
);
//
CopyVidyaState(
zIndex,
loopback,
conditions.vidyaStateBuffer //
);
//
CopySHH(
zIndex,
@@ -3135,9 +3362,50 @@ class XCX121XCAHelper : public XCBaseHelper
//
bool isTKISwitchedToBullish = isTKIBullish &&
!isTKIBullishPrev;
!isTKIBullishPrev;
bool isTKISwitchedToBearish = isTKIBearish &&
!isTKIBearishPrev;
!isTKIBearishPrev;
//
// VIDYA ...
//
double cVidya = conditions.vidyaBuffer[cIDX];
double pVidya = conditions.vidyaBuffer[pIDX];
double p2Vidya = conditions.vidyaBuffer[p2IDX];
//
double cVidyaState = conditions.vidyaStateBuffer[cIDX];
double pVidyaState = conditions.vidyaStateBuffer[pIDX];
double p2VidyaState = conditions.vidyaStateBuffer[p2IDX];
//
bool isVidyaRejectUp = cBar.IsRejected(
cVidya,
X_DIRECTION_BULLISH,
false,
false //
);
bool isVidyaRejectDown = cBar.IsRejected(
cVidya,
X_DIRECTION_BEARISH,
false,
false //
);
//
bool isVidyaBullish = cVidyaState > 0;
bool isVidyaBullishPrev = pVidyaState > 0;
//
bool isVidyaBearish = cVidyaState < 0;
bool isVidyaBearishPrev = pVidyaState < 0;
//
bool isVidyaSwitchedToBullish = isVidyaBullish &&
!isVidyaBullishPrev;
bool isVidyaSwitchedToBearish = isVidyaBearish &&
!isVidyaBearishPrev;
//
// SAR ...
@@ -3356,6 +3624,8 @@ class XCX121XCAHelper : public XCBaseHelper
conditions.isTKIRejectUp = isTKIRejectUp;
conditions.isPeakIsPivot = isPeakIsPivot;
conditions.isValeIsPivot = isValeIsPivot;
conditions.isVidyaBullish = isVidyaBullish;
conditions.isVidyaBearish = isVidyaBearish;
conditions.isKIRejectDown = isKIRejectDown;
conditions.isPeakSameLast = isPeakSameLast;
conditions.isPeakOverLast = isPeakOverLast;
@@ -3398,6 +3668,8 @@ class XCX121XCAHelper : public XCBaseHelper
conditions.isLastSwingHighRejected = isLastSwingHighRejected;
conditions.isLastResistanceBreaked = isLastResistanceBreaked;
conditions.isSupportSameAsSwingLow = isSupportSameAsSwingLow;
conditions.isVidyaSwitchedToBullish = isVidyaSwitchedToBullish;
conditions.isVidyaSwitchedToBearish = isVidyaSwitchedToBearish;
conditions.isLastResistanceRejected = isLastResistanceRejected;
conditions.isTrendSwitchedToBullish = isTrendSwitchedToBullish;
conditions.isTrendSwitchedToBearish = isTrendSwitchedToBearish;
@@ -3440,6 +3712,7 @@ class XCX121XCAHelper : public XCBaseHelper
double sarBuffer[];
double peakBuffer[];
double valeBuffer[];
double vidyaBuffer[];
double trendBuffer[];
double kiStateBuffer[];
double supportBuffer[];
@@ -3452,6 +3725,7 @@ class XCX121XCAHelper : public XCBaseHelper
double fiboLevel1Buffer[];
double fiboLevel2Buffer[];
double fiboLevel3Buffer[];
double vidyaStateBuffer[];
double trendStateBuffer[];
//
@@ -3485,6 +3759,15 @@ class XCX121XCAHelper : public XCBaseHelper
tkiBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_VIDYA_LINE,
barIndex,
maxRequiredBars,
vidyaBuffer //
);
//
CopyBuffer(
mHandler,
@@ -3611,6 +3894,15 @@ class XCX121XCAHelper : public XCBaseHelper
tkiStateBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_VIDYA_STATE_LINE,
barIndex,
maxRequiredBars,
vidyaStateBuffer //
);
//
CopyBuffer(
mHandler,
@@ -3719,6 +4011,12 @@ class XCX121XCAHelper : public XCBaseHelper
maxAllowed //
);
//
CleanupArray(
vidyaBuffer,
maxAllowed //
);
//
CleanupArray(
sHHBuffer,
@@ -3803,6 +4101,12 @@ class XCX121XCAHelper : public XCBaseHelper
maxAllowed //
);
//
CleanupArray(
vidyaStateBuffer,
maxAllowed //
);
//
CleanupArray(
supportBuffer,
+142 -12
View File
@@ -76,6 +76,14 @@ input double sarMax = 0.2; // Maximum
input group "KI";
input int kiLength = 26; // KI Length
//
// VIDYA ...
// Variable Index Dynamic Average ...
input group "VIDYA";
input int vidyaCMOLength = 20; // CMO (Candle Momentum) Length
input int vidyaEMALength = 14; // EMA Length
input ENUM_APPLIED_PRICE vidyaAppliedTo = PRICE_CLOSE; // Applied To
//
input group "Swing Detection";
input int swingLength = 5; // Length
@@ -96,6 +104,7 @@ input int startCalculationForLastBars = 1000; // Calculate Last n Bars
input bool showSar = true; // Show Sar
input bool showKI = true; // Show KI
input bool showTKI = true; // Show KI Trend
input bool showVidya = true; // Show Vidya
input bool showTrend = true; // Show Trend
input bool showSwings = true; // Show Swings
input bool showFiboLevel1 = true; // Show Fibo Level 1
@@ -137,8 +146,8 @@ input int swingHighArrowCode = 226; // Swing High Arrow Code
#property indicator_chart_window
//
#property indicator_buffers 31
#property indicator_plots 23
#property indicator_buffers 34
#property indicator_plots 24
//
// Plot Buffers ...
@@ -465,10 +474,29 @@ double tkiColorBuffer[];
#property indicator_style23 STYLE_DASHDOTDOT
#property indicator_width23 2
//
// VIDYA ...
//
#define vidyaBufferIndex 26
#define vidyaBufferPlotIndex 23
double vidyaBuffer[];
//
#define vidyaColorBufferIndex 27
double vidyaColorBuffer[];
//
#property indicator_label24 "VIDYA"
#property indicator_type24 DRAW_COLOR_LINE
#property indicator_color24 CLR_NONE, clrAqua, clrMagenta, clrGray
#property indicator_style24 STYLE_SOLID
#property indicator_width24 1
//
// Data Buffers ...
#define mLastBufferIndex 25
#define mLastBufferIndex 27
//
#define trendStateBufferIndex mLastBufferIndex + 1
@@ -483,11 +511,15 @@ double kiStateBuffer[];
double tkiStateBuffer[];
//
#define supBufferIndex mLastBufferIndex + 4
#define vidyaStateBufferIndex mLastBufferIndex + 4
double vidyaStateBuffer[];
//
#define supBufferIndex mLastBufferIndex + 5
double supBuffer[];
//
#define resBufferIndex mLastBufferIndex + 5
#define resBufferIndex mLastBufferIndex + 6
double resBuffer[];
//
@@ -507,6 +539,7 @@ int sarHandler = INVALID_HANDLE;
//
// TREND Handler ...
int tkiHandler = INVALID_HANDLE;
int vidyaHandler = INVALID_HANDLE;
int trendHandler = INVALID_HANDLE;
//
@@ -585,6 +618,22 @@ int OnInit()
return INIT_FAILED;
}
//
// VIDYA ...
vidyaHandler = iVIDyA(
_Symbol,
_Period,
vidyaCMOLength,
vidyaEMALength,
0,
vidyaAppliedTo //
);
isInited = vidyaHandler != INVALID_HANDLE;
if (!isInited)
{
return INIT_FAILED;
}
//
// TREND ...
trendHandler = iMA(
@@ -642,6 +691,8 @@ void OnDeinit(const int reason)
//
IndicatorRelease(sarHandler);
IndicatorRelease(tkiHandler);
IndicatorRelease(vidyaHandler);
IndicatorRelease(trendHandler);
}
@@ -696,6 +747,10 @@ int OnCalculate(
// TKI ...
int tkiCalculatedBars = BarsCalculated(tkiHandler);
//
// VIDYA ...
int vidyaCalculatedBars = BarsCalculated(vidyaHandler);
//
// TREND ...
int trendCalculatedBars = BarsCalculated(trendHandler);
@@ -709,6 +764,9 @@ int OnCalculate(
// TKI ...
tkiCalculatedBars >= maxLength &&
//
// VIDYA ...
vidyaCalculatedBars >= maxLength &&
//
// TREND ...
trendCalculatedBars >= maxLength
//
@@ -734,6 +792,10 @@ int OnCalculate(
// TKI ...
int copiedTKIs = CopyBuffer(tkiHandler, 0, 0, limit, tkiBuffer);
//
// TKI ...
int copiedVidyas = CopyBuffer(vidyaHandler, 0, 0, limit, vidyaBuffer);
//
// TREND ...
int copiedTrends = CopyBuffer(trendHandler, MAIN_LINE, 0, limit + 1, trendBuffer);
@@ -748,6 +810,9 @@ int OnCalculate(
// TKI ...
copiedTKIs >= limit &&
//
// VIDYA ...
copiedVidyas >= limit &&
//
// TREND ...
copiedTrends >= limit
//
@@ -801,6 +866,8 @@ bool ValidateInputs()
kiLength > 0 &&
swingLength > 0 &&
sarMax > sarStep &&
vidyaEMALength > 0 &&
vidyaCMOLength > 0 &&
//
// XCA ...
(IsValid(scMethod, scPeriod) &&
@@ -826,6 +893,8 @@ int ExtractMaxLengthOfInputs()
//
result = MathMax(kiLength, swingLength);
result = MathMax(result, vidyaCMOLength);
result = MathMax(result, vidyaEMALength);
//
return result;
@@ -1211,6 +1280,27 @@ void DefineBuffers()
ArraySetAsSeries(tkiColorBuffer, true);
SetIndexBuffer(tkiColorBufferIndex, tkiColorBuffer, INDICATOR_COLOR_INDEX);
//
// VIDYA ...
//
ENUM_DRAW_TYPE vidyaDrawType = showVidya ? DRAW_COLOR_LINE : DRAW_NONE;
//
ArraySetAsSeries(vidyaBuffer, true);
SetIndexBuffer(vidyaBufferIndex, vidyaBuffer, INDICATOR_DATA);
//
PlotIndexSetInteger(vidyaBufferPlotIndex, PLOT_SHOW_DATA, showKI);
// PlotIndexSetInteger(vidyaBufferPlotIndex, PLOT_DRAW_TYPE, vidyaDrawType);
//
PlotIndexSetDouble(vidyaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
//
ArraySetAsSeries(vidyaColorBuffer, true);
SetIndexBuffer(vidyaColorBufferIndex, vidyaColorBuffer, INDICATOR_COLOR_INDEX);
//
// SWINGS ...
@@ -1258,6 +1348,14 @@ void DefineBuffers()
ArraySetAsSeries(kiStateBuffer, true);
SetIndexBuffer(kiStateBufferIndex, kiStateBuffer, INDICATOR_CALCULATIONS);
//
ArraySetAsSeries(tkiStateBuffer, true);
SetIndexBuffer(tkiStateBufferIndex, tkiStateBuffer, INDICATOR_CALCULATIONS);
//
ArraySetAsSeries(vidyaStateBuffer, true);
SetIndexBuffer(vidyaStateBufferIndex, vidyaStateBuffer, INDICATOR_CALCULATIONS);
//
ArraySetAsSeries(supBuffer, true);
SetIndexBuffer(supBufferIndex, supBuffer, INDICATOR_CALCULATIONS);
@@ -1266,10 +1364,6 @@ void DefineBuffers()
ArraySetAsSeries(resBuffer, true);
SetIndexBuffer(resBufferIndex, resBuffer, INDICATOR_CALCULATIONS);
//
ArraySetAsSeries(tkiStateBuffer, true);
SetIndexBuffer(tkiStateBufferIndex, tkiStateBuffer, INDICATOR_CALCULATIONS);
//
}
@@ -1541,19 +1635,25 @@ void FillBuffersZero(int barIndex)
// TREND ...
trendBuffer[barIndex] = emptyValue;
trendColorBuffer[barIndex] = hideColorIDX;
trendStateBuffer[barIndex] = hideColorIDX;
trendStateBuffer[barIndex] = neuturalState;
//
// KI ...
kiBuffer[barIndex] = emptyValue;
kiColorBuffer[barIndex] = hideColorIDX;
kiStateBuffer[barIndex] = hideColorIDX;
kiStateBuffer[barIndex] = neuturalState;
//
// TKI ...
tkiBuffer[barIndex] = emptyValue;
tkiColorBuffer[barIndex] = hideColorIDX;
tkiStateBuffer[barIndex] = hideColorIDX;
tkiStateBuffer[barIndex] = neuturalState;
//
// VIDYA ...
vidyaBuffer[barIndex] = emptyValue;
vidyaColorBuffer[barIndex] = hideColorIDX;
vidyaStateBuffer[barIndex] = neuturalState;
//
// SWINGS ...
@@ -2017,6 +2117,36 @@ void CalculateValues(
tkiStateBuffer[bar_index] = iTKIState;
tkiColorBuffer[bar_index] = iTKIColor;
//
// VIDYA Color ...
//
double iVIDYA = vidyaBuffer[bar_index];
//
double iVIDYAState = neuturalState;
double iVIDYAColor = neuturalColorIDX;
if (iClose > iVIDYA)
{
//
iVIDYAState = bullishState;
iVIDYAColor =
!showVidya
? hideColorIDX
: bullishColorIDX;
}
else if (iClose < iVIDYA)
{
//
iVIDYAState = bearishState;
iVIDYAColor =
!showVidya
? hideColorIDX
: bearishColorIDX;
}
vidyaStateBuffer[bar_index] = iVIDYAState;
vidyaColorBuffer[bar_index] = iVIDYAColor;
//
// Cleanup Resources ...
+89
View File
@@ -187,6 +187,7 @@ struct XCAEAConditions
double sarBuffer[];
double peakBuffer[];
double valeBuffer[];
double vidyaBuffer[];
double trendBuffer[];
double kiStateBuffer[];
double supportBuffer[];
@@ -199,6 +200,7 @@ struct XCAEAConditions
double fiboLevel1Buffer[];
double fiboLevel2Buffer[];
double fiboLevel3Buffer[];
double vidyaStateBuffer[];
double trendStateBuffer[];
//
@@ -234,6 +236,21 @@ struct XCAEAConditions
bool isTKISwitchedToBullish;
bool isTKISwitchedToBearish;
//
// VIDYA ...
//
bool isVidyaRejectUp;
bool isVidyaRejectDown;
//
bool isVidyaBullish;
bool isVidyaBearish;
//
bool isVidyaSwitchedToBullish;
bool isVidyaSwitchedToBearish;
//
// SAR ...
@@ -649,6 +666,7 @@ struct XCAEAConditions
Clean(sarBuffer);
Clean(peakBuffer);
Clean(valeBuffer);
Clean(vidyaBuffer);
Clean(trendBuffer);
Clean(kiStateBuffer);
Clean(supportBuffer);
@@ -661,6 +679,7 @@ struct XCAEAConditions
Clean(fiboLevel1Buffer);
Clean(fiboLevel2Buffer);
Clean(fiboLevel3Buffer);
Clean(vidyaStateBuffer);
Clean(trendStateBuffer);
//
@@ -677,6 +696,7 @@ struct XCAEAConditions
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(vidyaBuffer, true);
ArraySetAsSeries(trendBuffer, true);
ArraySetAsSeries(kiStateBuffer, true);
ArraySetAsSeries(supportBuffer, true);
@@ -689,6 +709,7 @@ struct XCAEAConditions
ArraySetAsSeries(fiboLevel1Buffer, true);
ArraySetAsSeries(fiboLevel2Buffer, true);
ArraySetAsSeries(fiboLevel3Buffer, true);
ArraySetAsSeries(vidyaStateBuffer, true);
ArraySetAsSeries(trendStateBuffer, true);
//
@@ -724,6 +745,21 @@ struct XCAEAConditions
isTKISwitchedToBullish = false;
isTKISwitchedToBearish = false;
//
// VIDYA ...
//
isVidyaRejectUp = false;
isVidyaRejectDown = false;
//
isVidyaBullish = false;
isVidyaBearish = false;
//
isVidyaSwitchedToBullish = false;
isVidyaSwitchedToBearish = false;
//
// SAR ...
@@ -1132,6 +1168,37 @@ struct XCAEAConditions
bearishScore += minScore;
}
//
// VIDYA ...
//
if (isVidyaBullish)
{
bullishScore += minScore;
}
if (isVidyaRejectUp)
{
bullishScore += minScore;
}
if (isVidyaSwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isVidyaBearish)
{
bearishScore += minScore;
}
if (isVidyaRejectDown)
{
bearishScore += minScore;
}
if (isVidyaSwitchedToBearish)
{
bearishScore += minScore;
}
//
// SAR ...
@@ -1825,6 +1892,12 @@ struct XCAEAConditions
ToString("isTKIBearish", isTKIBearish, ignoreFalseConditions, separator) +
ToString("isTKISwitchedToBullish", isTKISwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isTKISwitchedToBearish", isTKISwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isVidyaRejectUp", isVidyaRejectUp, ignoreFalseConditions, separator) +
ToString("isVidyaRejectDown", isVidyaRejectDown, ignoreFalseConditions, separator) +
ToString("isVidyaBullish", isVidyaBullish, ignoreFalseConditions, separator) +
ToString("isVidyaBearish", isVidyaBearish, ignoreFalseConditions, separator) +
ToString("isVidyaSwitchedToBullish", isVidyaSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isVidyaSwitchedToBearish", isVidyaSwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) +
ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) +
@@ -2622,6 +2695,12 @@ class XCXCAEAHelper : XCBase
conditions.tkiBuffer //
);
//
Copy(
xcaConditions.vidyaBuffer,
conditions.vidyaBuffer //
);
//
Copy(
xcaConditions.sHHBuffer,
@@ -2706,6 +2785,12 @@ class XCXCAEAHelper : XCBase
conditions.tkiStateBuffer //
);
//
Copy(
xcaConditions.vidyaStateBuffer,
conditions.vidyaStateBuffer //
);
//
Copy(
xcaConditions.supportBuffer,
@@ -2780,6 +2865,8 @@ class XCXCAEAHelper : XCBase
conditions.isTKIRejectUp = xcaConditions.isTKIRejectUp;
conditions.isPeakIsPivot = xcaConditions.isPeakIsPivot;
conditions.isValeIsPivot = xcaConditions.isValeIsPivot;
conditions.isVidyaBullish = xcaConditions.isVidyaBullish;
conditions.isVidyaBearish = xcaConditions.isVidyaBearish;
conditions.isKIRejectDown = xcaConditions.isKIRejectDown;
conditions.isPeakSameLast = xcaConditions.isPeakSameLast;
conditions.isPeakOverLast = xcaConditions.isPeakOverLast;
@@ -2822,6 +2909,8 @@ class XCXCAEAHelper : XCBase
conditions.isLastSwingHighRejected = xcaConditions.isLastSwingHighRejected;
conditions.isLastResistanceBreaked = xcaConditions.isLastResistanceBreaked;
conditions.isSupportSameAsSwingLow = xcaConditions.isSupportSameAsSwingLow;
conditions.isVidyaSwitchedToBullish = xcaConditions.isVidyaSwitchedToBullish;
conditions.isVidyaSwitchedToBearish = xcaConditions.isVidyaSwitchedToBearish;
conditions.isLastResistanceRejected = xcaConditions.isLastResistanceRejected;
conditions.isTrendSwitchedToBullish = xcaConditions.isTrendSwitchedToBullish;
conditions.isTrendSwitchedToBearish = xcaConditions.isTrendSwitchedToBearish;