diff --git a/Classes/x-saherelm.x-expert.class.mq5 b/Classes/x-saherelm.x-expert.class.mq5 index db922b45..ac4719e8 100644 --- a/Classes/x-saherelm.x-expert.class.mq5 +++ b/Classes/x-saherelm.x-expert.class.mq5 @@ -407,7 +407,7 @@ class XCBaseExpert : public XCBaseAlert message = "Invalid Inputs ...."; // - Alert(message); + SendAlert(message); } // @@ -428,7 +428,7 @@ class XCBaseExpert : public XCBaseAlert // message = "Initialized Successfully ..."; - Alert(message); + SendAlert(message); // return result; @@ -582,7 +582,7 @@ class XCBaseExpert : public XCBaseAlert // // Since here Logger not Initiallized, we Use Raw Print Command ... errMessage = " Errors: \n" + errMessage; - Alert(errMessage); + SendAlert(errMessage); } // @@ -869,7 +869,7 @@ class XCBaseExpert : public XCBaseAlert string msg = "New Month ..."; // - Alert(msg); + SendAlert(msg); } } @@ -887,7 +887,7 @@ class XCBaseExpert : public XCBaseAlert string msg = "New Week ..."; // - Alert(msg); + SendAlert(msg); } } @@ -905,7 +905,7 @@ class XCBaseExpert : public XCBaseAlert string msg = "New Day ..."; // - Alert(msg); + SendAlert(msg); } } @@ -923,7 +923,7 @@ class XCBaseExpert : public XCBaseAlert string msg = "New Hour ..."; // - Alert(msg); + SendAlert(msg); } } } diff --git a/Documents/BKP/Indicators/x-saherelm.x121.xczone.2.mq5 b/Documents/BKP/Indicators/x-saherelm.x121.xczone.2.mq5 index e56dfa58..6489beb2 100644 --- a/Documents/BKP/Indicators/x-saherelm.x121.xczone.2.mq5 +++ b/Documents/BKP/Indicators/x-saherelm.x121.xczone.2.mq5 @@ -2239,7 +2239,7 @@ void DetectTriggerZone( } else if (canAlert) { - alert.Alert(message); + alert.SendAlert(message); } } diff --git a/Documents/BKP/Indicators/x-saherelm.x121.xczone.mq5 b/Documents/BKP/Indicators/x-saherelm.x121.xczone.mq5 index ec4125f4..5c21c5a5 100644 --- a/Documents/BKP/Indicators/x-saherelm.x121.xczone.mq5 +++ b/Documents/BKP/Indicators/x-saherelm.x121.xczone.mq5 @@ -2239,7 +2239,7 @@ void DetectTriggerZone( } else if (canAlert) { - alert.Alert(message); + alert.SendAlert(message); } } diff --git a/Documents/BKP/catb.test.ea.tmp.mq5 b/Documents/BKP/catb.test.ea.tmp.mq5 index f486dd5c..c64d330f 100644 --- a/Documents/BKP/catb.test.ea.tmp.mq5 +++ b/Documents/BKP/catb.test.ea.tmp.mq5 @@ -706,7 +706,7 @@ void HandleTimeReport() string msg = "New Month ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -718,7 +718,7 @@ void HandleTimeReport() string msg = "New Week ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -730,7 +730,7 @@ void HandleTimeReport() string msg = "New Day ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -742,7 +742,7 @@ void HandleTimeReport() string msg = "New Hour ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } } diff --git a/Documents/BKP/sample.mq5 b/Documents/BKP/sample.mq5 index 291ce9aa..a19cccf2 100644 --- a/Documents/BKP/sample.mq5 +++ b/Documents/BKP/sample.mq5 @@ -2167,7 +2167,7 @@ void DetectTriggerZone( } else if (canAlert) { - alert.Alert(message); + alert.SendAlert(message); } } diff --git a/Documents/BKP/xczone.test.ea.mq5 b/Documents/BKP/xczone.test.ea.mq5 index 7c8f8af7..fb359b70 100644 --- a/Documents/BKP/xczone.test.ea.mq5 +++ b/Documents/BKP/xczone.test.ea.mq5 @@ -946,7 +946,7 @@ void HandleTimeReport() string msg = "New Month ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -958,7 +958,7 @@ void HandleTimeReport() string msg = "New Week ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -970,7 +970,7 @@ void HandleTimeReport() string msg = "New Day ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -982,7 +982,7 @@ void HandleTimeReport() string msg = "New Hour ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } } diff --git a/Documents/Indicators/x-saherelm.x121.xczone.mq5 b/Documents/Indicators/x-saherelm.x121.xczone.mq5 index a6d7f746..f6d56a47 100644 --- a/Documents/Indicators/x-saherelm.x121.xczone.mq5 +++ b/Documents/Indicators/x-saherelm.x121.xczone.mq5 @@ -2403,7 +2403,7 @@ void DetectTriggerZone( } else if (canAlert) { - alert.Alert(message); + alert.SendAlert(message); } } diff --git a/Documents/Indicators/x-saherelm.x121.xtb.mq5 b/Documents/Indicators/x-saherelm.x121.xtb.mq5 index f251c25f..f40cea91 100644 --- a/Documents/Indicators/x-saherelm.x121.xtb.mq5 +++ b/Documents/Indicators/x-saherelm.x121.xtb.mq5 @@ -2619,7 +2619,7 @@ void DetectTriggerBlock( } else if (canAlert) { - alert.Alert(message); + alert.SendAlert(message); } } diff --git a/Documents/Temlates/x-saherelm.x-ea.template.ea.mq5 b/Documents/Temlates/x-saherelm.x-ea.template.ea.mq5 index ec3e2574..297e0b0e 100644 --- a/Documents/Temlates/x-saherelm.x-ea.template.ea.mq5 +++ b/Documents/Temlates/x-saherelm.x-ea.template.ea.mq5 @@ -106,7 +106,7 @@ int OnInit() // // Alert Initialization ... string msg = "Initialized Successfully ..."; - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); // // Init Succeed ... @@ -140,7 +140,7 @@ void OnDeinit(const int reason) // // Alert De Initialization Succeeded ... string msg = "De Initialized Successfully ..."; - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); // // Destroy all EA Requirements ... @@ -499,7 +499,7 @@ void HandleReportTime() string msg = "New Month ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -511,7 +511,7 @@ void HandleReportTime() string msg = "New Week ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -523,7 +523,7 @@ void HandleReportTime() string msg = "New Day ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -535,7 +535,7 @@ void HandleReportTime() string msg = "New Hour ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } } diff --git a/Documents/Temlates/x-saherelm.x-panel.ea.mq5 b/Documents/Temlates/x-saherelm.x-panel.ea.mq5 index c04228da..08417d44 100644 --- a/Documents/Temlates/x-saherelm.x-panel.ea.mq5 +++ b/Documents/Temlates/x-saherelm.x-panel.ea.mq5 @@ -111,7 +111,7 @@ int OnInit() // // Alert Initialization ... string msg = "Initialized Successfully ..."; - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); // // Init Succeed ... @@ -145,7 +145,7 @@ void OnDeinit(const int reason) // // Alert De Initialization Succeeded ... string msg = "De Initialized Successfully ..."; - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); // // Destroy all EA Requirements ... @@ -532,7 +532,7 @@ void HandleReportTime() string msg = "New Month ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -544,7 +544,7 @@ void HandleReportTime() string msg = "New Week ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -556,7 +556,7 @@ void HandleReportTime() string msg = "New Day ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -568,7 +568,7 @@ void HandleReportTime() string msg = "New Hour ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } } diff --git a/Experts/x-saherelm.rr.tools.mq5 b/Experts/x-saherelm.rr.tools.mq5 index 31661054..37aa2466 100644 --- a/Experts/x-saherelm.rr.tools.mq5 +++ b/Experts/x-saherelm.rr.tools.mq5 @@ -100,7 +100,7 @@ int OnInit() // // Alert Initialization ... string msg = "Initialized Successfully ..."; - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); // // Init Succeed ... @@ -134,7 +134,7 @@ void OnDeinit(const int reason) // // Alert De Initialization Succeeded ... string msg = "De Initialized Successfully ..."; - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); // // Destroy all EA Requirements ... diff --git a/Experts/x-saherelm.xcaea.ea.mq5 b/Experts/x-saherelm.xcaea.ea.mq5 index c2de1afd..de8a36a9 100644 --- a/Experts/x-saherelm.xcaea.ea.mq5 +++ b/Experts/x-saherelm.xcaea.ea.mq5 @@ -918,7 +918,7 @@ void HandleTimeReport() string msg = "New Month ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -930,7 +930,7 @@ void HandleTimeReport() string msg = "New Week ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -942,7 +942,7 @@ void HandleTimeReport() string msg = "New Day ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } // @@ -954,7 +954,7 @@ void HandleTimeReport() string msg = "New Hour ..."; // - eaAlert.Alert(msg); + eaAlert.SendAlert(msg); } } diff --git a/Experts/xcatb.test.ea.mq5 b/Experts/xcatb.test.ea.mq5 index bd62df7b..64be395a 100644 --- a/Experts/xcatb.test.ea.mq5 +++ b/Experts/xcatb.test.ea.mq5 @@ -671,6 +671,7 @@ void InitRequirements() // we Can make Show all requirements here ... // + eaInputs.drawSignals = false; eaInputs.showATRBand = false; // diff --git a/Helpers/x-saherelm.x121.xcatb.helper.mq5 b/Helpers/x-saherelm.x121.xcatb.helper.mq5 index 95f20d5c..3caac822 100644 --- a/Helpers/x-saherelm.x121.xcatb.helper.mq5 +++ b/Helpers/x-saherelm.x121.xcatb.helper.mq5 @@ -99,6 +99,7 @@ struct X121XCatbInputs // Signal ... int signalR2R; // Risk Reward Ratio bool drawSignals; // Draw Signal + bool drawTriggerBlock; // Draw Trigger Block double slAtrMultiplier; // ATR Multiplier for SL // @@ -179,9 +180,10 @@ struct X121XCatbInputs // // Signal ... - signalR2R = 0; // Risk Reward Ratio - drawSignals = false; // Draw Signal - slAtrMultiplier = 0; // ATR Multiplier for SL + signalR2R = 0; // Risk Reward Ratio + drawSignals = false; // Draw Signal + drawTriggerBlock = false; // Draw Trigger Block + slAtrMultiplier = 0; // ATR Multiplier for SL // // Validating ... @@ -255,9 +257,10 @@ struct X121XCatbInputs // // Signal ... - signalR2R = 4; // Risk Reward Ratio - drawSignals = false; // Draw Signal - slAtrMultiplier = 1.0; // ATR Multiplier for SL + signalR2R = 4; // Risk Reward Ratio + drawSignals = false; // Draw Signal + drawTriggerBlock = false; // Draw Trigger Block + slAtrMultiplier = 1.0; // ATR Multiplier for SL // // Validating ... @@ -322,6 +325,10 @@ struct X121XCatbInputs showATRBand = false; showSignalBars = false; showHKSignalBars = false; + + // + drawSignals = false; + drawTriggerBlock = false; } // @@ -372,6 +379,11 @@ struct X121XCatbConditions ENUM_TIMEFRAMES period; datetime time; + // + datetime to; + datetime from; + XOHCL bars[]; + // // Buffers ... double sarBuffer[]; @@ -412,9 +424,135 @@ struct X121XCatbConditions double bullishVolumeSignalBuffer[]; double bearishVolumeSignalBuffer[]; + // + double rsiOBLevel; // Over Bought Level + double rsiOSLevel; // Over Sold Level + double adxThreshold; // Big Movement Threshold + // // Conditions ... + // + // ATR Band ... + + // + bool isATRUp; + bool isATRDown; + + // + bool isClosedOverATRUpper; + bool isClosedUnderATRLower; + + // + // SAR ... + + // + bool isSarBullish; + bool isSarBearish; + + // + bool isSarSwitchedToBullish; + bool isSarSwitchedToBearish; + + // + // ADX ... + + // + bool isADXBiggerLast; + bool isADXLesserLast; + + // + bool isADXOverThreshold; + bool isADXUnderThreshold; + + // + bool isDXPBiggerThanDXN; + bool isDXNBiggerThanDXP; + + // + bool isADXBullish; + bool isADXBearish; + + // + bool isADXSwitchedToBullish; + bool isADXSwitchedToBearish; + + // + // RSI ... + + // + bool isRSIBullish; + bool isRSIBearish; + + // + bool isRSISwitchedToBullish; + bool isRSISwitchedToBearish; + + // + bool isRSIOB; + bool isRSIOS; + + // + bool isRSICrossedOverOB; + bool isRSICrossedOverOS; + + // + bool isRSICrossedUnderOB; + bool isRSICrossedUnderOS; + + // + // SIGNAL Bar ... + + // + bool isSBarBullish; + bool isSBarBearish; + + // + bool isSBarSwitchedToBullish; + bool isSBarSwitchedToBearish; + + // + // XHK Signal Bar ... + + // + bool isHKSBarBullish; + bool isHKSBarBearish; + + // + bool isHKSBarSwitchedToBullish; + bool isHKSBarSwitchedToBearish; + + // + // TREND ... + + // + bool isTrendUp; + bool isTrendDown; + + // + bool isTrendBullish; + bool isTrendBearish; + + // + bool isTrendSwitchedToBullish; + bool isTrendSwitchedToBearish; + + // + // PEAK ... + + // + bool isPeakSameLast; + bool isPeakOverLast; + bool isPeakUnderLast; + + // + // VALE ... + + // + bool isValeSameLast; + bool isValeOverLast; + bool isValeUnderLast; + // // Constructor ... X121XCatbConditions() @@ -432,14 +570,17 @@ struct X121XCatbConditions { // // Commons ... + to = NULL; + from = NULL; + time = NULL; symbol = NULL; period = NULL; - time = NULL; // // Buffers ... // + Clean(bars); Clean(sarBuffer); Clean(atrBuffer); Clean(rsiBuffer); @@ -479,6 +620,7 @@ struct X121XCatbConditions Clean(bearishVolumeSignalBuffer); // + ArraySetAsSeries(bars, true); ArraySetAsSeries(sarBuffer, true); ArraySetAsSeries(atrBuffer, true); ArraySetAsSeries(rsiBuffer, true); @@ -517,9 +659,138 @@ struct X121XCatbConditions ArraySetAsSeries(bullishVolumeSignalBuffer, true); ArraySetAsSeries(bearishVolumeSignalBuffer, true); + // + rsiOBLevel = 0; // Over Bought Level + rsiOSLevel = 0; // Over Sold Level + adxThreshold = 0; // Big Movement Threshold + // // Conditions ... + // + // Conditions ... + + // + // ATR Band ... + + // + isATRUp = false; + isATRDown = false; + + // + isClosedOverATRUpper = false; + isClosedUnderATRLower = false; + + // + // SAR ... + + // + isSarBullish = false; + isSarBearish = false; + + // + isSarSwitchedToBullish = false; + isSarSwitchedToBearish = false; + + // + // ADX ... + + // + isADXBiggerLast = false; + isADXLesserLast = false; + + // + isADXOverThreshold = false; + isADXUnderThreshold = false; + + // + isDXPBiggerThanDXN = false; + isDXNBiggerThanDXP = false; + + // + isADXBullish = false; + isADXBearish = false; + + // + isADXSwitchedToBullish = false; + isADXSwitchedToBearish = false; + + // + // RSI ... + + // + isRSIBullish = false; + isRSIBearish = false; + + // + isRSISwitchedToBullish = false; + isRSISwitchedToBearish = false; + + // + isRSIOB = false; + isRSIOS = false; + + // + isRSICrossedOverOB = false; + isRSICrossedOverOS = false; + + // + isRSICrossedUnderOB = false; + isRSICrossedUnderOS = false; + + // + // SIGNAL Bar ... + + // + isSBarBullish = false; + isSBarBearish = false; + + // + isSBarSwitchedToBullish = false; + isSBarSwitchedToBearish = false; + + // + // XHK Signal Bar ... + + // + isHKSBarBullish = false; + isHKSBarBearish = false; + + // + isHKSBarSwitchedToBullish = false; + isHKSBarSwitchedToBearish = false; + + // + // TREND ... + + // + isTrendUp = false; + isTrendDown = false; + + // + isTrendBullish = false; + isTrendBearish = false; + + // + isTrendSwitchedToBullish = false; + isTrendSwitchedToBearish = false; + + // + // PEAK ... + + // + isPeakSameLast = false; + isPeakOverLast = false; + isPeakUnderLast = false; + + // + // VALE ... + + // + isValeSameLast = false; + isValeOverLast = false; + isValeUnderLast = false; + // ZeroMemory(this); } @@ -543,6 +814,254 @@ struct X121XCatbConditions double score = 1; double minScore = 0.5; double highScore = 1.5; + + // + // ATR Band ... + + // + if (isATRUp) + { + bullishScore += score; + } + if (isClosedOverATRUpper) + { + bullishScore += score; + } + + // + if (isATRDown) + { + bearishScore += score; + } + if (isClosedUnderATRLower) + { + bearishScore += score; + } + + // + // SAR ... + + // + if (isSarBullish) + { + bullishScore += score; + } + if (isSarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isSarBearish) + { + bearishScore += score; + } + if (isSarSwitchedToBearish) + { + bearishScore += score; + } + + // + // ADX ... + + // + if (isADXBullish) + { + bullishScore += score; + } + if (isADXBiggerLast) + { + bullishScore += score; + } + if (isDXPBiggerThanDXN) + { + bullishScore += score; + } + if (isADXOverThreshold) + { + bullishScore += score; + } + if (isADXSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isADXBearish) + { + bearishScore += score; + } + if (isADXLesserLast) + { + bearishScore += score; + } + if (isDXNBiggerThanDXP) + { + bearishScore += score; + } + if (isADXUnderThreshold) + { + bearishScore += score; + } + if (isADXSwitchedToBearish) + { + bearishScore += score; + } + + // + // RSI ... + + // + if (isRSIOS) + { + bullishScore += score; + } + if (isRSIBullish) + { + bullishScore += score; + } + if (isRSICrossedOverOS) + { + bullishScore += score; + } + if (isRSICrossedOverOB) + { + bullishScore += score; + } + if (isRSISwitchedToBullish) + { + bullishScore += score; + } + + // + if (isRSIOB) + { + bearishScore += score; + } + if (isRSIBearish) + { + bearishScore += score; + } + if (isRSICrossedUnderOB) + { + bearishScore += score; + } + if (isRSICrossedUnderOS) + { + bearishScore += score; + } + if (isRSISwitchedToBearish) + { + bearishScore += score; + } + + // + // SIGNAL Bar ... + + // + if (isSBarBullish) + { + bullishScore += score; + } + if (isSBarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isSBarBearish) + { + bearishScore += score; + } + if (isSBarSwitchedToBearish) + { + bearishScore += score; + } + + // + // XHK Signal Bar ... + + // + if (isHKSBarBullish) + { + bullishScore += score; + } + if (isHKSBarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isHKSBarBearish) + { + bearishScore += score; + } + if (isHKSBarSwitchedToBearish) + { + bearishScore += score; + } + + // + // TREND ... + + // + if (isTrendUp) + { + bullishScore += score; + } + if (isTrendBullish) + { + bullishScore += score; + } + if (isTrendSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isTrendDown) + { + bearishScore += score; + } + if (isTrendBearish) + { + bearishScore += score; + } + if (isTrendSwitchedToBearish) + { + bearishScore += score; + } + + // + // PEAK and VALE ... + + // + if (isValeSameLast) + { + bullishScore += score; + } + if (isValeOverLast) + { + bullishScore += score; + } + if (isPeakOverLast) + { + bullishScore += score; + } + + // + if (isPeakSameLast) + { + bearishScore += score; + } + if (isPeakUnderLast) + { + bearishScore += score; + } + if (isValeUnderLast) + { + bearishScore += score; + } } /** @@ -596,6 +1115,94 @@ struct X121XCatbConditions // string conditionsStr = // + "-----------------------" + separator + + "XCATB: " + separator + + "-----------------------" + separator + + "" + separator + + // + "-----------------------" + separator + + "ATR Band: " + separator + + "-----------------------" + separator + + ToString("isATRUp", isATRUp, ignoreFalseConditions, separator) + + ToString("isATRDown", isATRDown, ignoreFalseConditions, separator) + + ToString("isClosedOverATRUpper", isClosedOverATRUpper, ignoreFalseConditions, separator) + + ToString("isClosedUnderATRLower", isClosedUnderATRLower, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "SAR: " + separator + + "-----------------------" + separator + + ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) + + ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) + + ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "ADX: " + separator + + "-----------------------" + separator + + ToString("isADXBiggerLast", isADXBiggerLast, ignoreFalseConditions, separator) + + ToString("isADXLesserLast", isADXLesserLast, ignoreFalseConditions, separator) + + ToString("isADXOverThreshold", isADXOverThreshold, ignoreFalseConditions, separator) + + ToString("isADXUnderThreshold", isADXUnderThreshold, ignoreFalseConditions, separator) + + ToString("isDXPBiggerThanDXN", isDXPBiggerThanDXN, ignoreFalseConditions, separator) + + ToString("isDXNBiggerThanDXP", isDXNBiggerThanDXP, ignoreFalseConditions, separator) + + ToString("isADXBullish", isADXBullish, ignoreFalseConditions, separator) + + ToString("isADXBearish", isADXBearish, ignoreFalseConditions, separator) + + ToString("isADXSwitchedToBullish", isADXSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isADXSwitchedToBearish", isADXSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "RSI: " + separator + + "-----------------------" + separator + + ToString("isRSIBullish", isRSIBullish, ignoreFalseConditions, separator) + + ToString("isRSIBearish", isRSIBearish, ignoreFalseConditions, separator) + + ToString("isRSISwitchedToBullish", isRSISwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isRSISwitchedToBearish", isRSISwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isRSIOB", isRSIOB, ignoreFalseConditions, separator) + + ToString("isRSIOS", isRSIOS, ignoreFalseConditions, separator) + + ToString("isRSICrossedOverOB", isRSICrossedOverOB, ignoreFalseConditions, separator) + + ToString("isRSICrossedOverOS", isRSICrossedOverOS, ignoreFalseConditions, separator) + + ToString("isRSICrossedUnderOB", isRSICrossedUnderOB, ignoreFalseConditions, separator) + + ToString("isRSICrossedUnderOS", isRSICrossedUnderOS, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "SIGNAL Bar: " + separator + + "-----------------------" + separator + + ToString("isSBarBullish", isSBarBullish, ignoreFalseConditions, separator) + + ToString("isSBarBearish", isSBarBearish, ignoreFalseConditions, separator) + + ToString("isSBarSwitchedToBullish", isSBarSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSBarSwitchedToBearish", isSBarSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "XHK Signal Bar: " + separator + + "-----------------------" + separator + + ToString("isHKSBarBullish", isHKSBarBullish, ignoreFalseConditions, separator) + + ToString("isHKSBarBearish", isHKSBarBearish, ignoreFalseConditions, separator) + + ToString("isHKSBarSwitchedToBullish", isHKSBarSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isHKSBarSwitchedToBearish", isHKSBarSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "Trend: " + separator + + "-----------------------" + separator + + ToString("isTrendUp", isTrendUp, ignoreFalseConditions, separator) + + ToString("isTrendDown", isTrendDown, ignoreFalseConditions, separator) + + ToString("isTrendBullish", isTrendBullish, ignoreFalseConditions, separator) + + ToString("isTrendBearish", isTrendBearish, ignoreFalseConditions, separator) + + ToString("isTrendSwitchedToBullish", isTrendSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isTrendSwitchedToBearish", isTrendSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "Peak: " + separator + + "-----------------------" + separator + + ToString("isPeakSameLast", isPeakSameLast, ignoreFalseConditions, separator) + + ToString("isPeakOverLast", isPeakOverLast, ignoreFalseConditions, separator) + + ToString("isPeakUnderLast", isPeakUnderLast, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "Vale: " + separator + + "-----------------------" + separator + + ToString("isValeSameLast", isValeSameLast, ignoreFalseConditions, separator) + + ToString("isValeOverLast", isValeOverLast, ignoreFalseConditions, separator) + + ToString("isValeUnderLast", isValeUnderLast, ignoreFalseConditions, separator) + "" // ; @@ -821,6 +1428,7 @@ class XCX121XCatbHelper : public XCBaseHelper "", // Signal ... mInputs.signalR2R, mInputs.drawSignals, + mInputs.drawTriggerBlock, mInputs.slAtrMultiplier, "", // Validating ... mInputs.forceHasSwing, @@ -2892,31 +3500,36 @@ class XCX121XCatbHelper : public XCBaseHelper conditions.time = TimeCurrent(); // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - result = zBar.Init( + // Filling Bars ... + int barsCount = GetBars( + conditions.bars, mSymbol, mPeriod, - barIndex // + barIndex, + loopback // ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); + result = barsCount == loopback; if (!result) { // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); + conditions.Clean(); // return result; } + // + int zIDX = 0; + int cIDX = 1; + int pIDX = cIDX + 1; + int p2IDX = pIDX + 1; + int p3IDX = p2IDX + 1; + int p4IDX = p3IDX + 1; + + // + conditions.to = conditions.bars[0].time; + conditions.from = conditions.bars[ArraySize(conditions.bars) - 1].time; + // int zIndex = barIndex; @@ -3181,34 +3794,329 @@ class XCX121XCatbHelper : public XCBaseHelper conditions.rsiBuffer // ); - // - // Conditions ... - - // - int zIDX = 0; - int cIDX = 1; - int pIDX = cIDX + 1; - int p2IDX = pIDX + 1; - int p3IDX = p2IDX + 1; - int p4IDX = p3IDX + 1; - // // Calculate ... + // + double rsiOBLevel = mInputs.rsiOBLevel; // Over Bought Level + double rsiOSLevel = mInputs.rsiOSLevel; // Over Sold Level + double adxThreshold = mInputs.adxThreshold; // Big Movement Threshold + + // + // Reading Values ... + + // + // ATR Upper ... + double zATRUpper = conditions.atrUpperBuffer[zIDX]; + double cATRUpper = conditions.atrUpperBuffer[cIDX]; + double pATRUpper = conditions.atrUpperBuffer[pIDX]; + double p2ATRUpper = conditions.atrUpperBuffer[p2IDX]; + double p3ATRUpper = conditions.atrUpperBuffer[p3IDX]; + + // + // ATR Lower ... + double zATRLower = conditions.atrLowerBuffer[zIDX]; + double cATRLower = conditions.atrLowerBuffer[cIDX]; + double pATRLower = conditions.atrLowerBuffer[pIDX]; + double p2ATRLower = conditions.atrLowerBuffer[p2IDX]; + double p3ATRLower = conditions.atrLowerBuffer[p3IDX]; + + // + // SAR ... + + // + double zSAR = conditions.sarBuffer[zIDX]; + double cSar = conditions.sarBuffer[cIDX]; + double pSAR = conditions.sarBuffer[pIDX]; + double p2SAR = conditions.sarBuffer[p2IDX]; + double p3SAR = conditions.sarBuffer[p3IDX]; + + // + double zSarState = conditions.sarStateBuffer[zIDX]; + double cSarState = conditions.sarStateBuffer[cIDX]; + double pSarState = conditions.sarStateBuffer[pIDX]; + double p2SarState = conditions.sarStateBuffer[p2IDX]; + double p3SarState = conditions.sarStateBuffer[p3IDX]; + + // + // ADX ... + + // + double zADX = conditions.adxBuffer[zIDX]; + double cADX = conditions.adxBuffer[cIDX]; + double pADX = conditions.adxBuffer[pIDX]; + double p2ADX = conditions.adxBuffer[p2IDX]; + double p3ADX = conditions.adxBuffer[p3IDX]; + + // + // ADX P ... + + // + double zADXP = conditions.adxpBuffer[zIDX]; + double cADXP = conditions.adxpBuffer[cIDX]; + double pADXP = conditions.adxpBuffer[pIDX]; + double p2ADXP = conditions.adxpBuffer[p2IDX]; + double p3ADXP = conditions.adxpBuffer[p3IDX]; + + // + // ADX N ... + + // + double zADXN = conditions.adxnBuffer[zIDX]; + double cADXN = conditions.adxnBuffer[cIDX]; + double pADXN = conditions.adxnBuffer[pIDX]; + double p2ADXN = conditions.adxnBuffer[p2IDX]; + double p3ADXN = conditions.adxnBuffer[p3IDX]; + + // + // RSI ... + + // + double zRSI = conditions.rsiBuffer[zIDX]; + double cRSI = conditions.rsiBuffer[cIDX]; + double pRSI = conditions.rsiBuffer[pIDX]; + double p2RSI = conditions.rsiBuffer[p2IDX]; + double p3RSI = conditions.rsiBuffer[p3IDX]; + + // + // SIGNAL Bar ... + + // + double zSBarO = conditions.sBarOpenBuffer[zIDX]; + double cSBarO = conditions.sBarOpenBuffer[cIDX]; + double pSBarO = conditions.sBarOpenBuffer[pIDX]; + double p2SBarO = conditions.sBarOpenBuffer[p2IDX]; + double p3SBarO = conditions.sBarOpenBuffer[p3IDX]; + + // + double zSBarC = conditions.sBarCloseBuffer[zIDX]; + double cSBarC = conditions.sBarCloseBuffer[cIDX]; + double pSBarC = conditions.sBarCloseBuffer[pIDX]; + double p2SBarC = conditions.sBarCloseBuffer[p2IDX]; + double p3SBarC = conditions.sBarCloseBuffer[p3IDX]; + + // + // TREND ... + + // + double zTrend = conditions.trendBuffer[zIDX]; + double cTrend = conditions.trendBuffer[cIDX]; + double pTrend = conditions.trendBuffer[pIDX]; + double p2Trend = conditions.trendBuffer[p2IDX]; + double p3Trend = conditions.trendBuffer[p3IDX]; + + // + double zTrendState = conditions.trendStateBuffer[zIDX]; + double cTrendState = conditions.trendStateBuffer[cIDX]; + double pTrendState = conditions.trendStateBuffer[pIDX]; + double p2TrendState = conditions.trendStateBuffer[p2IDX]; + double p3TrendState = conditions.trendStateBuffer[p3IDX]; + + // + // XPV ... + + // + double zPEAK = conditions.peakBuffer[zIDX]; + double cPEAK = conditions.peakBuffer[cIDX]; + double pPEAK = conditions.peakBuffer[pIDX]; + double p2PEAK = conditions.peakBuffer[p2IDX]; + double p3PEAK = conditions.peakBuffer[p3IDX]; + + // + double zVALE = conditions.valeBuffer[zIDX]; + double cVALE = conditions.valeBuffer[cIDX]; + double pVALE = conditions.valeBuffer[pIDX]; + double p2VALE = conditions.valeBuffer[p2IDX]; + double p3VALE = conditions.valeBuffer[p3IDX]; + + // + // ATR Band ... + + // + bool isATRUp = + cATRUpper > pATRUpper && + cATRLower > pATRLower; + bool isATRDown = + cATRUpper < pATRUpper && + cATRLower < pATRLower; + + // + bool isClosedOverATRUpper = + conditions.bars[cIDX].close > cATRUpper; + bool isClosedUnderATRLower = false; + + // + // SAR ... + + // + bool isSarBullish = false; + bool isSarBearish = false; + + // + bool isSarSwitchedToBullish = false; + bool isSarSwitchedToBearish = false; + + // + // ADX ... + + // + bool isADXBiggerLast = false; + bool isADXLesserLast = false; + + // + bool isADXOverThreshold = false; + bool isADXUnderThreshold = false; + + // + bool isDXPBiggerThanDXN = false; + bool isDXNBiggerThanDXP = false; + + // + bool isADXBullish = false; + bool isADXBearish = false; + + // + bool isADXSwitchedToBullish = false; + bool isADXSwitchedToBearish = false; + + // + // RSI ... + + // + bool isRSIBullish = false; + bool isRSIBearish = false; + + // + bool isRSISwitchedToBullish = false; + bool isRSISwitchedToBearish = false; + + // + bool isRSIOB = false; + bool isRSIOS = false; + + // + bool isRSICrossedOverOB = false; + bool isRSICrossedOverOS = false; + + // + bool isRSICrossedUnderOB = false; + bool isRSICrossedUnderOS = false; + + // + // SIGNAL Bar ... + + // + bool isSBarBullish = false; + bool isSBarBearish = false; + + // + bool isSBarSwitchedToBullish = false; + bool isSBarSwitchedToBearish = false; + + // + // XHK Signal Bar ... + + // + bool isHKSBarBullish = false; + bool isHKSBarBearish = false; + + // + bool isHKSBarSwitchedToBullish = false; + bool isHKSBarSwitchedToBearish = false; + + // + // TREND ... + + // + bool isTrendUp = false; + bool isTrendDown = false; + + // + bool isTrendBullish = false; + bool isTrendBearish = false; + + // + bool isTrendSwitchedToBullish = false; + bool isTrendSwitchedToBearish = false; + + // + // PEAK ... + + // + bool isPeakSameLast = false; + bool isPeakOverLast = false; + bool isPeakUnderLast = false; + + // + // VALE ... + + // + bool isValeSameLast = false; + bool isValeOverLast = false; + bool isValeUnderLast = false; + // // Attached ... + // + conditions.isATRUp = isATRUp; + conditions.isRSIOB = isRSIOB; + conditions.isRSIOS = isRSIOS; + conditions.isATRDown = isATRDown; + conditions.isTrendUp = isTrendUp; + conditions.rsiOBLevel = rsiOBLevel; + conditions.rsiOSLevel = rsiOSLevel; + conditions.isTrendDown = isTrendDown; + conditions.adxThreshold = adxThreshold; + conditions.isSarBullish = isSarBullish; + conditions.isSarBearish = isSarBearish; + conditions.isADXBullish = isADXBullish; + conditions.isADXBearish = isADXBearish; + conditions.isRSIBullish = isRSIBullish; + conditions.isRSIBearish = isRSIBearish; + conditions.isSBarBullish = isSBarBullish; + conditions.isSBarBearish = isSBarBearish; + conditions.isTrendBullish = isTrendBullish; + conditions.isTrendBearish = isTrendBearish; + conditions.isPeakSameLast = isPeakSameLast; + conditions.isPeakOverLast = isPeakOverLast; + conditions.isValeSameLast = isValeSameLast; + conditions.isValeOverLast = isValeOverLast; + conditions.isADXBiggerLast = isADXBiggerLast; + conditions.isADXLesserLast = isADXLesserLast; + conditions.isHKSBarBullish = isHKSBarBullish; + conditions.isHKSBarBearish = isHKSBarBearish; + conditions.isPeakUnderLast = isPeakUnderLast; + conditions.isValeUnderLast = isValeUnderLast; + conditions.isRSICrossedOverOB = isRSICrossedOverOB; + conditions.isRSICrossedOverOS = isRSICrossedOverOS; + conditions.isADXOverThreshold = isADXOverThreshold; + conditions.isDXPBiggerThanDXN = isDXPBiggerThanDXN; + conditions.isDXNBiggerThanDXP = isDXNBiggerThanDXP; + conditions.isRSICrossedUnderOB = isRSICrossedUnderOB; + conditions.isRSICrossedUnderOS = isRSICrossedUnderOS; + conditions.isADXUnderThreshold = isADXUnderThreshold; + conditions.isClosedOverATRUpper = isClosedOverATRUpper; + conditions.isClosedUnderATRLower = isClosedUnderATRLower; + conditions.isSarSwitchedToBullish = isSarSwitchedToBullish; + conditions.isSarSwitchedToBearish = isSarSwitchedToBearish; + conditions.isADXSwitchedToBullish = isADXSwitchedToBullish; + conditions.isADXSwitchedToBearish = isADXSwitchedToBearish; + conditions.isRSISwitchedToBullish = isRSISwitchedToBullish; + conditions.isRSISwitchedToBearish = isRSISwitchedToBearish; + conditions.isSBarSwitchedToBullish = isSBarSwitchedToBullish; + conditions.isSBarSwitchedToBearish = isSBarSwitchedToBearish; + conditions.isTrendSwitchedToBullish = isTrendSwitchedToBullish; + conditions.isTrendSwitchedToBearish = isTrendSwitchedToBearish; + conditions.isHKSBarSwitchedToBullish = isHKSBarSwitchedToBullish; + conditions.isHKSBarSwitchedToBearish = isHKSBarSwitchedToBearish; + // // Cleanup Resources ... // Cleanup(); - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - // return result; } diff --git a/Indicators/x-saherelm.x121.xcatb.mq5 b/Indicators/x-saherelm.x121.xcatb.mq5 index 533f7860..8fb1e13d 100644 --- a/Indicators/x-saherelm.x121.xcatb.mq5 +++ b/Indicators/x-saherelm.x121.xcatb.mq5 @@ -85,6 +85,7 @@ input ENUM_X_MARKET_CYCLES appliedCycle = X_MARKET_CYCLE_HIND; // Applied Cycle input group "Signal"; input int signalR2R = 4; // Risk Reward Ratio input bool drawSignals = true; // Draw Signal +input bool drawTriggerBlock = true; // Draw Trigger Block input double slAtrMultiplier = 1.0; // ATR Multiplier for SL // @@ -2020,13 +2021,17 @@ void CalculateValues( { // // Draw ... - has = DrawTriggerBlock( - tb, - mDrawer, - mObjects, - NULL, - drawSignals // - ); + if (drawTriggerBlock) + { + // + has = DrawTriggerBlock( + tb, + mDrawer, + mObjects, + NULL, + drawSignals // + ); + } // // Alert ... diff --git a/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 b/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 index 2ce8f16e..055b87dc 100644 --- a/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 +++ b/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 @@ -1187,7 +1187,7 @@ class XCXCAEATradeManager : public XCBaseAlert { // string message = signal.GetMessage("Provided"); - Alert(message); + SendAlert(message); } // @@ -1375,7 +1375,7 @@ class XCXCAEATradeManager : public XCBaseAlert } // - Alert(message); + SendAlert(message); } // @@ -1910,7 +1910,7 @@ class XCXCAEATradeManager : public XCBaseAlert ? prefix + "\n" : "") + "Account Balance: " + ToString(balance) + currency; - Alert(message); + SendAlert(message); } // @@ -1923,7 +1923,7 @@ class XCXCAEATradeManager : public XCBaseAlert } // - Alert(message); + SendAlert(message); } //