complete XCHICH Helper and Integrated it to XCH Strategy ...

This commit is contained in:
2024-08-06 00:06:06 +03:30
parent 423d2ef693
commit 4fcc0bc70b
7 changed files with 4998 additions and 1408 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+41 -83
View File
@@ -91,63 +91,21 @@ input ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period
input group "Presentation";
//
input group "All Cycles";
input bool showTenkanSen = true; // Show Tenkan Sen
input bool showKijunSen = true; // Show Kijun Sen
input bool showChikouSpan = true; // Show Chikou Span
input bool showSenkouSpanA = true; // Show Senkou Span A
input bool showSenkouSpanB = true; // Show Senkou Span B
input bool showKumo = true; // Show Kumo
input bool shiftKumo = true; // Shift Kumo to Future
//
input group "Current";
input bool showCTenkanSen = true; // Show Tenkan Sen
input bool showCKijunSen = true; // Show Kijun Sen
input bool showCChikouSpan = true; // Show Chikou Span
input bool showCSenkouSpanA = true; // Show Senkou Span A
input bool showCSenkouSpanB = true; // Show Senkou Span B
input bool showCKumo = true; // Show Kumo
input bool shiftCKumo = true; // Shift Kumo to Future
input bool showCurrent = true; // Show Current Cycle
input bool showShort = true; // Show Short Cycle
input bool showMedium = true; // Show Medium Cycle
input bool showLong = true; // Show Long Cycle
input bool showHind = true; // Show Hind Cycle
//
input group "Short";
input bool showSTenkanSen = true; // Show Tenkan Sen
input bool showSKijunSen = true; // Show Kijun Sen
input bool showSChikouSpan = true; // Show Chikou Span
input bool showSSenkouSpanA = true; // Show Senkou Span A
input bool showSSenkouSpanB = true; // Show Senkou Span B
input bool showSKumo = true; // Show Kumo
input bool shiftSKumo = true; // Shift Kumo to Future
//
input group "Medium";
input bool showMTenkanSen = true; // Show Tenkan Sen
input bool showMKijunSen = true; // Show Kijun Sen
input bool showMChikouSpan = true; // Show Chikou Span
input bool showMSenkouSpanA = true; // Show Senkou Span A
input bool showMSenkouSpanB = true; // Show Senkou Span B
input bool showMKumo = true; // Show Kumo
input bool shiftMKumo = true; // Shift Kumo to Future
//
input group "Long";
input bool showLTenkanSen = true; // Show Tenkan Sen
input bool showLKijunSen = true; // Show Kijun Sen
input bool showLChikouSpan = true; // Show Chikou Span
input bool showLSenkouSpanA = true; // Show Senkou Span A
input bool showLSenkouSpanB = true; // Show Senkou Span B
input bool showLKumo = true; // Show Kumo
input bool shiftLKumo = true; // Shift Kumo to Future
//
input group "Hind";
input bool showHTenkanSen = true; // Show Tenkan Sen
input bool showHKijunSen = true; // Show Kijun Sen
input bool showHChikouSpan = true; // Show Chikou Span
input bool showHSenkouSpanA = true; // Show Senkou Span A
input bool showHSenkouSpanB = true; // Show Senkou Span B
input bool showHKumo = true; // Show Kumo
input bool shiftHKumo = true; // Shift Kumo to Future
//
// Buffers ...
@@ -1000,7 +958,7 @@ void DefineBuffers()
// TENKANSEN ...
//
bool canCShowTenkanSen = showTenkanSen && showCTenkanSen;
bool canCShowTenkanSen = showTenkanSen && showCurrent;
ENUM_DRAW_TYPE cTenkanSenDrawType = canCShowTenkanSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1014,7 +972,7 @@ void DefineBuffers()
// KIJUNSEN ...
//
bool canCShowKijunSen = showKijunSen && showCKijunSen;
bool canCShowKijunSen = showKijunSen && showCurrent;
ENUM_DRAW_TYPE cKijunSenDrawType = canCShowKijunSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1028,7 +986,7 @@ void DefineBuffers()
// CHIKOUSPAN ...
//
bool canCShowChikouSpan = showChikouSpan && showCChikouSpan;
bool canCShowChikouSpan = showChikouSpan && showCurrent;
ENUM_DRAW_TYPE cChikouSpanDrawType = canCShowChikouSpan ? DRAW_LINE : DRAW_NONE;
//
@@ -1041,11 +999,11 @@ void DefineBuffers()
//
// SENKOUSPAN A and B ...
int cShiftSize = shiftCKumo ? mCKijunSenLength : 0;
int cShiftSize = shiftKumo ? mCKijunSenLength : 0;
//
// SENKOUSPANA ...
bool canCShowSenkouSpanA = showSenkouSpanA && showCSenkouSpanA;
bool canCShowSenkouSpanA = showSenkouSpanA && showCurrent;
ENUM_DRAW_TYPE cSenkouSpanADrawType = canCShowSenkouSpanA ? DRAW_LINE : DRAW_NONE;
//
@@ -1057,7 +1015,7 @@ void DefineBuffers()
//
// SENKOUSPANB ...
bool canCShowSenkouSpanB = showSenkouSpanB && showCSenkouSpanB;
bool canCShowSenkouSpanB = showSenkouSpanB && showCurrent;
ENUM_DRAW_TYPE cSenkouSpanBDrawType = canCShowSenkouSpanB ? DRAW_LINE : DRAW_NONE;
//
@@ -1074,7 +1032,7 @@ void DefineBuffers()
// TENKANSEN ...
//
bool canSShowTenkanSen = showTenkanSen && showSTenkanSen;
bool canSShowTenkanSen = showTenkanSen && showShort;
ENUM_DRAW_TYPE sTenkanSenDrawType = canSShowTenkanSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1088,7 +1046,7 @@ void DefineBuffers()
// KIJUNSEN ...
//
bool canSShowKijunSen = showKijunSen && showSKijunSen;
bool canSShowKijunSen = showKijunSen && showShort;
ENUM_DRAW_TYPE sKijunSenDrawType = canSShowKijunSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1102,7 +1060,7 @@ void DefineBuffers()
// CHIKOUSPAN ...
//
bool canSShowChikouSpan = showChikouSpan && showSChikouSpan;
bool canSShowChikouSpan = showChikouSpan && showShort;
ENUM_DRAW_TYPE sChikouSpanDrawType = canSShowChikouSpan ? DRAW_LINE : DRAW_NONE;
//
@@ -1115,11 +1073,11 @@ void DefineBuffers()
//
// SENKOUSPAN A and B ...
int sShiftSize = shiftSKumo ? mSKijunSenLength : 0;
int sShiftSize = shiftKumo ? mSKijunSenLength : 0;
//
// SENKOUSPANA ...
bool canSShowSenkouSpanA = showSenkouSpanA && showSSenkouSpanA;
bool canSShowSenkouSpanA = showSenkouSpanA && showShort;
ENUM_DRAW_TYPE sSenkouSpanADrawType = canSShowSenkouSpanA ? DRAW_LINE : DRAW_NONE;
//
@@ -1131,7 +1089,7 @@ void DefineBuffers()
//
// SENKOUSPANB ...
bool canSShowSenkouSpanB = showSenkouSpanB && showSSenkouSpanB;
bool canSShowSenkouSpanB = showSenkouSpanB && showShort;
ENUM_DRAW_TYPE sSenkouSpanBDrawType = canSShowSenkouSpanB ? DRAW_LINE : DRAW_NONE;
//
@@ -1148,7 +1106,7 @@ void DefineBuffers()
// TENKANSEN ...
//
bool canMShowTenkanSen = showTenkanSen && showMTenkanSen;
bool canMShowTenkanSen = showTenkanSen && showMedium;
ENUM_DRAW_TYPE mTenkanSenDrawType = canMShowTenkanSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1162,7 +1120,7 @@ void DefineBuffers()
// KIJUNSEN ...
//
bool canMShowKijunSen = showKijunSen && showMKijunSen;
bool canMShowKijunSen = showKijunSen && showMedium;
ENUM_DRAW_TYPE mKijunSenDrawType = canMShowKijunSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1176,7 +1134,7 @@ void DefineBuffers()
// CHIKOUSPAN ...
//
bool canMShowChikouSpan = showChikouSpan && showMChikouSpan;
bool canMShowChikouSpan = showChikouSpan && showMedium;
ENUM_DRAW_TYPE mChikouSpanDrawType = canMShowChikouSpan ? DRAW_LINE : DRAW_NONE;
//
@@ -1189,11 +1147,11 @@ void DefineBuffers()
//
// SENKOUSPAN A and B ...
int mShiftSize = shiftMKumo ? mMKijunSenLength : 0;
int mShiftSize = shiftKumo ? mMKijunSenLength : 0;
//
// SENKOUSPANA ...
bool canMShowSenkouSpanA = showSenkouSpanA && showMSenkouSpanA;
bool canMShowSenkouSpanA = showSenkouSpanA && showMedium;
ENUM_DRAW_TYPE mSenkouSpanADrawType = canMShowSenkouSpanA ? DRAW_LINE : DRAW_NONE;
//
@@ -1205,7 +1163,7 @@ void DefineBuffers()
//
// SENKOUSPANB ...
bool canMShowSenkouSpanB = showSenkouSpanB && showMSenkouSpanB;
bool canMShowSenkouSpanB = showSenkouSpanB && showMedium;
ENUM_DRAW_TYPE mSenkouSpanBDrawType = canMShowSenkouSpanB ? DRAW_LINE : DRAW_NONE;
//
@@ -1222,7 +1180,7 @@ void DefineBuffers()
// TENKANSEN ...
//
bool canLShowTenkanSen = showTenkanSen && showLTenkanSen;
bool canLShowTenkanSen = showTenkanSen && showLong;
ENUM_DRAW_TYPE lTenkanSenDrawType = canLShowTenkanSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1236,7 +1194,7 @@ void DefineBuffers()
// KIJUNSEN ...
//
bool canLShowKijunSen = showKijunSen && showLKijunSen;
bool canLShowKijunSen = showKijunSen && showLong;
ENUM_DRAW_TYPE lKijunSenDrawType = canLShowKijunSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1250,7 +1208,7 @@ void DefineBuffers()
// CHIKOUSPAN ...
//
bool canLShowChikouSpan = showChikouSpan && showLChikouSpan;
bool canLShowChikouSpan = showChikouSpan && showLong;
ENUM_DRAW_TYPE lChikouSpanDrawType = canLShowChikouSpan ? DRAW_LINE : DRAW_NONE;
//
@@ -1263,11 +1221,11 @@ void DefineBuffers()
//
// SENKOUSPAN A and B ...
int lShiftSize = shiftLKumo ? mLKijunSenLength : 0;
int lShiftSize = shiftKumo ? mLKijunSenLength : 0;
//
// SENKOUSPANA ...
bool canLShowSenkouSpanA = showSenkouSpanA && showLSenkouSpanA;
bool canLShowSenkouSpanA = showSenkouSpanA && showLong;
ENUM_DRAW_TYPE lSenkouSpanADrawType = canLShowSenkouSpanA ? DRAW_LINE : DRAW_NONE;
//
@@ -1279,7 +1237,7 @@ void DefineBuffers()
//
// SENKOUSPANB ...
bool canLShowSenkouSpanB = showSenkouSpanB && showLSenkouSpanB;
bool canLShowSenkouSpanB = showSenkouSpanB && showLong;
ENUM_DRAW_TYPE lSenkouSpanBDrawType = canLShowSenkouSpanB ? DRAW_LINE : DRAW_NONE;
//
@@ -1296,7 +1254,7 @@ void DefineBuffers()
// TENKANSEN ...
//
bool canHShowTenkanSen = showTenkanSen && showHTenkanSen;
bool canHShowTenkanSen = showTenkanSen && showHind;
ENUM_DRAW_TYPE hTenkanSenDrawType = canHShowTenkanSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1310,7 +1268,7 @@ void DefineBuffers()
// KIJUNSEN ...
//
bool canHShowKijunSen = showKijunSen && showHKijunSen;
bool canHShowKijunSen = showKijunSen && showHind;
ENUM_DRAW_TYPE hKijunSenDrawType = canHShowKijunSen ? DRAW_LINE : DRAW_NONE;
//
@@ -1324,7 +1282,7 @@ void DefineBuffers()
// CHIKOUSPAN ...
//
bool canHShowChikouSpan = showChikouSpan && showHChikouSpan;
bool canHShowChikouSpan = showChikouSpan && showHind;
ENUM_DRAW_TYPE hChikouSpanDrawType = canHShowChikouSpan ? DRAW_LINE : DRAW_NONE;
//
@@ -1337,11 +1295,11 @@ void DefineBuffers()
//
// SENKOUSPAN A and B ...
int hShiftSize = shiftHKumo ? mHKijunSenLength : 0;
int hShiftSize = shiftKumo ? mHKijunSenLength : 0;
//
// SENKOUSPANA ...
bool canHShowSenkouSpanA = showSenkouSpanA && showHSenkouSpanA;
bool canHShowSenkouSpanA = showSenkouSpanA && showHind;
ENUM_DRAW_TYPE hSenkouSpanADrawType = canHShowSenkouSpanA ? DRAW_LINE : DRAW_NONE;
//
@@ -1353,7 +1311,7 @@ void DefineBuffers()
//
// SENKOUSPANB ...
bool canHShowSenkouSpanB = showSenkouSpanB && showHSenkouSpanB;
bool canHShowSenkouSpanB = showSenkouSpanB && showHind;
ENUM_DRAW_TYPE hSenkouSpanBDrawType = canHShowSenkouSpanB ? DRAW_LINE : DRAW_NONE;
//
@@ -1371,7 +1329,7 @@ void DefineBuffers()
//
// Current ...
bool cCanShowKumo = showKumo && showCKumo;
bool cCanShowKumo = showKumo && showCurrent;
ENUM_DRAW_TYPE cKumoDrawType = cCanShowKumo ? DRAW_FILLING : DRAW_NONE;
//
@@ -1393,7 +1351,7 @@ void DefineBuffers()
//
// Short ...
bool sCanShowKumo = showKumo && showSKumo;
bool sCanShowKumo = showKumo && showShort;
ENUM_DRAW_TYPE sKumoDrawType = sCanShowKumo ? DRAW_FILLING : DRAW_NONE;
//
@@ -1415,7 +1373,7 @@ void DefineBuffers()
//
// Medium ...
bool mCanShowKumo = showKumo && showMKumo;
bool mCanShowKumo = showKumo && showMedium;
ENUM_DRAW_TYPE mKumoDrawType = mCanShowKumo ? DRAW_FILLING : DRAW_NONE;
//
@@ -1437,7 +1395,7 @@ void DefineBuffers()
//
// Long ...
bool lCanShowKumo = showKumo && showLKumo;
bool lCanShowKumo = showKumo && showLong;
ENUM_DRAW_TYPE lKumoDrawType = lCanShowKumo ? DRAW_FILLING : DRAW_NONE;
//
@@ -1459,7 +1417,7 @@ void DefineBuffers()
//
// Hind ...
bool hCanShowKumo = showKumo && showHKumo;
bool hCanShowKumo = showKumo && showHind;
ENUM_DRAW_TYPE hKumoDrawType = hCanShowKumo ? DRAW_FILLING : DRAW_NONE;
//
-1
View File
@@ -60,7 +60,6 @@ input ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period
input group "Presentation";
//
// Current ...
input bool showCurrent = true; // Show Current Cycle
input bool showShort = true; // Show Short Cycle
input bool showMedium = true; // Show Medium Cycle
+68
View File
@@ -11334,3 +11334,71 @@ ENUM_TIMEFRAMES GetCyclePeriod(
}
//
// Calculate a Cycle Length based on Host Period ...
int GetCycleLengthOn(
ENUM_TIMEFRAMES _hostPeriod,
ENUM_X_MARKET_CYCLES _cycle,
ENUM_X_PERIOD_METHOD _method,
ENUM_TIMEFRAMES _period //
)
{
//
int result = 0;
//
// Validate ...
bool isValid =
//
IsValid(_hostPeriod) &&
IsValid(_method, _Period)
//
;
if (!isValid)
{
return result;
}
//
// Calculate Period ...
isValid =
_method != X_PERIOD_NOTHING &&
_cycle != X_MARKET_CYCLE_UNKNOWN;
if (!isValid)
{
return result;
}
//
if (_method == X_PERIOD_AUTO)
{
//
_period = GetCyclePeriod(
_cycle,
_hostPeriod //
);
}
isValid = IsValid(_period);
if (!isValid)
{
return result;
}
//
int _hostPeriodSeconds = PeriodSeconds(_hostPeriod);
int _periodSeconds = PeriodSeconds(_period);
//
isValid = _periodSeconds >= _hostPeriodSeconds;
if (!isValid)
{
return result;
}
//
result = _periodSeconds / _hostPeriodSeconds;
//
return result;
}
//
+38 -2
View File
@@ -797,7 +797,8 @@ struct XCHStartegyConditionsParser
// Filter Long Signals ...
bool IsLongFiltered(
XSignal &signal,
XCHStrategyConditions &conditions //
XCHStrategyConditions &conditions,
bool force = false //
)
{
//
@@ -807,6 +808,9 @@ struct XCHStartegyConditionsParser
bool isEURUSD = _symbolParser.IsEURUSD(signal.symbol);
bool isGBPUSD = _symbolParser.IsGBPUSD(signal.symbol);
//
if (!force)
{
//
if (isEURUSD)
{
@@ -820,6 +824,20 @@ struct XCHStartegyConditionsParser
result =
_gbpusdLongParser.IsFiltered(conditions);
}
}
else
{
//
result =
//
_eurusdLongParser.IsFiltered(conditions)
//
||
//
_gbpusdLongParser.IsFiltered(conditions)
//
;
}
//
return result;
@@ -829,7 +847,8 @@ struct XCHStartegyConditionsParser
// Filter Short Signals ...
bool IsShortFiltered(
XSignal &signal,
XCHStrategyConditions &conditions //
XCHStrategyConditions &conditions,
bool force = false //
)
{
//
@@ -839,6 +858,9 @@ struct XCHStartegyConditionsParser
bool isEURUSD = _symbolParser.IsEURUSD(signal.symbol);
bool isGBPUSD = _symbolParser.IsGBPUSD(signal.symbol);
//
if (!force)
{
//
if (isEURUSD)
{
@@ -852,6 +874,20 @@ struct XCHStartegyConditionsParser
result =
_gbpusdShortParser.IsFiltered(conditions);
}
}
else
{
//
result =
//
_eurusdShortParser.IsFiltered(conditions)
//
||
//
_gbpusdShortParser.IsFiltered(conditions)
//
;
}
//
return result;
+62 -6
View File
@@ -31,6 +31,7 @@
#include "../Helpers/x-saherelm.xchche.helper.mq5"
#include "../Helpers/x-saherelm.xchstr.helper.mq5"
#include "../Helpers/x-saherelm.xchvlm.helper.mq5"
#include "../Helpers/x-saherelm.xchich.helper.mq5"
#include "../Helpers/x-saherelm.xchvwap.helper.mq5"
#include "../Helpers/x-saherelm.xchswings.helper.mq5"
@@ -95,6 +96,7 @@ struct XCHStrategyConditions
XCHCHEConditions chcheConditions;
XCHSTRConditions chstrConditions;
XCHVLMConditions chvlmConditions;
XCHICHConditions chichConditions;
XCHVWAPConditions chvwapConditions;
//
@@ -630,6 +632,15 @@ public:
return result;
}
//
// XCHICH ...
XCHICHConditions chichConditions;
result = chichHelper.GetConditions(chichConditions);
if (!result)
{
return result;
}
//
// XCHVWAP ...
XCHVWAPConditions chvwapConditions;
@@ -686,6 +697,7 @@ public:
conditions.chstrConditions = chstrConditions;
conditions.chcheConditions = chcheConditions;
conditions.chvlmConditions = chvlmConditions;
conditions.chichConditions = chichConditions;
conditions.chvwapConditions = chvwapConditions;
//
@@ -1380,6 +1392,11 @@ protected:
XCHVLMInputs chvlmInputs;
XSCXCHVLMHelper *chvlmHelper;
//
// XCHICH ...
XCHICHInputs chichInputs;
XSCXCHICHHelper *chichHelper;
//
// XCHVWAP ...
XCHVWAPInputs chvwapInputs;
@@ -1719,18 +1736,51 @@ private:
chvlmInputs //
);
//
// XCHICH ...
//
chichInputs.Default();
//
chichInputs.scMethod = scMethod;
chichInputs.scPeriod = scPeriod;
chichInputs.mcMethod = mcMethod;
chichInputs.mcPeriod = mcPeriod;
chichInputs.lcMethod = lcMethod;
chichInputs.lcPeriod = lcPeriod;
chichInputs.hcMethod = hcMethod;
chichInputs.hcPeriod = hcPeriod;
//
chichInputs.showTenkanSen = false;
chichInputs.showKijunSen = false;
chichInputs.showChikouSpan = false;
chichInputs.showSenkouSpanA = false;
chichInputs.showSenkouSpanB = false;
chichInputs.showKumo = false;
//
chichInputs.showCurrent = false;
chichInputs.showShort = false;
chichInputs.showMedium = false;
chichInputs.showLong = false;
chichInputs.showHind = false;
//
chichHelper = new XSCXCHICHHelper();
chichHelper.Init(
mSymbol,
mPeriod,
chichInputs //
);
//
// XCHVWAP ...
//
chvwapInputs.Default();
//
chvwapInputs.showShort = false;
chvwapInputs.showMedium = false;
chvwapInputs.showLong = false;
chvwapInputs.showHind = false;
//
chvwapInputs.scMethod = scMethod;
chvwapInputs.scPeriod = scPeriod;
@@ -1741,6 +1791,12 @@ private:
chvwapInputs.hcMethod = hcMethod;
chvwapInputs.hcPeriod = hcPeriod;
//
chvwapInputs.showShort = false;
chvwapInputs.showMedium = false;
chvwapInputs.showLong = false;
chvwapInputs.showHind = false;
//
chvwapHelper = new XSCXCHVWAPHelper();
chvwapHelper.Init(