apply some fix on XCH OSC Indicator Helpers Buffers ...

This commit is contained in:
2024-08-01 05:10:16 +03:30
parent a7982d6f05
commit 0f2bcd75e7
6 changed files with 74 additions and 69 deletions
+2 -2
View File
@@ -46,8 +46,8 @@ double eaSLPoint = 500; // Static SL Point
double eaR2R = 1.5; // Risk to Reward Ratio double eaR2R = 1.5; // Risk to Reward Ratio
double eaAllowLong = true; // Allow Long Positions double eaAllowLong = true; // Allow Long Positions
double eaAllowShort = true; // Allow Short Positions double eaAllowShort = true; // Allow Short Positions
int eaMaxAllowedLongs = 2; // Max Allowed Long Positions int eaMaxAllowedLongs = 1; // Max Allowed Long Positions
int eaMaxAllowedShorts = 2; // Max Allowed Short Positions int eaMaxAllowedShorts = 1; // Max Allowed Short Positions
double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for Open Trades double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for Open Trades
// //
+3 -3
View File
@@ -1001,7 +1001,7 @@ public:
// //
result = result =
// //
ToState(value) == XCHVLM_BEARISH_STATE; ToState(value) == XCHVLM_BULLISH_STATE;
// //
; ;
@@ -1449,7 +1449,7 @@ public:
} }
// //
result = GetSum(values); result = MathAbs(GetSum(values));
// //
return result; return result;
@@ -1475,7 +1475,7 @@ public:
} }
// //
result = GetSum(values); result = MathAbs(GetSum(values));
// //
return result; return result;
+35 -35
View File
@@ -561,91 +561,91 @@ void DefineBuffers()
// Current ... // Current ...
// //
ENUM_DRAW_TYPE cDrawType = showCurrent ? DRAW_LINE : DRAW_NONE; // ENUM_DRAW_TYPE cDrawType = showCurrent ? DRAW_LINE : DRAW_NONE;
// //
ArraySetAsSeries(cBullBuffer, true); ArraySetAsSeries(cBullBuffer, true);
SetIndexBuffer(cBullBufferIndex, cBullBuffer, INDICATOR_DATA); SetIndexBuffer(cBullBufferIndex, cBullBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(cBullBufferIndex, PLOT_DRAW_TYPE, cDrawType); // PlotIndexSetInteger(cBullBufferIndex, PLOT_DRAW_TYPE, cDrawType);
PlotIndexSetInteger(cBullBufferIndex, PLOT_SHOW_DATA, showCurrent); // PlotIndexSetInteger(cBullBufferIndex, PLOT_SHOW_DATA, showCurrent);
// //
ArraySetAsSeries(cBearBuffer, true); ArraySetAsSeries(cBearBuffer, true);
SetIndexBuffer(cBearBufferIndex, cBearBuffer, INDICATOR_DATA); SetIndexBuffer(cBearBufferIndex, cBearBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(cBearBufferIndex, PLOT_DRAW_TYPE, cDrawType); // PlotIndexSetInteger(cBearBufferIndex, PLOT_DRAW_TYPE, cDrawType);
PlotIndexSetInteger(cBearBufferIndex, PLOT_SHOW_DATA, showCurrent); // PlotIndexSetInteger(cBearBufferIndex, PLOT_SHOW_DATA, showCurrent);
// //
// Short ... // Short ...
// //
ENUM_DRAW_TYPE sDrawType = showShort ? DRAW_LINE : DRAW_NONE; // ENUM_DRAW_TYPE sDrawType = showShort ? DRAW_LINE : DRAW_NONE;
// //
ArraySetAsSeries(sBullBuffer, true); ArraySetAsSeries(sBullBuffer, true);
SetIndexBuffer(sBullBufferIndex, sBullBuffer, INDICATOR_DATA); SetIndexBuffer(sBullBufferIndex, sBullBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(sBullBufferIndex, PLOT_DRAW_TYPE, sDrawType); // PlotIndexSetInteger(sBullBufferIndex, PLOT_DRAW_TYPE, sDrawType);
PlotIndexSetInteger(sBullBufferIndex, PLOT_SHOW_DATA, showShort); // PlotIndexSetInteger(sBullBufferIndex, PLOT_SHOW_DATA, showShort);
// //
ArraySetAsSeries(sBearBuffer, true); ArraySetAsSeries(sBearBuffer, true);
SetIndexBuffer(sBearBufferIndex, sBearBuffer, INDICATOR_DATA); SetIndexBuffer(sBearBufferIndex, sBearBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(sBearBufferIndex, PLOT_DRAW_TYPE, sDrawType); // PlotIndexSetInteger(sBearBufferIndex, PLOT_DRAW_TYPE, sDrawType);
PlotIndexSetInteger(sBearBufferIndex, PLOT_SHOW_DATA, showShort); // PlotIndexSetInteger(sBearBufferIndex, PLOT_SHOW_DATA, showShort);
// //
// Medium ... // Medium ...
// //
ENUM_DRAW_TYPE mDrawType = showMedium ? DRAW_LINE : DRAW_NONE; // ENUM_DRAW_TYPE mDrawType = showMedium ? DRAW_LINE : DRAW_NONE;
// //
ArraySetAsSeries(mBullBuffer, true); ArraySetAsSeries(mBullBuffer, true);
SetIndexBuffer(mBullBufferIndex, mBullBuffer, INDICATOR_DATA); SetIndexBuffer(mBullBufferIndex, mBullBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(mBullBufferIndex, PLOT_DRAW_TYPE, mDrawType); // PlotIndexSetInteger(mBullBufferIndex, PLOT_DRAW_TYPE, mDrawType);
PlotIndexSetInteger(mBullBufferIndex, PLOT_SHOW_DATA, showMedium); // PlotIndexSetInteger(mBullBufferIndex, PLOT_SHOW_DATA, showMedium);
// //
ArraySetAsSeries(mBearBuffer, true); ArraySetAsSeries(mBearBuffer, true);
SetIndexBuffer(mBearBufferIndex, mBearBuffer, INDICATOR_DATA); SetIndexBuffer(mBearBufferIndex, mBearBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(mBearBufferIndex, PLOT_DRAW_TYPE, mDrawType); // PlotIndexSetInteger(mBearBufferIndex, PLOT_DRAW_TYPE, mDrawType);
PlotIndexSetInteger(mBearBufferIndex, PLOT_SHOW_DATA, showMedium); // PlotIndexSetInteger(mBearBufferIndex, PLOT_SHOW_DATA, showMedium);
// //
// Long ... // Long ...
// //
ENUM_DRAW_TYPE lDrawType = showLong ? DRAW_LINE : DRAW_NONE; // ENUM_DRAW_TYPE lDrawType = showLong ? DRAW_LINE : DRAW_NONE;
// //
ArraySetAsSeries(lBullBuffer, true); ArraySetAsSeries(lBullBuffer, true);
SetIndexBuffer(lBullBufferIndex, lBullBuffer, INDICATOR_DATA); SetIndexBuffer(lBullBufferIndex, lBullBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(lBullBufferIndex, PLOT_DRAW_TYPE, lDrawType); // PlotIndexSetInteger(lBullBufferIndex, PLOT_DRAW_TYPE, lDrawType);
PlotIndexSetInteger(lBullBufferIndex, PLOT_SHOW_DATA, showLong); // PlotIndexSetInteger(lBullBufferIndex, PLOT_SHOW_DATA, showLong);
// //
ArraySetAsSeries(lBearBuffer, true); ArraySetAsSeries(lBearBuffer, true);
SetIndexBuffer(lBearBufferIndex, lBearBuffer, INDICATOR_DATA); SetIndexBuffer(lBearBufferIndex, lBearBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(lBearBufferIndex, PLOT_DRAW_TYPE, lDrawType); // PlotIndexSetInteger(lBearBufferIndex, PLOT_DRAW_TYPE, lDrawType);
PlotIndexSetInteger(lBearBufferIndex, PLOT_SHOW_DATA, showLong); // PlotIndexSetInteger(lBearBufferIndex, PLOT_SHOW_DATA, showLong);
// //
// Hind ... // Hind ...
// //
ENUM_DRAW_TYPE hDrawType = showHind ? DRAW_LINE : DRAW_NONE; // ENUM_DRAW_TYPE hDrawType = showHind ? DRAW_LINE : DRAW_NONE;
// //
ArraySetAsSeries(hBullBuffer, true); ArraySetAsSeries(hBullBuffer, true);
SetIndexBuffer(hBullBufferIndex, hBullBuffer, INDICATOR_DATA); SetIndexBuffer(hBullBufferIndex, hBullBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(hBullBufferIndex, PLOT_DRAW_TYPE, hDrawType); // PlotIndexSetInteger(hBullBufferIndex, PLOT_DRAW_TYPE, hDrawType);
PlotIndexSetInteger(hBullBufferIndex, PLOT_SHOW_DATA, showHind); // PlotIndexSetInteger(hBullBufferIndex, PLOT_SHOW_DATA, showHind);
// //
ArraySetAsSeries(hBearBuffer, true); ArraySetAsSeries(hBearBuffer, true);
SetIndexBuffer(hBearBufferIndex, hBearBuffer, INDICATOR_DATA); SetIndexBuffer(hBearBufferIndex, hBearBuffer, INDICATOR_CALCULATIONS);
PlotIndexSetInteger(hBearBufferIndex, PLOT_DRAW_TYPE, hDrawType); // PlotIndexSetInteger(hBearBufferIndex, PLOT_DRAW_TYPE, hDrawType);
PlotIndexSetInteger(hBearBufferIndex, PLOT_SHOW_DATA, showHind); // PlotIndexSetInteger(hBearBufferIndex, PLOT_SHOW_DATA, showHind);
} }
// //
+22 -17
View File
@@ -569,9 +569,10 @@ void DefineBuffers()
// //
// ENUM_DRAW_TYPE cDrawType = showCurrent ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE cDrawType = showCurrent ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(cPlotBufferIndex, PLOT_DRAW_TYPE, cDrawType); // PlotIndexSetInteger(cPlotBufferIndex, PLOT_DRAW_TYPE, cDrawType);
SetIndexBuffer(cBufferIndex, cBuffer, INDICATOR_DATA); // PlotIndexSetInteger(cPlotBufferIndex, PLOT_SHOW_DATA, showCurrent);
SetIndexBuffer(cColorBufferIndex, cColorBuffer, INDICATOR_COLOR_INDEX); // SetIndexBuffer(cColorBufferIndex, cColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(cPlotBufferIndex, PLOT_SHOW_DATA, showCurrent); SetIndexBuffer(cBufferIndex, cBuffer, INDICATOR_CALCULATIONS);
SetIndexBuffer(cColorBufferIndex, cColorBuffer, INDICATOR_CALCULATIONS);
// //
// Short ... // Short ...
@@ -579,9 +580,10 @@ void DefineBuffers()
// //
// ENUM_DRAW_TYPE sDrawType = showShort ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE sDrawType = showShort ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(sPlotBufferIndex, PLOT_DRAW_TYPE, sDrawType); // PlotIndexSetInteger(sPlotBufferIndex, PLOT_DRAW_TYPE, sDrawType);
SetIndexBuffer(sBufferIndex, sBuffer, INDICATOR_DATA); // PlotIndexSetInteger(sPlotBufferIndex, PLOT_SHOW_DATA, showShort);
SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_COLOR_INDEX); // SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(sPlotBufferIndex, PLOT_SHOW_DATA, showShort); SetIndexBuffer(sBufferIndex, sBuffer, INDICATOR_CALCULATIONS);
SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_CALCULATIONS);
// //
// Medium ... // Medium ...
@@ -589,9 +591,10 @@ void DefineBuffers()
// //
// ENUM_DRAW_TYPE mDrawType = showMedium ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE mDrawType = showMedium ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(mPlotBufferIndex, PLOT_DRAW_TYPE, mDrawType); // PlotIndexSetInteger(mPlotBufferIndex, PLOT_DRAW_TYPE, mDrawType);
SetIndexBuffer(mBufferIndex, mBuffer, INDICATOR_DATA); // PlotIndexSetInteger(mPlotBufferIndex, PLOT_SHOW_DATA, showMedium);
SetIndexBuffer(mColorBufferIndex, mColorBuffer, INDICATOR_COLOR_INDEX); // SetIndexBuffer(mColorBufferIndex, mColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(mPlotBufferIndex, PLOT_SHOW_DATA, showMedium); SetIndexBuffer(mBufferIndex, mBuffer, INDICATOR_CALCULATIONS);
SetIndexBuffer(mColorBufferIndex, mColorBuffer, INDICATOR_CALCULATIONS);
// //
// Long ... // Long ...
@@ -599,19 +602,21 @@ void DefineBuffers()
// //
// ENUM_DRAW_TYPE lDrawType = showLong ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE lDrawType = showLong ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(lPlotBufferIndex, PLOT_DRAW_TYPE, lDrawType); // PlotIndexSetInteger(lPlotBufferIndex, PLOT_DRAW_TYPE, lDrawType);
SetIndexBuffer(lBufferIndex, lBuffer, INDICATOR_DATA); // PlotIndexSetInteger(lPlotBufferIndex, PLOT_SHOW_DATA, showLong);
SetIndexBuffer(lColorBufferIndex, lColorBuffer, INDICATOR_COLOR_INDEX); // SetIndexBuffer(lColorBufferIndex, lColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(lPlotBufferIndex, PLOT_SHOW_DATA, showLong); SetIndexBuffer(lBufferIndex, lBuffer, INDICATOR_CALCULATIONS);
SetIndexBuffer(lColorBufferIndex, lColorBuffer, INDICATOR_CALCULATIONS);
// //
// Hind ... // Hind ...
// //
ENUM_DRAW_TYPE hDrawType = showHind ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE hDrawType = showHind ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
SetIndexBuffer(hBufferIndex, hBuffer, INDICATOR_DATA); // PlotIndexSetInteger(hPlotBufferIndex, PLOT_DRAW_TYPE, hDrawType);
SetIndexBuffer(hColorBufferIndex, hColorBuffer, INDICATOR_COLOR_INDEX); // PlotIndexSetInteger(hPlotBufferIndex, PLOT_SHOW_DATA, showHind);
PlotIndexSetInteger(hPlotBufferIndex, PLOT_DRAW_TYPE, hDrawType); // SetIndexBuffer(hColorBufferIndex, hColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(hPlotBufferIndex, PLOT_SHOW_DATA, showHind); SetIndexBuffer(hBufferIndex, hBuffer, INDICATOR_CALCULATIONS);
SetIndexBuffer(hColorBufferIndex, hColorBuffer, INDICATOR_CALCULATIONS);
} }
// //
+7 -7
View File
@@ -570,8 +570,8 @@ void DefineBuffers()
// ENUM_DRAW_TYPE cDrawType = showCurrent ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE cDrawType = showCurrent ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(cPlotBufferIndex, PLOT_DRAW_TYPE, cDrawType); // PlotIndexSetInteger(cPlotBufferIndex, PLOT_DRAW_TYPE, cDrawType);
SetIndexBuffer(cBufferIndex, cBuffer, INDICATOR_DATA); SetIndexBuffer(cBufferIndex, cBuffer, INDICATOR_DATA);
SetIndexBuffer(cColorBufferIndex, cColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(cPlotBufferIndex, PLOT_SHOW_DATA, showCurrent); PlotIndexSetInteger(cPlotBufferIndex, PLOT_SHOW_DATA, showCurrent);
SetIndexBuffer(cColorBufferIndex, cColorBuffer, INDICATOR_COLOR_INDEX);
// //
// Short ... // Short ...
@@ -580,8 +580,8 @@ void DefineBuffers()
// ENUM_DRAW_TYPE sDrawType = showShort ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE sDrawType = showShort ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(sPlotBufferIndex, PLOT_DRAW_TYPE, sDrawType); // PlotIndexSetInteger(sPlotBufferIndex, PLOT_DRAW_TYPE, sDrawType);
SetIndexBuffer(sBufferIndex, sBuffer, INDICATOR_DATA); SetIndexBuffer(sBufferIndex, sBuffer, INDICATOR_DATA);
SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(sPlotBufferIndex, PLOT_SHOW_DATA, showShort); PlotIndexSetInteger(sPlotBufferIndex, PLOT_SHOW_DATA, showShort);
SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_COLOR_INDEX);
// //
// Medium ... // Medium ...
@@ -590,8 +590,8 @@ void DefineBuffers()
// ENUM_DRAW_TYPE mDrawType = showMedium ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE mDrawType = showMedium ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(mPlotBufferIndex, PLOT_DRAW_TYPE, mDrawType); // PlotIndexSetInteger(mPlotBufferIndex, PLOT_DRAW_TYPE, mDrawType);
SetIndexBuffer(mBufferIndex, mBuffer, INDICATOR_DATA); SetIndexBuffer(mBufferIndex, mBuffer, INDICATOR_DATA);
SetIndexBuffer(mColorBufferIndex, mColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(mPlotBufferIndex, PLOT_SHOW_DATA, showMedium); PlotIndexSetInteger(mPlotBufferIndex, PLOT_SHOW_DATA, showMedium);
SetIndexBuffer(mColorBufferIndex, mColorBuffer, INDICATOR_COLOR_INDEX);
// //
// Long ... // Long ...
@@ -600,18 +600,18 @@ void DefineBuffers()
// ENUM_DRAW_TYPE lDrawType = showLong ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE lDrawType = showLong ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(lPlotBufferIndex, PLOT_DRAW_TYPE, lDrawType); // PlotIndexSetInteger(lPlotBufferIndex, PLOT_DRAW_TYPE, lDrawType);
SetIndexBuffer(lBufferIndex, lBuffer, INDICATOR_DATA); SetIndexBuffer(lBufferIndex, lBuffer, INDICATOR_DATA);
SetIndexBuffer(lColorBufferIndex, lColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(lPlotBufferIndex, PLOT_SHOW_DATA, showLong); PlotIndexSetInteger(lPlotBufferIndex, PLOT_SHOW_DATA, showLong);
SetIndexBuffer(lColorBufferIndex, lColorBuffer, INDICATOR_COLOR_INDEX);
// //
// Hind ... // Hind ...
// //
ENUM_DRAW_TYPE hDrawType = showHind ? DRAW_COLOR_HISTOGRAM : DRAW_NONE; // ENUM_DRAW_TYPE hDrawType = showHind ? DRAW_COLOR_HISTOGRAM : DRAW_NONE;
// PlotIndexSetInteger(hPlotBufferIndex, PLOT_DRAW_TYPE, hDrawType);
SetIndexBuffer(hBufferIndex, hBuffer, INDICATOR_DATA); SetIndexBuffer(hBufferIndex, hBuffer, INDICATOR_DATA);
SetIndexBuffer(hColorBufferIndex, hColorBuffer, INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(hPlotBufferIndex, PLOT_DRAW_TYPE, hDrawType);
PlotIndexSetInteger(hPlotBufferIndex, PLOT_SHOW_DATA, showHind); PlotIndexSetInteger(hPlotBufferIndex, PLOT_SHOW_DATA, showHind);
SetIndexBuffer(hColorBufferIndex, hColorBuffer, INDICATOR_COLOR_INDEX);
} }
// //
+5 -5
View File
@@ -1635,11 +1635,11 @@ private:
chvlmInputs.hcPeriod = hcPeriod; chvlmInputs.hcPeriod = hcPeriod;
// //
chvlmInputs.showCurrent = false; chvlmInputs.showCurrent = true;
chvlmInputs.showShort = false; chvlmInputs.showShort = true;
chvlmInputs.showMedium = false; chvlmInputs.showMedium = true;
chvlmInputs.showLong = false; chvlmInputs.showLong = true;
chvlmInputs.showHind = false; chvlmInputs.showHind = true;
// //
chvlmHelper = new XSCXCHVLMHelper(); chvlmHelper = new XSCXCHVLMHelper();