From 8de6979fba2ef7fb328ec9c933eeeaa4f1e44b16 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Tue, 28 May 2024 08:03:47 +0330 Subject: [PATCH] last ... --- .../Classes/x-saherelm.base.class.mq5 | 88 + .../x-saherelm.x121.provider.class.mq5 | 11119 ++ .../Classes/x-saherelm.x121.xea.class.mq5 | 1676 + .../Classes/x-saherelm.x121.xmcycle.class.mq5 | 5738 + .../Classes/x-saherelm.x5.provider.class.mq5 | 95417 ++++++++++++++++ .../Classes/x-saherelm.x5.xea.class.mq5 | 308 + .../Classes/x-saherelm.xaccount.class.mq5 | 398 + .../Classes/x-saherelm.xalert.class.mq5 | 1363 + .../x-saherelm.xdata-collector.class.mq5 | 481 + .../14030308/Classes/x-saherelm.xea.class.mq5 | 3950 + .../Classes/x-saherelm.xhelper.class.mq5 | 148 + .../Classes/x-saherelm.xhttp.class.mq5 | 373 + .../Classes/x-saherelm.xmd5.class.mq5 | 441 + .../Classes/x-saherelm.xprovider.class.mq5 | 267 + .../Classes/x-saherelm.xtrade.class.mq5 | 3635 + .../BKPS/14030308/Experts/x-test.x121ea.mq5 | 967 + .../BKPS/14030308/Experts/x-test.x5121ea.mq5 | 1169 + .../BKPS/14030308/Experts/x-test.x5ea.mq5 | 252 + .../Helpers/x-saherelm.xama.helper.mq5 | 317 + .../Helpers/x-saherelm.xcc.helper.mq5 | 245 + .../Helpers/x-saherelm.xche.helper.mq5 | 514 + .../Helpers/x-saherelm.xchlh.helper.mq5 | 967 + .../Helpers/x-saherelm.xchma.helper.mq5 | 960 + .../Helpers/x-saherelm.xct.helper.mq5 | 220 + .../Helpers/x-saherelm.xdon.helper.mq5 | 1075 + .../Helpers/x-saherelm.xfi.helper.mq5 | 292 + .../Helpers/x-saherelm.xhk.helper.mq5 | 1014 + .../Helpers/x-saherelm.xhull.helper.mq5 | 399 + .../Helpers/x-saherelm.xich.helper.mq5 | 827 + .../Helpers/x-saherelm.xlh.helper.mq5 | 422 + .../Helpers/x-saherelm.xmc.helper.mq5 | 497 + .../Helpers/x-saherelm.xmrb.helper.mq5 | 1411 + .../Helpers/x-saherelm.xobd.helper.mq5 | 306 + .../Helpers/x-saherelm.xosc.helper.mq5 | 1321 + .../Helpers/x-saherelm.xpv.helper.mq5 | 1870 + .../Helpers/x-saherelm.xrsi.helper.mq5 | 392 + .../Helpers/x-saherelm.xsslc.helper.mq5 | 408 + .../Helpers/x-saherelm.xstr.helper.mq5 | 421 + .../Helpers/x-saherelm.xtd.helper.mq5 | 458 + .../Helpers/x-saherelm.xtm.helper.mq5 | 310 + .../Helpers/x-saherelm.xts.helper.mq5 | 550 + .../Helpers/x-saherelm.xzg.helper.mq5 | 527 + .../14030308/Indicators/x-saherelm.xama.mq5 | 348 + .../14030308/Indicators/x-saherelm.xcc.mq5 | 458 + .../14030308/Indicators/x-saherelm.xche.mq5 | 631 + .../14030308/Indicators/x-saherelm.xchlh.mq5 | 816 + .../14030308/Indicators/x-saherelm.xchma.mq5 | 1134 + .../14030308/Indicators/x-saherelm.xct.mq5 | 261 + .../14030308/Indicators/x-saherelm.xdon.mq5 | 366 + .../14030308/Indicators/x-saherelm.xfi.mq5 | 309 + .../14030308/Indicators/x-saherelm.xhk.mq5 | 479 + .../14030308/Indicators/x-saherelm.xhull.mq5 | 583 + .../14030308/Indicators/x-saherelm.xich.mq5 | 846 + .../14030308/Indicators/x-saherelm.xlh.mq5 | 352 + .../14030308/Indicators/x-saherelm.xmc.mq5 | 446 + .../14030308/Indicators/x-saherelm.xmrb.mq5 | 855 + .../14030308/Indicators/x-saherelm.xobd.mq5 | 392 + .../14030308/Indicators/x-saherelm.xosc.mq5 | 721 + .../14030308/Indicators/x-saherelm.xpv.mq5 | 1211 + .../14030308/Indicators/x-saherelm.xrsi.mq5 | 394 + .../14030308/Indicators/x-saherelm.xsslc.mq5 | 440 + .../14030308/Indicators/x-saherelm.xstr.mq5 | 580 + .../14030308/Indicators/x-saherelm.xtd.mq5 | 457 + .../14030308/Indicators/x-saherelm.xtm.mq5 | 351 + .../14030308/Indicators/x-saherelm.xts.mq5 | 548 + .../14030308/Indicators/x-saherelm.xzg.mq5 | 750 + .../Libraries/x-saherelm.common.lib.mq5 | 6882 ++ .../Libraries/x-saherelm.draw.lib.mq5 | 2443 + .../Libraries/x-saherelm.xtrade.lib.mq5 | 4112 + 69 files changed, 170678 insertions(+) create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.base.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.provider.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xea.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xmcycle.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.provider.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.xea.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xaccount.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xalert.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xdata-collector.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xea.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhelper.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhttp.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xmd5.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xprovider.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xtrade.class.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Experts/x-test.x121ea.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5121ea.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5ea.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xama.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xcc.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xche.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchlh.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchma.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xct.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xdon.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xfi.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhk.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhull.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xich.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xlh.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmc.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmrb.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xobd.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xosc.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xpv.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xrsi.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xsslc.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xstr.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtd.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtm.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xts.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xzg.helper.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xama.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xcc.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xche.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchlh.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchma.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xct.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xdon.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xfi.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhk.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhull.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xich.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xlh.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmc.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmrb.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xobd.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xosc.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xpv.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xrsi.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xsslc.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xstr.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtd.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtm.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xts.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xzg.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.common.lib.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.draw.lib.mq5 create mode 100644 MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.xtrade.lib.mq5 diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.base.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.base.class.mq5 new file mode 100644 index 0000000..cde0dd8 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.base.class.mq5 @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// -------------------------------------- +// Name: XBaseClass +// Description: provides all based classes for use ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// XBase Class ... +class XSCBase +{ + // + // Public ... +public: + // + // Protected ... + + // + // Represent Basic Unique Tag ... + virtual string GetTag(); + + // + // Retrieve Class Token ... + virtual string GetToken() + { + // + string result = NULL; + + // + string mType = GetTypeName(this); + + // + result = mType; + + // + string parts[]; + int partsCount = SplitContent( + parts, + result, + " " + // + ); + if (partsCount <= 0) + { + // + result = mType; + return result; + } + + // + bool hasLastPart = GetLastItem( + result, + parts + // + ); + if (!hasLastPart) + { + // + result = mType; + return result; + } + + // + return result; + } + +protected: + // + // Private ... +private: +}; diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.provider.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.provider.class.mq5 new file mode 100644 index 0000000..76ab39b --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.provider.class.mq5 @@ -0,0 +1,11119 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSC121Provider +// Description: provides all Base Provider +// requirements For X121 ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... + +// +#include "../Helpers/x-saherelm.xcc.helper.mq5" +#include "../Helpers/x-saherelm.xct.helper.mq5" +#include "../Helpers/x-saherelm.xmc.helper.mq5" +#include "../Helpers/x-saherelm.xdon.helper.mq5" +#include "../Helpers/x-saherelm.xzg.helper.mq5" +#include "../Helpers/x-saherelm.xpv.helper.mq5" +#include "../Helpers/x-saherelm.xstr.helper.mq5" +#include "../Helpers/x-saherelm.xche.helper.mq5" +#include "../Helpers/x-saherelm.xosc.helper.mq5" +#include "../Helpers/x-saherelm.xtm.helper.mq5" +#include "../Helpers/x-saherelm.xama.helper.mq5" +#include "../Helpers/x-saherelm.xlh.helper.mq5" +#include "../Helpers/x-saherelm.xtd.helper.mq5" +#include "../Helpers/x-saherelm.xfi.helper.mq5" +#include "../Helpers/x-saherelm.xts.helper.mq5" +#include "../Helpers/x-saherelm.xrsi.helper.mq5" +#include "../Helpers/x-saherelm.xobd.helper.mq5" +#include "../Helpers/x-saherelm.xchlh.helper.mq5" +#include "../Helpers/x-saherelm.xchma.helper.mq5" + +// +#include "../Classes/x-saherelm.xprovider.class.mq5" +#include "../Classes/x-saherelm.x121.xmcycle.class.mq5" + +// +// Definitions ... + +// +// Signallers ... +enum ENUM_X121_SIGNAL_PROVIDERS +{ + // + PROVIDER_NONE, + XSP, + XTEST, + X786, + X121, + X110, + X92, + X128, + // + XTD, + XTAM, + XSI, + XTSFI, + XOBDLH, + XCHMACC, + XCHMAMN, + XCHMAMX, +}; + +// +// X121 Provider Inputs ... +class X121ProviderInputs : public XSCBaseProviderInpts +{ + // + // Public ... +public: + // + // Props ... + + // + string symbol; + ENUM_TIMEFRAMES period; + + // + // S Market ... + ENUM_TIMEFRAMES sMarketPeriod; // Short Market Period + ENUM_X_PERIOD_METHOD sMarketMethod; // Short Market Period Method + string sMarketPrefix; // Short Market Prefix + + // + // MEDIUM Market ... + ENUM_TIMEFRAMES mMarketPeriod; // Medium Market Period + ENUM_X_PERIOD_METHOD mMarketMethod; // Medium Market Period Method + string mMarketPrefix; // Medium Market Prefix + + // + // LONG Market ... + ENUM_TIMEFRAMES lMarketPeriod; // Long Market Period + ENUM_X_PERIOD_METHOD lMarketMethod; // Long Market Period Method + string lMarketPrefix; // Long Market Prefix + + // + // HIND Market ... + ENUM_TIMEFRAMES hMarketPeriod; // Hind Market Period + ENUM_X_PERIOD_METHOD hMarketMethod; // Hind Market Period Method + string hMarketPrefix; // Hind Market Prefix + + // + // Indicators ... + XCCInputs ccInputs; + XCTInputs ctInputs; + XZGInputs zgInputs; + XPVInputs pvInputs; + XHKInputs hkInputs; + XMCInputs mcInputs; + XMRBInputs mrbInputs; + XICHInputs ichInputs; + XCHEInputs cheInputs; + XSTRInputs strInputs; + XDONInputs donInputs; + XOSCInputs oscInputs; + + // + XTSInputs tsInputs; + XTMInputs tmInputs; + XLHInputs lhInputs; + XTDInputs tdInputs; + XFIInputs fiInputs; + XOBDInputs obdInputs; + XAMAInputs amaInputs; + XRSIInputs rsiInputs; + XCHLHInputs chlhInputs; + XCHMAInputs chmaInputs; + + // + X121MCycleInputs cMarketInputs; // Curent Market Inputs + X121MCycleInputs sMarketInputs; // Short Market Inputs + X121MCycleInputs mMarketInputs; // Medium Market Inputs + X121MCycleInputs lMarketInputs; // Long Market Inputs + X121MCycleInputs hMarketInputs; // Hind Market Inputs + + // + // Tools ... + + // + // Initialize Input ... + bool Init() + { + // + bool result = false; + + // + // Validate Base Requirements ... + result = + // + IsSpecifiedValid(symbol) && + IsSpecifiedValid(period) && + IsSpecifiedValid(sMarketMethod, sMarketPeriod) && + IsSpecifiedValid(mMarketMethod, mMarketPeriod) && + IsSpecifiedValid(lMarketMethod, lMarketPeriod) && + IsSpecifiedValid(hMarketMethod, hMarketPeriod) + // + ; + if (!result) + { + return result; + } + + // + if (!zgInputs.IsValid()) + { + zgInputs.Default(); + } + if (!pvInputs.IsValid()) + { + pvInputs.Default(); + } + if (!mcInputs.IsValid()) + { + mcInputs.Default(); + } + if (!hkInputs.IsValid()) + { + hkInputs.Default(); + } + if (!mrbInputs.IsValid()) + { + mrbInputs.Default(); + } + if (!cheInputs.IsValid()) + { + cheInputs.Default(); + } + if (!strInputs.IsValid()) + { + strInputs.Default(); + } + if (!donInputs.IsValid()) + { + donInputs.Default(); + } + if (!oscInputs.IsValid()) + { + oscInputs.Default(); + } + if (!ichInputs.IsValid()) + { + ichInputs.Default(); + } + + // + if (!tsInputs.IsValid()) + { + tsInputs.Default(); + } + if (!tmInputs.IsValid()) + { + tmInputs.Default(); + } + if (!lhInputs.IsValid()) + { + lhInputs.Default(); + } + if (!tdInputs.IsValid()) + { + tdInputs.Default(); + } + if (!fiInputs.IsValid()) + { + fiInputs.Default(); + } + if (!obdInputs.IsValid()) + { + obdInputs.Default(); + } + if (!amaInputs.IsValid()) + { + amaInputs.Default(); + } + if (!rsiInputs.IsValid()) + { + rsiInputs.Default(); + } + if (!chlhInputs.IsValid()) + { + chlhInputs.Default(); + } + if (!chmaInputs.IsValid()) + { + chmaInputs.Default(); + } + + // + // Initialize Market Inputs ... + + // + // Current ... + cMarketInputs.pvInputs = this.pvInputs; + cMarketInputs.zgInputs = this.zgInputs; + cMarketInputs.mcInputs = this.mcInputs; + cMarketInputs.hkInputs = this.hkInputs; + cMarketInputs.mrbInputs = this.mrbInputs; + cMarketInputs.strInputs = this.strInputs; + cMarketInputs.oscInputs = this.oscInputs; + cMarketInputs.cheInputs = this.cheInputs; + cMarketInputs.ichInputs = this.ichInputs; + cMarketInputs.donInputs = this.donInputs; + result = cMarketInputs.Init( + this.symbol, + this.period, + X_MARKET_CYCLE_SHORT, + this.period, + X_PERIOD_MANUALLY, + "HOST", + false // + ); + if (!result) + { + return result; + } + + // + // Short ... + sMarketInputs.pvInputs = this.pvInputs; + sMarketInputs.zgInputs = this.zgInputs; + sMarketInputs.mcInputs = this.mcInputs; + sMarketInputs.hkInputs = this.hkInputs; + sMarketInputs.mrbInputs = this.mrbInputs; + sMarketInputs.strInputs = this.strInputs; + sMarketInputs.oscInputs = this.oscInputs; + sMarketInputs.cheInputs = this.cheInputs; + sMarketInputs.ichInputs = this.ichInputs; + sMarketInputs.donInputs = this.donInputs; + result = sMarketInputs.Init( + this.symbol, + this.period, + X_MARKET_CYCLE_SHORT, + this.sMarketPeriod, + this.sMarketMethod, + this.sMarketPrefix, + false // + ); + if (!result) + { + return result; + } + + // + // Medium ... + mMarketInputs.pvInputs = this.pvInputs; + mMarketInputs.zgInputs = this.zgInputs; + mMarketInputs.mcInputs = this.mcInputs; + mMarketInputs.hkInputs = this.hkInputs; + mMarketInputs.mrbInputs = this.mrbInputs; + mMarketInputs.strInputs = this.strInputs; + mMarketInputs.oscInputs = this.oscInputs; + mMarketInputs.cheInputs = this.cheInputs; + mMarketInputs.ichInputs = this.ichInputs; + mMarketInputs.donInputs = this.donInputs; + result = mMarketInputs.Init( + this.symbol, + this.period, + X_MARKET_CYCLE_MEDIUM, + this.mMarketPeriod, + this.mMarketMethod, + this.mMarketPrefix, + false // + ); + if (!result) + { + return result; + } + + // + // Long ... + lMarketInputs.pvInputs = this.pvInputs; + lMarketInputs.zgInputs = this.zgInputs; + lMarketInputs.mcInputs = this.mcInputs; + lMarketInputs.hkInputs = this.hkInputs; + lMarketInputs.mrbInputs = this.mrbInputs; + lMarketInputs.strInputs = this.strInputs; + lMarketInputs.oscInputs = this.oscInputs; + lMarketInputs.cheInputs = this.cheInputs; + lMarketInputs.ichInputs = this.ichInputs; + lMarketInputs.donInputs = this.donInputs; + result = lMarketInputs.Init( + this.symbol, + this.period, + X_MARKET_CYCLE_LONG, + this.lMarketPeriod, + this.lMarketMethod, + this.lMarketPrefix, + false // + ); + if (!result) + { + return result; + } + + // + // Hind ... + hMarketInputs.pvInputs = this.pvInputs; + hMarketInputs.zgInputs = this.zgInputs; + hMarketInputs.mcInputs = this.mcInputs; + hMarketInputs.hkInputs = this.hkInputs; + hMarketInputs.mrbInputs = this.mrbInputs; + hMarketInputs.strInputs = this.strInputs; + hMarketInputs.oscInputs = this.oscInputs; + hMarketInputs.cheInputs = this.cheInputs; + hMarketInputs.ichInputs = this.ichInputs; + hMarketInputs.donInputs = this.donInputs; + result = hMarketInputs.Init( + this.symbol, + this.period, + X_MARKET_CYCLE_HIND, + this.hMarketPeriod, + this.hMarketMethod, + this.hMarketPrefix, + false // + ); + if (!result) + { + return result; + } + + // + result = IsValid(); + + // + return result; + } + + // + // Validate Input ... + bool IsValid() override + { + // + bool result = false; + + // + result = + // + // + IsSpecifiedValid(symbol) && + IsSpecifiedValid(period) && + IsSpecifiedValid(sMarketMethod, sMarketPeriod) && + IsSpecifiedValid(mMarketMethod, mMarketPeriod) && + IsSpecifiedValid(lMarketMethod, lMarketPeriod) && + IsSpecifiedValid(hMarketMethod, hMarketPeriod) && + // + ccInputs.IsValid() && + ctInputs.IsValid() && + zgInputs.IsValid() && + pvInputs.IsValid() && + mcInputs.IsValid() && + hkInputs.IsValid() && + mrbInputs.IsValid() && + cheInputs.IsValid() && + strInputs.IsValid() && + donInputs.IsValid() && + oscInputs.IsValid() && + ichInputs.IsValid() && + // + tsInputs.IsValid() && + tmInputs.IsValid() && + lhInputs.IsValid() && + tdInputs.IsValid() && + fiInputs.IsValid() && + obdInputs.IsValid() && + amaInputs.IsValid() && + rsiInputs.IsValid() && + chlhInputs.IsValid() && + chmaInputs.IsValid() && + // + cMarketInputs.IsValid() && + sMarketInputs.IsValid() && + mMarketInputs.IsValid() && + lMarketInputs.IsValid() && + hMarketInputs.IsValid() + // + ; + + // + return result; + } + + // + // Cleanup ... + void Clean() override + { + // + symbol = NULL; + period = NULL; + + // + sMarketPeriod = NULL; + sMarketMethod = X_PERIOD_NOTHING; + sMarketPrefix = NULL; + + // + mMarketPeriod = NULL; + mMarketMethod = X_PERIOD_NOTHING; + mMarketPrefix = NULL; + + // + lMarketPeriod = NULL; + lMarketMethod = X_PERIOD_NOTHING; + lMarketPrefix = NULL; + + // + hMarketPeriod = NULL; + hMarketMethod = X_PERIOD_NOTHING; + hMarketPrefix = NULL; + + // + ccInputs.Clean(); + ctInputs.Clean(); + zgInputs.Clean(); + pvInputs.Clean(); + mcInputs.Clean(); + hkInputs.Clean(); + mrbInputs.Clean(); + cheInputs.Clean(); + strInputs.Clean(); + donInputs.Clean(); + oscInputs.Clean(); + ichInputs.Clean(); + // + tsInputs.Clean(); + tmInputs.Clean(); + lhInputs.Clean(); + tdInputs.Clean(); + fiInputs.Clean(); + obdInputs.Clean(); + amaInputs.Clean(); + rsiInputs.Clean(); + chlhInputs.Clean(); + chmaInputs.Clean(); + // + cMarketInputs.Clean(); + sMarketInputs.Clean(); + mMarketInputs.Clean(); + lMarketInputs.Clean(); + hMarketInputs.Clean(); + } + + // + // Default ... + void Default() override + { + // + symbol = NULL; + period = NULL; + + // + sMarketPeriod = NULL; + sMarketMethod = X_PERIOD_AUTO; + sMarketPrefix = NULL; + + // + mMarketPeriod = NULL; + mMarketMethod = X_PERIOD_AUTO; + mMarketPrefix = NULL; + + // + lMarketPeriod = NULL; + lMarketMethod = X_PERIOD_AUTO; + lMarketPrefix = NULL; + + // + hMarketPeriod = NULL; + hMarketMethod = X_PERIOD_AUTO; + hMarketPrefix = NULL; + + // + ccInputs.Default(); + ctInputs.Default(); + zgInputs.Default(); + pvInputs.Default(); + mcInputs.Default(); + hkInputs.Default(); + mrbInputs.Default(); + cheInputs.Default(); + strInputs.Default(); + donInputs.Default(); + oscInputs.Default(); + ichInputs.Default(); + tsInputs.Default(); + tmInputs.Default(); + lhInputs.Default(); + tdInputs.Default(); + fiInputs.Default(); + obdInputs.Default(); + amaInputs.Default(); + rsiInputs.Default(); + chlhInputs.Default(); + chmaInputs.Default(); + cMarketInputs.Default(); + sMarketInputs.Default(); + mMarketInputs.Default(); + lMarketInputs.Default(); + hMarketInputs.Default(); + } + + // + // Max ... + int Max() override + { + // + int result = 0; + + // + result = MathMax(lhInputs.Max(), tmInputs.Max()); + + // + result = MathMax(result, tsInputs.Max()); + result = MathMax(result, ctInputs.Max()); + result = MathMax(result, ccInputs.Max()); + result = MathMax(result, tdInputs.Max()); + result = MathMax(result, fiInputs.Max()); + result = MathMax(result, obdInputs.Max()); + result = MathMax(result, amaInputs.Max()); + result = MathMax(result, rsiInputs.Max()); + result = MathMax(result, chlhInputs.Max()); + result = MathMax(result, chmaInputs.Max()); + + // + return result; + } + + // + // Set Symbol ... + bool SetSymbol(string value) + { + // + bool result = false; + + // + result = IsSpecifiedValid(value); + if (!result) + { + return result; + } + + // + symbol = value; + cMarketInputs.cycle.symbol = value; + sMarketInputs.cycle.symbol = value; + mMarketInputs.cycle.symbol = value; + lMarketInputs.cycle.symbol = value; + hMarketInputs.cycle.symbol = value; + + // + return result; + } + + // + // Set Period ... + bool SetPeriod(ENUM_TIMEFRAMES value) + { + // + bool result = false; + + // + result = IsSpecifiedValid(value); + if (!result) + { + return result; + } + + // + period = value; + cMarketInputs.cycle.period = value; + sMarketInputs.cycle.period = value; + mMarketInputs.cycle.period = value; + lMarketInputs.cycle.period = value; + hMarketInputs.cycle.period = value; + + // + return result; + } + + // +}; + +// +// X121 Provider Market Conditions ... +class X121MarketConditions : public XSCBaseProviderMarketConditions +{ + // + // Public ... +public: + // + + // + // XTS ... + double tsCurrents[]; + double tsNearests[]; + double tsMediests[]; + double tsFarests[]; + + // + // XFI ... + double fis[]; + + // + // XTD ... + double tdBullishs[]; + double tdBearishs[]; + double tdSignals[]; + + // + // XLH ... + double lhHhs[]; + double lhLls[]; + double lhSignals[]; + + // + // XTM ... + double tms[]; + + // + // XAMA ... + double amas[]; + + // + // XOBD ... + double obds[]; + + // + // XRSI ... + double rsis[]; + + // + // XCHMA ... + double chmaScFasts[]; + double chmaScSlows[]; + double chmaMcFasts[]; + double chmaMcSlows[]; + double chmaLcFasts[]; + double chmaLcSlows[]; + double chmaHotStates[]; + + // + // XCHLH ... + double chlhScHHs[]; + double chlhScLLs[]; + double chlhMcHHs[]; + double chlhMcLLs[]; + double chlhLcHHs[]; + double chlhLcLLs[]; + double chlhHotStates[]; + + // + // Conditional Variables ... + + // + // XTM ... + bool isXTMPeak; + bool isXTMVale; + bool isXTMBullish; + bool isXTMBearish; + bool isXTMNeutural; + bool isXTMEndBullish; + bool isXTMEndBearish; + bool isXTMStartBullish; + bool isXTMStartBearish; + bool isXTMEndBullishByNeutural; + bool isXTMEndBearishByNeutural; + bool isXTMStartBullishAfterNeutural; + bool isXTMStartBearishAfterNeutural; + + // + // XAMA ... + bool isXAMAPeak; + bool isXAMAVale; + bool isXAMABullish; + bool isXAMABearish; + bool isXAMANeutural; + bool isXAMAEndBullish; + bool isXAMAEndBearish; + bool isXAMAStartBullish; + bool isXAMAStartBearish; + bool isXAMAEndBullishByNeutural; + bool isXAMAEndBearishByNeutural; + bool isXAMAStartBullishAfterNeutural; + bool isXAMAStartBearishAfterNeutural; + + // + // XLH ... + bool isXLHHHIncreased; + bool isXLHHHDecreased; + bool isXLHLLIncreased; + bool isXLHLLDecreased; + bool isXLHLowAttachedLL; + bool isXLHHighAttachedHH; + bool isXLHHHSameInLength; + bool isXLHLLSameInLength; + bool isXLHPriceOverSignal; + bool isXLHPriceUnderSignal; + bool isXLHPriceInSignalRange; + bool isXLHPriceCrossedOverSignal; + bool isXLHPriceCrossedUnderSignal; + + // + // XTD ... + bool isXTDSignalPeak; + bool isXTDSignalVale; + bool isXTDBullishPeak; + bool isXTDBullishVale; + bool isXTDBearishPeak; + bool isXTDBearishVale; + bool isXTDBullOverBear; + bool isXTDBullUnderBear; + bool isXTDSignalOverBear; + bool isXTDSignalUnderBear; + bool isXTDBullCrossedOverBear; + bool isXTDBullCrossedUnderBear; + bool isXTDSignalCrossedOverBear; + bool isXTDSignalCrossedUnderBear; + + // + // XFI ... + bool isXFIPeak; + bool isXFIVale; + bool isXFICrossedOverZero; + bool isXFIOverZero; + bool isXFICrossedUnderZero; + bool isXFIUnderZero; + + // + // XTS ... + bool isXTSAllSame; + bool isXTSCurrentMin; + bool isXTSCurrentMax; + bool isXTSCurrentOverFarest; + bool isXTSCurrentOverNearest; + bool isXTSCurrentOverMediest; + bool isXTSCurrentUnderFarest; + bool isXTSCurrentUnderNearest; + bool isXTSCurrentUnderMediest; + bool isXTSCurrentCrossedOverFarest; + bool isXTSCurrentCrossedOverNearest; + bool isXTSCurrentCrossedOverMediest; + bool isXTSCurrentCrossedUnderFarest; + bool isXTSCurrentCrossedUnderNearest; + bool isXTSCurrentCrossedUnderMediest; + + // + // XRSI ... + bool isXRSIPeak; + bool isXRSIVale; + bool isXRSICrossedOverLongExit; + bool isXRSICrossedOverLongEntry; + bool isXRSICrossedUnderShortExit; + bool isXRSICrossedUnderShortEntry; + + // + // XOBD ... + bool isXOBDSwingLow; + bool isXOBDSwingHigh; + + // + // XCHLH ... + // + bool isXCHLHSameHHs; + bool isXCHLHSameLLs; + // + bool isXCHLHSCMCHHSame; + bool isXCHLHSCMCLLSame; + // + bool isXCHLHSCLCHHSame; + bool isXCHLHSCLCLLSame; + // + bool isXCHLHMCLCHHSame; + bool isXCHLHMCLCLLSame; + // + bool isXCHLHMCOnTopOfLC; + bool isXCHLHMCInBottomOfLC; + + // + // XCHMA ... + // + bool isXCHMASCOverMax; + bool isXCHMASCOverMin; + bool isXCHMASCUnderMax; + bool isXCHMASCUnderMin; + // + bool isXCHMASCCrossedOverMax; + bool isXCHMASCCrossedUnderMax; + bool isXCHMASCCrossedOverMin; + bool isXCHMASCCrossedUnderMin; + // + bool isXCHMASCPeak; + bool isXCHMASCVale; + bool isXCHMASCTrendsUp; + bool isXCHMASCTrendsDown; + bool isXCHMASCFastOverSlow; + bool isXCHMASCFastUnderSlow; + bool isXCHMASCFastCrossedOverSlow; + bool isXCHMASCFastCrossedUnderSlow; + // + bool isXCHMAMCPeak; + bool isXCHMAMCVale; + bool isXCHMAMCTrendsUp; + bool isXCHMAMCTrendsDown; + bool isXCHMAMCFastOverSlow; + bool isXCHMAMCFastUnderSlow; + bool isXCHMAMCFastCrossedOverSlow; + bool isXCHMAMCFastCrossedUnderSlow; + // + bool isXCHMALCPeak; + bool isXCHMALCVale; + bool isXCHMALCTrendsUp; + bool isXCHMALCTrendsDown; + bool isXCHMALCFastOverSlow; + bool isXCHMALCFastUnderSlow; + bool isXCHMALCFastCrossedOverSlow; + bool isXCHMALCFastCrossedUnderSlow; + + // + X121MCycleConditions cMarketConditions; // Current Market Conditions + X121MCycleConditions sMarketConditions; // Short Market Conditions + X121MCycleConditions mMarketConditions; // Medium Market Conditions + X121MCycleConditions lMarketConditions; // Long Market Conditions + X121MCycleConditions hMarketConditions; // Hind Market Conditions + + // + // Tools ... + + // + // Cleanup ... + void Clear() + { + // + symbol = NULL; + period = NULL; + + // + Clean(bars); + + // + ArraySetAsSeries(bars, true); + + // + cMarketConditions.Clear(); + sMarketConditions.Clear(); + mMarketConditions.Clear(); + lMarketConditions.Clear(); + hMarketConditions.Clear(); + } + + // + void GenerateScore( + double &bullishScore, // Bullish Score + double &bearishScore, // Bearish Score + double cMarketMultiplier = 1, // Current Market Score Multiplier + double sMarketMultiplier = 1.1, // Short Market Score Multiplier + double mMarketMultiplier = 1.2, // Medium Market Score Multiplier + double lMarketMultiplier = 1.6, // Long Market Score Multiplier + double hMarketMultiplier = 1.8 // Hind Market Score Multiplier + ) + { + // + double bullScore = 0; + double bearScore = 0; + + // + // XTM ... + + // + if (isXTMPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTMVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTMBullish) + { + bullScore++; + } + + // + if (isXTMBearish) + { + bearScore++; + } + + // + if (isXTMNeutural) + { + } + + // + if (isXTMEndBullish) + { + bearScore++; + } + + // + if (isXTMEndBearish) + { + bullScore++; + } + + // + if (isXTMStartBullish) + { + bullScore++; + } + + // + if (isXTMStartBearish) + { + bearScore++; + } + + // + if (isXTMEndBullishByNeutural) + { + bearScore++; + } + + // + if (isXTMEndBearishByNeutural) + { + bullScore++; + } + + // + if (isXTMStartBullishAfterNeutural) + { + bullScore++; + } + + // + if (isXTMStartBearishAfterNeutural) + { + bearScore++; + } + + // + // XAMA ... + + // + if (isXAMAPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXAMAVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXAMABullish) + { + bullScore++; + } + + // + if (isXAMABearish) + { + bearScore++; + } + + // + if (isXAMANeutural) + { + } + + // + if (isXAMAEndBullish) + { + bearScore++; + } + + // + if (isXAMAEndBearish) + { + bullScore++; + } + + // + if (isXAMAStartBullish) + { + bullScore++; + } + + // + if (isXAMAStartBearish) + { + bearScore++; + } + + // + if (isXAMAEndBullishByNeutural) + { + bearScore++; + } + + // + if (isXAMAEndBearishByNeutural) + { + bullScore++; + } + + // + if (isXAMAStartBullishAfterNeutural) + { + bullScore++; + } + + // + if (isXAMAStartBearishAfterNeutural) + { + bearScore++; + } + + // + // XLH ... + + // + if (isXLHHHIncreased) + { + // + bullScore--; + bearScore++; + } + + // + if (isXLHHHDecreased) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHLLIncreased) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHLLDecreased) + { + // + bullScore--; + bearScore++; + } + + // + if (isXLHLowAttachedLL) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHHighAttachedHH) + { + // + bullScore--; + bearScore++; + } + + // + if (isXLHHHSameInLength) + { + } + + // + if (isXLHLLSameInLength) + { + } + + // + if (isXLHPriceOverSignal) + { + bullScore++; + } + + // + if (isXLHPriceUnderSignal) + { + bearScore++; + } + + // + if (isXLHPriceInSignalRange) + { + } + + // + if (isXLHPriceCrossedOverSignal) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHPriceCrossedUnderSignal) + { + // + bullScore--; + bearScore++; + } + + // + // XTD ... + + // + if (isXTDSignalPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDSignalVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBullishPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDBullishVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBearishPeak) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBearishVale) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDBullOverBear) + { + bullScore++; + } + + // + if (isXTDBullUnderBear) + { + bearScore++; + } + + // + if (isXTDSignalOverBear) + { + bullScore++; + } + + // + if (isXTDSignalUnderBear) + { + bearScore++; + } + + // + if (isXTDBullCrossedOverBear) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBullCrossedUnderBear) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDSignalCrossedOverBear) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDSignalCrossedUnderBear) + { + // + bullScore--; + bearScore++; + } + + // + // XFI ... + + // + if (isXFIPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXFIVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXFICrossedOverZero) + { + // + bullScore++; + bearScore--; + } + + // + if (isXFIOverZero) + { + bullScore++; + } + + // + if (isXFICrossedUnderZero) + { + // + bullScore--; + bearScore++; + } + + // + if (isXFIUnderZero) + { + bearScore++; + } + + // + // XTS ... + + // + if (isXTSAllSame) + { + } + + // + if (isXTSCurrentMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTSCurrentOverFarest) + { + bullScore--; + } + + // + if (isXTSCurrentOverNearest) + { + bullScore--; + } + + // + if (isXTSCurrentOverMediest) + { + bullScore--; + } + + // + if (isXTSCurrentUnderFarest) + { + bearScore--; + } + + // + if (isXTSCurrentUnderNearest) + { + bearScore--; + } + + // + if (isXTSCurrentUnderMediest) + { + bearScore--; + } + + // + if (isXTSCurrentCrossedOverFarest) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentCrossedOverNearest) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentCrossedOverMediest) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentCrossedUnderFarest) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTSCurrentCrossedUnderNearest) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTSCurrentCrossedUnderMediest) + { + // + bullScore--; + bearScore++; + } + + // + // XSI ... + + // + if (isXRSIPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXRSIVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXRSICrossedOverLongExit) + { + // + bullScore--; + bearScore++; + } + + // + if (isXRSICrossedOverLongEntry) + { + // + bullScore++; + bearScore--; + } + + // + if (isXRSICrossedUnderShortExit) + { + // + bullScore++; + bearScore--; + } + + // + if (isXRSICrossedUnderShortEntry) + { + // + bullScore--; + bearScore++; + } + + // + // XOBD ... + + // + if (isXOBDSwingLow) + { + bullScore++; + } + + // + if (isXOBDSwingHigh) + { + bearScore++; + } + + // + // XCHLH ... + + // + if (isXCHLHSameHHs) + { + bearScore++; + } + + // + if (isXCHLHSameLLs) + { + bullScore++; + } + + // + if (isXCHLHSCMCHHSame) + { + bearScore++; + } + + // + if (isXCHLHSCMCLLSame) + { + bullScore++; + } + + // + if (isXCHLHSCLCHHSame) + { + bearScore++; + } + + // + if (isXCHLHSCLCLLSame) + { + bullScore++; + } + + // + if (isXCHLHMCLCHHSame) + { + bearScore++; + } + + // + if (isXCHLHMCLCLLSame) + { + bullScore++; + } + + // + if (isXCHLHMCOnTopOfLC) + { + } + + // + if (isXCHLHMCInBottomOfLC) + { + } + + // + // XCHMA ... + + // + if (isXCHMASCOverMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCOverMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCUnderMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCUnderMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCCrossedOverMax) + { + // + bearScore--; + bearScore++; + } + + // + if (isXCHMASCCrossedUnderMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCCrossedOverMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCCrossedUnderMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCTrendsUp) + { + // + if (isXCHMASCFastOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCFastUnderSlow) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isXCHMASCTrendsDown) + { + // + if (isXCHMASCFastOverSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCFastUnderSlow) + { + // + bullScore++; + bearScore--; + } + } + + // + if (isXCHMASCFastOverSlow) + { + bearScore++; + } + + // + if (isXCHMASCFastUnderSlow) + { + bearScore++; + } + + // + if (isXCHMASCFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMAMCPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMAMCVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMAMCTrendsUp) + { + // + if (isXCHMAMCFastOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMAMCFastUnderSlow) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isXCHMAMCTrendsDown) + { + // + if (isXCHMAMCFastOverSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMAMCFastUnderSlow) + { + // + bullScore++; + bearScore--; + } + } + + // + if (isXCHMAMCFastOverSlow) + { + bullScore++; + } + + // + if (isXCHMAMCFastUnderSlow) + { + bearScore++; + } + + // + if (isXCHMAMCFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMAMCFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMALCPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMALCVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMALCTrendsUp) + { + // + if (isXCHMALCFastOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMALCFastUnderSlow) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isXCHMALCTrendsDown) + { + // + if (isXCHMALCFastOverSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMALCFastUnderSlow) + { + // + bullScore++; + bearScore--; + } + } + + // + if (isXCHMALCFastOverSlow) + { + bullScore++; + } + + // + if (isXCHMALCFastUnderSlow) + { + bearScore++; + } + + // + if (isXCHMALCFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMALCFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + + // + // Current Market ... + double cMarketBullScore = 0; + double cMarketBearScore = 0; + cMarketConditions.GenerateScore( + cMarketBullScore, + cMarketBearScore, + cMarketMultiplier // + ); + + // + // Short Market ... + double sMarketBullScore = 0; + double sMarketBearScore = 0; + sMarketConditions.GenerateScore( + sMarketBullScore, + sMarketBearScore, + sMarketMultiplier // + ); + + // + // Medium Market ... + double mMarketBullScore = 0; + double mMarketBearScore = 0; + mMarketConditions.GenerateScore( + mMarketBullScore, + mMarketBearScore, + mMarketMultiplier // + ); + + // + // Long Market ... + double lMarketBullScore = 0; + double lMarketBearScore = 0; + lMarketConditions.GenerateScore( + lMarketBullScore, + lMarketBearScore, + lMarketMultiplier // + ); + + // + // Hind Market ... + double hMarketBullScore = 0; + double hMarketBearScore = 0; + hMarketConditions.GenerateScore( + hMarketBullScore, + hMarketBearScore, + hMarketMultiplier // + ); + + // + // Calculate Summary Scores ... + + // + bullishScore = + // + bullScore + + cMarketBullScore + + sMarketBullScore + + mMarketBullScore + + lMarketBullScore + + hMarketBullScore + // + ; + + // + bearishScore = + // + bearScore + + cMarketBearScore + + sMarketBearScore + + mMarketBearScore + + lMarketBearScore + + hMarketBearScore + // + ; + } + + // + virtual string GenerateSummary( + const bool onlySummary = false, // Only Generate Conditions Summary + double cMarketMultiplier = 1, // Current Market Score Multiplier + double sMarketMultiplier = 1.1, // Short Market Score Multiplier + double mMarketMultiplier = 1.2, // Medium Market Score Multiplier + double lMarketMultiplier = 1.6, // Long Market Score Multiplier + double hMarketMultiplier = 1.8, // Hind Market Score Multiplier + const string separator = "\n", // Separator + string provided = NULL, // Additional Info about Type, Provider and Symbol + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + double bullScore = 0; + double bearScore = 0; + GenerateScore( + bullScore, + bearScore, + cMarketMultiplier, + sMarketMultiplier, + mMarketMultiplier, + lMarketMultiplier, + hMarketMultiplier // + ); + + // + string commonStr = + // + "Commons: " + separator + + "-----------------------------" + separator + + "Symbol: " + symbol + separator + + "Period: " + ToString(period) + separator + + "Time: " + ToString(TimeCurrent()) + separator + + "-----------" + separator + + "Cycles: " + separator + + "-----------" + separator + + sMarketConditions.GetTitle() + separator + + mMarketConditions.GetTitle() + separator + + lMarketConditions.GetTitle() + separator + + hMarketConditions.GetTitle() + separator + + "-----------" + separator + + "Scores: " + separator + + "-----------" + separator + + "Bullish: " + ToString(bullScore) + separator + + "Bearish: " + ToString(bearScore) + separator + + "-----------------------------" + separator + + // + // TODO: Add Scores Later ... + separator + + "" + // + ; + + // + // XOBD ... + string obdStr = + // + ToString("isXOBDSwingLow", isXOBDSwingLow, ignoreFalseConditions) + + ToString("isXOBDSwingHigh", isXOBDSwingHigh, ignoreFalseConditions) + + "" + // + ; + obdStr = SetLabel("XOBD: ", obdStr, separator); + + // + // ToString("", , ignoreFalseConditions) + + + // + // XFI ... + string fiStr = + // + ToString("isXFIPeak", isXFIPeak, ignoreFalseConditions) + + ToString("isXFIVale", isXFIVale, ignoreFalseConditions) + + ToString("isXFICrossedOverZero", isXFICrossedOverZero, ignoreFalseConditions) + + ToString("isXFIOverZero", isXFIOverZero, ignoreFalseConditions) + + ToString("isXFICrossedUnderZero", isXFICrossedUnderZero, ignoreFalseConditions) + + ToString("isXFIUnderZero", isXFIUnderZero, ignoreFalseConditions) + + "" + // + ; + fiStr = SetLabel("XFI: ", fiStr, separator); + + // + // XRSI ... + string rsiStr = + // + ToString("isXRSIPeak", isXRSIPeak, ignoreFalseConditions) + + ToString("isXRSIVale", isXRSIVale, ignoreFalseConditions) + + ToString("isXRSICrossedOverLongExit", isXRSICrossedOverLongExit, ignoreFalseConditions) + + ToString("isXRSICrossedOverLongEntry", isXRSICrossedOverLongEntry, ignoreFalseConditions) + + ToString("isXRSICrossedUnderShortExit", isXRSICrossedUnderShortExit, ignoreFalseConditions) + + ToString("isXRSICrossedUnderShortEntry", isXRSICrossedUnderShortEntry, ignoreFalseConditions) + + "" + // + ; + rsiStr = SetLabel("XRSI: ", rsiStr, separator); + + // + // XTM ... + string tmStr = + // + ToString("isXTMPeak", isXTMPeak, ignoreFalseConditions) + + ToString("isXTMVale", isXTMVale, ignoreFalseConditions) + + ToString("isXTMBullish", isXTMBullish, ignoreFalseConditions) + + ToString("isXTMBearish", isXTMBearish, ignoreFalseConditions) + + ToString("isXTMNeutural", isXTMNeutural, ignoreFalseConditions) + + ToString("isXTMEndBullish", isXTMEndBullish, ignoreFalseConditions) + + ToString("isXTMEndBearish", isXTMEndBearish, ignoreFalseConditions) + + ToString("isXTMStartBullish", isXTMStartBullish, ignoreFalseConditions) + + ToString("isXTMStartBearish", isXTMStartBearish, ignoreFalseConditions) + + ToString("isXTMEndBullishByNeutural", isXTMEndBullishByNeutural, ignoreFalseConditions) + + ToString("isXTMEndBearishByNeutural", isXTMEndBearishByNeutural, ignoreFalseConditions) + + ToString("isXTMStartBullishAfterNeutural", isXTMStartBullishAfterNeutural, ignoreFalseConditions) + + ToString("isXTMStartBearishAfterNeutural", isXTMStartBearishAfterNeutural, ignoreFalseConditions) + + "" + // + ; + tmStr = SetLabel("XTM: ", tmStr, separator); + + // + // XAMA ... + string amaStr = + // + ToString("isXAMAPeak", isXAMAPeak, ignoreFalseConditions) + + ToString("isXAMAVale", isXAMAVale, ignoreFalseConditions) + + ToString("isXAMABullish", isXAMABullish, ignoreFalseConditions) + + ToString("isXAMABearish", isXAMABearish, ignoreFalseConditions) + + ToString("isXAMANeutural", isXAMANeutural, ignoreFalseConditions) + + ToString("isXAMAEndBullish", isXAMAEndBullish, ignoreFalseConditions) + + ToString("isXAMAEndBearish", isXAMAEndBearish, ignoreFalseConditions) + + ToString("isXAMAStartBullish", isXAMAStartBullish, ignoreFalseConditions) + + ToString("isXAMAStartBearish", isXAMAStartBearish, ignoreFalseConditions) + + ToString("isXAMAEndBullishByNeutural", isXAMAEndBullishByNeutural, ignoreFalseConditions) + + ToString("isXAMAEndBearishByNeutural", isXAMAEndBearishByNeutural, ignoreFalseConditions) + + ToString("isXAMAStartBullishAfterNeutural", isXAMAStartBullishAfterNeutural, ignoreFalseConditions) + + ToString("isXAMAStartBearishAfterNeutural", isXAMAStartBearishAfterNeutural, ignoreFalseConditions) + + "" + // + ; + amaStr = SetLabel("XAMA: ", amaStr, separator); + + // + // XLH ... + string lhStr = + // + ToString("isXLHHHIncreased", isXLHHHIncreased, ignoreFalseConditions) + + ToString("isXLHHHDecreased", isXLHHHDecreased, ignoreFalseConditions) + + ToString("isXLHLLIncreased", isXLHLLIncreased, ignoreFalseConditions) + + ToString("isXLHLLDecreased", isXLHLLDecreased, ignoreFalseConditions) + + ToString("isXLHLowAttachedLL", isXLHLowAttachedLL, ignoreFalseConditions) + + ToString("isXLHHighAttachedHH", isXLHHighAttachedHH, ignoreFalseConditions) + + ToString("isXLHHHSameInLength", isXLHHHSameInLength, ignoreFalseConditions) + + ToString("isXLHLLSameInLength", isXLHLLSameInLength, ignoreFalseConditions) + + ToString("isXLHPriceOverSignal", isXLHPriceOverSignal, ignoreFalseConditions) + + ToString("isXLHPriceUnderSignal", isXLHPriceUnderSignal, ignoreFalseConditions) + + ToString("isXLHPriceInSignalRange", isXLHPriceInSignalRange, ignoreFalseConditions) + + ToString("isXLHPriceCrossedOverSignal", isXLHPriceCrossedOverSignal, ignoreFalseConditions) + + ToString("isXLHPriceCrossedUnderSignal", isXLHPriceCrossedUnderSignal, ignoreFalseConditions) + + "" + // + ; + lhStr = SetLabel("XLH: ", lhStr, separator); + + // + // XTD ... + string tdStr = + // + ToString("isXTDSignalPeak", isXTDSignalPeak, ignoreFalseConditions) + + ToString("isXTDSignalVale", isXTDSignalVale, ignoreFalseConditions) + + ToString("isXTDBullishPeak", isXTDBullishPeak, ignoreFalseConditions) + + ToString("isXTDBullishVale", isXTDBullishVale, ignoreFalseConditions) + + ToString("isXTDBearishPeak", isXTDBearishPeak, ignoreFalseConditions) + + ToString("isXTDBearishVale", isXTDBearishVale, ignoreFalseConditions) + + ToString("isXTDBullOverBear", isXTDBullOverBear, ignoreFalseConditions) + + ToString("isXTDBullUnderBear", isXTDBullUnderBear, ignoreFalseConditions) + + ToString("isXTDSignalOverBear", isXTDSignalOverBear, ignoreFalseConditions) + + ToString("isXTDSignalUnderBear", isXTDSignalUnderBear, ignoreFalseConditions) + + ToString("isXTDBullCrossedOverBear", isXTDBullCrossedOverBear, ignoreFalseConditions) + + ToString("isXTDBullCrossedUnderBear", isXTDBullCrossedUnderBear, ignoreFalseConditions) + + ToString("isXTDSignalCrossedOverBear", isXTDSignalCrossedOverBear, ignoreFalseConditions) + + ToString("isXTDSignalCrossedUnderBear", isXTDSignalCrossedUnderBear, ignoreFalseConditions) + + "" + // + ; + tdStr = SetLabel("XTD: ", tdStr, separator); + + // + // XTS ... + string tsStr = + // + ToString("isXTSAllSame", isXTSAllSame, ignoreFalseConditions) + + ToString("isXTSCurrentMin", isXTSCurrentMin, ignoreFalseConditions) + + ToString("isXTSCurrentMax", isXTSCurrentMax, ignoreFalseConditions) + + ToString("isXTSCurrentOverFarest", isXTSCurrentOverFarest, ignoreFalseConditions) + + ToString("isXTSCurrentOverNearest", isXTSCurrentOverNearest, ignoreFalseConditions) + + ToString("isXTSCurrentOverMediest", isXTSCurrentOverMediest, ignoreFalseConditions) + + ToString("isXTSCurrentUnderFarest", isXTSCurrentUnderFarest, ignoreFalseConditions) + + ToString("isXTSCurrentUnderNearest", isXTSCurrentUnderNearest, ignoreFalseConditions) + + ToString("isXTSCurrentUnderMediest", isXTSCurrentUnderMediest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedOverFarest", isXTSCurrentCrossedOverFarest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedOverNearest", isXTSCurrentCrossedOverNearest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedOverMediest", isXTSCurrentCrossedOverMediest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedUnderFarest", isXTSCurrentCrossedUnderFarest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedUnderNearest", isXTSCurrentCrossedUnderNearest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedUnderMediest", isXTSCurrentCrossedUnderMediest, ignoreFalseConditions) + + "" + // + ; + tsStr = SetLabel("XTS: ", tsStr, separator); + + // + // XCHLH ... + string chlhStr = + // + ToString("isXCHLHSameHHs", isXCHLHSameHHs, ignoreFalseConditions) + + ToString("isXCHLHSameLLs", isXCHLHSameLLs, ignoreFalseConditions) + + ToString("isXCHLHSCMCHHSame", isXCHLHSCMCHHSame, ignoreFalseConditions) + + ToString("isXCHLHSCMCLLSame", isXCHLHSCMCLLSame, ignoreFalseConditions) + + ToString("isXCHLHSCLCHHSame", isXCHLHSCLCHHSame, ignoreFalseConditions) + + ToString("isXCHLHSCLCLLSame", isXCHLHSCLCLLSame, ignoreFalseConditions) + + ToString("isXCHLHMCLCHHSame", isXCHLHMCLCHHSame, ignoreFalseConditions) + + ToString("isXCHLHMCLCLLSame", isXCHLHMCLCLLSame, ignoreFalseConditions) + + ToString("isXCHLHMCOnTopOfLC", isXCHLHMCOnTopOfLC, ignoreFalseConditions) + + ToString("isXCHLHMCInBottomOfLC", isXCHLHMCInBottomOfLC, ignoreFalseConditions) + + "" + // + ; + chlhStr = SetLabel("XCHLH: ", chlhStr, separator); + + // + // XCHMA ... + string chmaStr = + // + ToString("isXCHMASCOverMax", isXCHMASCOverMax, ignoreFalseConditions) + + ToString("isXCHMASCOverMin", isXCHMASCOverMin, ignoreFalseConditions) + + ToString("isXCHMASCUnderMax", isXCHMASCUnderMax, ignoreFalseConditions) + + ToString("isXCHMASCUnderMin", isXCHMASCUnderMin, ignoreFalseConditions) + + ToString("isXCHMASCCrossedOverMax", isXCHMASCCrossedOverMax, ignoreFalseConditions) + + ToString("isXCHMASCCrossedUnderMax", isXCHMASCCrossedUnderMax, ignoreFalseConditions) + + ToString("isXCHMASCCrossedOverMin", isXCHMASCCrossedOverMin, ignoreFalseConditions) + + ToString("isXCHMASCCrossedUnderMin", isXCHMASCCrossedUnderMin, ignoreFalseConditions) + + ToString("isXCHMASCPeak", isXCHMASCPeak, ignoreFalseConditions) + + ToString("isXCHMASCVale", isXCHMASCVale, ignoreFalseConditions) + + ToString("isXCHMASCTrendsUp", isXCHMASCTrendsUp, ignoreFalseConditions) + + ToString("isXCHMASCTrendsDown", isXCHMASCTrendsDown, ignoreFalseConditions) + + ToString("isXCHMASCFastOverSlow", isXCHMASCFastOverSlow, ignoreFalseConditions) + + ToString("isXCHMASCFastUnderSlow", isXCHMASCFastUnderSlow, ignoreFalseConditions) + + ToString("isXCHMASCFastCrossedOverSlow", isXCHMASCFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isXCHMASCFastCrossedUnderSlow", isXCHMASCFastCrossedUnderSlow, ignoreFalseConditions) + + ToString("isXCHMAMCPeak", isXCHMAMCPeak, ignoreFalseConditions) + + ToString("isXCHMAMCVale", isXCHMAMCVale, ignoreFalseConditions) + + ToString("isXCHMAMCTrendsUp", isXCHMAMCTrendsUp, ignoreFalseConditions) + + ToString("isXCHMAMCTrendsDown", isXCHMAMCTrendsDown, ignoreFalseConditions) + + ToString("isXCHMAMCFastOverSlow", isXCHMAMCFastOverSlow, ignoreFalseConditions) + + ToString("isXCHMAMCFastUnderSlow", isXCHMAMCFastUnderSlow, ignoreFalseConditions) + + ToString("isXCHMAMCFastCrossedOverSlow", isXCHMAMCFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isXCHMAMCFastCrossedUnderSlow", isXCHMAMCFastCrossedUnderSlow, ignoreFalseConditions) + + ToString("isXCHMALCPeak", isXCHMALCPeak, ignoreFalseConditions) + + ToString("isXCHMALCVale", isXCHMALCVale, ignoreFalseConditions) + + ToString("isXCHMALCTrendsUp", isXCHMALCTrendsUp, ignoreFalseConditions) + + ToString("isXCHMALCTrendsDown", isXCHMALCTrendsDown, ignoreFalseConditions) + + ToString("isXCHMALCFastOverSlow", isXCHMALCFastOverSlow, ignoreFalseConditions) + + ToString("isXCHMALCFastUnderSlow", isXCHMALCFastUnderSlow, ignoreFalseConditions) + + ToString("isXCHMALCFastCrossedOverSlow", isXCHMALCFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isXCHMALCFastCrossedUnderSlow", isXCHMALCFastCrossedUnderSlow, ignoreFalseConditions) + + "" + // + ; + chmaStr = SetLabel("XCHMA: ", chmaStr, separator); + + // + string cMarketConditionsStr = cMarketConditions.GenerateSummary(onlySummary, cMarketMultiplier); + string sMarketConditionsStr = sMarketConditions.GenerateSummary(onlySummary, sMarketMultiplier); + string mMarketConditionsStr = mMarketConditions.GenerateSummary(onlySummary, mMarketMultiplier); + string lMarketConditionsStr = lMarketConditions.GenerateSummary(onlySummary, lMarketMultiplier); + string hMarketConditionsStr = hMarketConditions.GenerateSummary(onlySummary, hMarketMultiplier); + + // + result = + // + "[" + GetToken() + "]" + separator + + (IsSpecifiedValid(provided) ? provided + separator : "") + + "-----------------------------" + separator + + commonStr + + (!onlySummary + ? obdStr + + fiStr + + rsiStr + + tmStr + + amaStr + + lhStr + + tdStr + + tsStr + + chlhStr + + chmaStr + + cMarketConditionsStr + + sMarketConditionsStr + + mMarketConditionsStr + + lMarketConditionsStr + + hMarketConditionsStr + + "" + : "") + + "" + // + ; + + // + return result; + } + + // + // For Data Collector ... + string GetToken() + { + return GetSpecificToken(this); + } + bool IsModelValid() + { + return false; + } + string ToModelString() + { + return NULL; + } + bool ParseModel(string content) + { + return false; + } + int FindIndex(X121MarketConditions &items[]) + { + return -1; + } +}; + +// +// Class ... + +// +// X121 Provider Class ... +class XSCX121Provider : public XSCBaseProvider +{ + // + // Public ... +public: + // + // Props ... + + // + XSCXCCHelper *ccHelper; // Candle Clear + XSCXCTHelper *ctHelper; // Candle Timer + + // + XSCXTSHelper *tsHelper; + XSCXFIHelper *fiHelper; + XSCXTDHelper *tdHelper; + XSCXLHHelper *lhHelper; + XSCXTMHelper *tmHelper; + XSCXOBDHelper *obdHelper; + XSCXRSIHelper *rsiHelper; + XSCXAMAHelper *amaHelper; + XSCXCHMAHelper *chmaHelper; + XSCXCHLHHelper *chlhHelper; + + // + XSCX121Market *cMarket; // Current Market + XSCX121Market *sMarket; // Short Market + XSCX121Market *mMarket; // Medium Market + XSCX121Market *lMarket; // Long Market + XSCX121Market *hMarket; // Hind Market + + // + // Constructor ... + XSCX121Provider( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + double staticVolume // Static Volume for Positions + + ) : XSCBaseProvider(symbol, period, staticVolume) + { + // + ccHelper = new XSCXCCHelper(); + ctHelper = new XSCXCTHelper(); + + // + tsHelper = new XSCXTSHelper(); + fiHelper = new XSCXFIHelper(); + tdHelper = new XSCXTDHelper(); + lhHelper = new XSCXLHHelper(); + tmHelper = new XSCXTMHelper(); + obdHelper = new XSCXOBDHelper(); + rsiHelper = new XSCXRSIHelper(); + amaHelper = new XSCXAMAHelper(); + chmaHelper = new XSCXCHMAHelper(); + chlhHelper = new XSCXCHLHHelper(); + + // + // Instantiate X121 Market Cycles Classes ... + cMarket = new XSCX121Market(); + sMarket = new XSCX121Market(); + mMarket = new XSCX121Market(); + lMarket = new XSCX121Market(); + hMarket = new XSCX121Market(); + + // + mNumberOfItems = 15; + mNumberOfSRVerified = 71; + mMinRequiredSupportAndResistances = 30; + } + + // + // Properties Gettr(s) / Setter(s) ... + + // + void SetNumberOfSRVerified(int value) + { + mNumberOfSRVerified = value; + } + + // + int GetNumberOfSRVerified() + { + return mNumberOfSRVerified; + } + + // + void SetNumberOfItems(int value) + { + mNumberOfItems = value; + } + + // + int GetNumberOfItems() + { + return mNumberOfItems; + } + + // + void SetMinRequiredSupportAndResistances(int value) + { + mMinRequiredSupportAndResistances = value; + } + + // + int GetMinRequiredSupportAndResistances() + { + return mMinRequiredSupportAndResistances; + } + + // + // Overrides ... + + // + // DeInit all Requirements ... + void DeInit() override + { + // + delete ccHelper; + delete ctHelper; + + // + delete tsHelper; + delete fiHelper; + delete tdHelper; + delete lhHelper; + delete tmHelper; + delete obdHelper; + delete rsiHelper; + delete amaHelper; + delete chmaHelper; + delete chlhHelper; + + // + delete cMarket; + delete sMarket; + delete mMarket; + delete lMarket; + delete hMarket; + } + + // + // Functions ... + + // + // Init all Requirements ... + bool Init(X121ProviderInputs &inputs) + { + // + bool result = false; + + // + // Validate ... + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + string mSymbol = GetSymbol(); + ENUM_TIMEFRAMES mPeriod = GetPeriod(); + + // + // Init Indicators Helpers ... + + // + // CT ... + result = ctHelper + .Init( + mSymbol, + mPeriod, + mInputs.ctInputs + // + ); + if (!result) + { + return result; + } + + // + // CC ... + result = ccHelper + .Init( + mSymbol, + mPeriod, + mInputs.ccInputs + // + ); + if (!result) + { + return result; + } + + // + result = tsHelper + .Init( + mSymbol, + mPeriod, + mInputs.tsInputs + // + ); + if (!result) + { + return result; + } + + // + result = fiHelper + .Init( + mSymbol, + mPeriod, + mInputs.fiInputs + // + ); + if (!result) + { + return result; + } + + // + result = tdHelper + .Init( + mSymbol, + mPeriod, + mInputs.tdInputs + // + ); + if (!result) + { + return result; + } + + // + result = lhHelper + .Init( + mSymbol, + mPeriod, + mInputs.lhInputs + // + ); + if (!result) + { + return result; + } + + // + result = tmHelper + .Init( + mSymbol, + mPeriod, + mInputs.tmInputs + // + ); + if (!result) + { + return result; + } + + // + result = obdHelper + .Init( + mSymbol, + mPeriod, + mInputs.obdInputs + // + ); + if (!result) + { + return result; + } + + // + result = rsiHelper + .Init( + mSymbol, + mPeriod, + mInputs.rsiInputs + // + ); + if (!result) + { + return result; + } + + // + result = amaHelper + .Init( + mSymbol, + mPeriod, + mInputs.amaInputs + // + ); + if (!result) + { + return result; + } + + // + result = chmaHelper + .Init( + mSymbol, + mPeriod, + mInputs.chmaInputs + // + ); + if (!result) + { + return result; + } + + // + result = chlhHelper + .Init( + mSymbol, + mPeriod, + mInputs.chlhInputs + // + ); + if (!result) + { + return result; + } + + // + // Initialize X121 Market Cycles ... + + // + // Current Market ... + result = cMarket + .Init(mInputs.cMarketInputs); + if (!result) + { + return result; + } + + // + // Short Market ... + result = sMarket + .Init(mInputs.sMarketInputs); + if (!result) + { + return result; + } + + // + // Medium Market ... + result = mMarket + .Init(mInputs.mMarketInputs); + if (!result) + { + return result; + } + + // + // Long Market ... + result = lMarket + .Init(mInputs.lMarketInputs); + if (!result) + { + return result; + } + + // + // Hind Market ... + result = hMarket + .Init(mInputs.hMarketInputs); + if (!result) + { + return result; + } + + // + return result; + } + + // + // Set Default Position's Type ... + // Enable / Disable Long (Buy), Short (Sell) ... + void SetSignalTypeState( + ENUM_POSITION_TYPE type, // Which types are Signals be Targetted + bool state // Which State is going to Set + ) + { + // + if (IsLong(type)) + { + mIsLongEnable = state; + } + else + { + mIsShortEnable = state; + } + } + + // + // Set Signal Providers ... + void SetSignalProviderState( + ENUM_X121_SIGNAL_PROVIDERS provider, // Provider State + bool state // Which state is going to set ... + ) + { + // + if (provider == PROVIDER_NONE) + { + return; + } + + // + switch (provider) + { + // + case XSP: + mIsXSPSignalProviderEnable = state; + break; + + // + case XTEST: + mIsXTESTSignalProviderEnable = state; + break; + + // + case X786: + mIsX786SignalProviderEnable = state; + break; + + // + case X121: + mIsX121SignalProviderEnable = state; + break; + + // + case X110: + mIsX110SignalProviderEnable = state; + break; + + // + case X92: + mIsX92SignalProviderEnable = state; + break; + + // + case X128: + mIsX128SignalProviderEnable = state; + break; + + // + case XTD: + mIsXTDSignalProviderEnable = state; + break; + + // + case XTAM: + mIsXTAMSignalProviderEnable = state; + break; + + // + case XSI: + mIsXSISignalProviderEnable = state; + break; + + // + case XTSFI: + mIsXTSFISignalProviderEnable = state; + break; + + // + case XOBDLH: + mIsXOBDLHSignalProviderEnable = state; + break; + + // + case XCHMACC: + mIsXCHMACCSignalProviderEnable = state; + break; + + // + case XCHMAMN: + mIsXCHMAMNSignalProviderEnable = state; + break; + + // + case XCHMAMX: + mIsXCHMAMXSignalProviderEnable = state; + break; + } + } + + // + void SetSignalProviderStates( + ENUM_X121_SIGNAL_PROVIDERS &providers[], // Collection of Providers ... + bool state // Which state is going to set ... + ) + { + // + int providersCount = ArraySize(providers); + if (providersCount <= 0) + { + return; + } + + // + for (int i = 0; i < providersCount; i++) + { + SetSignalProviderState(providers[i], state); + } + } + + // + string GetTag() + { + // + string result = NULL; + + // + result = + // + GetToken() + + "[" + + GetSymbol() + + "," + + ToString(GetPeriod()) + + "]" + // + ; + + // + return result; + } + + // + void GetMarketConditions( + X121MarketConditions &mConditions, // Market Conditions Result + int barIndex = 0 // Specified Bar Index + ) + { + // + mConditions.Clear(); + + // + CalculateConditions(mConditions, barIndex); + } + + // + // Check Market For Signal ... + bool HasSignal( + int barIndex, + XSignal &mSignal, // Hold's Signal if Exists ... + X121MarketConditions &mConditions // Hold's Market Conditions ... + ) + { + // + bool result = false; + + // + // Validate Enable Process ... + result = !CanIgnoreProcess(); + if (!result) + { + return result; + } + + // + mWaitsUntilNewBar = false; + + // + // Validate Enable Type of Signalling ... + result = mIsLongEnable || mIsShortEnable; + if (!result) + { + return result; + } + + // + // Now we Have to Pass the Conditions to Each Signal Provider + // for Retrieving Signals Based On them ... + + // + // Reading Market Conditions ... + GetMarketConditions(mConditions, barIndex); + AddScores(mConditions); + + // + int signalPusher = 0; + bool hasLong = false; + bool hasShort = false; + string provider = ""; + + // + double providedSL = 0; + double providedTP = 0; + double providedR2r = 0; + + // + // Long ... + if (mIsLongEnable) + { + // + signalPusher = 0; + + // + hasLong = HasSpecificSignal( + barIndex, + POSITION_TYPE_BUY, + provider, + signalPusher, + mConditions, + providedSL, + providedTP, + providedR2r // + ); + } + + // + // Short ... + if (mIsShortEnable) + { + // + signalPusher = 0; + + // + hasShort = HasSpecificSignal( + barIndex, + POSITION_TYPE_SELL, + provider, + signalPusher, + mConditions, + providedSL, + providedTP, + providedR2r // + ); + } + + // + result = hasLong || hasShort; + if (!result) + { + return result; + } + + // + // Validate Longs Use Common Conditions ... + + // + // if (hasLong) + // { + // // + // int pusher = 0; + // result = HasBaseLongConditions( + // mConditions, + // pusher // + // ); + + // // + // if (!result) + // { + // return result; + // } + // } + + // // + // if (hasShort) + // { + // // + // int pusher = 0; + // result = HasBaseShortConditions( + // mConditions, + // pusher // + // ); + + // // + // if (!result) + // { + // return result; + // } + // } + + // + // Prepare Signal ... + + // + if (result) + { + // + // Here We Have to Prepare Signal ... + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + double tpPoint = 60; + double slPoint = 30; + double volume = GetStaticVolume() * signalPusher; + double tpPrice = PointToPrice( + tpPoint, + symbol // + ); + double slPrice = PointToPrice( + slPoint, + symbol // + ); + ENUM_POSITION_TYPE type = hasLong + ? POSITION_TYPE_BUY + : POSITION_TYPE_SELL; + ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; + double entry = GetEntry( + symbol, + type // + ); + + // + double tp = 0; + double sl = 0; + + // + ENUM_X_SIGNAL_MANAGING_ACTIONS action = X_SIGNAL_USE_NOTHING; + + // + // TODO: Make Configurable ... + double r2r = providedR2r; + if (r2r <= 0) + { + r2r = 1.5; + } + + // + sl = 0; + tp = 0; + + // + // TP based on SL and Risk to Reward ... + if (providedSL > 0) + { + // + sl = providedSL; + + // + double risk = MathAbs(entry - sl); + + // + double reward = risk * r2r; + + // + tp = hasLong + ? entry + reward + : entry - reward; + } + else + // + // SL based on TP and Risk to Reward ... + if (providedTP > 0) + { + // + tp = providedTP; + + // + double reward = MathAbs(entry - tp); + + // + double risk = reward / r2r; + + // + sl = hasLong + ? entry - risk + : entry + risk; + } + + // + // TODOO: Remove this ... + sl = hasLong + ? GetMaxVales(true) + : GetMinPeaks(true); + double risk = MathAbs(entry - sl); + double reward = risk * r2r; + tp = hasLong + ? entry + reward + : entry - reward; + + // + result = mSignal.Prepare( + symbol, + provider, + period, + type, + mode, + entry, + volume, + action, + sl, + tp + // + ); + + // + // Generate Support Signal for Specified Provider ... + if (result && provider == ToString(PROVIDER_NONE)) + { + // + double cKijunSen = cMarket.ich.GetKijunSen(0); + double sKijunSen = sMarket.ich.GetKijunSen(0); + double mKijunSen = mMarket.ich.GetKijunSen(0); + double lKijunSen = lMarket.ich.GetKijunSen(0); + double hKijunSen = hMarket.ich.GetKijunSen(0); + + // + double kijunSens[] = { + cKijunSen, + sKijunSen, + mKijunSen, + lKijunSen, + hKijunSen // + }; + + // + double lesserKijun = FindLesserThan( + entry, + kijunSens, + true // + ); + + // + double biggerKijun = FindBiggerThan( + entry, + kijunSens, + true // + ); + + // + ENUM_POSITION_TYPE sType = + hasLong + ? POSITION_TYPE_SELL + : POSITION_TYPE_BUY; + + bool isLongS = IsLong(sType); + + // + double sEntry = + isLongS + ? biggerKijun + : lesserKijun; + + // + double peakMin = GetMinPeaks(true); + double peakMax = GetMinPeaks(true); + double valeMin = GetMaxVales(true); + double valeMax = GetMaxVales(true); + + // + double sTP = + isLongS + ? peakMin + : valeMax; + + // + double sSL = + isLongS + ? valeMin + : peakMax; + + // + double sVolume = mSignal.volume * 2; + + // + // Prepare ... + XSignal sSignal; + bool isValid = sSignal.Prepare( + mSignal.symbol, + mSignal.provider, + mSignal.period, + sType, + X_ORDER_MODE_STOP, + sEntry, + sVolume, + X_SIGNAL_USE_NOTHING, + sSL, + sTP // + ); + if (isValid) + { + // + AddRef( + sSignal, + mSignal.supports // + ); + } + } + + // + if (result) + { + mWaitsUntilNewBar = true; + } + } + + // + UpdateSupportsAndResistances(); + + // + return result; + } + + // + // Check for any Guards ... + bool HasGuard(XGuard &guards[]) + { + // + bool result = false; + + // + // Try to Find Support and Resistances if Configured ... + FindSupportAndResistances(); + + // + return result; + } + + // + // Tools ... + + // + void Draw() + { + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + ulong chID = FindChartID( + symbol, + period); + if (chID < 0) + { + return; + } + + // + int subWindow = 0; + + // + int offset = 0; + + // + cMarket.Draw(chID, subWindow, offset); + sMarket.Draw(chID, subWindow, offset); + mMarket.Draw(chID, subWindow, offset); + lMarket.Draw(chID, subWindow, offset); + hMarket.Draw(chID, subWindow, offset); + } + + // + // Support and Resistances ... + + // + int CountSupportResistances() + { + return ArraySize(mSupportResistances); + } + + // + bool GenerateSupRes( + XOHCLSupRes &supRes, // SupRes Instance ... + ENUM_POSITION_TYPE type, // Position Type ... + int count = 5, + double step = 0, + bool useAtrAsStep = true // + ) + { + // + bool result = false; + + // + if (count <= 0) + { + count = 1; + } + + // + if (step <= 0) + { + // + if (useAtrAsStep) + { + step = cMarket.osc.GetATR(0); + } + else + { + step = 0; + } + } + + // + supRes.Clean(); + + // + double price = GetExit( + GetSymbol(), + type // + ); + + // + result = supRes.Init( + price, + mSupportResistances, + count, + step // + ); + + // + return result; + } + + // + bool GenerateLongSupRes( + XOHCLSupRes &supRes, // SupRes Instance ... + int count = 5, + double step = 0, + bool useAtrAsStep = true // + ) + { + // + bool result = false; + + // + result = GenerateSupRes( + supRes, + POSITION_TYPE_BUY, + count, + step, + useAtrAsStep // + ); + + // + return result; + } + + // + bool GenerateShortSupRes( + XOHCLSupRes &supRes, // SupRes Instance ... + int count = 5, + double step = 0, + bool useAtrAsStep = true // + ) + { + // + bool result = false; + + // + result = GenerateSupRes( + supRes, + POSITION_TYPE_BUY, + count, + step, + useAtrAsStep // + ); + + // + return result; + } + + // + // Peask and Vales Finder ... + + // + void GetPeaks( + double &peaks[], + bool ignoreCurrent = false // + ) + { + // + Clean(peaks); + + // + // + double cPeak = cMarket.pv.GetPeak(0); + double sPeak = sMarket.pv.GetPeak(0); + double mPeak = mMarket.pv.GetPeak(0); + double lPeak = lMarket.pv.GetPeak(0); + double hPeak = hMarket.pv.GetPeak(0); + + // + double mPeaks[] = { + cPeak, + sPeak, + mPeak, + lPeak, + hPeak // + }; + + // + if (ignoreCurrent) + { + // + Remove( + cPeak, + mPeaks // + ); + } + + // + Copy( + mPeaks, + peaks // + ); + } + + // + void GetVales( + double &vales[], + bool ignoreCurrent = false // + ) + { + // + Clean(vales); + + // + double cVale = cMarket.pv.GetVale(0); + double sVale = sMarket.pv.GetVale(0); + double mVale = mMarket.pv.GetVale(0); + double lVale = lMarket.pv.GetVale(0); + double hVale = hMarket.pv.GetVale(0); + + // + double mVales[] = { + cVale, + sVale, + mVale, + lVale, + hVale // + }; + + // + if (ignoreCurrent) + { + // + Remove( + cVale, + mVales // + ); + } + + // + Copy( + mVales, + vales // + ); + } + + // + double GetMinPeaks(bool ignoreCurrent = false) + { + // + double peaks[]; + GetPeaks( + peaks, + ignoreCurrent // + ); + + // + double minPeak = GetMin(peaks); + double maxPeak = GetMax(peaks); + + // + return minPeak; + } + + // + double GetMaxPeaks(bool ignoreCurrent = false) + { + // + double peaks[]; + GetPeaks( + peaks, + ignoreCurrent // + ); + + // + double minPeak = GetMin(peaks); + double maxPeak = GetMax(peaks); + + // + return maxPeak; + } + + // + double GetMinVales(bool ignoreCurrent = false) + { + // + double vales[]; + GetVales( + vales, + ignoreCurrent // + ); + + // + double minVale = GetMin(vales); + double maxVale = GetMax(vales); + + // + return minVale; + } + + // + double GetMaxVales(bool ignoreCurrent = false) + { + // + double vales[]; + GetVales( + vales, + ignoreCurrent // + ); + + // + double minVale = GetMin(vales); + double maxVale = GetMax(vales); + + // + return maxVale; + } + + // + // Protected ... +protected: + // + X121ProviderInputs mInputs; + + // + // Support and Resistances ... + + // + // Check has Enough Support and Resistance ... + bool HasEnoughSupportAndResistance() + { + // + bool result = false; + + // + if (mNumberOfSRVerified <= 0 || + mMinRequiredSupportAndResistances <= 0) + { + result = true; + } + else + { + // + int currentSRsCount = CountSupportResistances(); + result = currentSRsCount >= mMinRequiredSupportAndResistances; + } + + // + return result; + } + + // + // Update Bar Index base Support and Resistances .... + void UpdateSupportsAndResistances( + int barIndex = 0 // + ) + { + // + if (mNumberOfSRVerified <= 0 || + mMinRequiredSupportAndResistances <= 0) + { + return; + } + + // + int before = CountSupportResistances(); + + // + // XICH ... + + // + // Current ... + + // + if (cMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified)) + { + // + double selectedKijunSen = cMarket.ich.GetKijunSen(barIndex); + AddSRValue(selectedKijunSen); + } + + // + if (cMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanA = cMarket.ich.GetSenkouSpanA(barIndex); + AddSRValue(selectedSenkouSpanA); + } + + // + if (cMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanB = cMarket.ich.GetSenkouSpanB(barIndex); + AddSRValue(selectedSenkouSpanB); + } + + // + // Short ... + + // + if (sMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified)) + { + // + double selectedKijunSen = sMarket.ich.GetKijunSen(barIndex); + AddSRValue(selectedKijunSen); + } + + // + if (sMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanA = sMarket.ich.GetSenkouSpanA(barIndex); + AddSRValue(selectedSenkouSpanA); + } + + // + if (sMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanB = sMarket.ich.GetSenkouSpanB(barIndex); + AddSRValue(selectedSenkouSpanB); + } + + // + // Medium ... + + // + if (mMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified)) + { + // + double selectedKijunSen = mMarket.ich.GetKijunSen(barIndex); + AddSRValue(selectedKijunSen); + } + + // + if (mMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanA = mMarket.ich.GetSenkouSpanA(barIndex); + AddSRValue(selectedSenkouSpanA); + } + + // + if (mMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanB = mMarket.ich.GetSenkouSpanB(barIndex); + AddSRValue(selectedSenkouSpanB); + } + + // + // Long ... + + // + if (lMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified)) + { + // + double selectedKijunSen = lMarket.ich.GetKijunSen(barIndex); + AddSRValue(selectedKijunSen); + } + + // + if (lMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanA = lMarket.ich.GetSenkouSpanA(barIndex); + AddSRValue(selectedSenkouSpanA); + } + + // + if (lMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanB = lMarket.ich.GetSenkouSpanB(barIndex); + AddSRValue(selectedSenkouSpanB); + } + + // + // Hind ... + + // + if (hMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified)) + { + // + double selectedKijunSen = hMarket.ich.GetKijunSen(barIndex); + AddSRValue(selectedKijunSen); + } + + // + if (hMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanA = hMarket.ich.GetSenkouSpanA(barIndex); + AddSRValue(selectedSenkouSpanA); + } + + // + if (hMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified)) + { + // + double selectedSenkouSpanB = hMarket.ich.GetSenkouSpanB(barIndex); + AddSRValue(selectedSenkouSpanB); + } + + // + // XDON ... + + // + // Short Market ... + + // + if (sMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperO = sMarket.don.GetUpperO(barIndex); + AddSRValue(selectedUpperO); + } + + // + if (sMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerO = sMarket.don.GetLowerO(barIndex); + AddSRValue(selectedLowerO); + } + + // + if (sMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperC = sMarket.don.GetUpperC(barIndex); + AddSRValue(selectedUpperC); + } + + // + if (sMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerC = sMarket.don.GetLowerC(barIndex); + AddSRValue(selectedLowerC); + } + + // + if (sMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperH = sMarket.don.GetUpperH(barIndex); + AddSRValue(selectedUpperH); + } + + // + if (sMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerH = sMarket.don.GetLowerH(barIndex); + AddSRValue(selectedLowerH); + } + + // + if (sMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperL = sMarket.don.GetUpperL(barIndex); + AddSRValue(selectedUpperL); + } + + // + if (sMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerL = sMarket.don.GetLowerL(barIndex); + AddSRValue(selectedLowerL); + } + + // + // Medium Market ... + + // + if (mMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperO = mMarket.don.GetUpperO(barIndex); + AddSRValue(selectedUpperO); + } + + // + if (mMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerO = mMarket.don.GetLowerO(barIndex); + AddSRValue(selectedLowerO); + } + + // + if (mMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperC = mMarket.don.GetUpperC(barIndex); + AddSRValue(selectedUpperC); + } + + // + if (mMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerC = mMarket.don.GetLowerC(barIndex); + AddSRValue(selectedLowerC); + } + + // + if (mMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperH = mMarket.don.GetUpperH(barIndex); + AddSRValue(selectedUpperH); + } + + // + if (mMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerH = mMarket.don.GetLowerH(barIndex); + AddSRValue(selectedLowerH); + } + + // + if (mMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperL = mMarket.don.GetUpperL(barIndex); + AddSRValue(selectedUpperL); + } + + // + if (mMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerL = mMarket.don.GetLowerL(barIndex); + AddSRValue(selectedLowerL); + } + + // + // Long Market ... + + // + if (lMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperO = lMarket.don.GetUpperO(barIndex); + AddSRValue(selectedUpperO); + } + + // + if (lMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerO = lMarket.don.GetLowerO(barIndex); + AddSRValue(selectedLowerO); + } + + // + if (lMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperC = lMarket.don.GetUpperC(barIndex); + AddSRValue(selectedUpperC); + } + + // + if (lMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerC = lMarket.don.GetLowerC(barIndex); + AddSRValue(selectedLowerC); + } + + // + if (lMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperH = lMarket.don.GetUpperH(barIndex); + AddSRValue(selectedUpperH); + } + + // + if (lMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerH = lMarket.don.GetLowerH(barIndex); + AddSRValue(selectedLowerH); + } + + // + if (lMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperL = lMarket.don.GetUpperL(barIndex); + AddSRValue(selectedUpperL); + } + + // + if (lMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerL = lMarket.don.GetLowerL(barIndex); + AddSRValue(selectedLowerL); + } + + // + // Hind Market ... + + // + if (hMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperO = hMarket.don.GetUpperO(barIndex); + AddSRValue(selectedUpperO); + } + + // + if (hMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerO = hMarket.don.GetLowerO(barIndex); + AddSRValue(selectedLowerO); + } + + // + if (hMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperC = hMarket.don.GetUpperC(barIndex); + AddSRValue(selectedUpperC); + } + + // + if (hMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerC = hMarket.don.GetLowerC(barIndex); + AddSRValue(selectedLowerC); + } + + // + if (hMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperH = hMarket.don.GetUpperH(barIndex); + AddSRValue(selectedUpperH); + } + + // + if (hMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerH = hMarket.don.GetLowerH(barIndex); + AddSRValue(selectedLowerH); + } + + // + if (hMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified)) + { + // + double selectedUpperL = hMarket.don.GetUpperL(barIndex); + AddSRValue(selectedUpperL); + } + + // + if (hMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLowerL = hMarket.don.GetLowerL(barIndex); + AddSRValue(selectedLowerL); + } + + // + // XPV ... + + // + // Short Market ... + + // + if (sMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified)) + { + // + double selectedPeak = sMarket.pv.GetPeak(barIndex); + AddSRValue(selectedPeak); + } + + // + if (sMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified)) + { + // + double selectedVale = sMarket.pv.GetVale(barIndex); + AddSRValue(selectedVale); + } + + // + if (sMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib1 = sMarket.pv.GetFib1(barIndex); + AddSRValue(selectedFib1); + } + + // + if (sMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib2 = sMarket.pv.GetFib2(barIndex); + AddSRValue(selectedFib2); + } + + // + if (sMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib3 = sMarket.pv.GetFib3(barIndex); + AddSRValue(selectedFib3); + } + + // + if (sMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib4 = sMarket.pv.GetFib4(barIndex); + AddSRValue(selectedFib4); + } + + // + if (sMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib5 = sMarket.pv.GetFib5(barIndex); + AddSRValue(selectedFib5); + } + + // + if (sMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCHH = sMarket.pv.GetSCHH(barIndex); + AddSRValue(selectedSCHH); + } + + // + if (sMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCLL = sMarket.pv.GetSCLL(barIndex); + AddSRValue(selectedSCLL); + } + + // + if (sMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCHH = sMarket.pv.GetMCHH(barIndex); + AddSRValue(selectedMCHH); + } + + // + if (sMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCLL = sMarket.pv.GetMCLL(barIndex); + AddSRValue(selectedMCLL); + } + + // + if (sMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCHH = sMarket.pv.GetLCHH(barIndex); + AddSRValue(selectedLCHH); + } + + // + if (sMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCLL = sMarket.pv.GetLCLL(barIndex); + AddSRValue(selectedLCLL); + } + + // + if (sMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCHH = sMarket.pv.GetHCHH(barIndex); + AddSRValue(selectedHCHH); + } + + // + if (sMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCLL = sMarket.pv.GetHCLL(barIndex); + AddSRValue(selectedHCLL); + } + + // + // Medium Market ... + + // + if (mMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified)) + { + // + double selectedPeak = mMarket.pv.GetPeak(barIndex); + AddSRValue(selectedPeak); + } + + // + if (mMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified)) + { + // + double selectedVale = mMarket.pv.GetVale(barIndex); + AddSRValue(selectedVale); + } + + // + if (mMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib1 = mMarket.pv.GetFib1(barIndex); + AddSRValue(selectedFib1); + } + + // + if (mMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib2 = mMarket.pv.GetFib2(barIndex); + AddSRValue(selectedFib2); + } + + // + if (mMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib3 = mMarket.pv.GetFib3(barIndex); + AddSRValue(selectedFib3); + } + + // + if (mMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib4 = mMarket.pv.GetFib4(barIndex); + AddSRValue(selectedFib4); + } + + // + if (mMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib5 = mMarket.pv.GetFib5(barIndex); + AddSRValue(selectedFib5); + } + + // + if (mMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCHH = mMarket.pv.GetSCHH(barIndex); + AddSRValue(selectedSCHH); + } + + // + if (mMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCLL = mMarket.pv.GetSCLL(barIndex); + AddSRValue(selectedSCLL); + } + + // + if (mMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCHH = mMarket.pv.GetMCHH(barIndex); + AddSRValue(selectedMCHH); + } + + // + if (mMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCLL = mMarket.pv.GetMCLL(barIndex); + AddSRValue(selectedMCLL); + } + + // + if (mMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCHH = mMarket.pv.GetLCHH(barIndex); + AddSRValue(selectedLCHH); + } + + // + if (mMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCLL = mMarket.pv.GetLCLL(barIndex); + AddSRValue(selectedLCLL); + } + + // + if (mMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCHH = mMarket.pv.GetHCHH(barIndex); + AddSRValue(selectedHCHH); + } + + // + if (mMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCLL = mMarket.pv.GetHCLL(barIndex); + AddSRValue(selectedHCLL); + } + + // + // Long Market ... + + // + if (lMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified)) + { + // + double selectedPeak = lMarket.pv.GetPeak(barIndex); + AddSRValue(selectedPeak); + } + + // + if (lMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified)) + { + // + double selectedVale = lMarket.pv.GetVale(barIndex); + AddSRValue(selectedVale); + } + + // + if (lMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib1 = lMarket.pv.GetFib1(barIndex); + AddSRValue(selectedFib1); + } + + // + if (lMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib2 = lMarket.pv.GetFib2(barIndex); + AddSRValue(selectedFib2); + } + + // + if (lMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib3 = lMarket.pv.GetFib3(barIndex); + AddSRValue(selectedFib3); + } + + // + if (lMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib4 = lMarket.pv.GetFib4(barIndex); + AddSRValue(selectedFib4); + } + + // + if (lMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib5 = lMarket.pv.GetFib5(barIndex); + AddSRValue(selectedFib5); + } + + // + if (lMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCHH = lMarket.pv.GetSCHH(barIndex); + AddSRValue(selectedSCHH); + } + + // + if (lMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCLL = lMarket.pv.GetSCLL(barIndex); + AddSRValue(selectedSCLL); + } + + // + if (lMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCHH = lMarket.pv.GetMCHH(barIndex); + AddSRValue(selectedMCHH); + } + + // + if (lMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCLL = lMarket.pv.GetMCLL(barIndex); + AddSRValue(selectedMCLL); + } + + // + if (lMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCHH = lMarket.pv.GetLCHH(barIndex); + AddSRValue(selectedLCHH); + } + + // + if (lMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCLL = lMarket.pv.GetLCLL(barIndex); + AddSRValue(selectedLCLL); + } + + // + if (lMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCHH = lMarket.pv.GetHCHH(barIndex); + AddSRValue(selectedHCHH); + } + + // + if (lMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCLL = lMarket.pv.GetHCLL(barIndex); + AddSRValue(selectedHCLL); + } + + // + // Hind Market ... + + // + if (hMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified)) + { + // + double selectedPeak = hMarket.pv.GetPeak(barIndex); + AddSRValue(selectedPeak); + } + + // + if (hMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified)) + { + // + double selectedVale = hMarket.pv.GetVale(barIndex); + AddSRValue(selectedVale); + } + + // + if (hMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib1 = hMarket.pv.GetFib1(barIndex); + AddSRValue(selectedFib1); + } + + // + if (hMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib2 = hMarket.pv.GetFib2(barIndex); + AddSRValue(selectedFib2); + } + + // + if (hMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib3 = hMarket.pv.GetFib3(barIndex); + AddSRValue(selectedFib3); + } + + // + if (hMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib4 = hMarket.pv.GetFib4(barIndex); + AddSRValue(selectedFib4); + } + + // + if (hMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified)) + { + // + double selectedFib5 = hMarket.pv.GetFib5(barIndex); + AddSRValue(selectedFib5); + } + + // + if (hMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCHH = hMarket.pv.GetSCHH(barIndex); + AddSRValue(selectedSCHH); + } + + // + if (hMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedSCLL = hMarket.pv.GetSCLL(barIndex); + AddSRValue(selectedSCLL); + } + + // + if (hMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCHH = hMarket.pv.GetMCHH(barIndex); + AddSRValue(selectedMCHH); + } + + // + if (hMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedMCLL = hMarket.pv.GetMCLL(barIndex); + AddSRValue(selectedMCLL); + } + + // + if (hMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCHH = hMarket.pv.GetLCHH(barIndex); + AddSRValue(selectedLCHH); + } + + // + if (hMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedLCLL = hMarket.pv.GetLCLL(barIndex); + AddSRValue(selectedLCLL); + } + + // + if (hMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCHH = hMarket.pv.GetHCHH(barIndex); + AddSRValue(selectedHCHH); + } + + // + if (hMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified)) + { + // + double selectedHCLL = hMarket.pv.GetHCLL(barIndex); + AddSRValue(selectedHCLL); + } + + // + // Add Candelstick Pivots ... + + // + // XOHCL sPBar = sMarket.GetBar(barIndex + 1); + // AddSRValue(sPBar); + + // + XOHCL mPBar = mMarket.GetBar(barIndex + 1); + AddSRValue(mPBar); + + // + XOHCL lPBar = lMarket.GetBar(barIndex + 1); + AddSRValue(lPBar); + + // + XOHCL hPBar = hMarket.GetBar(barIndex + 1); + AddSRValue(hPBar); + + // + int after = CountSupportResistances(); + + // + if (after > before) + { + // + string message = "Found: " + ToString(after - before) + " new Pivot for " + GetSymbol() + " ..."; + Print(message); + } + } + + // + void FindSupportAndResistances() + { + // + bool hasEnough = HasEnoughSupportAndResistance(); + if (hasEnough) + { + // + // if (IsNewBar()) + // { + // UpdateSupportsAndResistances(); + // } + return; + } + + // + int idx = 0; + while (!HasEnoughSupportAndResistance()) + { + // + UpdateSupportsAndResistances(idx); + + // + if (HasEnoughSupportAndResistance()) + { + break; + } + + // + idx += 50; + + // + // Print("idx: " + ToString(idx) + ", Count: " + ToString(CountSupportResistances())); + Print("Pivots: " + ToString(CountSupportResistances())); + } + } + + // + void AddSRValue(double value) + { + // + if (value <= 0) + { + return; + } + + // + AddIfNotExists( + value, + mSupportResistances // + ); + } + + // + void AddSRValue(XOHCL &bar) + { + // + if (!bar.IsValid()) + { + return; + } + + // + AddSRValue(bar.open); + AddSRValue(bar.high); + AddSRValue(bar.close); + AddSRValue(bar.low); + } + + // + // Private ... +private: + // + // Props ... + + // + int mNumberOfItems; // Number of Buffer Ites Read in Conditions ... + + // + // Support and Resistance ... + + // + int mNumberOfSRVerified; // Number of Verifications for Selecting Support and Resistances ... + + // + int mMinRequiredSupportAndResistances; // Minimum Requirement Supports and Resistances ... + + // + double mSupportResistances[]; // Holds Supports and Resistances ... + + // + // Bullish and Bearish Scores ... + + // + double mBullishScore[]; + double mBearishScore[]; + + // + // Store Market Conditions Scores ... + void AddScores(X121MarketConditions &conditions) + { + // + static datetime lasrScoreAdded = NULL; + ENUM_TIMEFRAMES mPeriod = GetPeriod(); + int seconds = PeriodSeconds(mPeriod); + datetime cTime = TimeCurrent(); + int dateDiff = (int)cTime - (int)lasrScoreAdded; + bool canDo = + // + lasrScoreAdded == NULL + ? true + : dateDiff >= seconds + // + ; + if (!canDo) + { + return; + } + + // + lasrScoreAdded = cTime; + + // + double bullishScore = 0; + double bearishScore = 0; + conditions.GenerateScore( + bullishScore, + bearishScore // + ); + + // + ArraySetAsSeries(mBullishScore, false); + ArraySetAsSeries(mBearishScore, false); + + // + Add( + bullishScore, + mBullishScore // + ); + + // + Add( + bearishScore, + mBearishScore // + ); + + // + ArraySetAsSeries(mBullishScore, true); + ArraySetAsSeries(mBearishScore, true); + } + + // + // Find Bullish Score Averages ... + double GetBullishScoreAverage( + int start = 0, + int count = 7 // + ) + { + // + return GetAverage( + mBullishScore, + start, + count // + ); + } + + // + // Find Bullish Scores Max Value ... + double GetBullishScoreMax( + int start = 0, + int count = 71 // + ) + { + // + return GetMax( + mBullishScore, + start, + count // + ); + } + + // + // Find Bullish Scores Min Value ... + double GetBullishScoreMin( + int start = 0, + int count = 71 // + ) + { + // + return GetMin( + mBullishScore, + start, + count // + ); + } + + // + // Find Bearish Score Averages ... + double GetBearishScoreAverage( + int start = 0, + int count = 7 // + ) + { + // + return GetAverage( + mBearishScore, + start, + count // + ); + } + + // + // Find Bearish Scores Max Value ... + double GetBearishScoreMax( + int start = 0, + int count = 71 // + ) + { + // + return GetMax( + mBearishScore, + start, + count // + ); + } + + // + // Find Bearish Scores Min Value ... + double GetBearishScoreMin( + int start = 0, + int count = 71 // + ) + { + // + return GetMin( + mBearishScore, + start, + count // + ); + } + + // + bool IsScorePassedForLong() + { + // + double bullishScore = mBullishScore[0]; + double bullishScoreAVG7 = GetBullishScoreAverage(0, 7); + + // + double bearishScore = mBearishScore[0]; + double bearishScoreAVG7 = GetBearishScoreAverage(0, 7); + + // + bool result = + // + ArraySize(mBullishScore) >= 7 && + ArraySize(mBearishScore) >= 7 && + bullishScore > bearishScore && + bullishScore > mBullishScore[1] && + bullishScore > bullishScoreAVG7 && + bearishScore < bearishScoreAVG7 + // + ; + + // + return result; + } + + // + bool IsScorePassedForShort() + { + + // + double bullishScore = mBullishScore[0]; + double bullishScoreAVG7 = GetBullishScoreAverage(0, 7); + + // + double bearishScore = mBearishScore[0]; + double bearishScoreAVG7 = GetBearishScoreAverage(0, 7); + + // + bool result = + // + ArraySize(mBullishScore) >= 7 && + ArraySize(mBearishScore) >= 7 && + bearishScore > bullishScore && + bearishScore > mBearishScore[1] && + bearishScore > bearishScoreAVG7 && + bullishScore < bullishScoreAVG7 + // + ; + + // + return result; + } + + // + // Signallers ... + + // + bool mIsLongEnable; + bool mIsShortEnable; + + // + bool mIsXSPSignalProviderEnable; + bool mIsX128SignalProviderEnable; + bool mIsX92SignalProviderEnable; + bool mIsX786SignalProviderEnable; + bool mIsX121SignalProviderEnable; + bool mIsX110SignalProviderEnable; + bool mIsXTESTSignalProviderEnable; + bool mIsXTDSignalProviderEnable; + bool mIsXTAMSignalProviderEnable; + bool mIsXSISignalProviderEnable; + bool mIsXTSFISignalProviderEnable; + bool mIsXOBDLHSignalProviderEnable; + bool mIsXCHMACCSignalProviderEnable; + bool mIsXCHMAMNSignalProviderEnable; + bool mIsXCHMAMXSignalProviderEnable; + + // + // + // Detect Signal ... + bool HasSpecificSignal( + int barIndex, // Specified Bar Index ... + ENUM_POSITION_TYPE mType, // Specific Signal Type ... + string &provider, // Signal Provider ... + int &signalPusher, // Number Of Same Time Signals ... + X121MarketConditions &mConditions, // Specified Market Conition ... + double &providedSL, + double &providedTP, + double &providedR2r // + ) + { + // + bool result = false; + + // + // Validate Signal Type is Enables ... + bool isLong = IsLong(mType); + result = + (isLong && mIsLongEnable) || + (!isLong && mIsShortEnable); + if (!result) + { + return result; + } + + // + // Now we have to Filter based on Enabled Signal Providers ... + + // + // Long ... + if (isLong && mIsLongEnable) + { + // + XSignal lSignal; + + // + signalPusher = 0; + + // + bool hasXSPSignal = false; + bool hasXTESTSignal = false; + bool hasX786Signal = false; + bool hasX121Signal = false; + bool hasX110Signal = false; + bool hasX92Signal = false; + bool hasX128Signal = false; + bool hasXTDSignal = false; + bool hasXTAMSignal = false; + bool hasXSISignal = false; + bool hasXTSFISignal = false; + bool hasXOBDLHSignal = false; + bool hasXCHMACCSignal = false; + bool hasXCHMAMNSignal = false; + bool hasXCHMAMXSignal = false; + + // + // XPS ... + if (mIsXSPSignalProviderEnable) + { + // + hasXSPSignal = XSPHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXSPSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XSP); + } + + // + signalPusher++; + } + } + + // + // XTEST ... + if (mIsXTESTSignalProviderEnable) + { + // + hasXTESTSignal = XTESTHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTESTSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTEST); + } + + // + signalPusher++; + } + } + + // + // X786 ... + if (mIsX786SignalProviderEnable) + { + // + hasX786Signal = X786HasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX786Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X786); + } + + // + signalPusher++; + } + } + + // + // X121 ... + if (mIsX121SignalProviderEnable) + { + // + hasX121Signal = X121HasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX121Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X121); + } + + // + signalPusher++; + } + } + + // + // X110 ... + if (mIsX110SignalProviderEnable) + { + // + hasX110Signal = X110HasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX110Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X110); + } + + // + signalPusher++; + } + } + + // + // X92 ... + if (mIsX92SignalProviderEnable) + { + // + hasX92Signal = X92HasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX92Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X92); + } + + // + signalPusher++; + } + } + + // + // X128 ... + if (mIsX128SignalProviderEnable) + { + // + hasX128Signal = X128HasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX128Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X128); + } + + // + signalPusher++; + } + } + + // + // XTD ... + if (mIsXTDSignalProviderEnable) + { + // + hasXTDSignal = XTDHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTDSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTD); + } + + // + signalPusher++; + } + } + + // + // XTAM ... + if (mIsXTAMSignalProviderEnable) + { + // + hasXTAMSignal = XTAMHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTAMSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTAM); + } + + // + signalPusher++; + } + } + + // + // XSI ... + if (mIsXSISignalProviderEnable) + { + // + hasXSISignal = XSIHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXSISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XSI); + } + + // + signalPusher++; + } + } + + // + // XTSFI ... + if (mIsXTSFISignalProviderEnable) + { + // + hasXTSFISignal = XTSFIHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTSFISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTSFI); + } + + // + signalPusher++; + } + } + + // + // XOBDLH ... + if (mIsXOBDLHSignalProviderEnable) + { + // + hasXOBDLHSignal = XOBDLHHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXOBDLHSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XOBDLH); + } + + // + signalPusher++; + } + } + + // + // XCHMACC ... + if (mIsXCHMACCSignalProviderEnable) + { + // + hasXCHMACCSignal = XCHMACCHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXCHMACCSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMACC); + } + + // + signalPusher++; + } + } + + // + // XCHMAMN ... + if (mIsXCHMAMNSignalProviderEnable) + { + // + hasXCHMAMNSignal = XCHMAMNHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXCHMAMNSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMN); + } + + // + signalPusher++; + } + } + + // + // XCHMAMX ... + if (mIsXCHMAMXSignalProviderEnable) + { + // + hasXCHMAMXSignal = XCHMAMXHasSpecifiedLongSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXCHMAMXSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMX); + } + + // + signalPusher++; + } + } + + // + result = + // + hasXSPSignal + // + || + // + hasXTESTSignal + // + || + // + hasX786Signal + // + || + // + hasX121Signal + // + || + // + hasX110Signal + // + || + // + hasX92Signal + // + || + // + hasX128Signal + // + ; + + // + if (result) + { + return result; + } + } + + // + // Short ... + if (!isLong && mIsShortEnable) + { + // + XSignal sSignal; + + // + signalPusher = 0; + + // + bool hasXSPSignal = false; + bool hasXTESTSignal = false; + bool hasX786Signal = false; + bool hasX121Signal = false; + bool hasX110Signal = false; + bool hasX92Signal = false; + bool hasX128Signal = false; + bool hasXTDSignal = false; + bool hasXTAMSignal = false; + bool hasXSISignal = false; + bool hasXTSFISignal = false; + bool hasXOBDLHSignal = false; + bool hasXCHMACCSignal = false; + bool hasXCHMAMNSignal = false; + bool hasXCHMAMXSignal = false; + + // + // XSP ... + if (mIsXSPSignalProviderEnable) + { + // + hasXSPSignal = XSPHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXSPSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XSP); + } + + // + signalPusher++; + } + } + + // + // XTEST ... + if (mIsXTESTSignalProviderEnable) + { + // + hasXTESTSignal = XTESTHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTESTSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTEST); + } + + // + signalPusher++; + } + } + + // + // X786 ... + if (mIsX786SignalProviderEnable) + { + // + hasX786Signal = X786HasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX786Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X786); + } + + // + signalPusher++; + } + } + + // + // X121 ... + if (mIsX121SignalProviderEnable) + { + // + hasX121Signal = X121HasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX121Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X121); + } + + // + signalPusher++; + } + } + + // + // X110 ... + if (mIsX110SignalProviderEnable) + { + // + hasX110Signal = X110HasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX110Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X110); + } + + // + signalPusher++; + } + } + + // + // X92 ... + if (mIsX92SignalProviderEnable) + { + // + hasX92Signal = X92HasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX92Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X92); + } + + // + signalPusher++; + } + } + + // + // X128 ... + if (mIsX128SignalProviderEnable) + { + // + hasX128Signal = X128HasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasX128Signal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X128); + } + + // + signalPusher++; + } + } + + // + // XTD ... + if (mIsXTDSignalProviderEnable) + { + // + hasXTDSignal = XTDHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTDSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTD); + } + + // + signalPusher++; + } + } + + // + // XTAM ... + if (mIsXTAMSignalProviderEnable) + { + // + hasXTAMSignal = XTAMHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTAMSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTAM); + } + + // + signalPusher++; + } + } + + // + // XSI ... + if (mIsXSISignalProviderEnable) + { + // + hasXSISignal = XSIHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXSISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XSI); + } + + // + signalPusher++; + } + } + + // + // XTSFI ... + if (mIsXTSFISignalProviderEnable) + { + // + hasXTSFISignal = XTSFIHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXTSFISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTSFI); + } + + // + signalPusher++; + } + } + + // + // XOBDLH ... + if (mIsXOBDLHSignalProviderEnable) + { + // + hasXOBDLHSignal = XOBDLHHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXOBDLHSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XOBDLH); + } + + // + signalPusher++; + } + } + + // + // XCHMACC ... + if (mIsXCHMACCSignalProviderEnable) + { + // + hasXCHMACCSignal = XCHMACCHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXCHMACCSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMACC); + } + + // + signalPusher++; + } + } + + // + // XCHMAMN ... + if (mIsXCHMAMNSignalProviderEnable) + { + // + hasXCHMAMNSignal = XCHMAMNHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXCHMAMNSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMN); + } + + // + signalPusher++; + } + } + + // + // XCHMAMX ... + if (mIsXCHMAMXSignalProviderEnable) + { + // + hasXCHMAMXSignal = XCHMAMXHasSpecifiedShortSignal( + mConditions, + providedSL, + providedTP, + providedR2r // + ); + + // + if (hasXCHMAMXSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMX); + } + + // + signalPusher++; + } + } + + // + result = + // + hasXSPSignal + // + || + // + hasXTESTSignal + // + || + // + hasX786Signal + // + || + // + hasX121Signal + // + || + // + hasX110Signal + // + || + // + hasX92Signal + // + || + // + hasX128Signal + // + || + // + hasXTDSignal + // + || + // + hasXTAMSignal + // + || + // + hasXSISignal + // + || + // + hasXTSFISignal + // + || + // + hasXOBDLHSignal + // + || + // + hasXCHMACCSignal + // + || + // + hasXCHMAMNSignal + // + || + // + hasXCHMAMXSignal + // + ; + + // + if (result) + { + return result; + } + } + + // + return result; + } + + // + void CalculateConditions( + X121MarketConditions &mConditions, // Market Conditions Result + int barIndex = 0 // Specified Bar Index + ) + { + // + mConditions.Clear(); + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex >= CountBars()) + { + barIndex = CountBars() + 2; + } + + // + int curr = barIndex + 1; + int prev = curr + 1; + int mLength = 10; + int mFrom = curr + mLength; + + // + mConditions.symbol = GetSymbol(); + mConditions.period = GetPeriod(); + mConditions.time = iTime( + mConditions.symbol, + mConditions.period, + barIndex // + ); + + // + GetBars( + mConditions.bars, + mConditions.symbol, + mConditions.period, + barIndex, + mNumberOfItems // + ); + + // + // Current Market Specified ... + + // + // XTM ... + tmHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.tms); + // + mConditions.isXTMPeak = IsIncreasing( + mFrom, + curr, + mConditions.tms); + + // + mConditions.isXTMVale = IsDecreasing( + mFrom, + curr, + mConditions.tms); + + // + mConditions.isXTMBullish = mConditions.bars[curr].low > mConditions.tms[curr]; + bool isXTMBullishPrev = mConditions.bars[prev].low > mConditions.tms[prev]; + + // + mConditions.isXTMBearish = mConditions.bars[curr].high < mConditions.tms[curr]; + bool isXTMBearishPrev = mConditions.bars[prev].high < mConditions.tms[prev]; + + // + mConditions.isXTMNeutural = !mConditions.isXTMBullish && !mConditions.isXTMBearish; + bool isXTMNeuturalPrev = !isXTMBullishPrev && !isXTMBearishPrev; + + // + mConditions.isXTMEndBullish = + // + !mConditions.isXTMBullish && + isXTMBullishPrev + // + ; + + // + mConditions.isXTMEndBearish = + // + !mConditions.isXTMBearish && + isXTMBearishPrev + // + ; + + // + mConditions.isXTMStartBullish = + // + mConditions.isXTMBullish && + !isXTMBullishPrev + // + ; + + // + mConditions.isXTMStartBearish = + // + mConditions.isXTMBearish && + !isXTMBearishPrev + // + ; + + // + mConditions.isXTMEndBullishByNeutural = + // + mConditions.isXTMNeutural && + isXTMBullishPrev + // + ; + + // + mConditions.isXTMEndBearishByNeutural = + // + mConditions.isXTMNeutural && + isXTMBearishPrev + // + ; + + // + mConditions.isXTMStartBullishAfterNeutural = + // + mConditions.isXTMBullish && + isXTMNeuturalPrev + // + ; + + // + mConditions.isXTMStartBearishAfterNeutural = + // + mConditions.isXTMBearish && + isXTMNeuturalPrev + // + ; + + // + // XAMA ... + amaHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.amas); + + // + mConditions.isXAMAPeak = IsIncreasing( + mFrom, + curr, + mConditions.amas); + + // + mConditions.isXAMAVale = IsDecreasing( + mFrom, + curr, + mConditions.amas); + + // + mConditions.isXAMABullish = mConditions.bars[curr].low > mConditions.amas[curr]; + bool isXAMABullishPrev = mConditions.bars[prev].low > mConditions.amas[prev]; + + // + mConditions.isXAMABearish = mConditions.bars[curr].high < mConditions.amas[curr]; + bool isXAMABearishPrev = mConditions.bars[prev].high < mConditions.amas[prev]; + + // + mConditions.isXAMANeutural = !mConditions.isXAMABullish && !mConditions.isXAMABearish; + bool isXAMANeuturalPrev = !isXAMABullishPrev && !isXAMABearishPrev; + + // + mConditions.isXAMAEndBullish = + // + !mConditions.isXAMABullish && + isXAMABullishPrev + // + ; + + // + mConditions.isXAMAEndBearish = + // + !mConditions.isXAMABearish && + isXAMABearishPrev + // + ; + + // + mConditions.isXAMAStartBullish = + // + mConditions.isXAMABullish && + !isXAMABullishPrev + // + ; + + // + mConditions.isXAMAStartBearish = + // + mConditions.isXAMABearish && + !isXAMABearishPrev + // + ; + + // + mConditions.isXAMAEndBullishByNeutural = + // + mConditions.isXAMANeutural && + isXAMABullishPrev + // + ; + + // + mConditions.isXAMAEndBearishByNeutural = + // + mConditions.isXAMANeutural && + isXAMABearishPrev + // + ; + + // + mConditions.isXAMAStartBullishAfterNeutural = + // + mConditions.isXAMABullish && + isXAMANeuturalPrev + // + ; + + // + mConditions.isXAMAStartBearishAfterNeutural = + // + mConditions.isXAMABearish && + isXAMANeuturalPrev + // + ; + + // + // XFI ... + fiHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.fis); + + // + mConditions.isXFIPeak = IsIncreasing( + mFrom, + curr, + mConditions.fis); + + // + mConditions.isXFIVale = IsDecreasing( + mFrom, + curr, + mConditions.fis); + + // + mConditions.isXFIOverZero = mConditions.fis[curr] > 0; + + // + mConditions.isXFICrossedOverZero = + // + mConditions.isXFIOverZero && + mConditions.fis[prev] <= 0 + // + ; + + // + mConditions.isXFIUnderZero = mConditions.fis[curr] < 0; + + // + mConditions.isXFICrossedUnderZero = + // + mConditions.isXFIUnderZero && + mConditions.fis[prev] >= 0 + // + ; + + // + // XOBD ... + obdHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.obds); + + // + mConditions.isXOBDSwingLow = mConditions.obds[curr] == X_SWING_LOW; + mConditions.isXOBDSwingHigh = mConditions.obds[curr] == X_SWING_HIGH; + + // + // XRSI ... + rsiHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.rsis); + + // + double shortEntryValue = mInputs.rsiInputs.shortEntryValue; + double shortExitValue = mInputs.rsiInputs.shortExitValue; + double longEntryValue = mInputs.rsiInputs.longEntryValue; + double longExitValue = mInputs.rsiInputs.longExitValue; + + // + mConditions.isXRSIPeak = IsIncreasing( + mFrom, + curr, + mConditions.rsis); + + // + mConditions.isXRSIVale = IsDecreasing( + mFrom, + curr, + mConditions.rsis); + + // + mConditions.isXRSICrossedOverLongExit = + // + mConditions.rsis[curr] > longExitValue && + mConditions.rsis[prev] <= longExitValue; + // + ; + + // + mConditions.isXRSICrossedOverLongEntry = + // + mConditions.rsis[curr] > longEntryValue && + mConditions.rsis[prev] <= longEntryValue; + // + ; + + // + mConditions.isXRSICrossedUnderShortExit = + // + mConditions.rsis[curr] < shortExitValue && + mConditions.rsis[prev] >= shortExitValue; + // + ; + + // + mConditions.isXRSICrossedUnderShortEntry = + // + mConditions.rsis[curr] < shortEntryValue && + mConditions.rsis[prev] >= shortEntryValue; + // + ; + + // + // XLH ... + + // + // HH ... + lhHelper.CopyHH( + barIndex, + mNumberOfItems, + mConditions.lhHhs); + + // + // LL ... + lhHelper.CopyLL( + barIndex, + mNumberOfItems, + mConditions.lhLls); + + // + // Signal ... + lhHelper.CopySignal( + barIndex, + mNumberOfItems, + mConditions.lhSignals); + + // + mConditions.isXLHHHIncreased = IsIncreasing( + mFrom, + curr, + mConditions.lhHhs); + + // + mConditions.isXLHHHDecreased = IsDecreasing( + mFrom, + curr, + mConditions.lhHhs); + + // + mConditions.isXLHLLIncreased = IsIncreasing( + mFrom, + curr, + mConditions.lhLls); + + // + mConditions.isXLHLLDecreased = IsDecreasing( + mFrom, + curr, + mConditions.lhLls); + + // + mConditions.isXLHLowAttachedLL = mConditions.bars[curr].low == mConditions.lhLls[curr]; + + // + mConditions.isXLHHighAttachedHH = mConditions.bars[curr].high == mConditions.lhHhs[curr]; + ; + + // + mConditions.isXLHHHSameInLength = IsSame(mConditions.lhHhs); + + // + mConditions.isXLHLLSameInLength = IsSame(mConditions.lhLls); + + // + mConditions.isXLHPriceOverSignal = mConditions.bars[curr].low > mConditions.lhSignals[curr]; + + // + mConditions.isXLHPriceUnderSignal = mConditions.bars[curr].high < mConditions.lhSignals[curr]; + + // + mConditions.isXLHPriceInSignalRange = !mConditions.isXLHPriceOverSignal && !mConditions.isXLHPriceUnderSignal; + + // + mConditions.isXLHPriceCrossedOverSignal = + // + mConditions.isXLHPriceOverSignal && + !(mConditions.bars[prev].low > mConditions.lhSignals[prev]) + // + ; + + // + mConditions.isXLHPriceCrossedUnderSignal = + // + mConditions.isXLHPriceUnderSignal && + !(mConditions.bars[curr].high < mConditions.lhSignals[curr]) + // + ; + + // + // XTD ... + + // + // Bullish ... + tdHelper.CopyBullish( + barIndex, + mNumberOfItems, + mConditions.tdBullishs); + + // + // Bearish ... + tdHelper.CopyBearish( + barIndex, + mNumberOfItems, + mConditions.tdBearishs); + + // + // Signal ... + tdHelper.CopySignal( + barIndex, + mNumberOfItems, + mConditions.tdSignals); + + // + mConditions.isXTDSignalPeak = IsIncreasing( + mFrom, + curr, + mConditions.tdSignals); + + // + mConditions.isXTDSignalVale = IsDecreasing( + mFrom, + curr, + mConditions.tdSignals); + + // + mConditions.isXTDBullishPeak = IsIncreasing( + mFrom, + curr, + mConditions.tdBullishs); + + // + mConditions.isXTDBullishVale = IsDecreasing( + mFrom, + curr, + mConditions.tdBullishs); + + // + mConditions.isXTDBearishPeak = IsIncreasing( + mFrom, + curr, + mConditions.tdBearishs); + + // + mConditions.isXTDBearishVale = IsDecreasing( + mFrom, + curr, + mConditions.tdBearishs); + + // + mConditions.isXTDBullOverBear = mConditions.tdBullishs[curr] > mConditions.tdBearishs[curr]; + bool isXTDBullOverBearPrev = mConditions.tdBullishs[prev] > mConditions.tdBearishs[prev]; + + // + mConditions.isXTDBullUnderBear = mConditions.tdBullishs[curr] < mConditions.tdBearishs[curr]; + bool isXTDBullUnderBearPrev = mConditions.tdBullishs[prev] < mConditions.tdBearishs[prev]; + + // + mConditions.isXTDSignalOverBear = mConditions.tdSignals[curr] > mConditions.tdBearishs[curr]; + bool isXTDSignalOverBearPrev = mConditions.tdSignals[prev] > mConditions.tdBearishs[prev]; + + // + mConditions.isXTDSignalUnderBear = mConditions.tdSignals[curr] < mConditions.tdBearishs[curr]; + bool isXTDSignalUnderBearPrev = mConditions.tdSignals[prev] < mConditions.tdBearishs[prev]; + + // + mConditions.isXTDBullCrossedOverBear = + mConditions.isXTDBullOverBear && + !isXTDBullOverBearPrev; + + // + mConditions.isXTDBullCrossedUnderBear = + mConditions.isXTDBullUnderBear && + !isXTDBullUnderBearPrev; + + // + mConditions.isXTDSignalCrossedOverBear = + mConditions.isXTDSignalOverBear && + !isXTDSignalOverBearPrev; + + // + mConditions.isXTDSignalCrossedUnderBear = + mConditions.isXTDSignalUnderBear && + !isXTDSignalUnderBearPrev; + + // + // XTS ... + + // + // Current ... + tsHelper.CopyCurrent( + barIndex, + mNumberOfItems, + mConditions.tsCurrents); + + // + // Nearest ... + tsHelper.CopyNearest( + barIndex, + mNumberOfItems, + mConditions.tsNearests); + + // + // Mediest ... + tsHelper.CopyMediest( + barIndex, + mNumberOfItems, + mConditions.tsMediests); + + // + // Farest ... + tsHelper.CopyFarest( + barIndex, + mNumberOfItems, + mConditions.tsFarests); + + // + double current = mConditions.tsCurrents[curr]; + double currentPrev = mConditions.tsCurrents[prev]; + + // + double nearest = mConditions.tsNearests[curr]; + double nearestPrev = mConditions.tsNearests[prev]; + + // + double mediest = mConditions.tsMediests[curr]; + double mediestPrev = mConditions.tsMediests[prev]; + + // + double farest = mConditions.tsFarests[curr]; + double farestPrev = mConditions.tsFarests[prev]; + + // + double tsValues[] = {current, nearest, mediest, farest}; + double tsMax = GetMax(tsValues); + double tsMin = GetMin(tsValues); + + // + double tsPrevValues[] = {currentPrev, nearestPrev, mediestPrev, farestPrev}; + double tsPrevMax = GetMax(tsPrevValues); + double tsPrevMin = GetMin(tsPrevValues); + + // + mConditions.isXTSAllSame = + // + current == nearest && + nearest == mediest && + mediest == farest + // + ; + + // + mConditions.isXTSCurrentMin = current == tsMin; + mConditions.isXTSCurrentMax = current == tsMax; + + // + mConditions.isXTSCurrentOverFarest = current > farest; + bool isXTSCurrentOverFarestPrev = currentPrev > farestPrev; + + // + mConditions.isXTSCurrentOverNearest = current > nearest; + bool isXTSCurrentOverNearestPrev = currentPrev > nearestPrev; + + // + mConditions.isXTSCurrentOverMediest = current > mediest; + bool isXTSCurrentOverMediestPrev = currentPrev > mediestPrev; + + // + mConditions.isXTSCurrentUnderFarest = current < farest; + bool isXTSCurrentUnderFarestPrev = currentPrev < farestPrev; + + // + mConditions.isXTSCurrentUnderNearest = current < nearest; + bool isXTSCurrentUnderNearestPrev = currentPrev < nearestPrev; + + // + mConditions.isXTSCurrentUnderMediest = current < mediest; + bool isXTSCurrentUnderMediestPrev = currentPrev < mediestPrev; + + // + mConditions.isXTSCurrentCrossedOverFarest = + mConditions.isXTSCurrentOverFarest && + !isXTSCurrentOverFarestPrev; + + // + mConditions.isXTSCurrentCrossedOverNearest = + mConditions.isXTSCurrentOverNearest && + !isXTSCurrentOverNearestPrev; + + // + mConditions.isXTSCurrentCrossedOverMediest = + mConditions.isXTSCurrentOverMediest && + !isXTSCurrentOverMediestPrev; + + // + mConditions.isXTSCurrentCrossedUnderFarest = + mConditions.isXTSCurrentUnderFarest && + !isXTSCurrentUnderFarestPrev; + + // + mConditions.isXTSCurrentCrossedUnderNearest = + mConditions.isXTSCurrentUnderNearest && + !isXTSCurrentUnderNearestPrev; + + // + mConditions.isXTSCurrentCrossedUnderMediest = + mConditions.isXTSCurrentUnderMediest && + !isXTSCurrentUnderMediestPrev; + + // + // XCHMA ... + + // + // Short ... + + // + // Fast ... + chmaHelper.CopySCFast( + barIndex, + mNumberOfItems, + mConditions.chmaScFasts); + + // + // Slow ... + chmaHelper.CopySCSlow( + barIndex, + mNumberOfItems, + mConditions.chmaScSlows); + + // + // Medium ... + + // + // Fast ... + chmaHelper.CopyMCFast( + barIndex, + mNumberOfItems, + mConditions.chmaMcFasts); + + // + // Slow ... + chmaHelper.CopyMCSlow( + barIndex, + mNumberOfItems, + mConditions.chmaMcSlows); + + // + // Long ... + + // + // Fast ... + chmaHelper.CopyLCFast( + barIndex, + mNumberOfItems, + mConditions.chmaLcFasts); + + // + // Slow ... + chmaHelper.CopyLCSlow( + barIndex, + mNumberOfItems, + mConditions.chmaLcSlows); + + // + // Hot States ... + chmaHelper.CopyHotState( + barIndex, + mNumberOfItems, + mConditions.chmaHotStates); + + // + double scFast = mConditions.chmaScFasts[curr]; + double scSlow = mConditions.chmaScSlows[curr]; + double scFastPrev = mConditions.chmaScFasts[prev]; + double scSlowPrev = mConditions.chmaScSlows[prev]; + + // + double mcFast = mConditions.chmaMcFasts[curr]; + double mcSlow = mConditions.chmaMcSlows[curr]; + double mcFastPrev = mConditions.chmaMcFasts[prev]; + double mcSlowPrev = mConditions.chmaMcSlows[prev]; + + // + double lcFast = mConditions.chmaLcFasts[curr]; + double lcSlow = mConditions.chmaLcSlows[curr]; + double lcFastPrev = mConditions.chmaLcFasts[prev]; + double lcSlowPrev = mConditions.chmaLcSlows[prev]; + + // + double chmaValues[] = { + scFast, + scSlow, + mcFast, + mcSlow, + lcFast, + lcSlow}; + double chmaNonSCValues[] = { + mcFast, + mcSlow, + lcFast, + lcSlow}; + double chmaMin = GetMin(chmaValues); + double chmaMax = GetMax(chmaValues); + double chmaNonSCMin = GetMin(chmaNonSCValues); + double chmaNonSCMax = GetMax(chmaNonSCValues); + + // + double chmaValuesPrev[] = { + scFastPrev, + scSlowPrev, + mcFastPrev, + mcSlowPrev, + lcFastPrev, + lcSlowPrev}; + double chmaNonSCValuesPrev[] = { + mcFastPrev, + mcSlowPrev, + lcFastPrev, + lcSlowPrev}; + double chmaMinPrev = GetMin(chmaValuesPrev); + double chmaMaxPrev = GetMax(chmaValuesPrev); + double chmaNonSCMinPrev = GetMin(chmaNonSCValuesPrev); + double chmaNonSCMaxPrev = GetMax(chmaNonSCValuesPrev); + + // + mConditions.isXCHMASCOverMax = MathMin(scFast, scSlow) > chmaNonSCMax; + bool isXCHMASCOverMaxPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMaxPrev; + + // + mConditions.isXCHMASCOverMin = MathMin(scFast, scSlow) > chmaNonSCMin; + bool isXCHMASCOverMinPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMinPrev; + + // + mConditions.isXCHMASCUnderMax = MathMax(scFast, scSlow) < chmaNonSCMax; + bool isXCHMASCUnderMaxPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMaxPrev; + + // + mConditions.isXCHMASCUnderMin = MathMax(scFast, scSlow) < chmaNonSCMin; + bool isXCHMASCUnderMinPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMinPrev; + + // + mConditions.isXCHMASCCrossedOverMax = + mConditions.isXCHMASCOverMax && + !isXCHMASCOverMaxPrev; + + // + mConditions.isXCHMASCCrossedUnderMax = + mConditions.isXCHMASCUnderMax && + !isXCHMASCUnderMaxPrev; + + // + mConditions.isXCHMASCCrossedOverMin = + mConditions.isXCHMASCOverMin && + !isXCHMASCOverMinPrev; + + // + mConditions.isXCHMASCCrossedUnderMin = + mConditions.isXCHMASCUnderMin && + !isXCHMASCUnderMinPrev; + + // + // Short ... + + // + mConditions.isXCHMASCPeak = IsIncreasing( + mFrom, + curr, + mConditions.chmaScFasts); + + // + mConditions.isXCHMASCVale = IsDecreasing( + mFrom, + curr, + mConditions.chmaScFasts); + + // + mConditions.isXCHMASCTrendsUp = IsTrendingUp( + mConditions.chmaScFasts, + mConditions.chmaScSlows); + + // + mConditions.isXCHMASCTrendsDown = IsTrendingDown( + mConditions.chmaScFasts, + mConditions.chmaScSlows); + + // + mConditions.isXCHMASCFastOverSlow = scFast > scSlow; + bool isXCHMASCFastOverSlowPrev = scFastPrev > scSlowPrev; + + // + mConditions.isXCHMASCFastUnderSlow = scFast < scSlow; + bool isXCHMASCFastUnderSlowPrev = scFastPrev < scSlowPrev; + + // + mConditions.isXCHMASCFastCrossedOverSlow = + mConditions.isXCHMASCFastOverSlow && + !isXCHMASCFastOverSlowPrev; + + // + mConditions.isXCHMASCFastCrossedUnderSlow = + mConditions.isXCHMASCFastUnderSlow && + !isXCHMASCFastUnderSlowPrev; + + // + // Medium ... + + // + mConditions.isXCHMAMCPeak = IsIncreasing( + mFrom, + curr, + mConditions.chmaMcFasts); + + // + mConditions.isXCHMAMCVale = IsDecreasing( + mFrom, + curr, + mConditions.chmaMcFasts); + + // + mConditions.isXCHMAMCTrendsUp = IsTrendingUp( + mConditions.chmaMcFasts, + mConditions.chmaMcSlows); + + // + mConditions.isXCHMAMCTrendsDown = IsTrendingDown( + mConditions.chmaMcFasts, + mConditions.chmaMcSlows); + + // + mConditions.isXCHMAMCFastOverSlow = mcFast > mcSlow; + bool isXCHMAMCFastOverSlowPrev = mcFastPrev > mcSlowPrev; + + // + mConditions.isXCHMAMCFastUnderSlow = mcFast < mcSlow; + bool isXCHMAMCFastUnderSlowPrev = mcFastPrev < mcSlowPrev; + + // + mConditions.isXCHMAMCFastCrossedOverSlow = + mConditions.isXCHMAMCFastOverSlow && + !isXCHMAMCFastOverSlowPrev; + + // + mConditions.isXCHMAMCFastCrossedUnderSlow = + mConditions.isXCHMAMCFastUnderSlow && + !isXCHMAMCFastUnderSlowPrev; + + // + // Long ... + + // + mConditions.isXCHMALCPeak = IsIncreasing( + mFrom, + curr, + mConditions.chmaLcFasts); + + // + mConditions.isXCHMALCVale = IsDecreasing( + mFrom, + curr, + mConditions.chmaLcFasts); + + // + mConditions.isXCHMALCTrendsUp = IsTrendingUp( + mConditions.chmaLcFasts, + mConditions.chmaLcSlows); + + // + mConditions.isXCHMALCTrendsDown = IsTrendingDown( + mConditions.chmaMcFasts, + mConditions.chmaMcSlows); + + // + mConditions.isXCHMALCFastOverSlow = lcFast > lcSlow; + bool isXCHMALCFastOverSlowPrev = lcFastPrev > lcSlowPrev; + + // + mConditions.isXCHMALCFastUnderSlow = lcFast < lcSlow; + bool isXCHMALCFastUnderSlowPrev = lcFastPrev < lcSlowPrev; + + // + mConditions.isXCHMALCFastCrossedOverSlow = + mConditions.isXCHMALCFastOverSlow && + !isXCHMALCFastOverSlowPrev; + + // + mConditions.isXCHMALCFastCrossedUnderSlow = + mConditions.isXCHMALCFastUnderSlow && + !isXCHMALCFastUnderSlowPrev; + + // + // XCHLH ... + + // + // Short ... + + // + // HH ... + chlhHelper.CopySCHH( + barIndex, + mNumberOfItems, + mConditions.chlhScHHs); + + // + // LL ... + chlhHelper.CopySCLL( + barIndex, + mNumberOfItems, + mConditions.chlhScLLs); + + // + // Medium ... + + // + // HH ... + chlhHelper.CopyMCHH( + barIndex, + mNumberOfItems, + mConditions.chlhMcHHs); + + // + // LL ... + chlhHelper.CopyMCLL( + barIndex, + mNumberOfItems, + mConditions.chlhMcLLs); + + // + // Long ... + + // + // HH ... + chlhHelper.CopyLCHH( + barIndex, + mNumberOfItems, + mConditions.chlhLcHHs); + + // + // LL ... + chlhHelper.CopyLCLL( + barIndex, + mNumberOfItems, + mConditions.chlhLcLLs); + + // + // Hot State ... + chlhHelper.CopyHotState( + barIndex, + mNumberOfItems, + mConditions.chlhHotStates); + + // + mConditions.isXCHLHSameHHs = + // + mConditions.chlhScHHs[curr] == mConditions.chlhMcHHs[curr] && + mConditions.chlhMcHHs[curr] == mConditions.chlhLcHHs[curr] + // + ; + + // + mConditions.isXCHLHSameLLs = + // + mConditions.chlhScLLs[curr] == mConditions.chlhMcLLs[curr] && + mConditions.chlhMcLLs[curr] == mConditions.chlhLcLLs[curr] + // + ; + + // + mConditions.isXCHLHSCMCHHSame = + // + mConditions.chlhScHHs[curr] == mConditions.chlhMcHHs[curr] + // + ; + + // + mConditions.isXCHLHSCMCLLSame = + // + mConditions.chlhScLLs[curr] == mConditions.chlhMcLLs[curr] + // + ; + + // + mConditions.isXCHLHSCLCHHSame = + // + mConditions.chlhScHHs[curr] == mConditions.chlhLcLLs[curr] + // + ; + + // + mConditions.isXCHLHSCLCLLSame = + // + mConditions.chlhScLLs[curr] == mConditions.chlhLcLLs[curr] + // + ; + + // + mConditions.isXCHLHMCLCHHSame = + // + mConditions.chlhMcHHs[curr] == mConditions.chlhLcHHs[curr] + // + ; + + // + mConditions.isXCHLHMCLCLLSame = + // + mConditions.chlhMcLLs[curr] == mConditions.chlhLcLLs[curr] + // + ; + + // + // X121 Cycles Conditions ... + + // + cMarket.GetMarketConditions( + mConditions.cMarketConditions, + barIndex, + mNumberOfItems // + ); + + // + sMarket.GetMarketConditions( + mConditions.sMarketConditions, + barIndex, + mNumberOfItems // + ); + + // + mMarket.GetMarketConditions( + mConditions.mMarketConditions, + barIndex, + mNumberOfItems // + ); + + // + lMarket.GetMarketConditions( + mConditions.lMarketConditions, + barIndex, + mNumberOfItems // + ); + + // + hMarket.GetMarketConditions( + mConditions.hMarketConditions, + barIndex, + mNumberOfItems // + ); + } + + // + // Check Market Conditions is Ready for Long Signals or not ... + bool IsReadyForLong( + X121MarketConditions &mConditions, // Market Conditions ... + bool checkXCHMAMin = true, // Force Check XCHMA Min State + bool checkXCHMAMax = true, // Force Check XCHMA Max State + bool checkXCHMACycles = true, // Force Check XCHMA Cycles State + bool checkXCHMAPeaks = true, // Force Check XCHMA Peaks State + bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers + bool checkXOBD = true, // Force Check XOBD State + bool checkXTS = true // Force Check XTS State + ) + { + // + bool result = true; + + // + if (checkXCHMAMin) + { + // + result = + // + // XCHMA MIN ... + !( + // + (mConditions.isXCHMASCOverMin || + mConditions.isXCHMASCCrossedOverMin) && + (mConditions.isXCHMASCUnderMin || + mConditions.isXCHMASCCrossedUnderMin) + // + ); + } + + // + if (checkXCHMAMax && result) + { + // + result = + // + // XCHMA MAX ... + !( + // + (mConditions.isXCHMASCOverMax || + mConditions.isXCHMASCCrossedOverMax) && + (mConditions.isXCHMASCUnderMax || + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ; + } + + // + if (checkXCHMACycles && result) + { + // + result = + // + // Check XCHMA Trend Bullish ... + ( + // + // All Cycles Bullish ... + ( + // + // SC ... + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + || + // + // Two Cycle Fully Bullish ... + ( + // + // SC and MC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + || + // + // SC and LC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + || + // + // MC and LC ... + ( + // + // MC ... + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMAPeaks && result) + { + // + result = + // + // XCHMA Check Peaks ... + !( + // + // All Cycles Peak ... + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + || + // + ( + // + // SC MC ... + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) + // + || + // + // SC LC ... + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCPeak) + // + || + // + // MC LC ... + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMATrendPowers && result) + { + // + result = + // + // XCHMA Check Trends Power ... + !( + // + // All Trends Down ... + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + // Twisted pairs ... + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ; + } + + // + if (checkXOBD && result) + { + // + result = + // + // XOBD Check Swings ... + !mConditions.isXOBDSwingLow + // + ; + } + + // + if (checkXTS && result) + { + result = + // + // XTS Check ... + !( + // + mConditions.isXTSCurrentMin && + // + ( + // + // All Under ... + ( + (mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest) && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest)) + // + || + // + // Pairs ... + ( + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest)) + // + || + // + ((mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest) && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest)) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // Check Market Conditions is Ready for Short Signals or not ... + bool IsReadyForShort( + X121MarketConditions &mConditions, // Market Conditions ... + bool checkXCHMAMin = true, // Force Check XCHMA Min State + bool checkXCHMAMax = true, // Force Check XCHMA Max State + bool checkXCHMACycles = true, // Force Check XCHMA Cycles State + bool checkXCHMAVales = true, // Force Check XCHMA Vales State + bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers + bool checkXOBD = true, // Force Check XOBD State + bool checkXTS = true // Force Check XTS State + ) + { + // + bool result = true; + + // + if (checkXCHMAMin) + { + // + result = + // + // XCHMA MIN ... + !( + // + (mConditions.isXCHMASCOverMin || + mConditions.isXCHMASCCrossedOverMin) && + (mConditions.isXCHMASCUnderMin || + mConditions.isXCHMASCCrossedUnderMin) + // + ); + } + + // + if (checkXCHMAMax && result) + { + // + result = + // + // XCHMA MAX ... + !( + // + (mConditions.isXCHMASCOverMax || + mConditions.isXCHMASCCrossedOverMax) && + (mConditions.isXCHMASCUnderMax || + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ; + } + + // + if (checkXCHMACycles && result) + { + // + result = + // + // Check XCHMA Trend Bullish ... + ( + // + // All Cycles Bullish ... + ( + // + // SC ... + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) + // + ) + // + || + // + // Two Cycle Fully Bullish ... + ( + // + // SC and MC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + || + // + // SC and LC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) + // + ) + // + || + // + // MC and LC ... + ( + // + // MC ... + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMAVales && result) + { + // + result = + // + // XCHMA Check Vales ... + !( + // + // All Cycles Vale ... + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + ( + // + // SC MC ... + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + || + // + // SC LC ... + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCVale) + // + || + // + // MC LC ... + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMATrendPowers && result) + { + // + result = + // + // XCHMA Check Trends Power ... + !( + // + // All Trends Down ... + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + // Twisted pairs ... + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ; + } + + // + if (checkXOBD && result) + { + // + result = + // + // XOBD Check Swings ... + !mConditions.isXOBDSwingHigh + // + ; + } + + // + if (checkXTS && result) + { + // + result = + // + // XTS Check ... + !( + // + mConditions.isXTSCurrentMax && + // + ( + // + // All Over ... + ( + (mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + || + // + // Pairs ... + ( + // + ((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest)) + // + || + // + ((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + || + // + ((mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // Signalling based On Signallers ... + + // + // Longs ... + + // + bool XSPHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + return result; + } + + // + bool XTESTHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + return result; + } + + // + // Use XSTR ... + bool X786HasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // // + // bool isCMStrLong = + // // + // mConditions.cMarketConditions.isTrendSwitchedToBullish && + // (mConditions.hMarketConditions.isTrendBullish && + // mConditions.lMarketConditions.isTrendBullish && + // mConditions.mMarketConditions.isTrendBullish && + // mConditions.sMarketConditions.isTrendBullish) + // // + // ; + + // // + // bool isSMStrLong = + // // + // mConditions.sMarketConditions.isTrendSwitchedToBullish && + // (mConditions.hMarketConditions.isTrendBullish && + // mConditions.lMarketConditions.isTrendBullish && + // mConditions.mMarketConditions.isTrendBullish && + // mConditions.cMarketConditions.isTrendBullish) + // // + // ; + + // + bool isMMStrLong = + // + mConditions.mMarketConditions.isTrendSwitchedToBullish && + (mConditions.hMarketConditions.isTrendBullish && + mConditions.lMarketConditions.isTrendBullish && + mConditions.sMarketConditions.isTrendBullish && + mConditions.cMarketConditions.isTrendBullish) + // + ; + + // + bool isLMStrLong = + // + mConditions.lMarketConditions.isTrendSwitchedToBullish && + (mConditions.hMarketConditions.isTrendBullish && + mConditions.mMarketConditions.isTrendBullish && + mConditions.sMarketConditions.isTrendBullish && + mConditions.cMarketConditions.isTrendBullish) + // + ; + + // + bool isHMStrLong = + // + mConditions.hMarketConditions.isTrendSwitchedToBullish && + (mConditions.lMarketConditions.isTrendBullish && + mConditions.mMarketConditions.isTrendBullish && + mConditions.sMarketConditions.isTrendBullish && + mConditions.cMarketConditions.isTrendBullish) + // + ; + + // + // bool isScorePassed = IsScorePassedForLong(); + + // + result = + // + // isCMStrLong + // // + // || + // + // isSMStrLong + // // + // || + // + isMMStrLong + // + || + // + isLMStrLong + // + || + // + isHMStrLong + // + ; + + // + // result = result && isScorePassed; + + // + // if (result) + // { + // sl = GetMinVales(); + // } + + // + return result; + } + + // + // Use XMC ... + bool X121HasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + // Current Market ... + // bool isCMCLong = + // // + // ( + // // + // (mConditions.cMarketConditions.isSlowOverVerifier && + // mConditions.cMarketConditions.isFastCrossedOverVerifier) + // // + // || + // // + // (mConditions.cMarketConditions.isFastOverVerifier && + // mConditions.cMarketConditions.isSlowCrossedOverVerifier) + // // + // ) + // // + // && + // // + // (mConditions.cMarketConditions.isCloseOverFast && + // mConditions.cMarketConditions.isCloseOverSlow && + // mConditions.cMarketConditions.isCloseOverVerifier) + // // + // ; + + // + // Short Market ... + // bool isSMCLong = + // // + // ( + // // + // (mConditions.sMarketConditions.isSlowOverVerifier && + // mConditions.sMarketConditions.isFastCrossedOverVerifier) + // // + // || + // // + // (mConditions.sMarketConditions.isFastOverVerifier && + // mConditions.sMarketConditions.isSlowCrossedOverVerifier) + // // + // ) + // // + // && + // // + // (mConditions.sMarketConditions.isCloseOverFast && + // mConditions.sMarketConditions.isCloseOverSlow && + // mConditions.sMarketConditions.isCloseOverVerifier) + // // + // ; + + // + // Medium Market ... + bool isMMCLong = + // + ( + // + (mConditions.mMarketConditions.isSlowOverVerifier && + mConditions.mMarketConditions.isFastCrossedOverVerifier) + // + || + // + (mConditions.mMarketConditions.isFastOverVerifier && + mConditions.mMarketConditions.isSlowCrossedOverVerifier) + // + ) + // + && + // + (mConditions.mMarketConditions.isCloseOverFast && + mConditions.mMarketConditions.isCloseOverSlow && + mConditions.mMarketConditions.isCloseOverVerifier) + // + ; + + // + // Long Market ... + bool isLMCLong = + // + ( + // + (mConditions.lMarketConditions.isSlowOverVerifier && + mConditions.lMarketConditions.isFastCrossedOverVerifier) + // + || + // + (mConditions.lMarketConditions.isFastOverVerifier && + mConditions.lMarketConditions.isSlowCrossedOverVerifier) + // + ) + // + && + // + (mConditions.lMarketConditions.isCloseOverFast && + mConditions.lMarketConditions.isCloseOverSlow && + mConditions.lMarketConditions.isCloseOverVerifier) + // + ; + + // + // Hind Market ... + bool isHMCLong = + // + ( + // + (mConditions.hMarketConditions.isSlowOverVerifier && + mConditions.hMarketConditions.isFastCrossedOverVerifier) + // + || + // + (mConditions.hMarketConditions.isFastOverVerifier && + mConditions.hMarketConditions.isSlowCrossedOverVerifier) + // + ) + // + && + // + (mConditions.hMarketConditions.isCloseOverFast && + mConditions.hMarketConditions.isCloseOverSlow && + mConditions.hMarketConditions.isCloseOverVerifier) + // + ; + + // + // bool isScorePassed = IsScorePassedForLong(); + + // + result = + // // + // isCMCLong + // // + // || + // // + // isSMCLong + // // + // || + // + isMMCLong + // + || + // + isLMCLong + // + || + // + isHMCLong + // + ; + + // + // result = result && isScorePassed; + + // // + // if (result) + // { + // sl = GetMinVales(); + // } + + // + return result; + } + + // + // Use XCHE ... + bool X110HasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // // + // bool isCCHELong = + // // + // (mConditions.cMarketConditions.isCHESwitchedInStrongLong && + // (mConditions.sMarketConditions.isCHEInStrongLong && + // mConditions.mMarketConditions.isCHEInStrongLong && + // mConditions.lMarketConditions.isCHEInStrongLong && + // mConditions.hMarketConditions.isCHEInStrongLong)) + // // + // ; + + // // + // bool isSCHELong = + // // + // (mConditions.sMarketConditions.isCHESwitchedInStrongLong && + // (mConditions.cMarketConditions.isCHEInStrongLong && + // mConditions.mMarketConditions.isCHEInStrongLong && + // mConditions.lMarketConditions.isCHEInStrongLong && + // mConditions.hMarketConditions.isCHEInStrongLong)) + // // + // ; + + // + bool isMCHELong = + // + (mConditions.mMarketConditions.isCHESwitchedInStrongLong && + (mConditions.cMarketConditions.isCHEInStrongLong && + mConditions.sMarketConditions.isCHEInStrongLong && + mConditions.lMarketConditions.isCHEInStrongLong && + mConditions.hMarketConditions.isCHEInStrongLong)) + // + ; + + // + bool isLCHELong = + // + (mConditions.lMarketConditions.isCHESwitchedInStrongLong && + (mConditions.cMarketConditions.isCHEInStrongLong && + mConditions.sMarketConditions.isCHEInStrongLong && + mConditions.mMarketConditions.isCHEInStrongLong && + mConditions.hMarketConditions.isCHEInStrongLong)) + // + ; + + // + bool isHCHELong = + // + (mConditions.hMarketConditions.isCHESwitchedInStrongLong && + (mConditions.cMarketConditions.isCHEInStrongLong && + mConditions.sMarketConditions.isCHEInStrongLong && + mConditions.mMarketConditions.isCHEInStrongLong && + mConditions.lMarketConditions.isCHEInStrongLong)) + // + ; + + // + // bool isScorePassed = IsScorePassedForLong(); + + // + result = + // // + // isCCHELong + // // + // || + // // + // isSCHELong + // // + // || + // + isMCHELong + // + || + // + isLCHELong + // + || + // + isHCHELong + // + ; + + // + // result = result && isScorePassed; + + // // + // if (result) + // { + // sl = GetMinVales(); + // } + + // + return result; + } + + // + // Use XHK ... + bool X92HasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + int curr = 0; + int prev = 1; + + // + bool isCSMHKSwitchedToBullish = + // + mConditions.cMarketConditions.smHKBars[curr].IsBullish() && + !mConditions.cMarketConditions.smHKBars[prev].IsBullish() + // + ; + + // + bool isCSMHKBullish = + // + mConditions.cMarketConditions.smHKBars[curr].IsBullish() && + mConditions.cMarketConditions.smHKBars[prev].IsBullish() && + !mConditions.bars[curr].open > mConditions.cMarketConditions.smHKBars[curr].GetUp() && + !mConditions.bars[prev].close > mConditions.cMarketConditions.smHKBars[prev].GetUp() + // + ; + + // + bool isSSMHKSwitchedToBullish = + // + mConditions.sMarketConditions.smHKBars[curr].IsBullish() && + !mConditions.sMarketConditions.smHKBars[prev].IsBullish() + // + ; + + // + bool isSSMHKBullish = + // + mConditions.sMarketConditions.smHKBars[curr].IsBullish() && + mConditions.sMarketConditions.smHKBars[prev].IsBullish() && + !mConditions.bars[curr].open > mConditions.sMarketConditions.smHKBars[curr].GetUp() && + !mConditions.bars[prev].close > mConditions.sMarketConditions.smHKBars[prev].GetUp() + // + ; + + // + bool isMSMHKSwitchedToBullish = + // + mConditions.mMarketConditions.smHKBars[curr].IsBullish() && + !mConditions.mMarketConditions.smHKBars[prev].IsBullish() + // + ; + + // + bool isMSMHKBullish = + // + mConditions.mMarketConditions.smHKBars[curr].IsBullish() && + mConditions.mMarketConditions.smHKBars[prev].IsBullish() && + !mConditions.bars[curr].open > mConditions.mMarketConditions.smHKBars[curr].GetUp() && + !mConditions.bars[prev].close > mConditions.mMarketConditions.smHKBars[prev].GetUp() + // + ; + + // + bool isLSMHKSwitchedToBullish = + // + mConditions.lMarketConditions.smHKBars[curr].IsBullish() && + !mConditions.lMarketConditions.smHKBars[prev].IsBullish() + // + ; + + // + bool isLSMHKBullish = + // + mConditions.lMarketConditions.smHKBars[curr].IsBullish() && + mConditions.lMarketConditions.smHKBars[prev].IsBullish() && + !mConditions.bars[curr].open > mConditions.lMarketConditions.smHKBars[curr].GetUp() && + !mConditions.bars[prev].close > mConditions.lMarketConditions.smHKBars[prev].GetUp() + // + ; + + // + bool isHSMHKSwitchedToBullish = + // + mConditions.hMarketConditions.smHKBars[curr].IsBullish() && + !mConditions.hMarketConditions.smHKBars[prev].IsBullish() + // + ; + + // + bool isHSMHKBullish = + // + mConditions.hMarketConditions.smHKBars[curr].IsBullish() && + mConditions.hMarketConditions.smHKBars[prev].IsBullish() && + !mConditions.bars[curr].open > mConditions.hMarketConditions.smHKBars[curr].GetUp() && + !mConditions.bars[prev].close > mConditions.hMarketConditions.smHKBars[prev].GetUp() + // + ; + + // + bool isCSMHKLong = + // + (isCSMHKBullish || + isCSMHKSwitchedToBullish) && + isSSMHKBullish && + isMSMHKBullish && + isLSMHKBullish && + isHSMHKBullish + // + ; + + // + bool isSSMHKLong = + // + (isSSMHKBullish || + isSSMHKSwitchedToBullish) && + isCSMHKBullish && + isMSMHKBullish && + isLSMHKBullish && + isHSMHKBullish + // + ; + + // + bool isMSMHKLong = + // + (isMSMHKBullish || + isMSMHKSwitchedToBullish) && + isSSMHKBullish && + isCSMHKBullish && + isLSMHKBullish && + isHSMHKBullish + // + ; + + // + bool isLSMHKLong = + // + (isLSMHKBullish || + isLSMHKSwitchedToBullish) && + isSSMHKBullish && + isCSMHKBullish && + isMSMHKBullish && + isHSMHKBullish + // + ; + + // + bool isHSMHKLong = + // + (isHSMHKBullish || + isHSMHKSwitchedToBullish) && + isSSMHKBullish && + isCSMHKBullish && + isMSMHKBullish && + isLSMHKBullish + // + ; + + // + result = + // + // isCSMHKLong + // // + // || + // // + // isSSMHKLong + // // + // || + // + isMSMHKLong + // + || + // + isLSMHKLong + // + || + // + isHSMHKLong + // + ; + + // + return result; + } + + // + // Use XMRB ... + bool X128HasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + // Current Cycle ... + + // + bool isCMRBFastOverSlow = + // + mConditions.cMarketConditions.mrbFasts[1] > mConditions.cMarketConditions.mrbSlows[1] + // + ; + + // + bool isCMRBFastCrossedOverSlow = + // + mConditions.cMarketConditions.mrbFasts[1] > mConditions.cMarketConditions.mrbSlows[1] && + mConditions.cMarketConditions.mrbFasts[2] <= mConditions.cMarketConditions.mrbSlows[2] + // + ; + + // + bool isCMRBClosedOverFast = + // + mConditions.cMarketConditions.bars[1].close > mConditions.cMarketConditions.mrbFasts[1] + // + ; + + // + // Short Cycle ... + + // + bool isSMRBFastOverSlow = + // + mConditions.sMarketConditions.mrbFasts[1] > mConditions.sMarketConditions.mrbSlows[1] + // + ; + + // + bool isSMRBFastCrossedOverSlow = + // + mConditions.sMarketConditions.mrbFasts[1] > mConditions.sMarketConditions.mrbSlows[1] && + mConditions.sMarketConditions.mrbFasts[2] <= mConditions.sMarketConditions.mrbSlows[2] + // + ; + + // + bool isSMRBClosedOverFast = + // + mConditions.sMarketConditions.bars[1].close > mConditions.sMarketConditions.mrbFasts[1] + // + ; + + // + // Medium Cycle ... + + // + bool isMMRBFastOverSlow = + // + mConditions.mMarketConditions.mrbFasts[1] > mConditions.mMarketConditions.mrbSlows[1] + // + ; + + // + bool isMMRBFastCrossedOverSlow = + // + mConditions.mMarketConditions.mrbFasts[1] > mConditions.mMarketConditions.mrbSlows[1] && + mConditions.mMarketConditions.mrbFasts[2] <= mConditions.mMarketConditions.mrbSlows[2] + // + ; + + // + bool isMMRBClosedOverFast = + // + mConditions.mMarketConditions.bars[1].close > mConditions.mMarketConditions.mrbFasts[1] + // + ; + + // + // Long Cycle ... + + // + bool isLMRBFastOverSlow = + // + mConditions.lMarketConditions.mrbFasts[1] > mConditions.lMarketConditions.mrbSlows[1] + // + ; + + // + bool isLMRBFastCrossedOverSlow = + // + mConditions.lMarketConditions.mrbFasts[1] > mConditions.lMarketConditions.mrbSlows[1] && + mConditions.lMarketConditions.mrbFasts[2] <= mConditions.lMarketConditions.mrbSlows[2] + // + ; + + // + bool isLMRBClosedOverFast = + // + mConditions.lMarketConditions.bars[1].close > mConditions.lMarketConditions.mrbFasts[1] + // + ; + + // + // Hind Cycle ... + + // + bool isHMRBFastOverSlow = + // + mConditions.hMarketConditions.mrbFasts[1] > mConditions.hMarketConditions.mrbSlows[1] + // + ; + + // + bool isHMRBFastCrossedOverSlow = + // + mConditions.hMarketConditions.mrbFasts[1] > mConditions.hMarketConditions.mrbSlows[1] && + mConditions.hMarketConditions.mrbFasts[2] <= mConditions.hMarketConditions.mrbSlows[2] + // + ; + + // + bool isHMRBClosedOverFast = + // + mConditions.hMarketConditions.bars[1].close > mConditions.hMarketConditions.mrbFasts[1] + // + ; + + // + bool isMRBLongWeight = + // + ( + // + isCMRBFastOverSlow && + isSMRBFastOverSlow && + isMMRBFastOverSlow && + isLMRBFastOverSlow && + isHMRBFastOverSlow + // + ) + // + || + // + ( + // + isCMRBFastOverSlow && + (( + isSMRBFastOverSlow && + isMMRBFastOverSlow && + isLMRBFastOverSlow) + // + || + // + ( + isSMRBFastOverSlow && + isLMRBFastOverSlow && + isHMRBFastOverSlow) + // + || + // + ( + isMMRBFastOverSlow && + isLMRBFastOverSlow && + isHMRBFastOverSlow)) + // + ) + // + ; + + // + bool isMBRCloseLong = + // + ( + // + isCMRBClosedOverFast && + isSMRBClosedOverFast && + isMMRBClosedOverFast && + isLMRBClosedOverFast && + isHMRBClosedOverFast + // + ) + // + || + // + ( + // + isCMRBClosedOverFast && + (( + isSMRBClosedOverFast && + isMMRBClosedOverFast) + // + || + // + ( + isSMRBClosedOverFast && + isLMRBClosedOverFast) + // + || + // + ( + isSMRBClosedOverFast && + isHMRBClosedOverFast) + // + || + // + ( + isMMRBClosedOverFast && + isLMRBClosedOverFast) + // + || + // + ( + isLMRBClosedOverFast && + isHMRBClosedOverFast) + // + || + // + ( + isMMRBClosedOverFast && + isHMRBClosedOverFast) + // + || + // + ( + isSMRBClosedOverFast && + isMMRBClosedOverFast && + isLMRBClosedOverFast) + // + || + // + ( + isSMRBClosedOverFast && + isLMRBClosedOverFast && + isHMRBClosedOverFast) + // + || + // + ( + isMMRBClosedOverFast && + isLMRBClosedOverFast && + isHMRBClosedOverFast)) + // + ) + // + ; + + // + bool isCMRBShort = + // + (isCMRBFastOverSlow || + isCMRBFastCrossedOverSlow) + // + && + // + isCMRBClosedOverFast && + // + isMRBLongWeight && + // + isMBRCloseLong + // + ; + + // + bool isSMRBShort = + // + (isSMRBFastOverSlow || + isSMRBFastCrossedOverSlow) + // + && + // + isSMRBClosedOverFast && + // + isMRBLongWeight && + // + isMBRCloseLong + // + ; + + // + bool isMMRBShort = + // + (isMMRBFastOverSlow || + isMMRBFastCrossedOverSlow) + // + && + // + isMMRBClosedOverFast && + // + isMRBLongWeight && + // + isMBRCloseLong + // + ; + + // + bool isLMRBShort = + // + (isLMRBFastOverSlow || + isLMRBFastCrossedOverSlow) + // + && + // + isLMRBClosedOverFast && + // + isMRBLongWeight && + // + isMBRCloseLong + // + ; + + // + bool isHMRBShort = + // + (isHMRBFastOverSlow || + isHMRBFastCrossedOverSlow) + // + && + // + isHMRBClosedOverFast && + // + isMRBLongWeight && + // + isMBRCloseLong + // + ; + + // + result = + // + isCMRBShort + // + || + // + isSMRBShort + // + || + // + isMMRBShort + // + || + // + isLMRBShort + // + || + // + isHMRBShort + // + ; + + // + return result; + } + + // + // XTD ... + bool XTDHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XTAM ... + bool XTAMHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XSI ... + bool XSIHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XTSFI ... + bool XTSFIHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XOBDLH ... + bool XOBDLHHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XCHMACC ... + bool XCHMACCHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XCHMAMN ... + bool XCHMAMNHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XCHMAMX ... + bool XCHMAMXHasSpecifiedLongSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // Short ... + + // + bool XSPHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + return result; + } + + // + bool XTESTHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + return result; + } + + // + // Use XSTR ... + bool X786HasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // // + // bool isCMStrShort = + // // + // mConditions.cMarketConditions.isTrendSwitchedToBearish && + // (mConditions.hMarketConditions.isTrendBearish && + // mConditions.lMarketConditions.isTrendBearish && + // mConditions.mMarketConditions.isTrendBearish && + // mConditions.sMarketConditions.isTrendBearish) + // // + // ; + + // // + // bool isSMStrShort = + // // + // mConditions.sMarketConditions.isTrendSwitchedToBearish && + // (mConditions.hMarketConditions.isTrendBearish && + // mConditions.lMarketConditions.isTrendBearish && + // mConditions.mMarketConditions.isTrendBearish && + // mConditions.cMarketConditions.isTrendBearish) + // // + // ; + + // + bool isMMStrShort = + // + mConditions.mMarketConditions.isTrendSwitchedToBearish && + (mConditions.hMarketConditions.isTrendBearish && + mConditions.lMarketConditions.isTrendBearish && + mConditions.sMarketConditions.isTrendBearish && + mConditions.cMarketConditions.isTrendBearish) + // + ; + + // + bool isLMStrShort = + // + mConditions.lMarketConditions.isTrendSwitchedToBearish && + (mConditions.hMarketConditions.isTrendBearish && + mConditions.mMarketConditions.isTrendBearish && + mConditions.sMarketConditions.isTrendBearish && + mConditions.cMarketConditions.isTrendBearish) + // + ; + + // + bool isHMStrShort = + // + mConditions.hMarketConditions.isTrendSwitchedToBearish && + (mConditions.lMarketConditions.isTrendBearish && + mConditions.mMarketConditions.isTrendBearish && + mConditions.sMarketConditions.isTrendBearish && + mConditions.cMarketConditions.isTrendBearish) + // + ; + + // + // bool isScorePassed = IsScorePassedForShort(); + + // + result = + // // + // isCMStrShort + // // + // || + // // + // isSMStrShort + // // + // || + // + isMMStrShort + // + || + // + isLMStrShort + // + || + // + isHMStrShort + // + ; + + // + // result = result && isScorePassed; + + // // + // if (result) + // { + // sl = GetMaxPeaks(); + // } + + // + return result; + } + + // + // Use XMC ... + bool X121HasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + // Current Market ... + // bool isCMCShort = + // // + // ( + // // + // (mConditions.cMarketConditions.isSlowUnderVerifier && + // mConditions.cMarketConditions.isFastCrossedUnderVerifier) + // // + // || + // // + // (mConditions.cMarketConditions.isFastUnderVerifier && + // mConditions.cMarketConditions.isSlowCrossedUnderVerifier) + // // + // ) + // // + // && + // // + // (mConditions.cMarketConditions.isCloseUnderFast && + // mConditions.cMarketConditions.isCloseUnderSlow && + // mConditions.cMarketConditions.isCloseUnderVerifier) + // // + // ; + + // + // Short Market ... + // bool isSMCShort = + // // + // ( + // // + // (mConditions.sMarketConditions.isSlowUnderVerifier && + // mConditions.sMarketConditions.isFastCrossedUnderVerifier) + // // + // || + // // + // (mConditions.sMarketConditions.isFastUnderVerifier && + // mConditions.sMarketConditions.isSlowCrossedUnderVerifier) + // // + // ) + // // + // && + // // + // (mConditions.sMarketConditions.isCloseUnderFast && + // mConditions.sMarketConditions.isCloseUnderSlow && + // mConditions.sMarketConditions.isCloseUnderVerifier) + // // + // ; + + // + // Medium Market ... + bool isMMCShort = + // + ( + // + (mConditions.mMarketConditions.isSlowUnderVerifier && + mConditions.mMarketConditions.isFastCrossedUnderVerifier) + // + || + // + (mConditions.mMarketConditions.isFastUnderVerifier && + mConditions.mMarketConditions.isSlowCrossedUnderVerifier) + // + ) + // + && + // + (mConditions.mMarketConditions.isCloseUnderFast && + mConditions.mMarketConditions.isCloseUnderSlow && + mConditions.mMarketConditions.isCloseUnderVerifier) + // + ; + + // + // Long Market ... + bool isLMCShort = + // + ( + // + (mConditions.lMarketConditions.isSlowUnderVerifier && + mConditions.lMarketConditions.isFastCrossedUnderVerifier) + // + || + // + (mConditions.lMarketConditions.isFastUnderVerifier && + mConditions.lMarketConditions.isSlowCrossedUnderVerifier) + // + ) + // + && + // + (mConditions.lMarketConditions.isCloseUnderFast && + mConditions.lMarketConditions.isCloseUnderSlow && + mConditions.lMarketConditions.isCloseUnderVerifier) + // + ; + + // + // Hind Market ... + bool isHMCShort = + // + ( + // + (mConditions.hMarketConditions.isSlowUnderVerifier && + mConditions.hMarketConditions.isFastCrossedUnderVerifier) + // + || + // + (mConditions.hMarketConditions.isFastUnderVerifier && + mConditions.hMarketConditions.isSlowCrossedUnderVerifier) + // + ) + // + && + // + (mConditions.hMarketConditions.isCloseUnderFast && + mConditions.hMarketConditions.isCloseUnderSlow && + mConditions.hMarketConditions.isCloseUnderVerifier) + // + ; + + // + // bool isScorePassed = IsScorePassedForShort(); + + // + result = + // // + // isCMCShort + // // + // || + // // + // isSMCShort + // // + // || + // + isMMCShort + // + || + // + isLMCShort + // + || + // + isHMCShort + // + ; + + // // + // result = result && isScorePassed; + + // // + // if (result) + // { + // sl = GetMaxPeaks(); + // } + + // + return result; + } + + // + // Use XCHE ... + bool X110HasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // // + // bool isCCHEShort = + // // + // (mConditions.cMarketConditions.isCHESwitchedInStrongShort && + // (mConditions.sMarketConditions.isCHEInStrongShort && + // mConditions.mMarketConditions.isCHEInStrongShort && + // mConditions.lMarketConditions.isCHEInStrongShort && + // mConditions.hMarketConditions.isCHEInStrongShort)) + // // + // ; + + // // + // bool isSCHEShort = + // // + // (mConditions.sMarketConditions.isCHESwitchedInStrongShort && + // (mConditions.cMarketConditions.isCHEInStrongShort && + // mConditions.mMarketConditions.isCHEInStrongShort && + // mConditions.lMarketConditions.isCHEInStrongShort && + // mConditions.hMarketConditions.isCHEInStrongShort)) + // // + // ; + + // + bool isMCHEShort = + // + (mConditions.mMarketConditions.isCHESwitchedInStrongShort && + (mConditions.cMarketConditions.isCHEInStrongShort && + mConditions.sMarketConditions.isCHEInStrongShort && + mConditions.lMarketConditions.isCHEInStrongShort && + mConditions.hMarketConditions.isCHEInStrongShort)) + // + ; + + // + bool isLCHEShort = + // + (mConditions.lMarketConditions.isCHESwitchedInStrongShort && + (mConditions.cMarketConditions.isCHEInStrongShort && + mConditions.sMarketConditions.isCHEInStrongShort && + mConditions.mMarketConditions.isCHEInStrongShort && + mConditions.hMarketConditions.isCHEInStrongShort)) + // + ; + + // + bool isHCHEShort = + // + (mConditions.hMarketConditions.isCHESwitchedInStrongShort && + (mConditions.cMarketConditions.isCHEInStrongShort && + mConditions.sMarketConditions.isCHEInStrongShort && + mConditions.mMarketConditions.isCHEInStrongShort && + mConditions.lMarketConditions.isCHEInStrongShort)) + // + ; + + // + // bool isScorePassed = IsScorePassedForShort(); + + // + result = + // // + // isCCHEShort + // // + // || + // // + // isSCHEShort + // // + // || + // + isMCHEShort + // + || + // + isLCHEShort + // + || + // + isHCHEShort + // + ; + + // + // result = result && isScorePassed; + + // + return result; + } + + // + // Use XHK ... + bool X92HasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + int curr = 0; + int prev = 1; + + // + bool isCSMHKSwitchedToBearish = + // + mConditions.cMarketConditions.smHKBars[curr].IsBearish() && + !mConditions.cMarketConditions.smHKBars[prev].IsBearish() + // + ; + + // + bool isCSMHKBearish = + // + mConditions.cMarketConditions.smHKBars[curr].IsBearish() && + mConditions.cMarketConditions.smHKBars[prev].IsBearish() && + !mConditions.bars[curr].open < mConditions.cMarketConditions.smHKBars[curr].GetDown() && + !mConditions.bars[prev].close < mConditions.cMarketConditions.smHKBars[prev].GetDown() + // + ; + + // + bool isSSMHKSwitchedToBearish = + // + mConditions.sMarketConditions.smHKBars[curr].IsBearish() && + !mConditions.sMarketConditions.smHKBars[prev].IsBearish() + // + ; + + // + bool isSSMHKBearish = + // + mConditions.sMarketConditions.smHKBars[curr].IsBearish() && + mConditions.sMarketConditions.smHKBars[prev].IsBearish() && + !mConditions.bars[curr].open < mConditions.sMarketConditions.smHKBars[curr].GetDown() && + !mConditions.bars[prev].close < mConditions.sMarketConditions.smHKBars[prev].GetDown() + // + ; + + // + bool isMSMHKSwitchedToBearish = + // + mConditions.mMarketConditions.smHKBars[curr].IsBearish() && + !mConditions.mMarketConditions.smHKBars[prev].IsBearish() + // + ; + + // + bool isMSMHKBearish = + // + mConditions.mMarketConditions.smHKBars[curr].IsBearish() && + mConditions.mMarketConditions.smHKBars[prev].IsBearish() && + !mConditions.bars[curr].open < mConditions.mMarketConditions.smHKBars[curr].GetDown() && + !mConditions.bars[prev].close < mConditions.mMarketConditions.smHKBars[prev].GetDown() + // + ; + + // + bool isLSMHKSwitchedToBearish = + // + mConditions.lMarketConditions.smHKBars[curr].IsBearish() && + !mConditions.lMarketConditions.smHKBars[prev].IsBearish() + // + ; + + // + bool isLSMHKBearish = + // + mConditions.lMarketConditions.smHKBars[curr].IsBearish() && + mConditions.lMarketConditions.smHKBars[prev].IsBearish() && + !mConditions.bars[curr].open < mConditions.lMarketConditions.smHKBars[curr].GetDown() && + !mConditions.bars[prev].close < mConditions.lMarketConditions.smHKBars[prev].GetDown() + // + ; + + // + bool isHSMHKSwitchedToBearish = + // + mConditions.hMarketConditions.smHKBars[curr].IsBearish() && + !mConditions.hMarketConditions.smHKBars[prev].IsBearish() + // + ; + + // + bool isHSMHKBearish = + // + mConditions.hMarketConditions.smHKBars[curr].IsBearish() && + mConditions.hMarketConditions.smHKBars[prev].IsBearish() && + !mConditions.bars[curr].open < mConditions.hMarketConditions.smHKBars[curr].GetDown() && + !mConditions.bars[prev].close < mConditions.hMarketConditions.smHKBars[prev].GetDown() + // + ; + + // + bool isCSMHKShort = + // + (isCSMHKBearish || + isCSMHKSwitchedToBearish) && + isSSMHKBearish && + isMSMHKBearish && + isLSMHKBearish && + isHSMHKBearish + // + ; + + // + bool isSSMHKShort = + // + (isSSMHKBearish || + isSSMHKSwitchedToBearish) && + isCSMHKBearish && + isMSMHKBearish && + isLSMHKBearish && + isHSMHKBearish + // + ; + + // + bool isMSMHKShort = + // + (isMSMHKBearish || + isMSMHKSwitchedToBearish) && + isSSMHKBearish && + isCSMHKBearish && + isLSMHKBearish && + isHSMHKBearish + // + ; + + // + bool isLSMHKShort = + // + (isLSMHKBearish || + isLSMHKSwitchedToBearish) && + isSSMHKBearish && + isCSMHKBearish && + isMSMHKBearish && + isHSMHKBearish + // + ; + + // + bool isHSMHKShort = + // + (isHSMHKBearish || + isHSMHKSwitchedToBearish) && + isSSMHKBearish && + isCSMHKBearish && + isMSMHKBearish && + isLSMHKBearish + // + ; + + // + result = + // + // isCSMHKShort + // // + // || + // // + // isSSMHKShort + // // + // || + // + isMSMHKShort + // + || + // + isLSMHKShort + // + || + // + isHSMHKShort + // + ; + + // + return result; + } + + // + // Use XMRB ... + bool X128HasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + // Current Cycle ... + + // + bool isCMRBFastUnderSlow = + // + mConditions.cMarketConditions.mrbFasts[1] < mConditions.cMarketConditions.mrbSlows[1] + // + ; + + // + bool isCMRBFastCrossedUnderSlow = + // + mConditions.cMarketConditions.mrbFasts[1] < mConditions.cMarketConditions.mrbSlows[1] && + mConditions.cMarketConditions.mrbFasts[2] >= mConditions.cMarketConditions.mrbSlows[2] + // + ; + + // + bool isCMRBClosedUnderFast = + // + mConditions.cMarketConditions.bars[1].close < mConditions.cMarketConditions.mrbFasts[1] + // + ; + + // + // Short Cycle ... + + // + bool isSMRBFastUnderSlow = + // + mConditions.sMarketConditions.mrbFasts[1] < mConditions.sMarketConditions.mrbSlows[1] + // + ; + + // + bool isSMRBFastCrossedUnderSlow = + // + mConditions.sMarketConditions.mrbFasts[1] < mConditions.sMarketConditions.mrbSlows[1] && + mConditions.sMarketConditions.mrbFasts[2] >= mConditions.sMarketConditions.mrbSlows[2] + // + ; + + // + bool isSMRBClosedUnderFast = + // + mConditions.sMarketConditions.bars[1].close < mConditions.sMarketConditions.mrbFasts[1] + // + ; + + // + // Medium Cycle ... + + // + bool isMMRBFastUnderSlow = + // + mConditions.mMarketConditions.mrbFasts[1] < mConditions.mMarketConditions.mrbSlows[1] + // + ; + + // + bool isMMRBFastCrossedUnderSlow = + // + mConditions.mMarketConditions.mrbFasts[1] < mConditions.mMarketConditions.mrbSlows[1] && + mConditions.mMarketConditions.mrbFasts[2] >= mConditions.mMarketConditions.mrbSlows[2] + // + ; + + // + bool isMMRBClosedUnderFast = + // + mConditions.mMarketConditions.bars[1].close < mConditions.mMarketConditions.mrbFasts[1] + // + ; + + // + // Long Cycle ... + + // + bool isLMRBFastUnderSlow = + // + mConditions.lMarketConditions.mrbFasts[1] < mConditions.lMarketConditions.mrbSlows[1] + // + ; + + // + bool isLMRBFastCrossedUnderSlow = + // + mConditions.lMarketConditions.mrbFasts[1] < mConditions.lMarketConditions.mrbSlows[1] && + mConditions.lMarketConditions.mrbFasts[2] >= mConditions.lMarketConditions.mrbSlows[2] + // + ; + + // + bool isLMRBClosedUnderFast = + // + mConditions.lMarketConditions.bars[1].close < mConditions.lMarketConditions.mrbFasts[1] + // + ; + + // + // Hind Cycle ... + + // + bool isHMRBFastUnderSlow = + // + mConditions.hMarketConditions.mrbFasts[1] < mConditions.hMarketConditions.mrbSlows[1] + // + ; + + // + bool isHMRBFastCrossedUnderSlow = + // + mConditions.hMarketConditions.mrbFasts[1] < mConditions.hMarketConditions.mrbSlows[1] && + mConditions.hMarketConditions.mrbFasts[2] >= mConditions.hMarketConditions.mrbSlows[2] + // + ; + + // + bool isHMRBClosedUnderFast = + // + mConditions.hMarketConditions.bars[1].close < mConditions.hMarketConditions.mrbFasts[1] + // + ; + + // + bool isMRBShortWeight = + // + ( + // + isCMRBFastUnderSlow && + isSMRBFastUnderSlow && + isMMRBFastUnderSlow && + isLMRBFastUnderSlow && + isHMRBFastUnderSlow + // + ) + // + || + // + ( + // + isCMRBFastUnderSlow && + (( + isSMRBFastUnderSlow && + isMMRBFastUnderSlow && + isLMRBFastUnderSlow) + // + || + // + ( + isSMRBFastUnderSlow && + isLMRBFastUnderSlow && + isHMRBFastUnderSlow) + // + || + // + ( + isMMRBFastUnderSlow && + isLMRBFastUnderSlow && + isHMRBFastUnderSlow)) + // + ) + // + ; + + // + bool isMBRCloseShort = + // + ( + // + isCMRBClosedUnderFast && + isSMRBClosedUnderFast && + isMMRBClosedUnderFast && + isLMRBClosedUnderFast && + isHMRBClosedUnderFast + // + ) + // + || + // + ( + // + isCMRBClosedUnderFast && + (( + isSMRBClosedUnderFast && + isMMRBClosedUnderFast) + // + || + // + ( + isSMRBClosedUnderFast && + isLMRBClosedUnderFast) + // + || + // + ( + isSMRBClosedUnderFast && + isHMRBClosedUnderFast) + // + || + // + ( + isMMRBClosedUnderFast && + isLMRBClosedUnderFast) + // + || + // + ( + isLMRBClosedUnderFast && + isHMRBClosedUnderFast) + // + || + // + ( + isMMRBClosedUnderFast && + isHMRBClosedUnderFast) + // + || + // + ( + isSMRBClosedUnderFast && + isMMRBClosedUnderFast && + isLMRBClosedUnderFast) + // + || + // + ( + isSMRBClosedUnderFast && + isLMRBClosedUnderFast && + isHMRBClosedUnderFast) + // + || + // + ( + isMMRBClosedUnderFast && + isLMRBClosedUnderFast && + isHMRBClosedUnderFast)) + // + ) + // + ; + + // + bool isCMRBShort = + // + (isCMRBFastUnderSlow || + isCMRBFastCrossedUnderSlow) + // + && + // + isCMRBClosedUnderFast && + // + isMRBShortWeight && + // + isMBRCloseShort + // + ; + + // + bool isSMRBShort = + // + (isSMRBFastUnderSlow || + isSMRBFastCrossedUnderSlow) + // + && + // + isSMRBClosedUnderFast && + // + isMRBShortWeight && + // + isMBRCloseShort + // + ; + + // + bool isMMRBShort = + // + (isMMRBFastUnderSlow || + isMMRBFastCrossedUnderSlow) + // + && + // + isMMRBClosedUnderFast && + // + isMRBShortWeight && + // + isMBRCloseShort + // + ; + + // + bool isLMRBShort = + // + (isLMRBFastUnderSlow || + isLMRBFastCrossedUnderSlow) + // + && + // + isLMRBClosedUnderFast && + // + isMRBShortWeight && + // + isMBRCloseShort + // + ; + + // + bool isHMRBShort = + // + (isHMRBFastUnderSlow || + isHMRBFastCrossedUnderSlow) + // + && + // + isHMRBClosedUnderFast && + // + isMRBShortWeight && + // + isMBRCloseShort + // + ; + + // + result = + // + isCMRBShort + // + || + // + isSMRBShort + // + || + // + isMMRBShort + // + || + // + isLMRBShort + // + || + // + isHMRBShort + // + ; + + // + return result; + } + + // + // XTD ... + bool XTDHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XTAM ... + bool XTAMHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XSI ... + bool XSIHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XTSFI ... + bool XTSFIHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XOBDLH ... + bool XOBDLHHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XCHMACC ... + bool XCHMACCHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XCHMAMN ... + bool XCHMAMNHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // XCHMAMX ... + bool XCHMAMXHasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // Base Signals ... + // Common Conditions ... + + // + bool HasBaseLongConditions( + X121MarketConditions &mConditions, + int &pusher // + ) + { + // + bool result = false; + + // + int count = 0; + + // + bool hasXTDConditions = XTDHasLongConditions(mConditions); + if (hasXTDConditions) + { + count++; + } + bool hasXTAMConditions = XTAMHasLongConditions(mConditions); + if (hasXTAMConditions) + { + count++; + } + bool hasXSIConditions = XSIHasLongConditions(mConditions); + if (hasXSIConditions) + { + count++; + } + bool hasXTSFIConditions = XTSFIHasLongConditions(mConditions); + if (hasXTSFIConditions) + { + count++; + } + bool hasXOBDLHConditions = XOBDLHHasLongConditions(mConditions); + if (hasXOBDLHConditions) + { + count++; + } + bool hasXCHMACCConditions = XCHMACCHasLongConditions(mConditions); + if (hasXCHMACCConditions) + { + count++; + } + bool hasXCHMAMNConditions = XCHMAMNHasLongConditions(mConditions); + if (hasXCHMAMNConditions) + { + count++; + } + bool hasXCHMAMXConditions = XCHMAMXHasLongConditions(mConditions); + if (hasXCHMAMXConditions) + { + count++; + } + + // + result = count >= 1; + pusher = count; + + // + return result; + } + + // + bool HasBaseShortConditions( + X121MarketConditions &mConditions, + int &pusher // + ) + { + // + bool result = false; + + // + int count = 0; + + // + bool hasXTDConditions = XTDHasShortConditions(mConditions); + if (hasXTDConditions) + { + count++; + } + bool hasXTAMConditions = XTAMHasShortConditions(mConditions); + if (hasXTAMConditions) + { + count++; + } + bool hasXSIConditions = XSIHasShortConditions(mConditions); + if (hasXSIConditions) + { + count++; + } + bool hasXTSFIConditions = XTSFIHasShortConditions(mConditions); + if (hasXTSFIConditions) + { + count++; + } + bool hasXOBDLHConditions = XOBDLHHasShortConditions(mConditions); + if (hasXOBDLHConditions) + { + count++; + } + bool hasXCHMACCConditions = XCHMACCHasShortConditions(mConditions); + if (hasXCHMACCConditions) + { + count++; + } + bool hasXCHMAMNConditions = XCHMAMNHasShortConditions(mConditions); + if (hasXCHMAMNConditions) + { + count++; + } + bool hasXCHMAMXConditions = XCHMAMXHasShortConditions(mConditions); + if (hasXCHMAMXConditions) + { + count++; + } + + // + result = count >= 1; + pusher = count; + + // + return result; + } + + // + // XTD ... + + // + bool XTDHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXTDSignalCrossedOverBear + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + bool XTDHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXTDSignalCrossedUnderBear + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // XTAM ... + + // + bool XTAMHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + (mConditions.amas[1] > mConditions.tms[1] && + mConditions.amas[2] > mConditions.tms[2]) + // + && + // + !(mConditions.amas[2] > mConditions.tms[2] && + mConditions.amas[3] > mConditions.tms[3]) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + bool XTAMHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + (mConditions.amas[1] < mConditions.amas[1] && + mConditions.amas[2] < mConditions.amas[2]) + // + && + // + !(mConditions.amas[2] < mConditions.amas[2] && + mConditions.amas[3] < mConditions.amas[3]) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // XSI ... + + // + bool XSIHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXRSICrossedOverLongEntry && + mConditions.rsis[3] < mInputs.rsiInputs.longEntryValue + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + true, // XCHMA Cycles + true, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + bool XSIHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXRSICrossedUnderShortEntry && + mConditions.rsis[3] > mInputs.rsiInputs.shortEntryValue + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + true, // XCHMA Cycles + true, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // XTSFI ... + + // + bool XTSFIHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double tsValues[] = { + mConditions.tsCurrents[1], + mConditions.tsNearests[1], + mConditions.tsMediests[1], + mConditions.tsFarests[1], + }; + + // + double tsMin = GetMin(tsValues); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + tsMin == mConditions.tsFarests[1] && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest) && + (mConditions.tsCurrents[1] < mConditions.tsNearests[1] || + mConditions.tsCurrents[1] < mConditions.tsMediests[1]) && + !(mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + bool XTSFIHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double tsValues[] = { + mConditions.tsCurrents[1], + mConditions.tsNearests[1], + mConditions.tsMediests[1], + mConditions.tsFarests[1], + }; + + // + double tsMax = GetMax(tsValues); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + tsMax == mConditions.tsFarests[1] && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest) && + (mConditions.tsCurrents[1] > mConditions.tsNearests[1] || + mConditions.tsCurrents[1] > mConditions.tsMediests[1]) && + !(mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // XOBDLH ... + + // + bool XOBDLHHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + X121MarketConditions mConditions2; + GetMarketConditions( + mConditions, + 2 // + ); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions2.isXOBDSwingLow && + mConditions2.isXLHLowAttachedLL && + mConditions.lhLls[1] >= mConditions.lhLls[2] + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + false, // XOBD + false // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + bool XOBDLHHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + X121MarketConditions mConditions2; + GetMarketConditions( + mConditions, + 2 // + ); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions2.isXOBDSwingHigh && + mConditions2.isXLHHighAttachedHH && + mConditions.lhHhs[1] <= mConditions.lhHhs[2] + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + false, // XOBD + false // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // XCHMACC ... + + // + bool XCHMACCHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.chmaScFasts[1] > mConditions.chmaScSlows[1] && + mConditions.chmaMcFasts[1] > mConditions.chmaMcSlows[1] && + mConditions.chmaLcFasts[1] > mConditions.chmaLcSlows[1] && + // + mConditions.chmaScFasts[2] > mConditions.chmaScSlows[2] && + mConditions.chmaMcFasts[2] > mConditions.chmaMcSlows[2] && + mConditions.chmaLcFasts[2] > mConditions.chmaLcSlows[2] && + // + !( + // + mConditions.chmaScFasts[3] > mConditions.chmaScSlows[3] && + mConditions.chmaMcFasts[3] > mConditions.chmaMcSlows[3] && + mConditions.chmaLcFasts[3] > mConditions.chmaLcSlows[3] + // + ) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + bool XCHMACCHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.chmaScFasts[1] < mConditions.chmaScSlows[1] && + mConditions.chmaMcFasts[1] < mConditions.chmaMcSlows[1] && + mConditions.chmaLcFasts[1] < mConditions.chmaLcSlows[1] && + // + mConditions.chmaScFasts[2] < mConditions.chmaScSlows[2] && + mConditions.chmaMcFasts[2] < mConditions.chmaMcSlows[2] && + mConditions.chmaLcFasts[2] < mConditions.chmaLcSlows[2] && + // + !( + // + mConditions.chmaScFasts[3] < mConditions.chmaScSlows[3] && + mConditions.chmaMcFasts[3] < mConditions.chmaMcSlows[3] && + mConditions.chmaLcFasts[3] < mConditions.chmaLcSlows[3] + // + ) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // XCHMAMN ... + + // + bool XCHMAMNHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedOverMin && + mConditions.chmaScFasts[2] < nonSCMin2 && + mConditions.chmaScSlows[2] < nonSCMin2 + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + bool XCHMAMNHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedUnderMin && + mConditions.chmaScFasts[2] > nonSCMin2 && + mConditions.chmaScSlows[2] > nonSCMin2 + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + // + return result; + } + + // + // XCHMAMX ... + + // + bool XCHMAMXHasLongConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedOverMax && + mConditions.chmaScFasts[2] < nonSCMax2 && + mConditions.chmaScSlows[2] < nonSCMax2 && + MathAbs(nonSCMax2 - mConditions.chmaScFasts[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) && + MathAbs(nonSCMax2 - mConditions.chmaScSlows[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + bool XCHMAMXHasShortConditions( + X121MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedUnderMax && + mConditions.chmaScFasts[2] > nonSCMax2 && + mConditions.chmaScSlows[2] > nonSCMax2 + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // +}; + +// +// Tools ... + +// +// Model Provider Descriptor ... +struct X121ProviderDescriptor +{ + // + string symbol; // Trading Symbol + ENUM_TIMEFRAMES period; // Trading Timeframe + double staticVolume; // Static Volume for Positions + bool allowLong; // Allow Long Signals + bool allowShort; // Allow Short Signals + ENUM_X121_SIGNAL_PROVIDERS signallers[]; // Allowed Signal Providers + + // + X121ProviderInputs inputs; + XSCX121Provider *provider; + + // + XSignal signal; + X121MarketConditions conditions; + + // + // Tools ... + + // + bool Init() + { + // + bool result = false; + + // + result = this.Init( + this.symbol, + this.period, + this.signallers, + this.allowLong, + this.allowShort, + this.staticVolume // + ); + + // + return result; + } + + // + bool Init( + ENUM_X121_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers + bool mAllowLong = true, // Allow Long Signals + bool mAllowShort = true, // Allow Short Signals + double mStaticVolume = 0.01 // Static Volume for Positions + ) + { + // + bool result = false; + + // + result = this.Init( + this.symbol, + this.period, + mSignallers, + mAllowLong, + mAllowShort, + mStaticVolume // + ); + + // + return result; + } + + // + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mPeriod, // Trading Timeframe + ENUM_X121_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers + bool mAllowLong = true, // Allow Long Signals + bool mAllowShort = true, // Allow Short Signals + double mStaticVolume = 0.01 // Static Volume for Positions + ) + { + // + bool result = false; + + // + result = + // + inputs.IsValid() && + IsValid(mSymbol) && + IsValid(mPeriod) && + NotEmpty(mStaticVolume) && + (allowLong || allowShort) && + ArraySize(mSignallers) > 0 + // + ; + if (!result) + { + return result; + } + + // + this.symbol = mSymbol; + this.period = mPeriod; + this.allowLong = mAllowLong; + this.allowShort = mAllowShort; + this.staticVolume = mStaticVolume; + + // + ENUM_X121_SIGNAL_PROVIDERS tmp[]; + Copy( + mSignallers, + tmp // + ); + Copy( + tmp, + this.signallers // + ); + + // + // Instantiate Provider ... + provider = new XSCX121Provider( + this.symbol, + this.period, + this.staticVolume // + ); + + // + // Set Long/Short State ... + + // + provider + .SetSignalTypeState( + POSITION_TYPE_BUY, + this.allowLong // + ); + + // + provider + .SetSignalTypeState( + POSITION_TYPE_SELL, + this.allowShort // + ); + + // + // Enable Required Signallers ... + provider + .SetSignalProviderStates( + this.signallers, + true // + ); + + // + // Now Must to Initialize Provider ... + result = provider.Init( + this.inputs // + ); + + // + return result; + } + + // + // Cleanup ... + void Clean() + { + // + signal.Clean(); + conditions.Clear(); + } + + // + // Validate ... + bool IsValid(bool validateInputs = true) + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + IsValid(period) && + NotEmpty(staticVolume) && + (validateInputs + ? inputs.IsValid() + : true) && + (allowLong || allowShort) && + ArraySize(signallers) > 0 + // + ; + + // + return result; + } + + // + // Check Signal ... + bool HasSignal(int barIndex = 0) + { + // + bool result = false; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + // Clear Signal and Conditions ... + Clean(); + + // + result = provider.HasSignal( + barIndex, + signal, + conditions // + ); + + // + return result; + } +}; + +// +void GetAllX121SignalProviders(ENUM_X121_SIGNAL_PROVIDERS &result[]) +{ + // + Clean(result); + + // + Add(XSP, result); + Add(XTEST, result); + Add(X786, result); + Add(X121, result); + Add(X110, result); + Add(X92, result); + Add(X128, result); + Add(XTD, result); + Add(XTAM, result); + Add(XSI, result); + Add(XTSFI, result); + Add(XOBDLH, result); + Add(XCHMACC, result); + Add(XCHMAMN, result); + Add(XCHMAMX, result); +} + +// +string ToString(ENUM_X121_SIGNAL_PROVIDERS value) +{ + return EnumToString(value); +} + +// +ENUM_X121_SIGNAL_PROVIDERS ToX121SignalProvider(string content) +{ + // + ENUM_X121_SIGNAL_PROVIDERS result = PROVIDER_NONE; + + // + if (!IsValid(content)) + { + return result; + } + + // + if (content == ToString(PROVIDER_NONE)) + { + result = PROVIDER_NONE; + } + else if (content == ToString(XSP)) + { + result = XSP; + } + else if (content == ToString(XTEST)) + { + result = XTEST; + } + else if (content == ToString(X786)) + { + result = X786; + } + else if (content == ToString(X121)) + { + result = X121; + } + else if (content == ToString(X110)) + { + result = X110; + } + else if (content == ToString(X92)) + { + result = X92; + } + else if (content == ToString(X128)) + { + result = X128; + } + else if (content == ToString(XTD)) + { + result = XTD; + } + else if (content == ToString(XTAM)) + { + result = XTAM; + } + else if (content == ToString(XSI)) + { + result = XSI; + } + else if (content == ToString(XTSFI)) + { + result = XTSFI; + } + else if (content == ToString(XOBDLH)) + { + result = XOBDLH; + } + else if (content == ToString(XCHMACC)) + { + result = XCHMACC; + } + else if (content == ToString(XCHMAMN)) + { + result = XCHMAMN; + } + else if (content == ToString(XCHMAMX)) + { + result = XCHMAMX; + } + + // + return result; +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xea.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xea.class.mq5 new file mode 100644 index 0000000..0269d3b --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xea.class.mq5 @@ -0,0 +1,1676 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCX121EA +// Description: provides all X121 EA requirements ... +// - X5 Provider; +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xea.class.mq5" +#include "../Classes/x-saherelm.x121.provider.class.mq5" + +// +// Define On Signal Event Handler Type Specified for X5 ... +typedef void (*TX121OnSignal)(X121ProviderDescriptor &descriptor); + +// +// Class Definition ... + +class XSCX121EA : public XSCBaseEA +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCX121EA( + // + // XTrade Class Requirements ... + int slippage, // Specify Slippage + ulong magicNumber, // Specify Magic Number + int manageInterval, // Manager Check Intervals Seconds + double maxAllowedSpread, // Max Allowed Spred for Opening Trades + int maxAllowedPositions, // Max Allowed Positions + double maxAllowedDrawdownFactor, // Max Allowed Drawdown Factor + double staticVolume, // Static Volume for Positions + // + // Position Management ... + bool allowLong = true, // Allow Long Trades + bool allowShort = true, // Allow Short Trades + double minProfitPerTrade = 0, // Min Profit Per Trade based On Volume Factor (Hedge) + double minProfitPerVolumeFactor = 0, // Min Volume Factor for Calculating Profit (Hedge) + // + // Event Handlers ... + TOnStopLoss onStopLossTriggered = NULL, // On StopLoass Triggered Event Handler + TOnTakeProfit onTakeProfitTriggered = NULL, // On TakeProfit Triggered Event Handler + TOnDealsChanged onDealsChangedHandler = NULL, // On Deals Changed Event Handler + TOnOrdersChanged onOrdersChangedHandler = NULL, // On Orders Changed Event Handler + TOnPositionsChanged onPositionsChangedHandler = NULL, // On Positions Changed Event Handler + TOnTradeStateChanged onTradeStateChangedHandler = NULL, // On Trade State Changed Event Handler + // + TOnSignal onSignalHandler = NULL, // On Signal Event Handler + // + // Log Handler ... + bool enableAlerts = true, // Enable Alerts + bool logAlerts = true, // Log Alerts + bool terminalAlerts = false, // Terminal Alerts + bool mailAlerts = false, // Mail Alerts + bool pushAlerts = false // Push Alerts + ) : XSCBaseEA(slippage, + magicNumber, + manageInterval, + maxAllowedSpread, + maxAllowedPositions, + maxAllowedDrawdownFactor, + staticVolume, + allowLong, + allowShort, + minProfitPerTrade, + minProfitPerVolumeFactor, + onStopLossTriggered, + onTakeProfitTriggered, + onDealsChangedHandler, + onOrdersChangedHandler, + onPositionsChangedHandler, + onTradeStateChangedHandler, + enableAlerts, + logAlerts, + terminalAlerts, + mailAlerts, + pushAlerts // + ) + { + } + + // + // Deconstructor ... + ~XSCX121EA() {} + + // + // Properties Getter(s) / Setter(s) ... + + // + // Add X5 Specified Signal Event Handler ... + void AddOnSignalEventHandler(TX121OnSignal listener) + { + // + Add( + listener, + mX121OnSignalEventHandlers + // + ); + } + + // + // Add Specified X5 Provider ... + bool AddProvider(X121ProviderDescriptor &descriptor) + { + // + bool result = false; + + // + // Validate Inputs ... + result = descriptor.Init(); + if (!result) + { + return result; + } + + // + AddRef( + descriptor, + mDescriptors // + ); + + // + return result; + } + + // + // Overrides ... + + // + // Customize Token ... + string GetToken() override + { + return GetSpecificToken(this); + } + + // + string GetTag() override + { + return this.GetToken(); + } + + // + void Draw() override + { + // + int descriptorsCount = CountDescriptors(); + if (descriptorsCount <= 0) + { + return; + } + + // + for (int i = 0; i < descriptorsCount; i++) + { + // + X121ProviderDescriptor iDescriptor = mDescriptors[i]; + + // + iDescriptor.provider.Draw(); + } + } + + // + // Check Provider for any Guards ... + bool CheckForGuard(XGuard &guards[]) override + { + // + bool result = false; + + // + Clean(guards); + + // + int descriptorsCount = CountDescriptors(); + result = descriptorsCount > 0; + if (!result) + { + return result; + } + + // + for (int i = 0; i < descriptorsCount; i++) + { + // + X121ProviderDescriptor iDescriptor = mDescriptors[i]; + + // + XGuard iGuards[]; + bool iHasGuard = iDescriptor.provider.HasGuard(iGuards); + if (iHasGuard) + { + // + Copy( + iGuards, + guards, + false // + ); + } + } + + // + result = ArraySize(guards) > 0; + + // + return result; + } + + // + // Request Provider to Collect all + // Potentially Signals and then + // filters theme here and passed them + // for Executing ... + int RequestForSignal( + XSignal &signals[] // Holds Signals ... + ) override + { + // + bool result = 0; + + // + Clean(signals); + + // + int descriptorsCount = CountDescriptors(); + if (descriptorsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < descriptorsCount; i++) + { + // + X121ProviderDescriptor iDescriptor = mDescriptors[i]; + + // + bool iHasSignal = iDescriptor.HasSignal(); + if (iHasSignal) + { + // + // Here we Can double check Signals by Conditions + // for Score Base Filtering ... + + // + AddRef( + iDescriptor.signal, + signals + // + ); + + // + NotifyX121OnSignalEventHandlers(iDescriptor); + } + } + + // + result = ArraySize(signals); + + // + return result; + } + + // + // Handl Management Actions ... + // if returns true, it is going to prevent for processing forward ... + bool HandleStateManagement(XSignal &signals[]) override + { + // + bool result = false; + + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions(positions); + if (positionsCount <= 0) + { + return result; + } + + // + // Synch Position Tracker ... + SyncPositionTracker(); + + // + HandleEQMState(signals); + + // + HandleEQMHedge(positions); + + // + HandleTrailManagement(positions); + + // + // Close all Positions on 22 ... + // TODO: Make it Configurable ... + int closeHour = -1; + MqlDateTime cTime = GetCurrentTime(); + if (closeHour >= 0 && cTime.hour == closeHour) + { + // + string comment = "EQM Close on Time ..."; + + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions(positions); + if (positionsCount <= 0) + { + return result; + } + + // + int closed = mTrader.Close( + positions, + comment // + ); + if (closed > 0) + { + mAlert.Alert(comment); + } + } + + // + // Must false ... + return result; + } + + // + void HandleEQMHedge(XPosition &positions[]) + { + // + // TODO: + // Make them Configurable ... + int numberOfPositionsForHege = 3; + + // + int positionsCount = ArraySize(positions); + if (positionsCount <= 0) + { + return; + } + + // + // Hedge ... + if (positionsCount >= numberOfPositionsForHege) + { + // + int maxAllowedPositions = GetMaxAllowedPositions(); + + // + double profit = CalculatePositionsProfit(positions); + double requiredProfit = CalculateRequiredProfitForHedge(positions); + + // + bool isReadyForHedge = + positionsCount < maxAllowedPositions + ? profit >= requiredProfit + : positionsCount >= maxAllowedPositions && profit >= (requiredProfit * 0.50) + ? true + : false; + if (!isReadyForHedge) + { + return; + } + + // + string comment = "EQM Hedge ..."; + int closed = mTrader.Close( + positions, + comment); + if (closed > 0) + { + // + string message = "EQM Hedge Positions on Profit: " + ToString(profit); + + // + mAlert.Alert(message); + + // + RemoveEQMOrders(); + + // + for (int i = 0; i < positionsCount; i++) + { + RemoveTrail(positions[i].ticket); + } + } + } + } + + // + void HandleEQMState(XSignal &signals[]) + { + // + bool equityReached = !mTrader.CheckEquityForTrade(); + bool maxAllowedReached = !mTrader.CheckPositionsForTrade(); + bool enableEQM = equityReached || maxAllowedReached; + // if (!enableEQM) + // { + // // + // return; + // } + + // + string mSymbols[]; + XSCPositionHolder *mHolders[]; + int symbolsCount = FilterSymbolBasedPositions( + mSymbols, + mHolders // + ); + + // + for (int i = 0; i < symbolsCount; i++) + { + // + string iSymbol = mSymbols[i]; + XSCPositionHolder *iHolder = mHolders[i]; + + // + // We Can Select Multiple Positions for Place EQM Supports ... + + // + // Select Max In Drawdown Position and Protect it ... + XPosition iSelectedPosition; + bool iHasPosition = iHolder.GetMaxInDrawdown(iSelectedPosition); + if (iHasPosition) + { + // + // Try to Protect Max In Drawdown Positions Position ... + PlaceEQMOrders(iSelectedPosition); + } + } + + // + } + + // + // Add Or Update EQM Orders ... + void PlaceEQMOrders(XPosition &position) + { + // + // TODO: Make It Configurable ... + int maxEQMCount = 5; + return; + + // + // Position Protection Senarioos ... + if (!position.IsValid()) + { + return; + } + + // + int descriptorIDX = FindDescriptorIndex(position); + if (descriptorIDX <= -1) + { + return; + } + + // + X121ProviderDescriptor descriptor = mDescriptors[descriptorIDX]; + + // + XOHCLSupRes slSupRes; + bool hasSupRes = descriptor + .provider + .GenerateSupRes( + slSupRes, + position.type, + 5 // + ); + + // + XDrawSpecifications supDrawSpecs; + supDrawSpecs.draw = true; + supDrawSpecs.rayRight = true; + supDrawSpecs.clr = clrLightGreen; + + //, + XDrawSpecifications resDrawSpecs; + resDrawSpecs.draw = true; + resDrawSpecs.rayRight = true; + resDrawSpecs.clr = clrLightCoral; + + // + // DrawSupRes( + // slSupRes, + // supDrawSpecs, + // resDrawSpecs // + // ); + + // + XSignal supports[]; + int supportsCount = GenerateEQMOrders( + supports, + position, + slSupRes // + ); + if (!IsValidSize(supportsCount)) + { + return; + } + + // + XOrder untriggeredOrders[]; + int untriggeredOrdersCount = mTrader.GetOrders( + untriggeredOrders, + position.symbol, + XEQMSupportToken, + position.period, + NULL, // All Types ... + ORDER_STATE_PLACED, + true // + ); + + // + XPosition triggereSupports[]; + int tiggeredSupportsCount = mTrader.GetPositions( + triggereSupports, + position.symbol, + XEQMSupportToken, + position.period, + NULL, // All Types ... + true // + ); + + // + if (untriggeredOrdersCount + + tiggeredSupportsCount >= + maxEQMCount) + { + return; + } + + // + XSignal filteredSignals[]; + for (int i = 0; i < supportsCount; i++) + { + // + XSignal iSupport = supports[i]; + + // + double sl; + iSupport.RegularSL(sl); + + // + double tp; + iSupport.RegularTP(tp); + + // + if (!IsValidSize(untriggeredOrdersCount) && !IsValidSize(tiggeredSupportsCount)) + { + // + AddRef( + iSupport, + filteredSignals // + ); + + // + continue; + } + + // + bool isOrdersPassed = true; + if (!IsValidSize(untriggeredOrdersCount)) + { + isOrdersPassed = true; + } + else + { + // + for (int j = 0; j < untriggeredOrdersCount; j++) + { + // + XOrder jOrder = untriggeredOrders[j]; + + // + bool isSame = + // + jOrder.symbol == iSupport.symbol && + jOrder.period == iSupport.period && + jOrder.openPrice == iSupport.entry && + jOrder.sl == sl && + jOrder.tp == tp + // + ; + if (isSame) + { + // + isOrdersPassed = false; + break; + } + } + } + + // + bool isPositionsPassed = true; + if (!IsValidSize(tiggeredSupportsCount)) + { + isPositionsPassed = true; + } + else + { + // + for (int j = 0; j < tiggeredSupportsCount; j++) + { + // + XPosition jPosition = triggereSupports[j]; + + // + bool isSame = + // + jPosition.symbol == iSupport.symbol && + jPosition.period == iSupport.period && + jPosition.entry == iSupport.entry && + jPosition.sl == sl && + jPosition.tp == tp + // + ; + if (isSame) + { + // + isPositionsPassed = false; + break; + } + } + } + + // + if (isOrdersPassed && + isPositionsPassed) + { + // + AddRef( + iSupport, + filteredSignals // + ); + } + } + int filteredSignalsCount = ArraySize(filteredSignals); + if (!IsValidSize(filteredSignalsCount)) + { + return; + } + + // + ENUM_X_SIGNAL_EXECUTION_RESULT states[]; + int placedOrders = mTrader.ExecuteSignals( + filteredSignals, + states, + ORDER_TIME_GTC, + NULL, + false // Ignore Policies ... + ); + if (placedOrders > 0) + { + // + string message = "EQM Placed (" + ToString(placedOrders) + ") Support Orders ..."; + + // + mAlert.Alert(message); + } + } + + // + void RemoveEQMOrders() + { + // + XOrder untriggeredOrders[]; + int untriggeredOrdersCount = mTrader.GetOrders( + untriggeredOrders, + NULL, + XEQMSupportToken, + NULL, + NULL, // All Types ... + ORDER_STATE_PLACED, + true // + ); + if (!IsValidSize(untriggeredOrdersCount)) + { + return; + } + + // + int canceleds = mTrader.CancelOrders( + untriggeredOrders // + ); + if (canceleds > 0) + { + // + string message = "EQM Cancel Support ..."; + + // + mAlert.Alert(message); + } + } + + // + void HandleTrailManagement(XPosition &positions[]) + { + // + // TODO: + // Make them Configurable ... + int maxTrailTPs = 5; + int levelsOnClose = 6; + int riskFreeLevel = 2; + int requiredAgeForTrail = 0; + int requiredDistanceForTrail = 20; + + // + int positionsCount = ArraySize(positions); + if (positionsCount <= 0) + { + return; + } + + // + double profit = CalculatePositionsProfit(positions); + + // + // Trail Positions Stop ... + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + bool canManageState = + // + iPosition.provider != XEQMSupportToken + // + ; + + // + // Position Management for X786 ... + if (canManageState) + { + // + // When Position in Profit, Trail SL ... + if (profit > 0) + { + // + if (iPosition.profit > 0) + { + // + XTrail trail; + bool isTrailedBefore = GetSLTrail( + iPosition.ticket, + trail // + ); + + // + if (!isTrailedBefore) + { + // + // Add First Time ... + + // + // Check Position Age ... + int iPositionAge = iPosition.GetAge(iPosition.period); + if (iPositionAge < requiredAgeForTrail) + { + continue; + } + + // + // Check Position Profit Distance ... + double priceDistanceInPoint = PriceToPoint(iPosition.profit / iPosition.volume, iPosition.symbol); + double priceDistance = PointToPrice(priceDistanceInPoint, iPosition.symbol); + if (priceDistance < requiredDistanceForTrail) + { + continue; + } + + // + double slDiff = PointToPrice(priceDistance, iPosition.symbol); + double appliedSL = slDiff; + + // + double sl = + IsLong(iPosition.type) + ? iPosition.sl + appliedSL + : iPosition.sl - appliedSL; + + // + // double sl = + // IsLong(iPosition.type) + // ? iPosition.entry + appliedSL + // : iPosition.entry - appliedSL; + + // + bool isInit = trail.Init( + iPosition.ticket, + iPosition.type, + iPosition.profit, + iPosition.sl, + sl // + ); + if (!isInit) + { + continue; + } + } + else + { + // + // Update Exists ... + + // + // Check Profit ... + bool isProfitPassed = iPosition.profit > trail.profit; + if (!isProfitPassed) + { + continue; + } + + // + // Check Age Distance from Last ... + int age = iBarShift( + iPosition.symbol, + iPosition.period, + trail.time, + false // + ); + if (age < requiredAgeForTrail) + { + continue; + } + + // + double priceDistanceInPoint = PriceToPoint((iPosition.profit - trail.profit) / iPosition.volume, iPosition.symbol); + double priceDistance = PointToPrice(priceDistanceInPoint, iPosition.symbol); + if (priceDistance < requiredDistanceForTrail) + { + continue; + } + + // + bool isLong = IsLong(iPosition.type); + + // + double slDiff = PointToPrice(priceDistance, iPosition.symbol); + double appliedSL = (slDiff / 2); + + // + double selectedValue = + // + (riskFreeLevel > 0 && + trail.level == riskFreeLevel) || + (isLong + ? iPosition.sl < iPosition.entry + : iPosition.sl > iPosition.entry) + ? iPosition.entry + : iPosition.sl + // + ; + + // + double sl = + isLong + ? selectedValue + appliedSL + : selectedValue - appliedSL; + + // + // Update Trail Values ... + bool isUpdated = trail.Update( + sl, + iPosition.profit // + ); + if (!isUpdated) + { + continue; + } + } + + // + if (trail.IsValid()) + { + // + string comment = trail.GenerateTag(); + bool isModified = mTrader.Modify( + trail.ticket, + trail.after, + iPosition.tp, + comment // + ); + if (isModified) + { + // + RemoveTrail(trail.ticket); + + // + AddSLTrail(trail); + + // + string message = "Position (" + ToString(trail.ticket) + ") Trailed SL on Level: " + ToString(trail.level); + mAlert.Alert(message); + } + } + } + } + + // + // When Position in Drawdown Trail TP ... + if (profit < 0) + { + // + if (iPosition.profit < 0) + { + // + XTrail trail; + bool isTrailedBefore = GetTPTrail( + iPosition.ticket, + trail // + ); + + // + if (!isTrailedBefore) + { + // + // Add First Time ... + + // + // Check Position Age ... + int iPositionAge = iPosition.GetAge(iPosition.period); + if (iPositionAge < requiredAgeForTrail) + { + continue; + } + + // + // Check Position Profit Distance ... + double priceDistanceInPoint = PriceToPoint(MathAbs(iPosition.profit) / iPosition.volume, iPosition.symbol); + double priceDistance = PointToPrice(priceDistanceInPoint, iPosition.symbol); + if (priceDistance < requiredDistanceForTrail) + { + continue; + } + + // + double tpDiff = PointToPrice(priceDistance, iPosition.symbol); + double appliedTP = tpDiff / 2; + + // + double tp = + IsLong(iPosition.type) + ? iPosition.tp - appliedTP + : iPosition.tp + appliedTP; + + // + bool isInit = trail.Init( + iPosition.ticket, + iPosition.type, + iPosition.profit, + iPosition.tp, + tp // + ); + if (!isInit) + { + continue; + } + } + else + { + // + // Update Exists ... + + // + if (trail.level >= maxTrailTPs) + { + continue; + } + + // + // Check Profit ... + bool isProfitPassed = MathAbs(iPosition.profit) > MathAbs(trail.profit); + if (!isProfitPassed) + { + continue; + } + + // + // Check Age Distance from Last ... + int age = iBarShift( + iPosition.symbol, + iPosition.period, + trail.time, + false // + ); + if (age < requiredAgeForTrail) + { + continue; + } + + // + double priceDistanceInPoint = PriceToPoint((MathAbs(iPosition.profit) - MathAbs(trail.profit)) / iPosition.volume, iPosition.symbol); + double priceDistance = PointToPrice(priceDistanceInPoint, iPosition.symbol); + + // + bool isLong = IsLong(iPosition.type); + + // + double tpDiff = PointToPrice(priceDistance, iPosition.symbol); + double appliedTP = tpDiff / 2; + + // + double tp = + isLong + ? iPosition.tp - appliedTP + : iPosition.tp + appliedTP; + + // + // Update Trail Values ... + bool isUpdated = trail.Update( + tp, + iPosition.profit // + ); + if (!isUpdated) + { + continue; + } + } + + // + if (trail.IsValid()) + { + // + string comment = trail.GenerateTag(); + bool isModified = mTrader.Modify( + trail.ticket, + iPosition.sl, + trail.after, + comment // + ); + if (isModified) + { + // + RemoveTrail(trail.ticket); + + // + AddTPTrail(trail); + + // + string message = "Position (" + ToString(trail.ticket) + ") Trailed TP on Level: " + ToString(trail.level); + mAlert.Alert(message); + } + } + } + } + } + } + } + + // + // Here we Can Filter Signals before Sending them to Execution ... + // based on Providers and etc ... + // for Volumes and Benefits ... + int HandleSignalManagement(XSignal &signals[]) override + { + // + // TODO: Make this Configurable ... + int minDistanceBetweenTwoSameProviderSignal = 7; + + // + int result = 0; + + // + if (ArraySize(signals) <= 0) + { + return result; + } + + // + // Create temp Array for Filtering ... + XSignal tmps[]; + Copy( + signals, + tmps // + ); + int tmpsCount = ArraySize(tmps); + + // + // Cleaning Source ... + Clean(signals); + + // + // Loop through Signals for Management ... + for (int i = 0; i < tmpsCount; i++) + { + // + XSignal iSignal = tmps[i]; + + // + // dont Manage NON Signal Provider's signals ... + string provider = iSignal.provider; + if (!IsValid(provider)) + { + // + AddRef( + iSignal, + signals // + ); + + // + continue; + } + + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions( + positions, + iSignal.symbol, + iSignal.provider, + NULL, // All Periods ... + iSignal.type // + ); + XPosition symbolPositions[]; + int symbolPositionsCount = mTrader.GetPositions( + positions, + iSignal.symbol, + NULL, // All Providers ... + NULL, // All Periods ... + iSignal.type // + ); + double profit = CalculatePositionsProfit(positions); + double symbolProfit = CalculatePositionsProfit(symbolPositions); + if (positionsCount <= 0) + { + // + // First Signal in a While of Specific Provider ... + + // + // iSignal.volume *= 2; + + // + AddRef( + iSignal, + signals // + ); + + // + continue; + } + else if (positionsCount < 2) + { + // + // Next Signal in a While of Specific Provider ... + + // + // Find Longest Position and Check it's Age ... + // Compare it by min age for same provider signals ... + XPosition youngest; + int youngestAge = GetYoungest( + youngest, + positions // + ); + if (youngestAge == -1 || youngestAge < minDistanceBetweenTwoSameProviderSignal) + { + continue; + } + + // + AddRef( + iSignal, + signals // + ); + + // + continue; + } + // else if (profit > 0 && symbolProfit > 0) + // { + // // + // AddRef( + // iSignal, + // signals // + // ); + // } + } + + // + result = ArraySize(signals); + + // + return result; + } + + // + // Request for Support Signals using Guard ... + bool RequestForSupport( + XSignal &support, // Holds Support Signal, if Provided + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame + ) override + { + // + // TODO: Implement this ... + + // + // Support Senario ... + // Check Support Position Exists or not ... + // Check Positions for Support based on Types ... + // Update Untriggered Positions ... + return false; + } + + // + // Tools ... + + // + // Management Tracker/Profit etc ... + + // + // Handle Position Changed Event ... + void OnPositionsChangedHandler(int count) override + { + // + // Synchronize Tracker ... + SyncPositionTracker(); + } + + // + // Called when a Position Going in Profit ... + void OnPositionGoingInProfit(XPositionTrack &track) override + { + // + string message = "Position (" + ToString(track.ticket) + ", " + track.symbol + ") Dropped in Profit ..."; + + // + mAlert.Alert(message); + } + + // + // Called when a Position Going to Drawdown ... + void OnPositionGoingToDrawdown(XPositionTrack &track) override + { + // + string message = "Position (" + ToString(track.ticket) + ", " + track.symbol + ") Dropped in Drawdown ..."; + + // + mAlert.Alert(message); + } + + // + // Called when Account Going in Profit ... + void OnGoingToProfit(XProfitTrack &track) override + { + // + string message = "Account In Profit ..."; + + // + mAlert.Alert(message); + + // + RemoveEQMOrders(); + } + + // + // Called when Account Going in Drawdown ... + void OnGoingToDrawdown(XProfitTrack &track) override + { + // + string message = "Account In Drawdown ..."; + + // + mAlert.Alert(message); + + // + // Here i Have to Detect In DrawDown Positions ... + + // + RemoveEQMOrders(); + + // + string mSymbols[]; + XSCPositionHolder *mHolders[]; + int symbolsCount = FilterSymbolBasedPositions( + mSymbols, + mHolders // + ); + + // + for (int i = 0; i < symbolsCount; i++) + { + // + string iSymbol = mSymbols[i]; + XSCPositionHolder *iHolder = mHolders[i]; + + // + XPosition iMaxInDP; + bool hasMaxInDP = iHolder.GetMaxInDrawdown(iMaxInDP); + if (!hasMaxInDP) + { + continue; + } + + // + // Try to Protect a Position ... + ProtectPosition(iMaxInDP); + } + } + + // + // Protected ... +protected: + // + // Tools ... + + // + void NotifyX121OnSignalEventHandlers(X121ProviderDescriptor &descriptor) + { + // + int listenersCount = ArraySize(mX121OnSignalEventHandlers); + if (listenersCount <= 0) + { + return; + } + + // + for (int i = 0; i < listenersCount; i++) + { + // + TX121OnSignal iListener = mX121OnSignalEventHandlers[i]; + + // + iListener(descriptor); + } + } + + // + // Protect Specified Position ... + void ProtectPosition(XPosition &position) + { + // + // Here i Can Protect Position ... + // This Protect Include One Position in Market Mode ... + // If Provided ... + // the Positions Selection must passed Some conditions ... + + // + string message = "For (" + position.symbol + ") Max In Drawdown Position is: (" + + ToString(position.ticket) + "), by Profit: " + ToString(position.profit); + + // + mAlert.Alert(message); + } + + // + // Private ... +private: + // + // Props ... + + // + // Collection of Signal Event Listeners ... + TX121OnSignal mX121OnSignalEventHandlers[]; + + // + // a Collection of X5 Provider Descriptors ... + X121ProviderDescriptor mDescriptors[]; + + // + int CountDescriptors() + { + return ArraySize(mDescriptors); + } + + // + // Find Specifc Descriptor ... + int FindDescriptorIndex( + string symbol, + ENUM_TIMEFRAMES period // + ) + { + // + int result = -1; + + // + if (!IsValid(symbol) || + !IsValid(period)) + { + return result; + } + + // + int descriptorsCount = CountDescriptors(); + if (!IsValidSize(descriptorsCount)) + { + return result; + } + + // + for (int i = 0; i < descriptorsCount; i++) + { + // + X121ProviderDescriptor iDescriptor = mDescriptors[i]; + + // + bool isPassed = + // + iDescriptor.symbol == symbol && + iDescriptor.period == period + // + ; + if (isPassed) + { + // + result = i; + break; + } + } + + // + return result; + } + + template + int FindDescriptorIndex( + T &item // + ) + { + return FindDescriptorIndex( + item.symbol, + item.period // + ); + } + + // + // Trails Holding ... + + // + XTrail mSLTrails[]; + XTrail mTPTrails[]; + + // + int CountSLTrails() + { + return ArraySize(mSLTrails); + } + int CountTPTrails() + { + return ArraySize(mTPTrails); + } + + // + bool RemoveTrail(ulong ticket) + { + // + bool isSLRemoved = RemoveSLTrail(ticket); + bool isTPRemoved = RemoveTPTrail(ticket); + + // + bool result = isSLRemoved || isTPRemoved; + + // + return result; + } + bool RemoveSLTrail(ulong ticket) + { + // + bool result = false; + + // + int idx = FindSLTrailIndex(ticket); + result = idx >= 0; + if (!result) + { + return result; + } + + // + result = ArrayRemove( + mSLTrails, + idx, + 1 // + ); + + // + return result; + } + bool RemoveTPTrail(ulong ticket) + { + // + bool result = false; + + // + int idx = FindTPTrailIndex(ticket); + result = idx >= 0; + if (!result) + { + return result; + } + + // + result = ArrayRemove( + mTPTrails, + idx, + 1 // + ); + + // + return result; + } + + // + int FindSLTrailIndex(ulong ticket) + { + // + int result = -1; + + // + int trailsCount = CountSLTrails(); + if (ticket <= 0 || trailsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < trailsCount; i++) + { + // + XTrail iTrail = mSLTrails[i]; + + // + if (iTrail.ticket == ticket) + { + // + result = i; + break; + } + } + + // + return result; + } + int FindTPTrailIndex(ulong ticket) + { + // + int result = -1; + + // + int trailsCount = CountTPTrails(); + if (ticket <= 0 || trailsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < trailsCount; i++) + { + // + XTrail iTrail = mTPTrails[i]; + + // + if (iTrail.ticket == ticket) + { + // + result = i; + break; + } + } + + // + return result; + } + + // + bool GetSLTrail( + ulong ticket, + XTrail &trail // + ) + { + // + bool result = false; + + // + int idx = FindSLTrailIndex(ticket); + result = idx >= 0; + if (!result) + { + return result; + } + + // + trail = mSLTrails[idx]; + + // + return result; + } + bool GetTPTrail( + ulong ticket, + XTrail &trail // + ) + { + // + bool result = false; + + // + int idx = FindTPTrailIndex(ticket); + result = idx >= 0; + if (!result) + { + return result; + } + + // + trail = mTPTrails[idx]; + + // + return result; + } + + // + void AddSLTrail( + XTrail &trail // + ) + { + // + if (!trail.IsValid()) + { + return; + } + + // + AddRef( + trail, + mSLTrails // + ); + } + void AddTPTrail( + XTrail &trail // + ) + { + // + if (!trail.IsValid()) + { + return; + } + + // + AddRef( + trail, + mTPTrails // + ); + } + + // + // Tools ... +}; + +// +// Tools ... + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xmcycle.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xmcycle.class.mq5 new file mode 100644 index 0000000..6065c14 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x121.xmcycle.class.mq5 @@ -0,0 +1,5738 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSC121MCycle +// Description: provides all requirements for +// Handling Specified Market Cycle Analysis... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... + +// +#include "../Libraries/x-saherelm.draw.lib.mq5" + +// +#include "../Helpers/x-saherelm.xhk.helper.mq5" +#include "../Helpers/x-saherelm.xmc.helper.mq5" +#include "../Helpers/x-saherelm.xpv.helper.mq5" +#include "../Helpers/x-saherelm.xzg.helper.mq5" +#include "../Helpers/x-saherelm.xmrb.helper.mq5" +#include "../Helpers/x-saherelm.xdon.helper.mq5" +#include "../Helpers/x-saherelm.xche.helper.mq5" +#include "../Helpers/x-saherelm.xosc.helper.mq5" +#include "../Helpers/x-saherelm.xstr.helper.mq5" +#include "../Helpers/x-saherelm.xich.helper.mq5" + +// +#include "../Classes/x-saherelm.xprovider.class.mq5" + +// +// Definitions ... + +// +// X121 Specified Market Cycle Structure ... +class X121MCycleInputs : public XSCBaseProviderInpts +{ + // + // Public ... +public: + // + // Props ... + + // + XMarketCycle cycle; // Cycle Descriptor ... + + // + // Draw Props ... + + // + XDrawSpecifications cBarMidDrawSpecs; // Current Bar MidLine Draw Specifications + XOHCLDrawSpecification cBarDrawSpecs; // Current Bar Draw Specifications + + // + XDrawSpecifications pBarMidDrawSpecs; // Previous Bar MidLine Draw Specifications + XOHCLDrawSpecification pBarDrawSpecs; // Previous Bar Draw Specifications + + // + bool drawLabels; // Draw Labels + bool drawCBar; // Draw Current Bar + bool drawPBar; // Draw Previous Bar + bool drawCBarMid; // Draw Current Bar Mid Line + bool drawPBarMid; // Draw Previous Bar Mid Line + + // + XHKInputs hkInputs; // HK Inputs ... + XMCInputs mcInputs; // MC Inputs ... + XPVInputs pvInputs; // PV Inputs ... + XZGInputs zgInputs; // ZG Inputs ... + XMRBInputs mrbInputs; // MRB Inputs ... + XSTRInputs strInputs; // STR Inputs ... + XOSCInputs oscInputs; // OSC Inputs ... + XCHEInputs cheInputs; // CHE Inputs ... + XICHInputs ichInputs; // ICH Inputs ... + XDONInputs donInputs; // DON Inputs ... + + // + // Constructor ... + + // + // Tools ... + + // + // Initialize Market Cycle ... + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mHostPeriod, // Host Period + ENUM_X_MARKET_CYCLES mCycle, // Init Cycle + ENUM_TIMEFRAMES mPeriod, // Cycle Period + ENUM_X_PERIOD_METHOD mPeriodMethod, // Cycle Period Method + string mPrefix = "", // Prefix + bool useDefaults = true // Use Inputs Default Settings ... + ) + { + // + bool result = false; + + // + cycle.period = mPeriod; + cycle.method = mPeriodMethod; + + // + // Initial Cycle Model ... + result = cycle.Init( + mSymbol, + mHostPeriod, + mCycle, + mPrefix + // + ); + if (!result) + { + return result; + } + + // + if (useDefaults) + { + // + hkInputs.Default(); + mcInputs.Default(); + pvInputs.Default(); + zgInputs.Default(); + mrbInputs.Default(); + strInputs.Default(); + oscInputs.Default(); + cheInputs.Default(); + ichInputs.Default(); + donInputs.Default(); + } + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + return result; + } + + // + // Initialize Market Cycle ... + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mHostPeriod, // Host Period + ENUM_X_MARKET_CYCLES mCycle, // Init Cycle + XHKInputs &mHkInputs, // HK Inputs + XMCInputs &mMcInputs, // MC Inputs + XPVInputs &mPvInputs, // PV Inputs ... + XZGInputs &mZgInputs, // ZG Inputs ... + XMRBInputs &mMrbInputs, // MRB Inputs ... + XSTRInputs &mStrInputs, // STR Inputs + XOSCInputs &mOscInputs, // OSC Inputs + XCHEInputs &mCheInputs, // CHE Inputs + XICHInputs &mIchInputs, // ICH Inputs ... + XDONInputs &mDonInputs, // DON Inputs ... + int mHostBarIndex = 0, // Specified Host Period Bar Index + string mPrefix = "" // Prefix + ) + { + // + bool result = false; + + // + // Initial Cycle Model ... + result = cycle.Init( + mSymbol, + mHostPeriod, + mCycle, + mPrefix + // + ); + if (!result) + { + return result; + } + + // + hkInputs = mHkInputs; + mcInputs = mMcInputs; + pvInputs = mPvInputs; + zgInputs = mZgInputs; + mrbInputs = mMrbInputs; + strInputs = mStrInputs; + oscInputs = mOscInputs; + cheInputs = mCheInputs; + ichInputs = mIchInputs; + donInputs = mDonInputs; + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + return result; + } + + // + // Cleanup ... + virtual void Clean() + { + // + cycle.Clean(); + + // + hkInputs.Clean(); + mcInputs.Clean(); + pvInputs.Clean(); + zgInputs.Clean(); + mrbInputs.Clean(); + strInputs.Clean(); + oscInputs.Clean(); + cheInputs.Clean(); + ichInputs.Clean(); + donInputs.Clean(); + + // + cBarDrawSpecs.Clean(); + pBarDrawSpecs.Clean(); + cBarMidDrawSpecs.Clean(); + pBarMidDrawSpecs.Clean(); + + // + drawLabels = false; + drawCBar = false; + drawPBar = false; + drawCBarMid = false; + drawPBarMid = false; + } + + // + // Default ... + virtual void Default() + { + // + hkInputs.Default(); + mcInputs.Default(); + pvInputs.Default(); + zgInputs.Default(); + mrbInputs.Default(); + strInputs.Default(); + oscInputs.Default(); + cheInputs.Default(); + ichInputs.Default(); + donInputs.Default(); + + // + drawLabels = false; + drawCBar = false; + drawPBar = false; + drawCBarMid = false; + drawPBarMid = false; + } + + // + // Validation ... + virtual bool IsValid() + { + // + bool result = false; + + // + result = cycle.IsValid(); + if (!result) + { + return result; + } + + // + result = hkInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = mcInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = pvInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = zgInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = mrbInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = strInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = oscInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = cheInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = ichInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = donInputs.IsValid(); + if (!result) + { + return result; + } + + // + return result; + } + + // + // Max ... + virtual int Max() + { + // + int result = 0; + + // + result = MathMax(mcInputs.Max(), strInputs.Max()); + + // + result = MathMax(result, hkInputs.Max()); + result = MathMax(result, mcInputs.Max()); + result = MathMax(result, pvInputs.Max()); + result = MathMax(result, zgInputs.Max()); + result = MathMax(result, mrbInputs.Max()); + result = MathMax(result, strInputs.Max()); + result = MathMax(result, oscInputs.Max()); + result = MathMax(result, cheInputs.Max()); + result = MathMax(result, ichInputs.Max()); + result = MathMax(result, donInputs.Max()); + + // + return result; + } +}; + +// +// Specific Market Sense Based on Specified Bar Index on Host Period ... +class X121MCycleConditions : public XSCBaseProviderMarketConditions +{ + // + // Public ... +public: + // + // Props ... + + // + // Common ... + string prefix; // Cycle Prefix ... + ENUM_TIMEFRAMES hostPeriod; // Hosting Time Frame ... + ENUM_X_MARKET_CYCLES cycle; // Init Cycle ... + + // + // Candlestic Conditions ... + bool isLastBullish; + bool isLastBearish; + bool isCurrentBullish; + bool isCurrentBearish; + bool isCurrentMidLineOverLastHigh; + bool isCurrentMidLineUnderLastLow; + bool isCurrentMidLineOverLastUp; + bool isCurrentMidLineUnderLastDown; + bool isCurrentMidLineOverLastMidLine; + bool isCurrentMidLineUnderLastMidLine; + + // + // Buffers ... + + // + XOHCL hkBars[]; + XOHCL smHKBars[]; + + // + // XICH ... + double ichTenkanSens[]; + double ichKijunSens[]; + double ichChikouSpans[]; + double ichSenkouSpanAs[]; + double ichSenkouSpanBs[]; + + // + // XMC ... + double mcFasts[]; + double mcSlows[]; + double mcVerifiers[]; + + // + // XSTR ... + double strTrends[]; + double strStates[]; + + // + // XZG ... + double zigzags[]; + double zigzagPVs[]; + + // + // XMRB ... + + // + double mrbFasts[]; + double mrb1Fasts[]; + double mrb2Fasts[]; + double mrb3Fasts[]; + double mrb4Fasts[]; + double mrb5Fasts[]; + double mrb6Fasts[]; + + // + double mrbSlows[]; + double mrb1Slows[]; + double mrb2Slows[]; + double mrb3Slows[]; + double mrb4Slows[]; + double mrb5Slows[]; + double mrb6Slows[]; + + // + // XCHE ... + double cheLongExit1s[]; + double cheLongExit2s[]; + double cheShortExit1s[]; + double cheShortExit2s[]; + + // + // XDON ... + double donUpperOs[]; + double donLowerOs[]; + double donUpperCs[]; + double donLowerCs[]; + double donUpperHs[]; + double donLowerHs[]; + double donUpperLs[]; + double donLowerLs[]; + + // + // XPV ... + double pvPeaks[]; + double pvVales[]; + double pvResistances[]; + double pvSupports[]; + double pvFib1s[]; + double pvFib2s[]; + double pvFib3s[]; + double pvFib4s[]; + double pvFib5s[]; + double pvSCHHs[]; + double pvSCLLs[]; + double pvMCHHs[]; + double pvMCLLs[]; + double pvLCHHs[]; + double pvLCLLs[]; + double pvHCHHs[]; + double pvHCLLs[]; + + // + // XOSC ... + double oscAtrs[]; + double oscRviMains[]; + double oscRviSignals[]; + double oscBullPs[]; + double oscBearPs[]; + double oscVolumes[]; + double oscRsis[]; + double oscCcis[]; + double oscMomentums[]; + double oscSars[]; + double oscMacdMains[]; + double oscMacdSignals[]; + double oscStochMains[]; + double oscStochSignals[]; + double oscStddevs[]; + + // + // XHK ... + + // + bool isHKBullish; + bool isSMHKBullish; + bool isHKBearish; + bool isSMHKBearish; + bool isClosedOverSMHK; + bool isClosedUnderSMHK; + bool isHKBullishPrev; + bool isSMHKBullishPrev; + bool isHKBearishPrev; + bool isSMHKBearishPrev; + bool isClosedOverSMHKPrev; + bool isClosedUnderSMHKPrev; + + // + // XZG ... + + // + bool isZigZagInPeak; + bool isZigZagInVale; + + // + // XDON ... + + // + bool isDONAttachedMaxLower; + bool isDONAttachedMinLower; + bool isDONCrossedOverMaxLower; + bool isDONCrossedUnderMaxLower; + + // + bool isDONAttachedMaxUpper; + bool isDONAttachedMinUpper; + bool isDONCrossedOverMaxUpper; + bool isDONCrossedUnderMaxUpper; + + // + // XPV ... + + // + bool isPVPeakSameAs; + bool isPVNewPeak; + bool isPVNewPeakOverLast; + bool isPVNewPeakUnderLast; + bool isPVValeSameAs; + bool isPVNewVale; + bool isPVNewValeOverLast; + bool isPVNewValeUnderLast; + bool isPVFiboIncreased; + bool isPVFiboDecreased; + bool isPVFiboSectionChanged; + + // + bool isPVSCBullish; + bool isPVSCHHBullish; + bool isPVSCLLBullish; + bool isPVSCSwitchedToBullish; + + // + bool isPVSCBearish; + bool isPVSCHHBearish; + bool isPVSCLLBearish; + bool isPVSCSwitchedToBearish; + + // + bool isPVMCBullish; + bool isPVMCHHBullish; + bool isPVMCLLBullish; + bool isPVMCSwitchedToBullish; + + // + bool isPVMCBearish; + bool isPVMCHHBearish; + bool isPVMCLLBearish; + bool isPVMCSwitchedToBearish; + + // + bool isPVLCBullish; + bool isPVLCHHBullish; + bool isPVLCLLBullish; + bool isPVLCSwitchedToBullish; + + // + bool isPVLCBearish; + bool isPVLCHHBearish; + bool isPVLCLLBearish; + bool isPVLCSwitchedToBearish; + + // + bool isPVHCBullish; + bool isPVHCHHBullish; + bool isPVHCLLBullish; + bool isPVHCSwitchedToBullish; + + // + bool isPVHCBearish; + bool isPVHCHHBearish; + bool isPVHCLLBearish; + bool isPVHCSwitchedToBearish; + + // + // XICH ... + // Ichimoku strategy + // Strategy one: Ichimoku trend identifier: + // According to this strategy, we need a trigger that can be used + // to inform us about the trend type, + // if it is an uptrend or downtrend. + // We will check three values to do that and these values are the: + // closing price, Senkou Span A, and Senkou Span B. + // If the closing price is greater than the Senkou Span B and at the same time + // the closing price is greater than Senkou Span A, + // this will be the trigger to know that the trend is up. + // Vice versa, if the closing price is lower than the Senkou Span B and at the same time + // the closing price is lower than the Senkou Span A, + // this will be the trigger to the downtrend. + // + // Closing price > Senkou Span B and closing price > Senkou Span A --> Uptrend + // Closing price < Senkou Span B and closing price < Senkou Span A --> Downtrend + // + // Strategy two: Ichimoku trend strength: + // Based on this strategy, we need a trigger that can inform us the current trend is strong. + // We will check three values to do that and these values are the: + // - current Senkou Span A, + // - the previous Senkou Span A, and + // - the Senkou Span B. + // If the current Senkou Span A is greater than the previous Senkous Span A and at the same time + // the current Senkou Span A is greater than the Senkou Span B, + // this is a trigger that the trend is up and strong. + // Vice versa, if the current Senkou Span A is lower than the previous Senkou Span A and at the + // same time, the current Senkou Span A is lower than the Senkou Span B, + // this will be a signal that the trend is down and strong. + // + // Current Senkou Span A > previous Senkou Span A and current Senkou Span A > Senkou Span B --> the uptrend is strong + // Current Senkou Span A < previous Senkou Span A and current Senkou Span A < Senkou Span B --> the downtrend is strong + bool isSenkouSpanAOverB; + bool isSenkouSpanAUnderB; + bool isSenkouSpanAOverLast; + bool isSenkouSpanAUnderLast; + bool isFutureSenkouSpanAOverB; + bool isFutureSenkouSpanAUnderB; + bool isFutureSenkouSpanAOverLast; + bool isFutureSenkouSpanAUnderLast; + // + // Strategy three: Ichimoku price-Ki signal: + // According to this strategy, during the uptrend, we need a trigger that can + // alert us about the bullish signal, and during the downtrend, we need a trigger than can alert us about the bearish signal. + // We will check based on this strategy two values, closing price, and Kijun-Sen. + // If the closing price is greater than the Kijun-sen value, + // this will be a trigger to a bullish signal. + // Vice versa, if the closing price is lower than the Kijun-sen value, + // this will be a bearish signal. + // + // During uptrend, closing price > Kijun -sen --> bullish signal + // Duuring downtrend, closing price < Kijun -sen --> bearish signal + bool isCloseOverKijunSen; + bool isCloseUnderKijunSen; + // + // Strategy four: Ichimoku ten-ki signal: + // According to this strategy, during the uptrend, we need another trigger or + // method to alert us when there is a bullish signal or + // during the downtrend, we need a signal of bearishness. + // We will check based on this strategy two values, Tenkan-sen and Kijum-sen. + // If the Tenkan-sen value is greater than the Kijun-sen, + // this will be a signal of bullishness. + // Vice versa, if the Tenkan-sen is lower than the Kijun-sen, + // this will be a signal of bearishness. + // + // Tenkan-sen > Kijun-sen --> bullish signal + // Tenkan-sen < Kijun-sen --> bearish signal + bool isTenkanSenOverKijunSen; + bool isTenkanSenUnderKijunSen; + bool isTenkanSenCrossedOverKijunSen; + bool isTenkanSenCrossedUnderKijunSen; + + // + // XMC ... + // Three Moving Averages Crossover + // In this strategy, we will use three simple moving averages: + // the shorter simple moving average period is 10, the longer one period is 48, and in between a period of 24. + // + // According to the strategy, we need the three simple moving averages to be checked at every tick: + // + // If 10 SMA > 24 SMA, 10 SMA > 48 SMA, and 24 SMA > 48 SMA: the signal will be to buy and we need to be appeared as a comment on the chart. + // If 10 SMA < 24 SMA, 10 SMA < 48 SMA, and 24 SMA < 48 SMA: the signal will be to sell and we need to be appeared as a comment on the chart. + // If anything, else do nothing. + bool isFastOverSlow; + bool isFastUnderSlow; + bool isFastOverVerifier; + bool isFastUnderVerifier; + bool isSlowOverVerifier; + bool isSlowUnderVerifier; + bool isCloseOverFast; + bool isCloseUnderFast; + bool isCloseOverSlow; + bool isCloseUnderSlow; + bool isCloseOverVerifier; + bool isCloseUnderVerifier; + bool isFastCrossedOverSlow; + bool isFastCrossedUnderSlow; + bool isFastCrossedOverVerifier; + bool isFastCrossedUnderVerifier; + bool isSlowCrossedOverVerifier; + bool isSlowCrossedUnderVerifier; + + // + // XSTR ... + bool isTrendBullish; + bool isTrendSwitchedToBullish; + bool isTrendBearish; + bool isTrendSwitchedToBearish; + + // + // XCHE ... + bool isCHEInLong; + bool isCHEInStrongLong; + bool isCHESwitchedInStrongLong; + bool isCHEInShort; + bool isCHEInStrongShort; + bool isCHESwitchedInStrongShort; + + // + // XOSC ... + + // + // RVI Signals ... + // Strategy one: RVI Crossover - Uptrend: + // Based on this strategy, we need to get buy and close signals during the uptrend by a specific condition. + // When the RVI current value and RVI signal current value are greater than the zero level at the same time + // that RVI current value is greater than the current value of the RVI signal, this will be a buy signal. + // Vice Versa, when the RVI current value and RVI signal current value is below zero level at + // the same time that the RVI current value is below the current value of the RVI signal, this will be a close signal. + // + // RVI value > 0 and RVI signal value > 0 and RVI value > RVI signal value --> buy + // RVI value < 0 and RVI signal value < 0 and RVI value < RVI signal value --> close + bool isRVILongStart; + bool isRVILongStop; + // + // Strategy two: RVI Crossover - Downtrend: + // Based on this strategy, we need to get the opposite signals of the previous RVI Crossover - + // Uptrend strategy as we need to get short and cover signals. + // When the RVI current value and RVI signal current value are lower than the zero level at + // the same time that RVI current value is lower than the current value of the RVI signal, this will be a short signal. + // Vice Versa, when the RVI current value and RVI signal current value is above the zero level + // at the same time that the RVI current value is above the current value of the RVI signal, this will be a cover signal. + // + // RVI value < 0 and RVI signal value < 0 and RVI value < RVI signal value --> short + // RVI value > 0 and RVI signal value > 0 and RVI value > RVI signal value --> cover + bool isRVIShortStart; + bool isRVIShortStop; + // + // Strategy three: RVI and MA Crossover + // Based on this strategy, we need to get buy and sell signals based on specific conditions + // as we need to get a + // buy signal + // when the closing price is greater than the 100 -period moving average + // at the same time that the current RVI value is greater than the current RVI signal value. + // In the other scenario, we need to get a + // sell signal + // when the closing price is lower than the 100 -period moving average + // at the same time that the current RVI value is lower than the current RVI signal value. + + // + // RSI strategy ... + // During Uptrend + // In this case, most of the time RSI values move between or moving between + // the mid range and level 70 (Overbought level). + // The trading strategy for the uptrend is: + // + // RSI Value < 50 = Buy + // RSI Value > 70 = Take Profit + bool isRSIUnder50; + bool isRSIOver70; + // + // During Downtrend + // During the downtrend, the RSI moves most of the time between + // the mid range and level 30 (Oversold level). + // The trading strategy will be as follows: + // + // RSI Value > 50 = Short + // RSI Value < 30 = Take Profit + bool isRSIOver50; + bool isRSIUnder30; + // + // During Sideways: + // RSI spends most of the time between levels 30 (Oversold level) and 70 (Oversbought level). + // The trading strategy will be as follows: + // RSI Value < 30 = Buy + // RSI Value > 50 = Take Profit + // RSI Value > 70 = Short + // RSI Value < 50 = Take Profit + + // + // Bull's Power strategy: + // In this part, we will learn how we can use Bull's Power through simple strategies + // that can be used based on the basic concept of this indicator. + // The following are for these strategies and their conditions. + // I need to confirm here, that these strategies for education only as the main objective + // is to understand the main concept behind the indicator and how we can use them in our favor, + // so you must test any of them before using them on your real account to make sure that + // it will be good for your trading as there is no strategy is suitable for everyone. + // + // Strategy one: Bull's Power Movement: + // Based on this strategy, we need to get signals based on the position of current and previous bull's power values. + // If the current bull's power value is greater than the previous one, + // we will consider it as a signal of the rising of the Bull's Power indicator. + // Vice versa, if the current value is lower than the previous one, we will consider that as a signal of + // declining Bull's Power. + // + // To simplify that, it will be the same as the following: + // + // Current Bull's Power > Previous Bull's Power --> Bull's Power is Rising + // Current Bull's Power < Previous Bull's Power --> Bull's Power is declining + bool isBullPowerOverLast; + bool isBullPoswerUnderLast; + // + // Strategy two: Bull's Power - Strong or Divergence + // Based on this strategy, we want to get a signal that informs us if there is a strong movement + // or there is a divergence by evaluating four values and these values are current high, + // the previous high, bull power, and previous bull power. + // If the current high is higher than the previous high and + // the current bull power value is higher than the previous one, + // we will consider that as a signal of a strong move. + // In the other case, if the current high is higher than the previous high and the current + // bull value is lower than the previous one, we will consider that as a signal of bearish divergence. + // + // To simplify that, it will be the same as the following: + // + // Current high > previous high and current bull's power > previous bull's power --> strong move + // Current high < previous high and current bull's power > previous bull's power --> bearish divergence + // + // Strategy three: Bull's Power signals + // Based on this strategy, we need a signal that can be used to get buy and sell signals and we will + // evaluate four values to do that based on this strategy. + // These four values are: + // - current bull's power, + // - zero level, + // - current close value, and + // - current exponential moving average. + // If the current bull's power is lower than the zero level and + // the current close is lower than the exponential moving average, + // we will consider it as a signal of selling. + // If the current bull's power is greater than the zero level and the current close is greater than + // the exponential moving average, this will be a signal of buying. + // + // To simplify that, it will be the same as the following: + // + // Current bull's power < zero level and current close < EMA --> sell + // Current bear's power > zero level and current close > EMA --> buy + bool isBullPowerOverZero; + bool isBullPoswerUnderZero; + + // + // Bear's Power strategy + // In this part, we will learn how we can use Bear's Power through simple strategies + // that can be used based on the basic concept of this indicator. + // The following are for these strategies and their conditions. + // I need to confirm here, that these strategies for education as the main objective + // is to understand the main concept behind the indicator and how we can use it, + // so you must test any of them before using them on your real account to + // make sure that it will be good for your trading. + // + // Strategy one: Bear's Power Movement + // According to this strategy, we need to get signals based on the position of current and previous + // bear's power values. + // If the current value is greater than the previous, this will be a signal of the rising of + // Bear's Power indicator. + // Vice versa, if the current value is lower than the previous value, + // this will be a signal of declining Bear's Power. + // + // Simply, + // + // Current Bear's Power > Previous Bear's Power --> Bear's Power is Rising + // Current Bear's Power < Previous Bear's Power --> Bear's Power is declining + bool isBearPowerOverLast; + bool isBearPoswerUnderLast; + // + // Strategy two: Bear's Power - Strong or Divergence + // According to this strategy, we need to get a signal that informs us if there are strong movements or + // there are divergences by evaluating four values and they are: + // -current low, + // - previous low, + // - bear power, and + // - previous bear power. + // If the current low is lower than the previous low and the current bear power value + // is lower than the previous one, this will be a signal of a strong move. + // In the other case, if the current low is lower than the previous low and the current + // bear value is greater than the previous one, this will be a signal of bullish divergence. + // + // Simply, + // + // Current low < previous low and current bear's power < previous bear's power --> strong move + // Current low < previous low and current bear's power > previous bear's power --> bullish divergence + // + // Strategy three + // According to this strategy, we need a trigger that can be used to get buy and sell signals and + // we will evaluate four values to do that based on this strategy. + // These four values are current: + // - bear's power, + // - zero level, + // - current close value, and + // - current exponential moving average. + // If the current bear's power is greater than the zero level and the current close is greater than + // the exponential moving average, this will be a signal of buy. + // If the current bear's power is lower than the zero level and the current close is lower than + // the exponential moving average, this will be a signal of selling. + // + // Simply, + // + // Current bear's power > zero level and current close > EMA --> buy + // Current bear's power < zero level and current close < EMA --> sell + bool isBearPowerOverZero; + bool isBearPoswerUnderZero; + + // + // CCI ... + bool isCCIPositive; + bool isCCINegative; + bool isCCIOverPositiveHundred; + bool isCCIUnderNegativeHundred; + + // + // STDDEV ... + // Based on this strategy, we need to measure the volatility based on the comparison between the + // current Std Dev and the average of the five previous Std values. + // If the current Std Dev is greater than the Std Dev 5-periods average, this will be a high volatility signal. + // If the current Std is lower than the Std Dev 5- period average, this will be low volatility. + // + // Based on this strategy, we need to get buy and sell signals based on specific conditions. + // If the current Std Dev is greater than the previous Std Dev and the Ask value is greater than the moving average, + // this will be a buy signal. + // If the current Std Dev is greater than the previous Std Dev and the Bid value is lower than the moving average, + // this will be a sell signal. + // + // Current Std > Prev. Std and Ask > MA --> Buy signal + // Current Std > Prev. Std and Bid < MA --> Sell signal + // + // Based on this strategy, we need to get buy and sell signals based on other conditions. + // If the current Std Dev is greater than Std Dev Avg and Ask is greater than the moving average, + // this will be a buy signal. + // If the current Std Dev is greater than Std Dev Avg and Bid is lower than the moving average, + // this will be a sell signal. + // + // Current Std > Std Avg and Ask > MA --> Buy signal + // Current Std > Std Avg and Bid < Ma --> Sell signal + bool isSTDDEVOverAVG; + bool isSTDDEVOverLast; + bool isSTDDEVUnderAVG; + bool isSTDDEVUnderLast; + + // + // MACD ... + // According to this strategy, we need to identify the market setup: + // is it buying setup or shorting setup. + // In other words we need to identify the market direction, if it is bullish or bearish market, + // and this will be identified by MACD. + // If the MACD main line breaks above zero level, this will be a buying setup or bullish setup and + // vice versa if MACD main line breaks below zero level, this will be a shorting setup or bearish. + // + // MACD main line > 0 = Bullish Setup + // MACD main line < 0 = Bearish Setup + // + // According to this strategy, we need to identify generated signals + // if there is a buy signal or a sell signal based on MACD main line and Signal line crossover. + // If MACD main line breaks above Signal line, this will be a buy signal and if MACD main line breaks + // below Signal line, this will be a short signal. + // + // MACD main line > MACD signal line = Buying Signal + // MACD main line < MACD signal line = Shorting signal + bool isMACDPositiove; + bool isMACDNegative; + bool isMACDOverSignal; + bool isMACDUnderSignal; + + // + // STOCHASTIC ... + // Stochastic strategy + // In this part, we will talk about how we can use this indicator through simple strategies. + // We can get signals from the stochastic indicator according to market trend and these strategies are + // uptrend strategy, downtrend strategy, and sideways strategy. + // + // Strategy one: Uptrend strategy + // According to this strategy, we need to check if the %K line and %D line are below the 50 level, + // then, the buy signal will be generated + // when the %K line crosses above the %D line. + // We can take profit according to another effective tool like price action by searching + // for a lower low for example. + // + // %K, %D < 50 --> %K > %D = buy signal + bool isStochKOverD; + bool isStochKDUnder50; + // + // Strategy two: downtrend strategy + // According to this strategy, we need to check if the %K line and %D line are above the 50 level, + // then, the sell signal will be generated + // when the %K line crosses below the %D line. + // We can take profit according to another effective tool like price action by searching + // for a higher high for example. + // + // %K, %D > 50 --> %K < %D = sell signal + bool isStochKUnderD; + bool isStochKDOver50; + // + // Strategy three: sideways strategy + // + // The buy signal: + // According to this strategy, we need to check if the %K line and %D line are below the 20 level, + // then, the buy signal will be generated + // when the %K line crosses above the %D line. + // When the %K line and %D line are above 80, then the take profit signal will be generated + // when the %K line crosses below the %D line. + // %K, %D < 20 --> %K > %D = buy signal + // %K, %D > 80 --> %K < %D = take profit + bool isStochKDUnder20; + // + // The sell signal + // According to this strategy, we need to check if the %K line and %D line are above the 80 level, + // then, the sell signal will be generated + // when the %K line crosses below the %D line. + // When the %K line and %D are below the 20 level, then, the take profit signal will be generated + // when the %K line crosses above the %D line. + // + // %K, %D > 80 --> %K < %D = sell signal + // %K, %D < 20 --> %K > %D = take profit + bool isStochKDOver80; + + // + // XMR ... + bool isMRBFastOverSlow; + bool isMRBFastCrossedOverSlow; + bool isMRBCloseOverFast; + bool isMRBFastUnderSlow; + bool isMRBFastCrossedUnderSlow; + bool isMRBCloseUnderSlow; + + // + // Tools ... + + // + void Clear() + { + // + // Commons ... + time = 0; + cycle = NULL; + prefix = NULL; + symbol = NULL; + period = NULL; + hostPeriod = NULL; + + // + Clean(bars); + + // + // Candlestic ... + isLastBullish = false; + isLastBearish = false; + isCurrentBullish = false; + isCurrentBearish = false; + isCurrentMidLineOverLastHigh = false; + isCurrentMidLineUnderLastLow = false; + isCurrentMidLineOverLastUp = false; + isCurrentMidLineUnderLastDown = false; + isCurrentMidLineOverLastMidLine = false; + isCurrentMidLineUnderLastMidLine = false; + + // + // Buffers ... + Clean(bars); + Clean(hkBars); + Clean(smHKBars); + Clean(ichTenkanSens); + Clean(ichKijunSens); + Clean(ichChikouSpans); + Clean(ichSenkouSpanAs); + Clean(ichSenkouSpanBs); + Clean(mcFasts); + Clean(mcSlows); + Clean(mcVerifiers); + Clean(strTrends); + Clean(strStates); + Clean(cheLongExit1s); + Clean(cheLongExit2s); + Clean(cheShortExit1s); + Clean(cheShortExit2s); + Clean(oscAtrs); + Clean(oscRviMains); + Clean(oscRviSignals); + Clean(oscBullPs); + Clean(oscBearPs); + Clean(oscVolumes); + Clean(oscRsis); + Clean(oscCcis); + Clean(oscMomentums); + Clean(oscSars); + Clean(oscMacdMains); + Clean(oscMacdSignals); + Clean(oscStochMains); + Clean(oscStochSignals); + Clean(oscStddevs); + Clean(zigzags); + Clean(zigzagPVs); + Clean(mrbFasts); + Clean(mrb1Fasts); + Clean(mrb2Fasts); + Clean(mrb3Fasts); + Clean(mrb4Fasts); + Clean(mrb5Fasts); + Clean(mrb6Fasts); + Clean(mrbSlows); + Clean(mrb1Slows); + Clean(mrb2Slows); + Clean(mrb3Slows); + Clean(mrb4Slows); + Clean(mrb5Slows); + Clean(mrb6Slows); + Clean(donUpperOs); + Clean(donLowerOs); + Clean(donUpperCs); + Clean(donLowerCs); + Clean(donUpperHs); + Clean(donLowerHs); + Clean(donUpperLs); + Clean(donLowerLs); + Clean(pvPeaks); + Clean(pvVales); + Clean(pvResistances); + Clean(pvSupports); + Clean(pvFib1s); + Clean(pvFib2s); + Clean(pvFib3s); + Clean(pvFib4s); + Clean(pvFib5s); + Clean(pvSCHHs); + Clean(pvSCLLs); + Clean(pvMCHHs); + Clean(pvMCLLs); + Clean(pvLCHHs); + Clean(pvLCLLs); + Clean(pvHCHHs); + Clean(pvHCLLs); + + // + // Buffers ... + ArraySetAsSeries(bars, true); + ArraySetAsSeries(hkBars, true); + ArraySetAsSeries(smHKBars, true); + ArraySetAsSeries(ichTenkanSens, true); + ArraySetAsSeries(ichKijunSens, true); + ArraySetAsSeries(ichChikouSpans, true); + ArraySetAsSeries(ichSenkouSpanAs, true); + ArraySetAsSeries(ichSenkouSpanBs, true); + ArraySetAsSeries(mcFasts, true); + ArraySetAsSeries(mcSlows, true); + ArraySetAsSeries(mcVerifiers, true); + ArraySetAsSeries(strTrends, true); + ArraySetAsSeries(strStates, true); + ArraySetAsSeries(cheLongExit1s, true); + ArraySetAsSeries(cheLongExit2s, true); + ArraySetAsSeries(cheShortExit1s, true); + ArraySetAsSeries(cheShortExit2s, true); + ArraySetAsSeries(oscAtrs, true); + ArraySetAsSeries(oscRviMains, true); + ArraySetAsSeries(oscRviSignals, true); + ArraySetAsSeries(oscBullPs, true); + ArraySetAsSeries(oscBearPs, true); + ArraySetAsSeries(oscVolumes, true); + ArraySetAsSeries(oscRsis, true); + ArraySetAsSeries(oscCcis, true); + ArraySetAsSeries(oscMomentums, true); + ArraySetAsSeries(oscSars, true); + ArraySetAsSeries(oscMacdMains, true); + ArraySetAsSeries(oscMacdSignals, true); + ArraySetAsSeries(oscStochMains, true); + ArraySetAsSeries(oscStochSignals, true); + ArraySetAsSeries(oscStddevs, true); + ArraySetAsSeries(zigzags, true); + ArraySetAsSeries(zigzagPVs, true); + ArraySetAsSeries(mrbFasts, true); + ArraySetAsSeries(mrb1Fasts, true); + ArraySetAsSeries(mrb2Fasts, true); + ArraySetAsSeries(mrb3Fasts, true); + ArraySetAsSeries(mrb4Fasts, true); + ArraySetAsSeries(mrb5Fasts, true); + ArraySetAsSeries(mrb6Fasts, true); + ArraySetAsSeries(mrbSlows, true); + ArraySetAsSeries(mrb1Slows, true); + ArraySetAsSeries(mrb2Slows, true); + ArraySetAsSeries(mrb3Slows, true); + ArraySetAsSeries(mrb4Slows, true); + ArraySetAsSeries(mrb5Slows, true); + ArraySetAsSeries(mrb6Slows, true); + ArraySetAsSeries(donUpperOs, true); + ArraySetAsSeries(donLowerOs, true); + ArraySetAsSeries(donUpperCs, true); + ArraySetAsSeries(donLowerCs, true); + ArraySetAsSeries(donUpperHs, true); + ArraySetAsSeries(donLowerHs, true); + ArraySetAsSeries(donUpperLs, true); + ArraySetAsSeries(donLowerLs, true); + ArraySetAsSeries(pvPeaks, true); + ArraySetAsSeries(pvVales, true); + ArraySetAsSeries(pvResistances, true); + ArraySetAsSeries(pvSupports, true); + ArraySetAsSeries(pvFib1s, true); + ArraySetAsSeries(pvFib2s, true); + ArraySetAsSeries(pvFib3s, true); + ArraySetAsSeries(pvFib4s, true); + ArraySetAsSeries(pvFib5s, true); + ArraySetAsSeries(pvSCHHs, true); + ArraySetAsSeries(pvSCLLs, true); + ArraySetAsSeries(pvMCHHs, true); + ArraySetAsSeries(pvMCLLs, true); + ArraySetAsSeries(pvLCHHs, true); + ArraySetAsSeries(pvLCLLs, true); + ArraySetAsSeries(pvHCHHs, true); + ArraySetAsSeries(pvHCLLs, true); + + // + isHKBullish = false; + isSMHKBullish = false; + isHKBearish = false; + isSMHKBearish = false; + isClosedOverSMHK = false; + isClosedUnderSMHK = false; + isHKBullishPrev = false; + isSMHKBullishPrev = false; + isHKBearishPrev = false; + isSMHKBearishPrev = false; + isClosedOverSMHKPrev = false; + isClosedUnderSMHKPrev = false; + isZigZagInPeak = false; + isZigZagInVale = false; + isDONAttachedMaxLower = false; + isDONAttachedMinLower = false; + isDONCrossedOverMaxLower = false; + isDONCrossedUnderMaxLower = false; + isDONAttachedMaxUpper = false; + isDONAttachedMinUpper = false; + isDONCrossedOverMaxUpper = false; + isDONCrossedUnderMaxUpper = false; + isPVPeakSameAs = false; + isPVNewPeak = false; + isPVNewPeakOverLast = false; + isPVNewPeakUnderLast = false; + isPVValeSameAs = false; + isPVNewVale = false; + isPVNewValeOverLast = false; + isPVNewValeUnderLast = false; + isPVFiboIncreased = false; + isPVFiboDecreased = false; + isPVFiboSectionChanged = false; + isPVSCBullish = false; + isPVSCHHBullish = false; + isPVSCLLBullish = false; + isPVSCSwitchedToBullish = false; + isPVSCBearish = false; + isPVSCHHBearish = false; + isPVSCLLBearish = false; + isPVSCSwitchedToBearish = false; + isPVMCBullish = false; + isPVMCHHBullish = false; + isPVMCLLBullish = false; + isPVMCSwitchedToBullish = false; + isPVMCBearish = false; + isPVMCHHBearish = false; + isPVMCLLBearish = false; + isPVMCSwitchedToBearish = false; + isPVLCBullish = false; + isPVLCHHBullish = false; + isPVLCLLBullish = false; + isPVLCSwitchedToBullish = false; + isPVLCBearish = false; + isPVLCHHBearish = false; + isPVLCLLBearish = false; + isPVLCSwitchedToBearish = false; + isPVHCBullish = false; + isPVHCHHBullish = false; + isPVHCLLBullish = false; + isPVHCSwitchedToBullish = false; + isPVHCBearish = false; + isPVHCHHBearish = false; + isPVHCLLBearish = false; + isPVHCSwitchedToBearish = false; + + // + // XTSR ... + isTrendBullish = false; + isTrendBearish = false; + isTrendSwitchedToBullish = false; + isTrendSwitchedToBearish = false; + + // + // XCHE ... + isCHEInLong = false; + isCHEInStrongLong = false; + isCHEInShort = false; + isCHEInStrongShort = false; + + // + // XICH ... + isSenkouSpanAOverB = false; + isSenkouSpanAUnderB = false; + isSenkouSpanAOverLast = false; + isSenkouSpanAUnderLast = false; + isFutureSenkouSpanAOverB = false; + isFutureSenkouSpanAUnderB = false; + isFutureSenkouSpanAOverLast = false; + isFutureSenkouSpanAUnderLast = false; + isCloseOverKijunSen = false; + isCloseUnderKijunSen = false; + isTenkanSenOverKijunSen = false; + isTenkanSenUnderKijunSen = false; + + // + // XMC ... + isFastOverSlow = false; + isFastUnderSlow = false; + isFastOverVerifier = false; + isFastUnderVerifier = false; + isSlowOverVerifier = false; + isSlowUnderVerifier = false; + isCloseOverFast = false; + isCloseUnderFast = false; + isCloseOverSlow = false; + isCloseUnderSlow = false; + isCloseOverVerifier = false; + isCloseUnderVerifier = false; + + // + // XOSC ... + + // + // STDDEV ... + isSTDDEVOverAVG = false; + isSTDDEVUnderAVG = false; + isSTDDEVOverLast = false; + isSTDDEVUnderLast = false; + + // + // RVI ... + isRVILongStart = false; + isRVILongStop = false; + isRVIShortStart = false; + isRVIShortStop = false; + + // + // RSI ... + isRSIUnder50 = false; + isRSIOver70 = false; + isRSIOver50 = false; + isRSIUnder30 = false; + + // + // BULLPOWER ... + isBullPowerOverLast = false; + isBullPoswerUnderLast = false; + isBullPowerOverZero = false; + isBullPoswerUnderZero = false; + + // + // BEARPOWER ... + isBearPowerOverLast = false; + isBearPoswerUnderLast = false; + isBearPowerOverZero = false; + isBearPoswerUnderZero = false; + + // + // CCI ... + isCCIPositive = false; + isCCINegative = false; + isCCIOverPositiveHundred = false; + isCCIUnderNegativeHundred = false; + + // + // MACD ... + isMACDPositiove = false; + isMACDNegative = false; + isMACDOverSignal = false; + isMACDUnderSignal = false; + + // + // STOCH ... + isStochKOverD = false; + isStochKDUnder50 = false; + isStochKUnderD = false; + isStochKDOver50 = false; + isStochKDUnder20 = false; + isStochKDOver80 = false; + + // + // XMR ... + isMRBFastOverSlow = false; + isMRBFastCrossedOverSlow = false; + isMRBCloseOverFast = false; + isMRBFastUnderSlow = false; + isMRBFastCrossedUnderSlow = false; + isMRBCloseUnderSlow = false; + } + + // + // Generate Score ... + virtual void GenerateScore( + double &bullishScore, // Holds Bullish Score ... + double &bearishScore, // Holds Bearish Score ... + double multiplier = 1 // Score Multiplier ... + ) + { + // + double bullScore = 0; + double bearScore = 0; + + // + if (multiplier <= 0) + { + multiplier = 1; + } + + // + // Candlestic ... + + // + // BULLISH ... + if (isLastBullish) + { + bullScore++; + } + if (isCurrentBullish) + { + bullScore++; + } + if (isCurrentMidLineOverLastUp) + { + bullScore++; + } + if (isCurrentMidLineOverLastHigh) + { + bullScore++; + } + if (isCurrentMidLineOverLastMidLine) + { + bullScore++; + } + + // + // BEARISH ... + if (isLastBearish) + { + bearScore++; + } + if (isCurrentBearish) + { + bearScore++; + } + if (isCurrentMidLineUnderLastLow) + { + bearScore++; + } + if (isCurrentMidLineUnderLastDown) + { + bearScore++; + } + if (isCurrentMidLineUnderLastMidLine) + { + bearScore++; + } + + // + // XHK ... + + // + if (isHKBullish) + { + // + bullScore++; + bearScore--; + } + if (isSMHKBullish) + { + // + bullScore++; + bearScore--; + } + if (isHKBearish) + { + // + bullScore--; + bearScore++; + } + if (isSMHKBearish) + { + // + bullScore--; + bearScore++; + } + if (isClosedOverSMHK) + { + // + bullScore++; + bearScore--; + } + if (isClosedUnderSMHK) + { + // + bullScore--; + bearScore++; + } + + // + if (isHKBullishPrev) + { + // + bullScore += 2; + bearScore--; + } + if (isSMHKBullishPrev) + { + // + bullScore += 2; + bearScore--; + } + if (isHKBearishPrev) + { + // + bullScore--; + bearScore += 2; + } + if (isSMHKBearishPrev) + { + // + bullScore--; + bearScore += 2; + } + if (isClosedOverSMHKPrev) + { + // + bullScore += 2; + bearScore--; + } + if (isClosedUnderSMHKPrev) + { + // + bullScore--; + bearScore += 2; + } + + // + // XZG ... + if (isZigZagInPeak) + { + // + bullScore--; + bearScore++; + } + if (isZigZagInVale) + { + // + bullScore++; + bearScore--; + } + + // + // XDON ... + if (isDONAttachedMaxLower) + { + // + bullScore++; + bearScore--; + } + if (isDONAttachedMinLower) + { + bearScore++; + } + if (isDONCrossedOverMaxLower) + { + // + bullScore++; + bearScore--; + } + if (isDONCrossedUnderMaxLower) + { + // + bullScore--; + bearScore++; + } + if (isDONAttachedMaxUpper) + { + // + bullScore--; + bearScore++; + } + if (isDONAttachedMinUpper) + { + bullScore++; + } + if (isDONCrossedOverMaxUpper) + { + // + bullScore++; + bearScore--; + } + if (isDONCrossedUnderMaxUpper) + { + // + bullScore--; + bearScore++; + } + + // + // XPV ... + if (isPVPeakSameAs) + { + } + if (isPVNewPeak) + { + } + if (isPVNewPeakOverLast) + { + // + bullScore--; + bearScore++; + } + if (isPVNewPeakUnderLast) + { + // + bullScore++; + bearScore--; + } + if (isPVValeSameAs) + { + } + if (isPVNewVale) + { + } + if (isPVNewValeOverLast) + { + // + bullScore--; + bearScore++; + } + if (isPVNewValeUnderLast) + { + // + bullScore++; + bearScore--; + } + if (isPVFiboSectionChanged) + { + // + if (isPVFiboIncreased) + { + // + bullScore++; + bearScore--; + } + if (isPVFiboDecreased) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isPVSCBullish) + { + bullScore++; + } + if (isPVSCHHBullish) + { + bullScore--; + } + if (isPVSCLLBullish) + { + bullScore++; + } + if (isPVSCSwitchedToBullish) + { + // + bullScore++; + bearScore--; + } + if (isPVSCBearish) + { + bearScore++; + } + if (isPVSCHHBearish) + { + bearScore--; + } + if (isPVSCLLBearish) + { + bearScore++; + } + if (isPVSCSwitchedToBearish) + { + // + bullScore--; + bearScore++; + } + if (isPVMCBullish) + { + bullScore++; + } + if (isPVMCHHBullish) + { + bullScore--; + } + if (isPVMCLLBullish) + { + bullScore++; + } + if (isPVMCSwitchedToBullish) + { + // + bullScore++; + bearScore--; + } + if (isPVMCBearish) + { + bullScore++; + } + if (isPVMCHHBearish) + { + bearScore--; + } + if (isPVMCLLBearish) + { + bearScore++; + } + if (isPVMCSwitchedToBearish) + { + // + bullScore--; + bearScore++; + } + if (isPVLCBullish) + { + bullScore++; + } + if (isPVLCHHBullish) + { + bullScore--; + } + if (isPVLCLLBullish) + { + bullScore++; + } + if (isPVLCSwitchedToBullish) + { + // + bullScore++; + bullScore--; + } + if (isPVLCBearish) + { + bearScore++; + } + if (isPVLCHHBearish) + { + bearScore--; + } + if (isPVLCLLBearish) + { + bearScore++; + } + if (isPVLCSwitchedToBearish) + { + // + bullScore--; + bearScore++; + } + if (isPVHCBullish) + { + bullScore++; + } + if (isPVHCHHBullish) + { + bullScore--; + } + if (isPVHCLLBullish) + { + bullScore++; + } + if (isPVHCSwitchedToBullish) + { + // + bullScore++; + bearScore--; + } + if (isPVHCBearish) + { + bearScore++; + } + if (isPVHCHHBearish) + { + bearScore--; + } + if (isPVHCLLBearish) + { + bearScore++; + } + if (isPVHCSwitchedToBearish) + { + // + bullScore--; + bearScore++; + } + + // + // XSTR ... + if (isTrendBullish) + { + bullScore++; + } + if (isTrendBearish) + { + bearScore++; + } + if (isTrendSwitchedToBullish) + { + // + bullScore++; + bearScore--; + } + if (isTrendSwitchedToBearish) + { + // + bullScore--; + bearScore++; + } + + // + // XICH ... + + // + // BULLISH ... + if (isSenkouSpanAOverB) + { + bullScore++; + } + if (isSenkouSpanAOverLast) + { + bullScore++; + } + if (isCloseOverKijunSen) + { + bullScore++; + } + if (isTenkanSenOverKijunSen) + { + bullScore++; + } + if (isFutureSenkouSpanAOverB) + { + bullScore++; + } + if (isFutureSenkouSpanAOverLast) + { + bullScore++; + } + if (isTenkanSenCrossedOverKijunSen) + { + // + bullScore++; + bearScore--; + } + + // + // BEARISH ... + if (isSenkouSpanAUnderB) + { + bearScore++; + } + if (isSenkouSpanAUnderLast) + { + bearScore++; + } + if (isCloseUnderKijunSen) + { + bearScore++; + } + if (isTenkanSenUnderKijunSen) + { + bearScore++; + } + if (isFutureSenkouSpanAUnderB) + { + bearScore++; + } + if (isFutureSenkouSpanAUnderLast) + { + bearScore++; + } + if (isTenkanSenCrossedUnderKijunSen) + { + // + bullScore--; + bearScore++; + } + + // + // XMC ... + + // + // BULLISH ... + if (isFastOverSlow) + { + bullScore++; + } + if (isFastOverVerifier) + { + bullScore++; + } + if (isSlowOverVerifier) + { + bullScore++; + } + if (isCloseOverFast) + { + bullScore++; + } + if (isCloseOverSlow) + { + bullScore++; + } + if (isCloseOverVerifier) + { + bullScore++; + } + if (isFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + if (isFastCrossedOverVerifier) + { + // + bullScore++; + bearScore--; + } + if (isSlowCrossedOverVerifier) + { + // + bullScore++; + bearScore--; + } + + // + // BEARISH ... + if (isFastUnderSlow) + { + bearScore++; + } + if (isFastUnderVerifier) + { + bearScore++; + } + if (isSlowUnderVerifier) + { + bearScore++; + } + if (isCloseUnderFast) + { + bearScore++; + } + if (isCloseUnderSlow) + { + bearScore++; + } + if (isCloseUnderVerifier) + { + bearScore++; + } + if (isFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + if (isFastCrossedUnderVerifier) + { + // + bullScore--; + bearScore++; + } + if (isSlowCrossedUnderVerifier) + { + // + bullScore--; + bearScore++; + } + + // + // XCHE ... + if (isCHEInLong) + { + bullScore++; + } + if (isCHEInStrongLong) + { + // + bullScore++; + bearScore--; + } + if (isCHESwitchedInStrongLong) + { + // + bullScore++; + bearScore--; + } + if (isCHEInShort) + { + // + bearScore++; + } + if (isCHEInStrongShort) + { + // + bullScore--; + bearScore++; + } + if (isCHESwitchedInStrongShort) + { + // + bullScore--; + bearScore++; + } + + // + // XOSC ... + + // + // STDDEV ... + + // + // BULLISH ... + if (isSTDDEVOverAVG) + { + bullScore++; + } + if (isSTDDEVOverLast) + { + bullScore++; + } + + // + // BEARISH ... + if (isSTDDEVUnderAVG) + { + bearScore++; + } + if (isSTDDEVUnderLast) + { + bearScore++; + } + + // + // RVI ... + if (isRVILongStart && !isRVILongStop) + { + bullScore++; + } + if (isRVIShortStart && isRVIShortStop) + { + bearScore++; + } + + // + // RSI ... + + // + // BULLISH ... + if (isRSIUnder30 || (!isRSIUnder30 && isRSIOver50 && isRSIOver70)) + { + bullScore++; + } + + // + // BEARISH ... + if (isRSIOver70 || (!isRSIOver70 && !isRSIOver50 && isRSIUnder30)) + { + bearScore++; + } + + // + // BULLPOWER ... + + // + // BULLISH ... + if (isBullPowerOverLast) + { + bullScore++; + } + if (isBullPowerOverZero) + { + bullScore++; + } + + // + // BEARISH ... + if (isBullPoswerUnderLast) + { + bearScore++; + } + if (isBullPoswerUnderZero) + { + bearScore++; + } + + // + // BEARPOWER ... + + // + // BULLISH ... + if (isBearPoswerUnderLast) + { + bullScore++; + } + if (isBearPoswerUnderZero) + { + bullScore++; + } + + // + // BEARISH ... + if (isBearPowerOverLast) + { + bearScore++; + } + if (isBearPowerOverZero) + { + bearScore++; + } + + // + // CCI ... + + // + // BULLISH ... + if (isCCIPositive) + { + bullScore++; + } + if (isCCIOverPositiveHundred) + { + bullScore++; + } + + // + // BEARISH ... + if (isCCINegative) + { + bearScore++; + } + if (isCCIUnderNegativeHundred) + { + bearScore++; + } + + // + // MACD ... + + // + // BULLISH ... + if (isMACDPositiove) + { + bullScore++; + } + if (isMACDOverSignal) + { + bullScore++; + } + + // + // BEARISH ... + if (isMACDNegative) + { + bearScore++; + } + if (isMACDUnderSignal) + { + bearScore++; + } + + // + // STOCH ... + + // + // BULLISH ... + if (isStochKOverD) + { + bullScore++; + } + if (isStochKDUnder20) + { + bullScore++; + } + if (isStochKDUnder50) + { + bullScore++; + } + + // + // BEARISH ... + if (isStochKUnderD) + { + bearScore++; + } + if (isStochKDOver50) + { + bearScore++; + } + if (isStochKDOver80) + { + bearScore++; + } + + // + // XMR ... + if (isMRBFastOverSlow) + { + bullScore++; + } + if (isMRBFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + if (isMRBCloseOverFast) + { + // + bullScore++; + bearScore--; + } + if (isMRBFastUnderSlow) + { + bearScore++; + } + if (isMRBFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + if (isMRBCloseUnderSlow) + { + bullScore--; + bearScore++; + } + + // + bullishScore = bullScore * multiplier; + bearishScore = bearScore * multiplier; + } + + // + // Generate Summary ... + virtual string GenerateSummary( + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + result = GenerateSummaryBody( + onlySummary, + multiplier, + separator, + ignoreFalseConditions + // + ); + + // + // Generating Full Result by Combining parts ... + result = + // + "[" + GetToken() + "]" + separator + + "-----------------------------" + separator + + result + + "" + // + ; + + // + return result; + } + + // + string GenerateSummary( + string provided, // Additional Info about Type, Provider and Symbol + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + result = GenerateSummaryBody( + onlySummary, + multiplier, + separator, + ignoreFalseConditions + // + ); + + // + // Generating Full Result by Combining parts ... + result = + // + "[" + GetToken() + "]" + separator + + provided + separator + + "-----------------------------" + separator + + result + + "" + // + ; + + // + return result; + } + + // + string GenerateSummaryBody( + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + double bullScore = 0; + double bearScore = 0; + GenerateScore( + bullScore, + bearScore, + multiplier // + ); + + // + // Common ... + string commonStr = + // + "Commons: " + separator + + "-----------------------------" + separator + + "Time: " + ToString(TimeCurrent()) + separator + + "-----------" + separator + + "Scores: " + separator + + "-----------" + separator + + "Bullish: " + ToString(bullScore) + separator + + "Bearish: " + ToString(bearScore) + separator + + "-----------------------------" + separator + + // + // TODO: Add Scores Later ... + separator + + "" + // + ; + + // + // Candlestick ... + string candlesticStr = + // + ToString("isLastBullish", isLastBullish, ignoreFalseConditions) + + ToString("isLastBearish", isLastBearish, ignoreFalseConditions) + + ToString("isCurrentBullish", isCurrentBullish, ignoreFalseConditions) + + ToString("isCurrentBearish", isCurrentBearish, ignoreFalseConditions) + + ToString("isCurrentMidLineOverLastHigh", isCurrentMidLineOverLastHigh, ignoreFalseConditions) + + ToString("isCurrentMidLineUnderLastLow", isCurrentMidLineUnderLastLow, ignoreFalseConditions) + + ToString("isCurrentMidLineOverLastUp", isCurrentMidLineOverLastUp, ignoreFalseConditions) + + ToString("isCurrentMidLineUnderLastDown", isCurrentMidLineUnderLastDown, ignoreFalseConditions) + + ToString("isCurrentMidLineOverLastMidLine", isCurrentMidLineOverLastMidLine, ignoreFalseConditions) + + ToString("isCurrentMidLineUnderLastMidLine", isCurrentMidLineUnderLastMidLine, ignoreFalseConditions) + + "" + // + ; + candlesticStr = SetLabel("Candelstick: ", candlesticStr, separator); + + // + // XHK ... + string hkStr = + // + ToString("isHKBullish", isHKBullish, ignoreFalseConditions) + + ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions) + + ToString("isHKBearish", isHKBearish, ignoreFalseConditions) + + ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions) + + ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions) + + ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions) + + ToString("isHKBullishPrev", isHKBullishPrev, ignoreFalseConditions) + + ToString("isSMHKBullishPrev", isSMHKBullishPrev, ignoreFalseConditions) + + ToString("isHKBearishPrev", isHKBearishPrev, ignoreFalseConditions) + + ToString("isSMHKBearishPrev", isSMHKBearishPrev, ignoreFalseConditions) + + ToString("isClosedOverSMHKPrev", isClosedOverSMHKPrev, ignoreFalseConditions) + + ToString("isClosedUnderSMHKPrev", isClosedUnderSMHKPrev, ignoreFalseConditions) + + "" + // + ; + hkStr = SetLabel("XHK: ", hkStr, separator); + + // + // XZG ... + string zigzagStr = + // + ToString("isZigZagInPeak", isZigZagInPeak, ignoreFalseConditions) + + ToString("isZigZagInVale", isZigZagInVale, ignoreFalseConditions) + + "" + // + ; + zigzagStr = SetLabel("XZG: ", zigzagStr, separator); + + // + // XMR ... + string mrbStr = + // + ToString("isMRBFastOverSlow", isMRBFastOverSlow, ignoreFalseConditions) + + ToString("isMRBFastCrossedOverSlow", isMRBFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isMRBCloseOverFast", isMRBCloseOverFast, ignoreFalseConditions) + + ToString("isMRBFastUnderSlow", isMRBFastUnderSlow, ignoreFalseConditions) + + ToString("isMRBFastCrossedUnderSlow", isMRBFastCrossedUnderSlow, ignoreFalseConditions) + + ToString("isMRBCloseUnderSlow", isMRBCloseUnderSlow, ignoreFalseConditions) + + "" + // + ; + mrbStr = SetLabel("XMRB: ", mrbStr, separator); + + // + // XSTR ... + string strStr = + // + ToString("isTrendBullish", isTrendBullish, ignoreFalseConditions) + + ToString("isTrendBearish", isTrendBearish, ignoreFalseConditions) + + ToString("isTrendSwitchedToBullish", isTrendSwitchedToBullish, ignoreFalseConditions) + + ToString("isTrendSwitchedToBearish", isTrendSwitchedToBearish, ignoreFalseConditions) + + "" + // + ; + strStr = SetLabel("XSTR: ", strStr, separator); + + // + // XCHE ... + string cheStr = + // + ToString("isCHEInLong", isCHEInLong, ignoreFalseConditions) + + ToString("isCHEInStrongLong", isCHEInStrongLong, ignoreFalseConditions) + + ToString("isCHESwitchedInStrongLong", isCHESwitchedInStrongLong, ignoreFalseConditions) + + ToString("isCHEInShort", isCHEInShort, ignoreFalseConditions) + + ToString("isCHEInStrongShort", isCHEInStrongShort, ignoreFalseConditions) + + ToString("isCHESwitchedInStrongShort", isCHESwitchedInStrongShort, ignoreFalseConditions) + + "" + // + ; + cheStr = SetLabel("XCHE: ", cheStr, separator); + + // + // XDON ... + string donStr = + // + ToString("isDONAttachedMaxLower", isDONAttachedMaxLower, ignoreFalseConditions) + + ToString("isDONAttachedMinLower", isDONAttachedMinLower, ignoreFalseConditions) + + ToString("isDONCrossedOverMaxLower", isDONCrossedOverMaxLower, ignoreFalseConditions) + + ToString("isDONCrossedUnderMaxLower", isDONCrossedUnderMaxLower, ignoreFalseConditions) + + ToString("isDONAttachedMaxUpper", isDONAttachedMaxUpper, ignoreFalseConditions) + + ToString("isDONAttachedMinUpper", isDONAttachedMinUpper, ignoreFalseConditions) + + ToString("isDONCrossedOverMaxUpper", isDONCrossedOverMaxUpper, ignoreFalseConditions) + + ToString("isDONCrossedUnderMaxUpper", isDONCrossedUnderMaxUpper, ignoreFalseConditions) + + "" + // + ; + donStr = SetLabel("XDON: ", donStr, separator); + + // + // XICH ... + string ichStr = + // + ToString("isSenkouSpanAOverB", isSenkouSpanAOverB, ignoreFalseConditions) + + ToString("isSenkouSpanAUnderB", isSenkouSpanAUnderB, ignoreFalseConditions) + + ToString("isSenkouSpanAOverLast", isSenkouSpanAOverLast, ignoreFalseConditions) + + ToString("isSenkouSpanAUnderLast", isSenkouSpanAUnderLast, ignoreFalseConditions) + + ToString("isCloseOverKijunSen", isCloseOverKijunSen, ignoreFalseConditions) + + ToString("isCloseUnderKijunSen", isCloseUnderKijunSen, ignoreFalseConditions) + + ToString("isTenkanSenOverKijunSen", isTenkanSenOverKijunSen, ignoreFalseConditions) + + ToString("isTenkanSenUnderKijunSen", isTenkanSenUnderKijunSen, ignoreFalseConditions) + + ToString("isFutureSenkouSpanAOverB", isFutureSenkouSpanAOverB, ignoreFalseConditions) + + ToString("isFutureSenkouSpanAUnderB", isFutureSenkouSpanAUnderB, ignoreFalseConditions) + + ToString("isFutureSenkouSpanAOverLast", isFutureSenkouSpanAOverLast, ignoreFalseConditions) + + ToString("isFutureSenkouSpanAUnderLast", isFutureSenkouSpanAUnderLast, ignoreFalseConditions) + + "" + // + ; + ichStr = SetLabel("XICH: ", ichStr, separator); + + // + // XMC ... + string mcStr = + // + ToString("isFastOverSlow", isFastOverSlow, ignoreFalseConditions) + + ToString("isFastUnderSlow", isFastUnderSlow, ignoreFalseConditions) + + ToString("isFastOverVerifier", isFastOverVerifier, ignoreFalseConditions) + + ToString("isFastUnderVerifier", isFastUnderVerifier, ignoreFalseConditions) + + ToString("isSlowOverVerifier", isSlowOverVerifier, ignoreFalseConditions) + + ToString("isSlowUnderVerifier", isSlowUnderVerifier, ignoreFalseConditions) + + ToString("isCloseOverFast", isCloseOverFast, ignoreFalseConditions) + + ToString("isCloseUnderFast", isCloseUnderFast, ignoreFalseConditions) + + ToString("isCloseOverSlow", isCloseOverSlow, ignoreFalseConditions) + + ToString("isCloseUnderSlow", isCloseUnderSlow, ignoreFalseConditions) + + ToString("isCloseOverVerifier", isCloseOverVerifier, ignoreFalseConditions) + + ToString("isCloseUnderVerifier", isCloseUnderVerifier, ignoreFalseConditions) + + ToString("isFastCrossedOverSlow", isFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isFastCrossedUnderSlow", isFastCrossedUnderSlow, ignoreFalseConditions) + + ToString("isFastCrossedOverVerifier", isFastCrossedOverVerifier, ignoreFalseConditions) + + ToString("isFastCrossedUnderVerifier", isFastCrossedUnderVerifier, ignoreFalseConditions) + + ToString("isSlowCrossedOverVerifier", isSlowCrossedOverVerifier, ignoreFalseConditions) + + ToString("isSlowCrossedUnderVerifier", isSlowCrossedUnderVerifier, ignoreFalseConditions) + + "" + // + ; + mcStr = SetLabel("XMC: ", mcStr, separator); + + // + // XPV ... + string pvStr = + // + ToString("isPVPeakSameAs", isPVPeakSameAs, ignoreFalseConditions) + + ToString("isPVNewPeak", isPVNewPeak, ignoreFalseConditions) + + ToString("isPVNewPeakOverLast", isPVNewPeakOverLast, ignoreFalseConditions) + + ToString("isPVNewPeakUnderLast", isPVNewPeakUnderLast, ignoreFalseConditions) + + ToString("isPVValeSameAs", isPVValeSameAs, ignoreFalseConditions) + + ToString("isPVNewVale", isPVNewVale, ignoreFalseConditions) + + ToString("isPVNewValeOverLast", isPVNewValeOverLast, ignoreFalseConditions) + + ToString("isPVNewValeUnderLast", isPVNewValeUnderLast, ignoreFalseConditions) + + ToString("isPVFiboIncreased", isPVFiboIncreased, ignoreFalseConditions) + + ToString("isPVFiboDecreased", isPVFiboDecreased, ignoreFalseConditions) + + ToString("isPVFiboSectionChanged", isPVFiboSectionChanged, ignoreFalseConditions) + + ToString("isPVSCBullish", isPVSCBullish, ignoreFalseConditions) + + ToString("isPVSCHHBullish", isPVSCHHBullish, ignoreFalseConditions) + + ToString("isPVSCLLBullish", isPVSCLLBullish, ignoreFalseConditions) + + ToString("isPVSCSwitchedToBullish", isPVSCSwitchedToBullish, ignoreFalseConditions) + + ToString("isPVSCBearish", isPVSCBearish, ignoreFalseConditions) + + ToString("isPVSCHHBearish", isPVSCHHBearish, ignoreFalseConditions) + + ToString("isPVSCLLBearish", isPVSCLLBearish, ignoreFalseConditions) + + ToString("isPVSCSwitchedToBearish", isPVSCSwitchedToBearish, ignoreFalseConditions) + + ToString("isPVMCBullish", isPVMCBullish, ignoreFalseConditions) + + ToString("isPVMCHHBullish", isPVMCHHBullish, ignoreFalseConditions) + + ToString("isPVMCLLBullish", isPVMCLLBullish, ignoreFalseConditions) + + ToString("isPVMCSwitchedToBullish", isPVMCSwitchedToBullish, ignoreFalseConditions) + + ToString("isPVMCBearish", isPVMCBearish, ignoreFalseConditions) + + ToString("isPVMCHHBearish", isPVMCHHBearish, ignoreFalseConditions) + + ToString("isPVMCLLBearish", isPVMCLLBearish, ignoreFalseConditions) + + ToString("isPVMCSwitchedToBearish", isPVMCSwitchedToBearish, ignoreFalseConditions) + + ToString("isPVLCBullish", isPVLCBullish, ignoreFalseConditions) + + ToString("isPVLCHHBullish", isPVLCHHBullish, ignoreFalseConditions) + + ToString("isPVLCLLBullish", isPVLCLLBullish, ignoreFalseConditions) + + ToString("isPVLCSwitchedToBullish", isPVLCSwitchedToBullish, ignoreFalseConditions) + + ToString("isPVLCBearish", isPVLCBearish, ignoreFalseConditions) + + ToString("isPVLCHHBearish", isPVLCHHBearish, ignoreFalseConditions) + + ToString("isPVLCLLBearish", isPVLCLLBearish, ignoreFalseConditions) + + ToString("isPVLCSwitchedToBearish", isPVLCSwitchedToBearish, ignoreFalseConditions) + + ToString("isPVHCBullish", isPVHCBullish, ignoreFalseConditions) + + ToString("isPVHCHHBullish", isPVHCHHBullish, ignoreFalseConditions) + + ToString("isPVHCLLBullish", isPVHCLLBullish, ignoreFalseConditions) + + ToString("isPVHCSwitchedToBullish", isPVHCSwitchedToBullish, ignoreFalseConditions) + + ToString("isPVHCBearish", isPVHCBearish, ignoreFalseConditions) + + ToString("isPVHCHHBearish", isPVHCHHBearish, ignoreFalseConditions) + + ToString("isPVHCLLBearish", isPVHCLLBearish, ignoreFalseConditions) + + ToString("isPVHCSwitchedToBearish", isPVHCSwitchedToBearish, ignoreFalseConditions) + + "" + // + ; + pvStr = SetLabel("XPV: ", pvStr, separator); + + // + // XOSC ... + + // + // STDDEV ... + string stddevStr = + // + ToString("isSTDDEVOverAVG", isSTDDEVOverAVG, ignoreFalseConditions) + + ToString("isSTDDEVUnderAVG", isSTDDEVUnderAVG, ignoreFalseConditions) + + ToString("isSTDDEVOverLast", isSTDDEVOverLast, ignoreFalseConditions) + + ToString("isSTDDEVUnderLast", isSTDDEVUnderLast, ignoreFalseConditions) + + "" + // + ; + stddevStr = SetLabel("STDDEV: ", stddevStr, separator); + + // + // RVI ... + string rviStr = + // + ToString("isRVILongStart", isRVILongStart, ignoreFalseConditions) + + ToString("isRVILongStop", isRVILongStop, ignoreFalseConditions) + + ToString("isRVIShortStart", isRVIShortStart, ignoreFalseConditions) + + ToString("isRVIShortStop", isRVIShortStop, ignoreFalseConditions) + + "" + // + ; + rviStr = SetLabel("RVI: ", rviStr, separator); + + // + // RSI ... + string rsiStr = + // + ToString("isRSIOver50", isRSIOver50, ignoreFalseConditions) + + ToString("isRSIUnder50", isRSIUnder50, ignoreFalseConditions) + + ToString("isRSIOver70", isRSIOver70, ignoreFalseConditions) + + ToString("isRSIUnder30", isRSIUnder30, ignoreFalseConditions) + + "" + // + ; + rsiStr = SetLabel("RSI: ", rsiStr, separator); + + // + // CCI ... + string cciStr = + // + ToString("isCCIPositive", isCCIPositive, ignoreFalseConditions) + + ToString("isCCINegative", isCCINegative, ignoreFalseConditions) + + ToString("isCCIOverPositiveHundred", isCCIOverPositiveHundred, ignoreFalseConditions) + + ToString("isCCIUnderNegativeHundred", isCCIUnderNegativeHundred, ignoreFalseConditions) + + "" + // + ; + cciStr = SetLabel("CCI: ", cciStr, separator); + + // + // MACD ... + string macdStr = + // + ToString("isMACDPositiove", isMACDPositiove, ignoreFalseConditions) + + ToString("isMACDNegative", isMACDNegative, ignoreFalseConditions) + + ToString("isMACDOverSignal", isMACDOverSignal, ignoreFalseConditions) + + ToString("isMACDUnderSignal", isMACDUnderSignal, ignoreFalseConditions) + + "" + // + ; + macdStr = SetLabel("MACD: ", macdStr, separator); + + // + // BULLP ... + string bullPStr = + // + ToString("isBullPowerOverLast", isBullPowerOverLast, ignoreFalseConditions) + + ToString("isBullPoswerUnderLast", isBullPoswerUnderLast, ignoreFalseConditions) + + ToString("isBullPowerOverZero", isBullPowerOverZero, ignoreFalseConditions) + + ToString("isBullPoswerUnderZero", isBullPoswerUnderZero, ignoreFalseConditions) + + "" + // + ; + bullPStr = SetLabel("BULLP: ", bullPStr, separator); + + // + // BEARP ... + string bearPStr = + // + ToString("isBearPowerOverLast", isBearPowerOverLast, ignoreFalseConditions) + + ToString("isBearPoswerUnderLast", isBearPoswerUnderLast, ignoreFalseConditions) + + ToString("isBearPowerOverZero", isBearPowerOverZero, ignoreFalseConditions) + + ToString("isBearPoswerUnderZero", isBearPoswerUnderZero, ignoreFalseConditions) + + "" + // + ; + bearPStr = SetLabel("BEARP: ", bearPStr, separator); + + // + // STOCH ... + string stochStr = + // + ToString("isStochKOverD", isStochKOverD, ignoreFalseConditions) + + ToString("isStochKUnderD", isStochKUnderD, ignoreFalseConditions) + + ToString("isStochKDOver50", isStochKDOver50, ignoreFalseConditions) + + ToString("isStochKDOver80", isStochKDOver80, ignoreFalseConditions) + + ToString("isStochKDUnder20", isStochKDUnder20, ignoreFalseConditions) + + ToString("isStochKDUnder50", isStochKDUnder50, ignoreFalseConditions) + + "" + // + ; + stochStr = SetLabel("STOCH: ", stochStr, separator); + + // + string oscStr = + // + stddevStr + + rviStr + + rsiStr + + cciStr + + macdStr + + bullPStr + + bearPStr + + stochStr + + "" + // + ; + oscStr = SetLabel("XOSC: ", oscStr, separator); + + // + result = + // + commonStr + + candlesticStr + + (onlySummary + ? "" + : hkStr + + zigzagStr + + mrbStr + + strStr + + cheStr + + donStr + + ichStr + + mcStr + + pvStr + + oscStr + + "" // + ) + + "" + // + ; + + // + return result; + } + + // + string GetTitle() + { + // + string result = NULL; + + // + result = + // + "[" + ToString(cycle) + "]: " + ToString(period) + // + ; + + // + return result; + } + + // + // For Data Collector ... + string GetToken() + { + return GetSpecificToken(this); + } + bool IsModelValid() + { + return false; + } + string ToModelString() + { + return NULL; + } + bool ParseModel(string content) + { + return false; + } + int FindIndex(X121MCycleConditions &items[]) + { + return -1; + } +}; + +// +// Market Class ... +class XSCX121Market : XSCBase +{ + // + // Public ... +public: + // + // Props ... + XSCXHKHelper hk; + XSCXMCHelper mc; + XSCXPVHelper pv; + XSCXZGHelper zg; + XSCXMRBHelper mrb; + XSCXSTRHelper str; + XSCXCHEHelper che; + XSCXOSCHelper osc; + XSCXICHHelper ich; + XSCXDONHelper don; + + // + // Properties ... + + // + // Retrieve Trading Symbol ... + string GetSymbol() + { + return mInputs.cycle.symbol; + } + + // + // Retrieve Cycle Time Frame ... + ENUM_TIMEFRAMES GetPeriod() + { + return mInputs.cycle.period; + } + + // + // Retrieve Market Host Time Frame ... + ENUM_TIMEFRAMES GetHostPeriod() + { + return mInputs.cycle.hostPeriod; + } + + // + // Count Total Available Bars in Market ... + int CountBars() + { + // + Update(0); + return mInputs.cycle.CountBars(); + } + + // + // Check Market is in new Bar ... + int IsNewBar() + { + // + Update(0); + return mInputs.cycle.IsNewBar(); + } + + // + // Retrieve Current Cycles Specific Bar ... + XOHCL GetBar(int barIndex) + { + // + Update(0); + return mInputs.cycle.GetBar(barIndex); + } + + // + // Retrieve Current Bar Index based on Host Period bar Index ... + int GetBarIndex(int barIndex) + { + // + Update(barIndex); + return mInputs.cycle.GetBarIndex(barIndex); + } + + // + // Retrieve Bar Time ... + datetime GetBarTime(int barIndex) + { + // + Update(0); + return mInputs.cycle.GetBarTime(barIndex); + } + + // + // Retrieve Current Market Config ... + bool GetInputs(X121MCycleInputs &inputs) + { + // + bool result = false; + + // + inputs = mInputs; + + // + result = inputs.IsValid(); + + // + return result; + } + + // + // Set Market Inputs and Re Initial ... + bool SetInputs( + X121MCycleInputs &inputs // Config + ) + { + // + return Init(inputs); + } + + // + // Tools ... + // + void GetMarketConditions( + X121MCycleConditions &conditions, // Market Conditions Result + int barIndex = 0, // Specified Bar Index + int mNumberOfItems = 15 // Number of Reading Items + ) + { + // + conditions.Clear(); + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex >= CountBars()) + { + barIndex = CountBars() + 2; + } + + // + int curr = barIndex + 1; + int prev = curr + 1; + + // + // Here i Have to Calculate Market Conditions based on + // Several Indicator/Oscillator(s) ... + + // + // Set Commons ... + conditions.time = GetBarTime(barIndex); + conditions.cycle = mInputs.cycle.cycle; + conditions.prefix = mInputs.cycle.prefix; + conditions.symbol = mInputs.cycle.symbol; + conditions.period = mInputs.cycle.period; + conditions.hostPeriod = mInputs.cycle.hostPeriod; + + // + Clean(conditions.bars); + GetBars( + conditions.bars, + conditions.symbol, + conditions.period, + barIndex, + barIndex + 5); + + // + XOHCL cBar = GetBar(barIndex); + XOHCL pBar = GetBar(barIndex + 1); + + // + // CANDELSTICK ... + + // + bool isLastBullish = + // + pBar.IsBullish() + // + ; + + // + bool isLastBearish = + // + pBar.IsBearish() + // + ; + + // + bool isCurrentBullish = + // + cBar.IsBullish() + // + ; + + // + bool isCurrentBearish = + // + cBar.IsBearish() + // + ; + + // + bool isCurrentMidLineOverLastHigh = + // + cBar.GetMid() > pBar.high; + // + ; + + // + bool isCurrentMidLineUnderLastLow = + // + cBar.GetMid() < pBar.low + // + ; + + // + bool isCurrentMidLineOverLastUp = + // + cBar.GetMid() > pBar.GetUp() + // + ; + + // + bool isCurrentMidLineUnderLastDown = + // + cBar.GetMid() < pBar.GetDown() + // + ; + + // + bool isCurrentMidLineOverLastMidLine = + // + cBar.GetMid() > pBar.GetMid() + // + ; + + // + bool isCurrentMidLineUnderLastMidLine = + // + cBar.GetMid() < pBar.GetMid() + // + ; + + // + conditions.isLastBullish = isLastBullish; + conditions.isLastBearish = isLastBearish; + conditions.isCurrentBullish = isCurrentBullish; + conditions.isCurrentBearish = isCurrentBearish; + conditions.isCurrentMidLineOverLastHigh = isCurrentMidLineOverLastHigh; + conditions.isCurrentMidLineUnderLastLow = isCurrentMidLineUnderLastLow; + conditions.isCurrentMidLineOverLastUp = isCurrentMidLineOverLastUp; + conditions.isCurrentMidLineUnderLastDown = isCurrentMidLineUnderLastDown; + conditions.isCurrentMidLineOverLastMidLine = isCurrentMidLineOverLastMidLine; + conditions.isCurrentMidLineUnderLastMidLine = isCurrentMidLineUnderLastMidLine; + + // + // XHK ... + + // + hk.CopyAsOHCL( + barIndex, + mNumberOfItems, + conditions.hkBars // + ); + + // + hk.CopySMAsOHCL( + barIndex, + mNumberOfItems, + conditions.smHKBars // + ); + + // + bool isHKBullish = conditions.hkBars[curr].IsBullish(); + bool isHKBullishPrev = conditions.hkBars[prev].IsBullish(); + bool isSMHKBullish = conditions.smHKBars[curr].IsBullish(); + bool isSMHKBullishPrev = conditions.smHKBars[prev].IsBullish(); + + // + bool isHKBearish = conditions.hkBars[curr].IsBearish(); + bool isHKBearishPrev = conditions.hkBars[prev].IsBearish(); + bool isSMHKBearish = conditions.smHKBars[curr].IsBearish(); + bool isSMHKBearishPrev = conditions.smHKBars[prev].IsBearish(); + + // + bool isClosedOverSMHK = conditions.bars[curr].close > conditions.smHKBars[curr].GetUp(); + bool isClosedUnderSMHK = conditions.bars[curr].close < conditions.smHKBars[curr].GetDown(); + bool isClosedOverSMHKPrev = conditions.bars[prev].close > conditions.smHKBars[prev].GetUp(); + bool isClosedUnderSMHKPrev = conditions.bars[prev].close < conditions.smHKBars[prev].GetDown(); + + // + conditions.isHKBullish = isHKBullish; + conditions.isSMHKBullish = isSMHKBullish; + conditions.isHKBearish = isHKBearish; + conditions.isSMHKBearish = isSMHKBearish; + conditions.isClosedOverSMHK = isClosedOverSMHK; + conditions.isClosedUnderSMHK = isClosedUnderSMHK; + conditions.isHKBullishPrev = isHKBullishPrev; + conditions.isSMHKBullishPrev = isSMHKBullishPrev; + conditions.isHKBearishPrev = isHKBearishPrev; + conditions.isSMHKBearishPrev = isSMHKBearishPrev; + conditions.isClosedOverSMHKPrev = isClosedOverSMHKPrev; + conditions.isClosedUnderSMHKPrev = isClosedUnderSMHKPrev; + + // + // XZG ... + + // + zg.CopyMain( + barIndex, + mNumberOfItems, + conditions.zigzags // + ); + + // + zg.CopyPeaksAndVales( + barIndex, + mNumberOfItems, + conditions.zigzagPVs // + ); + + // + // Looking for Vale ... + bool isZigZagInPeak = conditions.zigzags[curr] < conditions.zigzagPVs[curr]; + conditions.isZigZagInPeak = isZigZagInPeak; + + // + // Looking for Peak ... + bool isZigZagInVale = conditions.zigzags[curr] > conditions.zigzagPVs[curr]; + conditions.isZigZagInVale = isZigZagInVale; + + // + // XMR ... + + // + mrb.CopyFast( + barIndex, + mNumberOfItems, + conditions.mrbFasts // + ); + + // + mrb.CopyR1Fast( + barIndex, + mNumberOfItems, + conditions.mrb1Fasts // + ); + + // + mrb.CopyR2Fast( + barIndex, + mNumberOfItems, + conditions.mrb2Fasts // + ); + + // + mrb.CopyR3Fast( + barIndex, + mNumberOfItems, + conditions.mrb3Fasts // + ); + + // + mrb.CopyR4Fast( + barIndex, + mNumberOfItems, + conditions.mrb4Fasts // + ); + + // + mrb.CopyR5Fast( + barIndex, + mNumberOfItems, + conditions.mrb5Fasts // + ); + + // + mrb.CopyR6Fast( + barIndex, + mNumberOfItems, + conditions.mrb6Fasts // + ); + + // + mrb.CopySlow( + barIndex, + mNumberOfItems, + conditions.mrbSlows // + ); + + // + mrb.CopyR1Slow( + barIndex, + mNumberOfItems, + conditions.mrb1Slows // + ); + + // + mrb.CopyR2Slow( + barIndex, + mNumberOfItems, + conditions.mrb2Slows // + ); + + // + mrb.CopyR3Slow( + barIndex, + mNumberOfItems, + conditions.mrb3Slows // + ); + + // + mrb.CopyR4Slow( + barIndex, + mNumberOfItems, + conditions.mrb4Slows // + ); + + // + mrb.CopyR5Slow( + barIndex, + mNumberOfItems, + conditions.mrb5Slows // + ); + + // + mrb.CopyR6Slow( + barIndex, + mNumberOfItems, + conditions.mrb6Slows // + ); + + // + bool isMRBFastOverSlow = + // + conditions.mrbFasts[curr] > conditions.mrbSlows[curr] && + conditions.mrbFasts[prev] > conditions.mrbSlows[prev] + // + ; + bool isMRBFastCrossedOverSlow = + // + conditions.mrbFasts[curr] > conditions.mrbSlows[curr] && + conditions.mrbFasts[prev] <= conditions.mrbSlows[prev] + // + ; + bool isMRBCloseOverFast = + // + conditions.bars[prev].close > conditions.mrbFasts[prev] && + conditions.bars[curr].low > conditions.mrbFasts[prev] + // + ; + bool isMRBFastUnderSlow = + // + conditions.mrbFasts[curr] < conditions.mrbSlows[curr] && + conditions.mrbFasts[prev] < conditions.mrbSlows[prev] + // + ; + bool isMRBFastCrossedUnderSlow = + // + conditions.mrbFasts[curr] < conditions.mrbSlows[curr] && + conditions.mrbFasts[prev] >= conditions.mrbSlows[prev] + // + ; + bool isMRBCloseUnderSlow = + // + conditions.bars[prev].close < conditions.mrbSlows[prev] && + conditions.bars[curr].high < conditions.mrbSlows[prev] + // + ; + + // + isMRBFastOverSlow = isMRBFastOverSlow; + isMRBFastCrossedOverSlow = isMRBFastCrossedOverSlow; + isMRBCloseOverFast = isMRBCloseOverFast; + isMRBFastUnderSlow = isMRBFastUnderSlow; + isMRBFastCrossedUnderSlow = isMRBFastCrossedUnderSlow; + isMRBCloseUnderSlow = isMRBCloseUnderSlow; + + // + // XDON ... + + // + don.CopyUpperO( + barIndex, + mNumberOfItems, + conditions.donUpperOs // + ); + don.CopyLowerO( + barIndex, + mNumberOfItems, + conditions.donLowerOs // + ); + don.CopyUpperC( + barIndex, + mNumberOfItems, + conditions.donUpperCs // + ); + don.CopyLowerC( + barIndex, + mNumberOfItems, + conditions.donLowerCs // + ); + don.CopyUpperH( + barIndex, + mNumberOfItems, + conditions.donUpperHs // + ); + don.CopyLowerH( + barIndex, + mNumberOfItems, + conditions.donLowerHs // + ); + don.CopyUpperL( + barIndex, + mNumberOfItems, + conditions.donUpperLs // + ); + don.CopyLowerL( + barIndex, + mNumberOfItems, + conditions.donLowerLs // + ); + + // + // Upper ... + + // + double donUpperO = conditions.donUpperOs[curr]; + double donUpperOPrev = conditions.donUpperOs[prev]; + + // + double donUpperC = conditions.donUpperCs[curr]; + double donUpperCPrev = conditions.donUpperCs[prev]; + + // + double donUpperH = conditions.donUpperHs[curr]; + double donUpperHPrev = conditions.donUpperHs[prev]; + + // + double donUpperL = conditions.donUpperLs[curr]; + double donUpperLPrev = conditions.donUpperLs[prev]; + + // + double donUppers[] = { + donUpperO, + donUpperC, + donUpperH, + donUpperL // + }; + double maxDonUpper = GetMax(donUppers); + double minDonUpper = GetMin(donUppers); + + // + double donUpperPrevs[] = { + donUpperOPrev, + donUpperCPrev, + donUpperHPrev, + donUpperLPrev // + }; + double maxDonUpperPrev = GetMax(donUpperPrevs); + double minDonUpperPrev = GetMin(donUpperPrevs); + + // + // Lower ... + + // + double donLowerO = conditions.donLowerOs[curr]; + double donLowerOPrev = conditions.donLowerOs[prev]; + + // + double donLowerC = conditions.donLowerCs[curr]; + double donLowerCPrev = conditions.donLowerCs[prev]; + + // + double donLowerH = conditions.donLowerHs[curr]; + double donLowerHPrev = conditions.donLowerHs[prev]; + + // + double donLowerL = conditions.donLowerLs[curr]; + double donLowerLPrev = conditions.donLowerLs[prev]; + + // + double donLowers[] = { + donLowerO, + donLowerC, + donLowerH, + donLowerL // + }; + double maxDonLower = GetMax(donLowers); + double minDonLower = GetMin(donLowers); + + // + double donLowerPrevs[] = { + donLowerOPrev, + donLowerCPrev, + donLowerHPrev, + donLowerLPrev // + }; + double maxDonLowerPrev = GetMax(donLowerPrevs); + double minDonLowerPrev = GetMin(donLowerPrevs); + + // + bool isDONAttachedMaxLower = conditions.bars[curr].low == maxDonLower; + bool isDONAttachedMinLower = conditions.bars[curr].low == minDonLower; + bool isDONCrossedOverMaxLower = + // + ((conditions.bars[curr].low > maxDonLower) || + (conditions.bars[curr].close > maxDonLower)) + // + && + // + ((conditions.bars[prev].high <= maxDonLower) || + (conditions.bars[prev].open <= maxDonLower)) + // + ; + bool isDONCrossedUnderMaxLower = + // + ((conditions.bars[curr].low < maxDonLower) || + (conditions.bars[curr].close < maxDonLower)) + // + && + // + ((conditions.bars[prev].high >= maxDonLower) || + (conditions.bars[prev].open >= maxDonLower)) + // + ; + + // + bool isDONAttachedMaxUpper = conditions.bars[curr].high == maxDonUpper; + bool isDONAttachedMinUpper = conditions.bars[curr].high == minDonUpper; + bool isDONCrossedOverMaxUpper = + // + ((conditions.bars[curr].low > maxDonUpper) || + (conditions.bars[curr].close > maxDonUpper)) + // + && + // + ((conditions.bars[prev].high <= maxDonUpper) || + (conditions.bars[prev].open <= maxDonUpper)) + // + ; + bool isDONCrossedUnderMaxUpper = + // + ((conditions.bars[curr].low < maxDonUpper) || + (conditions.bars[curr].close < maxDonUpper)) + // + && + // + ((conditions.bars[prev].high >= maxDonUpper) || + (conditions.bars[prev].open >= maxDonUpper)) + // + ; + + // + conditions.isDONAttachedMaxLower = isDONAttachedMaxLower; + conditions.isDONAttachedMinLower = isDONAttachedMinLower; + conditions.isDONCrossedOverMaxLower = isDONCrossedOverMaxLower; + conditions.isDONCrossedUnderMaxLower = isDONCrossedUnderMaxLower; + + // + conditions.isDONAttachedMaxUpper = isDONAttachedMaxUpper; + conditions.isDONAttachedMinUpper = isDONAttachedMinUpper; + conditions.isDONCrossedOverMaxUpper = isDONCrossedOverMaxUpper; + conditions.isDONCrossedUnderMaxUpper = isDONCrossedUnderMaxUpper; + + // + // XPV ... + + // + pv.CopyPeak( + barIndex, + mNumberOfItems, + conditions.pvPeaks // + ); + pv.CopyVale( + barIndex, + mNumberOfItems, + conditions.pvVales // + ); + pv.CopyResistance( + barIndex, + mNumberOfItems, + conditions.pvResistances // + ); + pv.CopySupport( + barIndex, + mNumberOfItems, + conditions.pvSupports // + ); + pv.CopyFib1( + barIndex, + mNumberOfItems, + conditions.pvFib1s // + ); + pv.CopyFib2( + barIndex, + mNumberOfItems, + conditions.pvFib2s // + ); + pv.CopyFib3( + barIndex, + mNumberOfItems, + conditions.pvFib3s // + ); + pv.CopyFib4( + barIndex, + mNumberOfItems, + conditions.pvFib4s // + ); + pv.CopyFib5( + barIndex, + mNumberOfItems, + conditions.pvFib5s // + ); + pv.CopySCHH( + barIndex, + mNumberOfItems, + conditions.pvSCHHs // + ); + pv.CopySCLL( + barIndex, + mNumberOfItems, + conditions.pvSCLLs // + ); + pv.CopyMCHH( + barIndex, + mNumberOfItems, + conditions.pvMCHHs // + ); + pv.CopyMCLL( + barIndex, + mNumberOfItems, + conditions.pvMCLLs // + ); + pv.CopyLCHH( + barIndex, + mNumberOfItems, + conditions.pvLCHHs // + ); + pv.CopyLCLL( + barIndex, + mNumberOfItems, + conditions.pvLCLLs // + ); + pv.CopyHCHH( + barIndex, + mNumberOfItems, + conditions.pvHCHHs // + ); + pv.CopyHCLL( + barIndex, + mNumberOfItems, + conditions.pvHCLLs // + ); + + // + double pvPeak = conditions.pvPeaks[curr]; + double pvPeakPrev = conditions.pvPeaks[prev]; + + // + double pvVale = conditions.pvVales[curr]; + double pvValePrev = conditions.pvVales[prev]; + + // + double pvFib1 = conditions.pvFib1s[curr]; + double pvFib2 = conditions.pvFib2s[curr]; + double pvFib3 = conditions.pvFib3s[curr]; + double pvFib4 = conditions.pvFib4s[curr]; + double pvFib5 = conditions.pvFib5s[curr]; + + // + double pvFib1Prev = conditions.pvFib1s[prev]; + double pvFib2Prev = conditions.pvFib2s[prev]; + double pvFib3Prev = conditions.pvFib3s[prev]; + double pvFib4Prev = conditions.pvFib4s[prev]; + double pvFib5Prev = conditions.pvFib5s[prev]; + + // + bool isPVPeakSameAs = IsSame(conditions.pvPeaks); + bool isPVNewPeak = NotEmpty(pvPeak) && pvPeak != pvPeakPrev; + bool isPVNewPeakOverLast = isPVNewPeak && pvPeak > pvPeakPrev; + bool isPVNewPeakUnderLast = isPVNewPeak && pvPeak < pvPeakPrev; + bool isPVValeSameAs = IsSame(conditions.pvVales); + bool isPVNewVale = NotEmpty(pvVale) && pvVale != pvValePrev; + bool isPVNewValeOverLast = isPVNewVale && pvVale > pvValePrev; + bool isPVNewValeUnderLast = isPVNewVale && pvVale < pvValePrev; + bool isPVFiboIncreased = + // + pvFib1 > pvFib1Prev && + pvFib2 > pvFib2Prev && + pvFib3 > pvFib3Prev && + pvFib4 > pvFib4Prev && + pvFib5 > pvFib5Prev + // + ; + bool isPVFiboDecreased = + // + pvFib1 < pvFib1Prev && + pvFib2 < pvFib2Prev && + pvFib3 < pvFib3Prev && + pvFib4 < pvFib4Prev && + pvFib5 < pvFib5Prev + // + ; + + bool isPVFiboSectionChanged = + // + (isPVNewPeakUnderLast && isPVFiboDecreased) + // + || + // + (isPVNewValeOverLast && isPVFiboIncreased) + // + ; + + // + conditions.isPVPeakSameAs = isPVPeakSameAs; + conditions.isPVNewPeak = isPVNewPeak; + conditions.isPVNewPeakOverLast = isPVNewPeakOverLast; + conditions.isPVNewPeakUnderLast = isPVNewPeakUnderLast; + conditions.isPVValeSameAs = isPVValeSameAs; + conditions.isPVNewVale = isPVNewVale; + conditions.isPVNewValeOverLast = isPVNewValeOverLast; + conditions.isPVNewValeUnderLast = isPVNewValeUnderLast; + conditions.isPVFiboIncreased = isPVFiboIncreased; + conditions.isPVFiboDecreased = isPVFiboDecreased; + conditions.isPVFiboSectionChanged = isPVFiboSectionChanged; + + // + // XPV Cycles ... + + // + double pvSCHH = conditions.pvSCHHs[curr]; + double pvSCLL = conditions.pvSCLLs[curr]; + double pvMCHH = conditions.pvMCHHs[curr]; + double pvMCLL = conditions.pvMCLLs[curr]; + double pvLCHH = conditions.pvLCHHs[curr]; + double pvLCLL = conditions.pvLCLLs[curr]; + double pvHCHH = conditions.pvHCHHs[curr]; + double pvHCLL = conditions.pvHCLLs[curr]; + + // + double pvSCHHPrev = conditions.pvSCHHs[prev]; + double pvSCLLPrev = conditions.pvSCLLs[prev]; + double pvMCHHPrev = conditions.pvMCHHs[prev]; + double pvMCLLPrev = conditions.pvMCLLs[prev]; + double pvLCHHPrev = conditions.pvLCHHs[prev]; + double pvLCLLPrev = conditions.pvLCLLs[prev]; + double pvHCHHPrev = conditions.pvHCHHs[prev]; + double pvHCLLPrev = conditions.pvHCLLs[prev]; + + // + double pvSCHHPrevPrev = conditions.pvSCHHs[prev + 1]; + double pvSCLLPrevPrev = conditions.pvSCLLs[prev + 1]; + double pvMCHHPrevPrev = conditions.pvMCHHs[prev + 1]; + double pvMCLLPrevPrev = conditions.pvMCLLs[prev + 1]; + double pvLCHHPrevPrev = conditions.pvLCHHs[prev + 1]; + double pvLCLLPrevPrev = conditions.pvLCLLs[prev + 1]; + double pvHCHHPrevPrev = conditions.pvHCHHs[prev + 1]; + double pvHCLLPrevPrev = conditions.pvHCLLs[prev + 1]; + + // + // Short ... + + // + bool isPVSCHHBullish = pvSCHH > pvSCHHPrev; + bool isPVSCHHBullishPrev = pvSCHHPrev > pvSCHHPrevPrev; + bool isPVSCLLBullish = pvSCLL > pvSCLLPrev; + bool isPVSCLLBullishPrev = pvSCLLPrev > pvSCLLPrevPrev; + bool isPVSCBullish = + // + isPVSCHHBullish && + isPVSCLLBullish + // + ; + bool isPVSCBullishPrev = + // + isPVSCHHBullishPrev && + isPVSCLLBullishPrev + // + ; + bool isPVSCSwitchedToBullish = + // + isPVSCBullish && + !isPVSCBullishPrev + // + ; + + // + bool isPVSCHHBearish = pvSCHH < pvSCHHPrev; + bool isPVSCHHBearishPrev = pvSCHHPrev < pvSCHHPrevPrev; + bool isPVSCLLBearish = pvSCLL < pvSCLLPrev; + bool isPVSCLLBearishPrev = pvSCLLPrev < pvSCLLPrevPrev; + bool isPVSCBearish = + // + isPVSCHHBearish && + isPVSCLLBearish + // + ; + bool isPVSCBearishPrev = + // + isPVSCHHBearishPrev && + isPVSCLLBearishPrev + // + ; + bool isPVSCSwitchedToBearish = + // + isPVSCBearish && + !isPVSCBearishPrev + // + ; + + // + // Medium ... + + // + bool isPVMCHHBullish = pvMCHH > pvMCHHPrev; + bool isPVMCHHBullishPrev = pvMCHHPrev > pvMCHHPrevPrev; + bool isPVMCLLBullish = pvMCLL > pvMCLLPrev; + bool isPVMCLLBullishPrev = pvMCLLPrev > pvMCLLPrevPrev; + bool isPVMCBullish = + // + isPVMCHHBullish && + isPVMCLLBullish + // + ; + bool isPVMCBullishPrev = + // + isPVMCHHBullishPrev && + isPVMCLLBullishPrev + // + ; + bool isPVMCSwitchedToBullish = + // + isPVMCBullish && + !isPVMCBullishPrev + // + ; + + // + bool isPVMCHHBearish = pvMCHH < pvMCHHPrev; + bool isPVMCHHBearishPrev = pvMCHHPrev < pvMCHHPrevPrev; + bool isPVMCLLBearish = pvMCLL < pvMCLLPrev; + bool isPVMCLLBearishPrev = pvMCLLPrev < pvMCLLPrevPrev; + bool isPVMCBearish = + // + isPVMCHHBearish && + isPVMCLLBearish + // + ; + bool isPVMCBearishPrev = + // + isPVMCHHBearishPrev && + isPVMCLLBearishPrev + // + ; + bool isPVMCSwitchedToBearish = + // + isPVMCBearish && + !isPVMCBearishPrev + // + ; + + // + // Long ... + + // + bool isPVLCHHBullish = pvLCHH > pvLCHHPrev; + bool isPVLCHHBullishPrev = pvLCHHPrev > pvLCHHPrevPrev; + bool isPVLCLLBullish = pvLCLL > pvLCLLPrev; + bool isPVLCLLBullishPrev = pvLCLLPrev > pvLCLLPrevPrev; + bool isPVLCBullish = + // + isPVLCHHBullish && + isPVLCLLBullish + // + ; + bool isPVLCBullishPrev = + // + isPVLCHHBullishPrev && + isPVLCLLBullishPrev + // + ; + bool isPVLCSwitchedToBullish = + // + isPVLCBullish && + !isPVLCBullishPrev + // + ; + + // + bool isPVLCHHBearish = pvLCHH < pvLCHHPrev; + bool isPVLCHHBearishPrev = pvLCHHPrev < pvLCHHPrevPrev; + bool isPVLCLLBearish = pvLCLL < pvLCLLPrev; + bool isPVLCLLBearishPrev = pvLCLLPrev < pvLCLLPrevPrev; + bool isPVLCBearish = + // + isPVLCHHBearish && + isPVLCLLBearish + // + ; + bool isPVLCBearishPrev = + // + isPVLCHHBearishPrev && + isPVLCLLBearishPrev + // + ; + bool isPVLCSwitchedToBearish = + // + isPVLCBearish && + !isPVLCBearishPrev + // + ; + + // + // Hind ... + + // + bool isPVHCHHBullish = pvHCHH > pvHCHHPrev; + bool isPVHCHHBullishPrev = pvHCHHPrev > pvHCHHPrevPrev; + bool isPVHCLLBullish = pvHCLL > pvHCLLPrev; + bool isPVHCLLBullishPrev = pvHCLLPrev > pvHCLLPrevPrev; + bool isPVHCBullish = + // + isPVHCHHBullish && + isPVHCLLBullish + // + ; + bool isPVHCBullishPrev = + // + isPVHCHHBullishPrev && + isPVHCLLBullishPrev + // + ; + bool isPVHCSwitchedToBullish = + // + isPVHCBullish && + !isPVHCBullishPrev + // + ; + + // + bool isPVHCHHBearish = pvHCHH < pvHCHHPrev; + bool isPVHCHHBearishPrev = pvHCHHPrev < pvHCHHPrevPrev; + bool isPVHCLLBearish = pvHCLL < pvHCLLPrev; + bool isPVHCLLBearishPrev = pvHCLLPrev < pvHCLLPrevPrev; + bool isPVHCBearish = + // + isPVHCHHBearish && + isPVHCLLBearish + // + ; + bool isPVHCBearishPrev = + // + isPVHCHHBearishPrev && + isPVHCLLBearishPrev + // + ; + bool isPVHCSwitchedToBearish = + // + isPVHCBearish && + !isPVHCBearishPrev + // + ; + + // + conditions.isPVSCHHBullish = isPVSCHHBullish; + conditions.isPVSCLLBullish = isPVSCLLBullish; + conditions.isPVSCBullish = isPVSCBullish; + conditions.isPVSCSwitchedToBullish = isPVSCSwitchedToBullish; + conditions.isPVSCHHBearish = isPVSCHHBearish; + conditions.isPVSCLLBearish = isPVSCLLBearish; + conditions.isPVSCBearish = isPVSCBearish; + conditions.isPVSCSwitchedToBearish = isPVSCSwitchedToBearish; + conditions.isPVMCHHBullish = isPVMCHHBullish; + conditions.isPVMCLLBullish = isPVMCLLBullish; + conditions.isPVMCBullish = isPVMCBullish; + conditions.isPVMCSwitchedToBullish = isPVMCSwitchedToBullish; + conditions.isPVMCHHBearish = isPVMCHHBearish; + conditions.isPVMCLLBearish = isPVMCLLBearish; + conditions.isPVMCBearish = isPVMCBearish; + conditions.isPVMCSwitchedToBearish = isPVMCSwitchedToBearish; + conditions.isPVLCHHBullish = isPVLCHHBullish; + conditions.isPVLCLLBullish = isPVLCLLBullish; + conditions.isPVLCBullish = isPVLCBullish; + conditions.isPVLCSwitchedToBullish = isPVLCSwitchedToBullish; + conditions.isPVLCHHBearish = isPVLCHHBearish; + conditions.isPVLCLLBearish = isPVLCLLBearish; + conditions.isPVLCBearish = isPVLCBearish; + conditions.isPVLCSwitchedToBearish = isPVLCSwitchedToBearish; + conditions.isPVHCHHBullish = isPVHCHHBullish; + conditions.isPVHCLLBullish = isPVHCLLBullish; + conditions.isPVHCBullish = isPVHCBullish; + conditions.isPVHCSwitchedToBullish = isPVHCSwitchedToBullish; + conditions.isPVHCHHBearish = isPVHCHHBearish; + conditions.isPVHCLLBearish = isPVHCLLBearish; + conditions.isPVHCBearish = isPVHCBearish; + conditions.isPVHCSwitchedToBearish = isPVHCSwitchedToBearish; + + // + // XSTR ... + + // + str.CopyTrend( + barIndex, + mNumberOfItems, + conditions.strTrends // + ); + str.CopyState( + barIndex, + mNumberOfItems, + conditions.strStates // + ); + + // + bool isTrendBullish = + // + str.IsBullish(str.GetState(curr)) + // + ; + bool isTrendBearish = + // + str.IsBearish(str.GetState(curr)) + // + ; + + // + bool isTrendBullishPrev = + // + str.IsBullish(str.GetState(prev)) + // + ; + bool isTrendBearishPrev = + // + str.IsBearish(str.GetState(prev)) + // + ; + + // + conditions.isTrendBullish = isTrendBullish; + conditions.isTrendBearish = isTrendBearish; + conditions.isTrendSwitchedToBullish = + // + isTrendBullish && + !isTrendBullishPrev + // + ; + conditions.isTrendSwitchedToBearish = + // + isTrendBearish && + !isTrendBearishPrev + // + ; + + // + // XCHE ... + + // + che.CopyLongExit1( + barIndex, + mNumberOfItems, + conditions.cheLongExit1s // + ); + che.CopyLongExit2( + barIndex, + mNumberOfItems, + conditions.cheLongExit2s // + ); + che.CopyShortExit1( + barIndex, + mNumberOfItems, + conditions.cheShortExit1s // + ); + che.CopyShortExit2( + barIndex, + mNumberOfItems, + conditions.cheShortExit2s // + ); + + // + bool isCHEInLong = + // + NotEmpty(che.GetLongExit1(curr)) + // + ; + bool isCHEInLongPrev = + // + NotEmpty(che.GetLongExit1(prev)) + // + ; + bool isCHEInStrongLong = + // + isCHEInLong && + NotEmpty(che.GetLongExit2(curr)) + // + ; + bool isCHEInStrongLongPrev = + // + isCHEInLongPrev && + NotEmpty(che.GetLongExit2(prev)) + // + ; + bool isCHEInShort = + // + NotEmpty(che.GetShortExit1(curr)) + // + ; + bool isCHEInShortPrev = + // + NotEmpty(che.GetShortExit1(prev)) + // + ; + bool isCHEInStrongShort = + // + isCHEInShort && + NotEmpty(che.GetShortExit2(curr)) + // + ; + bool isCHEInStrongShortPrev = + // + isCHEInShortPrev && + NotEmpty(che.GetShortExit2(prev)) + // + ; + + // + conditions.isCHEInLong = isCHEInLong; + conditions.isCHEInStrongLong = isCHEInStrongLong; + conditions.isCHESwitchedInStrongLong = + // + isCHEInStrongLong && + !isCHEInStrongLongPrev + // + ; + conditions.isCHEInShort = isCHEInShort; + conditions.isCHEInStrongShort = isCHEInStrongShort; + conditions.isCHESwitchedInStrongShort = + // + isCHEInStrongShort && + !isCHEInStrongShortPrev + // + ; + + // + // XMC ... + + // + mc.CopyFast( + barIndex, + mNumberOfItems, + conditions.mcFasts // + ); + mc.CopySlow( + barIndex, + mNumberOfItems, + conditions.mcSlows // + ); + mc.CopyVerifier( + barIndex, + mNumberOfItems, + conditions.mcVerifiers // + ); + + // + bool isFastOverSlow = + // + conditions.mcFasts[curr] > conditions.mcSlows[curr] && + conditions.mcFasts[prev] > conditions.mcSlows[prev] + // + ; + bool isFastUnderSlow = + // + conditions.mcFasts[curr] < conditions.mcSlows[curr] && + conditions.mcFasts[prev] < conditions.mcSlows[prev] + // + ; + bool isFastOverVerifier = + // + conditions.mcFasts[curr] > conditions.mcVerifiers[curr] && + conditions.mcFasts[prev] > conditions.mcVerifiers[prev] + // + ; + bool isFastUnderVerifier = + // + conditions.mcFasts[curr] < conditions.mcVerifiers[curr] && + conditions.mcFasts[prev] < conditions.mcVerifiers[prev] + // + ; + bool isSlowOverVerifier = + // + conditions.mcSlows[curr] > conditions.mcVerifiers[curr] && + conditions.mcSlows[prev] > conditions.mcVerifiers[prev] + // + ; + bool isSlowUnderVerifier = + // + conditions.mcSlows[curr] < conditions.mcVerifiers[curr] && + conditions.mcSlows[prev] < conditions.mcVerifiers[prev] + // + ; + bool isCloseOverFast = + // + pBar.close > conditions.mcFasts[prev] + // + ; + bool isCloseUnderFast = + // + pBar.close < conditions.mcFasts[prev] + // + ; + bool isCloseOverSlow = + // + pBar.close > conditions.mcSlows[prev] + // + ; + bool isCloseUnderSlow = + // + pBar.close < conditions.mcSlows[prev] + // + ; + bool isCloseOverVerifier = + // + pBar.close > conditions.mcVerifiers[prev] + // + ; + bool isCloseUnderVerifier = + // + pBar.close < conditions.mcVerifiers[prev] + // + ; + + // + bool isFastCrossedOverSlow = + // + conditions.mcFasts[curr] > conditions.mcSlows[curr] && + conditions.mcFasts[prev] <= conditions.mcSlows[prev] + // + ; + + // + bool isFastCrossedUnderSlow = + // + conditions.mcFasts[curr] < conditions.mcSlows[curr] && + conditions.mcFasts[prev] >= conditions.mcSlows[prev] + // + ; + + // + bool isFastCrossedOverVerifier = + // + conditions.mcFasts[curr] > conditions.mcVerifiers[curr] && + conditions.mcFasts[prev] <= conditions.mcVerifiers[prev] + // + ; + + // + bool isFastCrossedUnderVerifier = + // + conditions.mcFasts[curr] < conditions.mcVerifiers[curr] && + conditions.mcFasts[prev] >= conditions.mcVerifiers[prev] + // + ; + + // + bool isSlowCrossedOverVerifier = + // + conditions.mcSlows[curr] > conditions.mcVerifiers[curr] && + conditions.mcSlows[prev] <= conditions.mcVerifiers[prev] + // + ; + + // + bool isSlowCrossedUnderVerifier = + // + conditions.mcSlows[curr] < conditions.mcVerifiers[curr] && + conditions.mcSlows[prev] >= conditions.mcVerifiers[prev] + // + ; + + // + conditions.isFastOverSlow = isFastOverSlow; + conditions.isFastUnderSlow = isFastUnderSlow; + conditions.isFastOverVerifier = isFastOverVerifier; + conditions.isFastUnderVerifier = isFastUnderVerifier; + conditions.isSlowOverVerifier = isSlowOverVerifier; + conditions.isSlowUnderVerifier = isSlowUnderVerifier; + conditions.isCloseOverFast = isCloseOverFast; + conditions.isCloseUnderFast = isCloseUnderFast; + conditions.isCloseOverSlow = isCloseOverSlow; + conditions.isCloseUnderSlow = isCloseUnderSlow; + conditions.isCloseOverVerifier = isCloseOverVerifier; + conditions.isCloseUnderVerifier = isCloseUnderVerifier; + conditions.isFastCrossedOverSlow = isFastCrossedOverSlow; + conditions.isFastCrossedUnderSlow = isFastCrossedUnderSlow; + conditions.isFastCrossedOverVerifier = isFastCrossedOverVerifier; + conditions.isFastCrossedUnderVerifier = isFastCrossedUnderVerifier; + conditions.isSlowCrossedOverVerifier = isSlowCrossedOverVerifier; + conditions.isSlowCrossedUnderVerifier = isSlowCrossedUnderVerifier; + + // + // XICH ... + + // + ich.CopyTenkanSen( + barIndex, + mNumberOfItems, + conditions.ichTenkanSens // + ); + ich.CopyKijunSen( + barIndex, + mNumberOfItems, + conditions.ichKijunSens // + ); + ich.CopyChikouSpan( + barIndex, + mNumberOfItems, + conditions.ichChikouSpans // + ); + ich.CopySenkouSpanA( + barIndex, + mNumberOfItems, + conditions.ichSenkouSpanBs // + ); + ich.CopySenkouSpanB( + barIndex, + mNumberOfItems, + conditions.ichSenkouSpanAs // + ); + + // + double tenkanSen = ich.GetTenkanSen(curr); + double tenkanSenPrev = ich.GetTenkanSen(prev); + + // + double kijunSen = ich.GetKijunSen(curr); + double kijunSenPrev = ich.GetKijunSen(prev); + + // + double senkouSpanA = ich.GetSenkouSpanA(curr); + double senkouSpanAPrev = ich.GetSenkouSpanA(prev); + + // + double senkouSpanB = ich.GetSenkouSpanB(curr); + double senkouSpanBPrev = ich.GetSenkouSpanB(prev); + + // + double futureSenkouSpanA = ich.GetFutureSenkouSpanA(curr); + double futureSenkouSpanAPrev = ich.GetFutureSenkouSpanA(prev); + + // + double futureSenkouSpanB = ich.GetFutureSenkouSpanB(curr); + double futureSenkouSpanBPrev = ich.GetFutureSenkouSpanB(prev); + + // + bool isSenkouSpanAOverB = senkouSpanA > senkouSpanB; + bool isSenkouSpanAUnderB = senkouSpanA < senkouSpanB; + bool isSenkouSpanAOverLast = senkouSpanA > senkouSpanAPrev; + bool isSenkouSpanAUnderLast = senkouSpanA < senkouSpanAPrev; + bool isFutureSenkouSpanAOverB = futureSenkouSpanA > futureSenkouSpanB; + bool isFutureSenkouSpanAUnderB = futureSenkouSpanA < futureSenkouSpanB; + bool isFutureSenkouSpanAOverLast = futureSenkouSpanA > futureSenkouSpanAPrev; + bool isFutureSenkouSpanAUnderLast = futureSenkouSpanA < futureSenkouSpanAPrev; + bool isCloseOverKijunSen = pBar.close > kijunSenPrev; + bool isCloseUnderKijunSen = pBar.close < kijunSenPrev; + bool isTenkanSenOverKijunSen = tenkanSen > kijunSen; + bool isTenkanSenUnderKijunSen = tenkanSen < kijunSen; + bool isTenkanSenPrevOverKijunSen = tenkanSenPrev > kijunSenPrev; + bool isTenkanSenPrevUnderKijunSen = tenkanSenPrev < kijunSenPrev; + bool isTenkanSenCrossedOverKijunSen = + // + isTenkanSenOverKijunSen && + !isTenkanSenPrevOverKijunSen + // + ; + bool isTenkanSenCrossedUnderKijunSen = + // + isTenkanSenUnderKijunSen && + !isTenkanSenPrevUnderKijunSen + // + ; + + // + conditions.isSenkouSpanAOverB = isSenkouSpanAOverB; + conditions.isSenkouSpanAUnderB = isSenkouSpanAUnderB; + conditions.isSenkouSpanAOverLast = isSenkouSpanAOverLast; + conditions.isSenkouSpanAUnderLast = isSenkouSpanAUnderLast; + conditions.isFutureSenkouSpanAOverB = isFutureSenkouSpanAOverB; + conditions.isFutureSenkouSpanAUnderB = isFutureSenkouSpanAUnderB; + conditions.isFutureSenkouSpanAOverLast = isFutureSenkouSpanAOverLast; + conditions.isFutureSenkouSpanAUnderLast = isFutureSenkouSpanAUnderLast; + conditions.isCloseOverKijunSen = isCloseOverKijunSen; + conditions.isCloseUnderKijunSen = isCloseUnderKijunSen; + conditions.isTenkanSenOverKijunSen = isTenkanSenOverKijunSen; + conditions.isTenkanSenUnderKijunSen = isTenkanSenUnderKijunSen; + conditions.isTenkanSenCrossedOverKijunSen = isTenkanSenCrossedOverKijunSen; + conditions.isTenkanSenCrossedUnderKijunSen = isTenkanSenCrossedUnderKijunSen; + + // + // XOSC ... + + // + // ATR ... + osc.CopyATR( + barIndex, + mNumberOfItems, + conditions.oscAtrs // + ); + + // + // VOLUE ... + osc.CopyVolume( + barIndex, + mNumberOfItems, + conditions.oscVolumes // + ); + + // + // MOMENTUM ... + osc.CopyMomentum( + barIndex, + mNumberOfItems, + conditions.oscMomentums // + ); + + // + // SAR ... + osc.CopySAR( + barIndex, + mNumberOfItems, + conditions.oscSars // + ); + + // + // RVI ... + + // + osc.CopyRVI( + barIndex, + mNumberOfItems, + conditions.oscRviMains // + ); + osc.CopyRVISignal( + barIndex, + mNumberOfItems, + conditions.oscRviSignals // + ); + + // + double rvi = osc.GetRVI(curr); + double rviSignal = osc.GetRVISignal(curr); + + // + bool isRVILongStart = + // + rvi > 0 && + rviSignal > 0 && + rvi > rviSignal + // + ; + bool isRVILongStop = + // + rvi < 0 && + rviSignal < 0 && + rvi < rviSignal + // + ; + bool isRVIShortStart = + // + rvi < 0 && + rviSignal < 0 && + rvi < rviSignal + // + ; + bool isRVIShortStop = + // + rvi > 0 && + rviSignal > 0 && + rvi > rviSignal + // + ; + + // + conditions.isRVILongStart = isRVILongStart; + conditions.isRVILongStop = isRVILongStop; + conditions.isRVIShortStart = isRVIShortStart; + conditions.isRVIShortStop = isRVIShortStop; + + // + // RSI ... + + // + osc.CopyRSI( + barIndex, + mNumberOfItems, + conditions.oscRsis // + ); + + // + double rsi = osc.GetRSI(curr); + + // + bool isRSIUnder50 = + // + rsi < 50 + // + ; + bool isRSIOver70 = + // + rsi > 70 + // + ; + bool isRSIOver50 = + // + rsi > 50 + // + ; + bool isRSIUnder30 = + // + rsi < 30 + // + ; + + // + conditions.isRSIUnder50 = isRSIUnder50; + conditions.isRSIOver70 = isRSIOver70; + conditions.isRSIOver50 = isRSIOver50; + conditions.isRSIUnder30 = isRSIUnder30; + + // + // BULLPOWER ... + + // + osc.CopyBullPower( + barIndex, + mNumberOfItems, + conditions.oscBullPs // + ); + + // + double bullp = osc.GetBullPower(curr); + double bullpLast = osc.GetBullPower(prev); + + // + bool isBullPowerOverLast = + // + bullp > bullpLast + // + ; + bool isBullPoswerUnderLast = + // + bullp < bullpLast + // + ; + bool isBullPowerOverZero = + // + bullp > 0 + // + ; + bool isBullPoswerUnderZero = + // + bullp < 0 + // + ; + + // + conditions.isBullPowerOverLast = isBullPowerOverLast; + conditions.isBullPoswerUnderLast = isBullPoswerUnderLast; + conditions.isBullPowerOverZero = isBullPowerOverZero; + conditions.isBullPoswerUnderZero = isBullPoswerUnderZero; + + // + // BEARPOWER ... + + // + osc.CopyBearPower( + barIndex, + mNumberOfItems, + conditions.oscBearPs // + ); + + // + double bearp = osc.GetBearPower(curr); + double bearpLast = osc.GetBearPower(prev); + + // + bool isBearPowerOverLast = + // + bearp > bearpLast + // + ; + bool isBearPoswerUnderLast = + // + bearp < bearpLast + // + ; + bool isBearPowerOverZero = + // + bearp > 0 + // + ; + bool isBearPoswerUnderZero = + // + bearp < 0 + // + ; + + // + conditions.isBearPowerOverLast = isBearPowerOverLast; + conditions.isBearPoswerUnderLast = isBearPoswerUnderLast; + conditions.isBearPowerOverZero = isBearPowerOverZero; + conditions.isBearPoswerUnderZero = isBearPoswerUnderZero; + + // + // CCI ... + + // + osc.CopyCCI( + barIndex, + mNumberOfItems, + conditions.oscCcis // + ); + + // + double cci = osc.GetCCI(curr); + + // + bool isCCIPositive = + // + cci > 0 + // + ; + bool isCCINegative = + // + cci < 0 + // + ; + bool isCCIOverPositiveHundred = + // + cci > 100 + // + ; + bool isCCIUnderNegativeHundred = + // + cci < -100 + // + ; + + // + conditions.isCCIPositive = isCCIPositive; + conditions.isCCINegative = isCCINegative; + conditions.isCCIOverPositiveHundred = isCCIOverPositiveHundred; + conditions.isCCIUnderNegativeHundred = isCCIUnderNegativeHundred; + + // + // MACD ... + + // + osc.CopyMACD( + barIndex, + mNumberOfItems, + conditions.oscMacdMains // + ); + osc.CopyMACDSignal( + barIndex, + mNumberOfItems, + conditions.oscMacdSignals // + ); + + // + double macd = osc.GetMACD(curr); + double macdSignal = osc.GetMACDSignal(curr); + + // + bool isMACDPositiove = + // + macd > 0 + // + ; + bool isMACDNegative = + // + macd < 0 + // + ; + bool isMACDOverSignal = + // + macd > macdSignal + // + ; + bool isMACDUnderSignal = + // + macd < macdSignal + // + ; + + // + conditions.isMACDPositiove = isMACDPositiove; + conditions.isMACDNegative = isMACDNegative; + conditions.isMACDOverSignal = isMACDOverSignal; + conditions.isMACDUnderSignal = isMACDUnderSignal; + + // + // STOCH ... + + // + osc.CopySTOCH( + barIndex, + mNumberOfItems, + conditions.oscStochMains // + ); + osc.CopySTOCHSignal( + barIndex, + mNumberOfItems, + conditions.oscStochSignals // + ); + + // + double stoch = osc.GetSTOCH(curr); + double stochSignal = osc.GetSTOCHSignal(curr); + + // + bool isStochKOverD = + // + stoch > stochSignal + // + ; + bool isStochKDUnder50 = + // + stoch < 50 && + stochSignal < 50 + // + ; + bool isStochKUnderD = + // + stoch < stochSignal + // + ; + bool isStochKDOver50 = + // + stoch > 50 && + stochSignal > 50 + // + ; + bool isStochKDUnder20 = + // + stoch < 20 && + stochSignal < 20 + // + ; + bool isStochKDOver80 = + // + stoch > 80 && + stochSignal > 80 + // + ; + + // + conditions.isStochKOverD = isStochKOverD; + conditions.isStochKDUnder50 = isStochKDUnder50; + conditions.isStochKUnderD = isStochKUnderD; + conditions.isStochKDOver50 = isStochKDOver50; + conditions.isStochKDUnder20 = isStochKDUnder20; + conditions.isStochKDOver80 = isStochKDOver80; + + // + // STDDEV ... + + // + osc.CopySTDDEV( + barIndex, + mNumberOfItems, + conditions.oscStddevs // + ); + + // + double stdDevs[]; + osc.CopySTDDEV( + barIndex + 1, + 5, + stdDevs // + ); + double stdDevAVG = GetAverage(stdDevs); + + // + double stdDev = osc.GetSTDDEV(curr); + double stdDevLast = osc.GetSTDDEV(prev); + + // + bool isSTDDEVOverAVG = + // + stdDev > stdDevAVG + // + ; + bool isSTDDEVUnderAVG = + // + stdDev < stdDevAVG + // + ; + bool isSTDDEVOverLast = + // + stdDev > stdDevLast + // + ; + bool isSTDDEVUnderLast = + // + stdDev < stdDevLast + // + ; + + // + conditions.isSTDDEVOverAVG = isSTDDEVOverAVG; + conditions.isSTDDEVUnderAVG = isSTDDEVUnderAVG; + conditions.isSTDDEVOverLast = isSTDDEVOverLast; + conditions.isSTDDEVUnderLast = isSTDDEVUnderLast; + } + + // + // Initial Market Cycle ... + bool Init( + X121MCycleInputs &inputs // Inputs for Initialization + ) + { + // + bool result = false; + + // + // Validate Input ... + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + string symbol = mInputs.cycle.symbol; + ENUM_TIMEFRAMES period = mInputs.cycle.period; + + // + // Init Helpers ... + + // + // XHK ... + result = hk.Init( + symbol, + period, + mInputs.hkInputs + // + ); + if (!result) + { + return result; + } + + // + // XMC ... + result = mc.Init( + symbol, + period, + mInputs.mcInputs + // + ); + if (!result) + { + return result; + } + + // + // XPV ... + result = pv.Init( + symbol, + period, + mInputs.pvInputs + // + ); + if (!result) + { + return result; + } + + // + // XZG ... + result = zg.Init( + symbol, + period, + mInputs.zgInputs + // + ); + if (!result) + { + return result; + } + + // + // XMRB ... + result = mrb.Init( + symbol, + period, + mInputs.mrbInputs + // + ); + if (!result) + { + return result; + } + + // + // XSTR ... + result = str.Init( + symbol, + period, + mInputs.strInputs + // + ); + if (!result) + { + return result; + } + + // + // XCHE ... + result = che.Init( + symbol, + period, + mInputs.cheInputs + // + ); + if (!result) + { + return result; + } + + // + // XOSC ... + result = osc.Init( + symbol, + period, + mInputs.oscInputs + // + ); + if (!result) + { + return result; + } + + // + // XICH ... + result = ich.Init( + symbol, + period, + mInputs.ichInputs + // + ); + if (!result) + { + return result; + } + + // + // XDON ... + result = don.Init( + symbol, + period, + mInputs.donInputs + // + ); + if (!result) + { + return result; + } + + // + return result; + } + + // + // Draw Tools ... + // + // Completely Draw Bars ... + void Draw( + long chartID, // Chart ID ... + int subWindow, // Chart Sub Window ... + int &offset // Distance used for Labels ... + ) + { + // + if (mInputs.drawCBar || mInputs.drawPBar) + { + // + DrawOHCL( + chartID, + subWindow, + mInputs.drawLabels, + !mInputs.drawCBar && mInputs.drawPBar, + !mInputs.drawPBar && mInputs.drawCBar, + offset + // + ); + + // + if (mInputs.drawLabels) + { + offset += 3; + } + } + + // + if (mInputs.drawCBarMid || mInputs.drawPBarMid) + { + // + DrawMidLine( + chartID, + subWindow, + mInputs.drawLabels, + !mInputs.drawCBarMid && mInputs.drawPBarMid, + !mInputs.drawPBarMid && mInputs.drawCBarMid, + offset + // + ); + + // + if (mInputs.drawLabels) + { + // + if (mInputs.drawCBarMid) + { + offset++; + } + + // + if (mInputs.drawPBarMid) + { + offset++; + } + } + } + } + + // + // Draw Functions ... + // + // Draw Middle Line of Cycle ... + void DrawOHCL( + long chartID, + int subWindow, + bool drawLabel = false, // Specify Draw Label of Mid Line or not ... + bool drawOnlyPrev = false, // Specify Draw Only Prev Bar of Cycle ... + bool drawOnlyCurrent = false, // Specify Draw Only Current Bar of Cycle ... + int offset = 0 // Distance used for Labels ... + ) + { + // + if (offset < 0) + { + offset = 0; + } + + // + string baseTag = ToString(mInputs.cycle.cycle); + + // + XOHCL cBar = GetBar(0); + XOHCL pBar = GetBar(1); + + // + datetime fromCDate = GetBarTime(0); + datetime fromPDate = GetBarTime(1); + + // + datetime cTime = TimeCurrent(); + + // + // Try to Draw ... + + // + bool canDrawPrev = !drawOnlyCurrent; + bool canDrawCurrent = !drawOnlyPrev; + + // + // Set Cycles Color based on Current Candle ... + + // + bool isCBarBullish = + cBar.IsBullish(); + + // + bool isPBarBullish = + pBar.IsBearish(); + + // + color clrTemoBullishColor = mInputs.cBarDrawSpecs.openStyle.clr; + color clrTemoBearishColor = mInputs.cBarDrawSpecs.closeStyle.clr; + + // + color cBarSelectedColor = isCBarBullish ? clrTemoBullishColor : clrTemoBearishColor; + color pBarSelectedColor = isPBarBullish ? clrTemoBullishColor : clrTemoBearishColor; + + // + mInputs.cBarDrawSpecs.openStyle.clr = cBarSelectedColor; + mInputs.cBarDrawSpecs.openStyle.labelColor = cBarSelectedColor; + + // + mInputs.cBarDrawSpecs.closeStyle.clr = cBarSelectedColor; + mInputs.cBarDrawSpecs.closeStyle.labelColor = cBarSelectedColor; + + // + mInputs.pBarDrawSpecs.openStyle.clr = pBarSelectedColor; + mInputs.pBarDrawSpecs.openStyle.labelColor = pBarSelectedColor; + + // + mInputs.pBarDrawSpecs.closeStyle.clr = pBarSelectedColor; + mInputs.pBarDrawSpecs.closeStyle.labelColor = pBarSelectedColor; + + // + if (canDrawPrev) + { + offset++; + } + + // + // Label ... + if (drawLabel) + { + // + if (canDrawPrev) + { + // + // Draw Prev Bar Lables ... + + // + DrawXOHCLLabel( + chartID, + subWindow, + pBar, + mInputs.pBarDrawSpecs, + "P", + cTime, + offset - 1 + // + ); + + // + offset += 3; + } + + // + if (canDrawCurrent) + { + // + // Draw Current Bar Lables ... + + // + DrawXOHCLLabel( + chartID, + subWindow, + cBar, + mInputs.cBarDrawSpecs, + "C", + cTime, + offset + // + ); + } + } + + // + // Line ... + + // + if (canDrawPrev) + { + // + // Draw Cycle Prev Bar ... + DrawXOHCLContent( + chartID, + subWindow, + pBar, + mInputs.pBarDrawSpecs, + "P", + fromPDate + // + ); + } + + // + if (canDrawCurrent) + { + // + // Draw Cycle Current Bar ... + DrawXOHCLContent( + chartID, + subWindow, + cBar, + mInputs.cBarDrawSpecs, + "C", + fromCDate + // + ); + } + } + + // + // Draw Middle Line of Cycle ... + void DrawMidLine( + long chartID, + int subWindow, + bool drawLabel = false, // Specify Draw Label of Mid Line or not ... + bool drawOnlyPrev = false, // Specify Draw Only Prev Bar of Cycle ... + bool drawOnlyCurrent = false, // Specify Draw Only Current Bar of Cycle ... + int offset = 0 // Distance used for Labels ... + ) + { + // + if (offset < 0) + { + offset = 0; + } + + // + // Calculate Mid Line ... + XOHCL cBar = GetBar(0); + double cMidLine = cBar.GetMid(); + + // + XOHCL pBar = GetBar(1); + double pMidLine = pBar.GetMid(); + + // + string baseTag = ToString(mInputs.cycle.cycle); + + // + string midCTag = baseTag + "|MID|C|"; + string midPTag = baseTag + "|MID|P|"; + + // + string midCLblTag = midCTag + "lbl"; + string midPLblTag = midPTag + "lbl"; + + // + datetime fromCDate = GetBarTime(0); + datetime fromPDate = GetBarTime(1); + + // + datetime cTime = TimeCurrent(); + + // + // Try to Draw ... + + // + bool canDrawPrev = !drawOnlyCurrent; + bool canDrawCurrent = !drawOnlyPrev; + + // + if (canDrawPrev) + { + offset++; + } + + // + // Label ... + if (drawLabel) + { + // + if (canDrawPrev) + { + // + // Draw Prev Candle MidLine Lable ... + DrawLabel( + chartID, + subWindow, + mInputs.pBarMidDrawSpecs, + midPLblTag, + cTime, + pMidLine, + offset // + ); + } + + // + if (canDrawCurrent) + { + // + // Draw Current Candle MidLine Label ... + DrawLabel( + chartID, + subWindow, + mInputs.cBarMidDrawSpecs, + midCLblTag, + cTime, + cMidLine, + offset - 1 // + ); + } + } + + // + // Line ... + + // + if (canDrawPrev) + { + // + // Draw Prev Candle MidLine ... + DrawLine( + chartID, + subWindow, + mInputs.pBarMidDrawSpecs, + midPTag, + fromPDate, + pMidLine // + ); + } + + // + if (canDrawCurrent) + { + // + // Draw Current Candle MidLine ... + DrawLine( + chartID, + subWindow, + mInputs.cBarMidDrawSpecs, + midCTag, + fromCDate, + cMidLine // + ); + } + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + + // + X121MCycleInputs mInputs; + + // + // Tools ... + + // + bool Update(int hostBarIndex = 0) + { + return mInputs.cycle.Update(hostBarIndex); + } + + // + // Draw Functions ... + + // + // Draw OHCL Labels ... + void DrawXOHCLLabel( + long chartID, + int subWindow, + XOHCL &bar, // Specify Cycle XOHCL Model to Draw ... + XOHCLDrawSpecification &specs, // Specify Cycle XOHCL Draw Specifications ... + string baseTag, // Specify a Unique Tag ... + datetime time, // Draw Time ... + int offset = 0 // + ) + { + // + // Open ... + string openTag = mInputs.cycle.prefix + "_" + baseTag + "_O_lbl"; + DrawLabel( + chartID, + subWindow, + specs.openStyle, + openTag, + time, + bar.open, + offset + // + ); + + // + // High ... + string highTag = mInputs.cycle.prefix + "_" + baseTag + "_H_lbl"; + DrawLabel( + chartID, + subWindow, + specs.highStyle, + highTag, + time, + bar.high, + offset + 1 + // + ); + + // + // Close ... + string closeTag = mInputs.cycle.prefix + "_" + baseTag + "_C_lbl"; + DrawLabel( + chartID, + subWindow, + specs.closeStyle, + closeTag, + time, + bar.close, + offset + 2 + // + ); + + // + // Low ... + string lowTag = mInputs.cycle.prefix + "_" + baseTag + "_L_lbl"; + DrawLabel( + chartID, + subWindow, + specs.lowStyle, + lowTag, + time, + bar.low, + offset + 3 + // + ); + } + + // + // Draw XOHCL Content ... + void DrawXOHCLContent( + long chartID, + int subWindow, + XOHCL &bar, // Specify Cycle XOHCL Model to Draw ... + XOHCLDrawSpecification &specs, // Specify Cycle XOHCL Draw Specifications ... + string baseTag, // Specify a Unique Tag ... + datetime time // Draw Time ... + ) + { + // + // Open ... + string openTag = mInputs.cycle.prefix + "_" + baseTag + "_O"; + DrawLine( + chartID, + subWindow, + specs.openStyle, + openTag, + time, + bar.open + // + ); + + // + // High ... + string highTag = mInputs.cycle.prefix + "_" + baseTag + "_H"; + DrawLine( + chartID, + subWindow, + specs.highStyle, + highTag, + time, + bar.high + // + ); + + // + // Close ... + string closeTag = mInputs.cycle.prefix + "_" + baseTag + "_C"; + DrawLine( + chartID, + subWindow, + specs.closeStyle, + closeTag, + time, + bar.close + // + ); + + // + // Low ... + string lowTag = mInputs.cycle.prefix + "_" + baseTag + "_L"; + DrawLine( + chartID, + subWindow, + specs.lowStyle, + lowTag, + time, + bar.low + // + ); + } + + // + // Draw Label Using Specifications ... + void DrawLabel( + long chartID, + int subWindow, + XDrawSpecifications &specs, + string tag, + datetime time, + double price, + int offset = 0 // + ) + { + // + if (offset < 0) + { + offset = 0; + } + + // + int offsetSeconds = PeriodSeconds(mInputs.cycle.hostPeriod) * offset; + + // + string value = specs.label; + + // + DrawText( + chartID, + tag, + subWindow, + time - offsetSeconds, + price, + specs.label, + specs.labelFont, + specs.labelFontSize, + specs.labelColor, + specs.labelAngel, + specs.labelAnchor, + specs.back, + specs.selection, + specs.hidden, + specs.zOrder // + ); + } + + // + // Draw TrendLine Using Specifications ... + void DrawLine( + long chartID, + int subWindow, + XDrawSpecifications &specs, + string tag, + datetime fromDate, + double fromPrice, + datetime toDate = NULL, + double toPrice = 0 // + ) + { + // + if (toPrice <= 0) + { + toPrice = fromPrice; + } + + // + if (toDate == 0 || toDate == NULL) + { + toDate = TimeCurrent(); + } + + // + DrawTrendLine( + chartID, + tag, + subWindow, + fromDate, + fromPrice, + toDate, + toPrice, + specs.clr, + specs.style, + specs.width, + specs.back, + specs.selection, + specs.rayRight, + specs.hidden, + specs.zOrder // + ); + } +}; + +// +// Tools ... + +// +struct X121MarketCycleDescriptor +{ + // + string symbol; // Trading Symbol + ENUM_TIMEFRAMES hostPeriod; // Host Period + ENUM_X_MARKET_CYCLES cycle; // Init Cycle + ENUM_TIMEFRAMES period; // Cycle Period + ENUM_X_PERIOD_METHOD periodMethod; // Cycle Period Method + string prefix; // Prefix + bool useDefaults; // Use Inputs Default Settings ... + + // + X121MCycleInputs inputs; // Inputs + + // + XSCX121Market *market; // Market + + // + X121MCycleConditions conditions; // Market Conditions + + // + // Tools ... + + // + bool Init() + { + // + bool result = false; + + // + result = inputs.Init( + symbol, + hostPeriod, + cycle, + period, + periodMethod, + prefix, + useDefaults // + ); + if (!result) + { + return result; + } + + // + + // + // Instantiate Market ... + market = new XSCX121Market(); + + // + // Initialize Market ... + result = market.Init(inputs); + + // + return result; + } + + // + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mHostPeriod, // Host Period + ENUM_X_MARKET_CYCLES mCycle, // Init Cycle + ENUM_TIMEFRAMES mPeriod, // Cycle Period + ENUM_X_PERIOD_METHOD mPeriodMethod, // Cycle Period Method + string mPrefix = "", // Prefix + bool mUseDefaults = true // Use Inputs Default Settings ... + ) + { + // + bool result = false; + + // + result = + // + IsValid(mSymbol) && + IsValid(mHostPeriod) && + IsValid(mPeriodMethod, mPeriod) + // + ; + if (!result) + { + return result; + } + + // + this.cycle = mCycle; + this.symbol = mSymbol; + this.period = mPeriod; + this.prefix = mPrefix; + this.hostPeriod = mHostPeriod; + this.useDefaults = mUseDefaults; + this.periodMethod = mPeriodMethod; + + // + result = this.Init(); + + // + return result; + } +}; + +// +// Custom Draws ... + +// +// Custom Struct Draws ... +bool DrawSupRes( + XOHCLSupRes &item, // Struct item to Draw ... + XDrawSpecifications &supSpecs, // Supports specs ... + XDrawSpecifications &resSpecs, // Resistances specs ... + long chartID = 0, + int subWindow = 0, + string prefix = "SupRes" // +) +{ + // + bool result = false; + + // + result = item.IsValid(); + if (!result) + { + return result; + } + + // + datetime cTime = TimeCurrent(); + datetime pTime = TimeCurrent() - PeriodSeconds(PERIOD_M10); + + // + // Support ... + int supCount = item.CountSupports(); + bool canDrawSups = IsValidSize(supCount) && supSpecs.draw; + if (canDrawSups) + { + // + for (int i = 0; i < supCount; i++) + { + // + double iSup = item.sup[i]; + + // + string supName = prefix + "_" + "Sup_" + ToString(iSup); + + // + DrawTrendLine( + chartID, + supName, + subWindow, + pTime, + iSup, + cTime, + iSup, + supSpecs.clr, + supSpecs.style, + supSpecs.width, + supSpecs.back, + supSpecs.selection, + supSpecs.rayRight, + supSpecs.hidden, + supSpecs.zOrder // + ); + + // + if (IsValid(supSpecs.label)) + { + // + DrawText( + chartID, + supName + "_lbl", + subWindow, + cTime, + iSup, + supSpecs.label, + supSpecs.labelFont, + supSpecs.labelFontSize, + supSpecs.labelColor, + supSpecs.labelAngel, + supSpecs.labelAnchor, + supSpecs.back, + supSpecs.selection, + supSpecs.hidden, + supSpecs.zOrder // + ); + } + } + } + + // + // Resistance ... + int resCount = item.CountResistances(); + bool canDrawRess = IsValidSize(supCount) && supSpecs.draw; + if (canDrawRess) + { + // + for (int i = 0; i < resCount; i++) + { + // + double iRes = item.res[i]; + + // + string resName = prefix + "_" + "Res_" + ToString(iRes); + + // + DrawTrendLine( + chartID, + resName, + subWindow, + pTime, + iRes, + cTime, + iRes, + resSpecs.clr, + resSpecs.style, + resSpecs.width, + resSpecs.back, + resSpecs.selection, + resSpecs.rayRight, + resSpecs.hidden, + resSpecs.zOrder // + ); + + // + if (IsValid(resSpecs.label)) + { + // + DrawText( + chartID, + resName + "_lbl", + subWindow, + cTime, + iRes, + resSpecs.label, + resSpecs.labelFont, + resSpecs.labelFontSize, + resSpecs.labelColor, + resSpecs.labelAngel, + resSpecs.labelAnchor, + resSpecs.back, + resSpecs.selection, + resSpecs.hidden, + resSpecs.zOrder // + ); + } + } + } + + // + result = canDrawSups || canDrawRess; + + // + return result; +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.provider.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.provider.class.mq5 new file mode 100644 index 0000000..a23bcc2 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.provider.class.mq5 @@ -0,0 +1,95417 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCX5Provider +// Description: provides all Base Provider +// requirements For X5 ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... + +// +#include "../Helpers/x-saherelm.xct.helper.mq5" +#include "../Helpers/x-saherelm.xcc.helper.mq5" +#include "../Helpers/x-saherelm.xtm.helper.mq5" +#include "../Helpers/x-saherelm.xama.helper.mq5" +#include "../Helpers/x-saherelm.xlh.helper.mq5" +#include "../Helpers/x-saherelm.xtd.helper.mq5" +#include "../Helpers/x-saherelm.xfi.helper.mq5" +#include "../Helpers/x-saherelm.xts.helper.mq5" +#include "../Helpers/x-saherelm.xrsi.helper.mq5" +#include "../Helpers/x-saherelm.xobd.helper.mq5" +#include "../Helpers/x-saherelm.xchlh.helper.mq5" +#include "../Helpers/x-saherelm.xchma.helper.mq5" + +// +#include "../Classes/x-saherelm.xprovider.class.mq5" + +// +// Definitions ... + +// +// Signallers ... +enum ENUM_X5_SIGNAL_PROVIDERS +{ + // + X5NONE, + // + // X5XSP Expert Support Mechanism ... + X5XSP, + // + // XTD ... + XTD, + // + // XTAM ... + XTAM, + // + // XSI ... + XSI, + // + // XTSFI ... + XTSFI, + // + // XOBDLH ... + XOBDLH, + // + // XCHMACC ... + XCHMACC, + // + // XCHMACMN ... + XCHMAMN, + // + // XCHMACMX ... + XCHMAMX, +}; + +// +// X5 Provider Inputs ... +class X5ProviderInputs : public XSCBaseProviderInpts +{ + // + // Public ... +public: + // + // Props ... + XTSInputs tsInputs; + XTMInputs tmInputs; + XLHInputs lhInputs; + XTDInputs tdInputs; + XFIInputs fiInputs; + XCTInputs ctInputs; + XCCInputs ccInputs; + XOBDInputs obdInputs; + XAMAInputs amaInputs; + XRSIInputs rsiInputs; + XCHLHInputs chlhInputs; + XCHMAInputs chmaInputs; + + // + // Tools ... + + // + // Validate ... + virtual bool IsValid() + { + // + bool result = false; + + // + result = tsInputs.IsValid(); + if (!result) + { + return result; + } + + result = ctInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = ccInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = tmInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = lhInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = tdInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = fiInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = obdInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = amaInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = rsiInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = chlhInputs.IsValid(); + if (!result) + { + return result; + } + + // + result = chmaInputs.IsValid(); + + // + return result; + } + + // + // Cleanup ... + virtual void Clean() + { + // + tsInputs.Clean(); + ctInputs.Clean(); + ccInputs.Clean(); + tmInputs.Clean(); + lhInputs.Clean(); + tdInputs.Clean(); + fiInputs.Clean(); + obdInputs.Clean(); + amaInputs.Clean(); + rsiInputs.Clean(); + chlhInputs.Clean(); + chmaInputs.Clean(); + } + + // + // Default ... + virtual void Default() + { + // + tsInputs.Default(); + ctInputs.Default(); + ccInputs.Default(); + tmInputs.Default(); + lhInputs.Default(); + tdInputs.Default(); + fiInputs.Default(); + obdInputs.Default(); + amaInputs.Default(); + rsiInputs.Default(); + chlhInputs.Default(); + chmaInputs.Default(); + } + + // + // Max ... + virtual int Max() + { + // + int result = 0; + + // + result = MathMax(lhInputs.Max(), tmInputs.Max()); + + // + result = MathMax(result, tsInputs.Max()); + result = MathMax(result, ctInputs.Max()); + result = MathMax(result, ccInputs.Max()); + result = MathMax(result, tdInputs.Max()); + result = MathMax(result, fiInputs.Max()); + result = MathMax(result, obdInputs.Max()); + result = MathMax(result, amaInputs.Max()); + result = MathMax(result, rsiInputs.Max()); + result = MathMax(result, chlhInputs.Max()); + result = MathMax(result, chmaInputs.Max()); + + // + return result; + } +}; + +// +// XSC5MarketConditionDataCollector ... +class XSC5MarketConditionDataCollector +{ + // + // Public ... +public: + // + // Constructor ... + void XSC5MarketConditionDataCollector() + { + // + XSCDataCollector mBase; + mBase.Clear(); + } + + // + // Cleaning Store ... + void Clear() + { + // + XSCDataCollector mBase; + + // + mBase.Clear(); + } + + // + // Add String Content ... + bool Add(string content) + { + // + bool result = false; + + // + XSCDataCollector mBase; + + // + result = mBase.Add(content); + + // + return result; + } + + // + // Protected ... +protected: + // + // Private ... +private: +}; + +// +// X5 Provider Market Conditions ... +class X5MarketConditions : public XSCBaseProviderMarketConditions +{ + // + // Public ... +public: + // + // Buffers ... + + // + // XTS ... + double tsCurrents[]; + double tsNearests[]; + double tsMediests[]; + double tsFarests[]; + + // + // XFI ... + double fis[]; + + // + // XTD ... + double tdBullishs[]; + double tdBearishs[]; + double tdSignals[]; + + // + // XLH ... + double lhHhs[]; + double lhLls[]; + double lhSignals[]; + + // + // XTM ... + double tms[]; + + // + // XAMA ... + double amas[]; + + // + // XOBD ... + double obds[]; + + // + // XRSI ... + double rsis[]; + + // + // XCHMA ... + double chmaScFasts[]; + double chmaScSlows[]; + double chmaMcFasts[]; + double chmaMcSlows[]; + double chmaLcFasts[]; + double chmaLcSlows[]; + double chmaHotStates[]; + + // + // XCHLH ... + double chlhScHHs[]; + double chlhScLLs[]; + double chlhMcHHs[]; + double chlhMcLLs[]; + double chlhLcHHs[]; + double chlhLcLLs[]; + double chlhHotStates[]; + + // + // Conditional Variables ... + + // + // XTM ... + bool isXTMPeak; + bool isXTMVale; + bool isXTMBullish; + bool isXTMBearish; + bool isXTMNeutural; + bool isXTMEndBullish; + bool isXTMEndBearish; + bool isXTMStartBullish; + bool isXTMStartBearish; + bool isXTMEndBullishByNeutural; + bool isXTMEndBearishByNeutural; + bool isXTMStartBullishAfterNeutural; + bool isXTMStartBearishAfterNeutural; + + // + // XAMA ... + bool isXAMAPeak; + bool isXAMAVale; + bool isXAMABullish; + bool isXAMABearish; + bool isXAMANeutural; + bool isXAMAEndBullish; + bool isXAMAEndBearish; + bool isXAMAStartBullish; + bool isXAMAStartBearish; + bool isXAMAEndBullishByNeutural; + bool isXAMAEndBearishByNeutural; + bool isXAMAStartBullishAfterNeutural; + bool isXAMAStartBearishAfterNeutural; + + // + // XLH ... + bool isXLHHHIncreased; + bool isXLHHHDecreased; + bool isXLHLLIncreased; + bool isXLHLLDecreased; + bool isXLHLowAttachedLL; + bool isXLHHighAttachedHH; + bool isXLHHHSameInLength; + bool isXLHLLSameInLength; + bool isXLHPriceOverSignal; + bool isXLHPriceUnderSignal; + bool isXLHPriceInSignalRange; + bool isXLHPriceCrossedOverSignal; + bool isXLHPriceCrossedUnderSignal; + + // + // XTD ... + bool isXTDSignalPeak; + bool isXTDSignalVale; + bool isXTDBullishPeak; + bool isXTDBullishVale; + bool isXTDBearishPeak; + bool isXTDBearishVale; + bool isXTDBullOverBear; + bool isXTDBullUnderBear; + bool isXTDSignalOverBear; + bool isXTDSignalUnderBear; + bool isXTDBullCrossedOverBear; + bool isXTDBullCrossedUnderBear; + bool isXTDSignalCrossedOverBear; + bool isXTDSignalCrossedUnderBear; + + // + // XFI ... + bool isXFIPeak; + bool isXFIVale; + bool isXFICrossedOverZero; + bool isXFIOverZero; + bool isXFICrossedUnderZero; + bool isXFIUnderZero; + + // + // XTS ... + bool isXTSAllSame; + bool isXTSCurrentMin; + bool isXTSCurrentMax; + bool isXTSCurrentOverFarest; + bool isXTSCurrentOverNearest; + bool isXTSCurrentOverMediest; + bool isXTSCurrentUnderFarest; + bool isXTSCurrentUnderNearest; + bool isXTSCurrentUnderMediest; + bool isXTSCurrentCrossedOverFarest; + bool isXTSCurrentCrossedOverNearest; + bool isXTSCurrentCrossedOverMediest; + bool isXTSCurrentCrossedUnderFarest; + bool isXTSCurrentCrossedUnderNearest; + bool isXTSCurrentCrossedUnderMediest; + + // + // XRSI ... + bool isXRSIPeak; + bool isXRSIVale; + bool isXRSICrossedOverLongExit; + bool isXRSICrossedOverLongEntry; + bool isXRSICrossedUnderShortExit; + bool isXRSICrossedUnderShortEntry; + + // + // XOBD ... + bool isXOBDSwingLow; + bool isXOBDSwingHigh; + + // + // XCHLH ... + // + bool isXCHLHSameHHs; + bool isXCHLHSameLLs; + // + bool isXCHLHSCMCHHSame; + bool isXCHLHSCMCLLSame; + // + bool isXCHLHSCLCHHSame; + bool isXCHLHSCLCLLSame; + // + bool isXCHLHMCLCHHSame; + bool isXCHLHMCLCLLSame; + // + bool isXCHLHMCOnTopOfLC; + bool isXCHLHMCInBottomOfLC; + + // + // XCHMA ... + // + bool isXCHMASCOverMax; + bool isXCHMASCOverMin; + bool isXCHMASCUnderMax; + bool isXCHMASCUnderMin; + // + bool isXCHMASCCrossedOverMax; + bool isXCHMASCCrossedUnderMax; + bool isXCHMASCCrossedOverMin; + bool isXCHMASCCrossedUnderMin; + // + bool isXCHMASCPeak; + bool isXCHMASCVale; + bool isXCHMASCTrendsUp; + bool isXCHMASCTrendsDown; + bool isXCHMASCFastOverSlow; + bool isXCHMASCFastUnderSlow; + bool isXCHMASCFastCrossedOverSlow; + bool isXCHMASCFastCrossedUnderSlow; + // + bool isXCHMAMCPeak; + bool isXCHMAMCVale; + bool isXCHMAMCTrendsUp; + bool isXCHMAMCTrendsDown; + bool isXCHMAMCFastOverSlow; + bool isXCHMAMCFastUnderSlow; + bool isXCHMAMCFastCrossedOverSlow; + bool isXCHMAMCFastCrossedUnderSlow; + // + bool isXCHMALCPeak; + bool isXCHMALCVale; + bool isXCHMALCTrendsUp; + bool isXCHMALCTrendsDown; + bool isXCHMALCFastOverSlow; + bool isXCHMALCFastUnderSlow; + bool isXCHMALCFastCrossedOverSlow; + bool isXCHMALCFastCrossedUnderSlow; + + // + // Tools ... + + // + // Conditions ... + void Clear() + { + // + Clean(bars); + Clean(tsCurrents); + Clean(tsNearests); + Clean(tsMediests); + Clean(tsFarests); + Clean(fis); + Clean(tdBullishs); + Clean(tdBearishs); + Clean(tdSignals); + Clean(lhHhs); + Clean(lhLls); + Clean(lhSignals); + Clean(tms); + Clean(amas); + Clean(obds); + Clean(rsis); + Clean(chmaScFasts); + Clean(chmaScSlows); + Clean(chmaMcFasts); + Clean(chmaMcSlows); + Clean(chmaLcFasts); + Clean(chmaLcSlows); + Clean(chmaHotStates); + Clean(chlhScHHs); + Clean(chlhScLLs); + Clean(chlhMcHHs); + Clean(chlhMcLLs); + Clean(chlhLcHHs); + Clean(chlhLcLLs); + Clean(chlhHotStates); + + // + ArraySetAsSeries(bars, true); + ArraySetAsSeries(tsCurrents, true); + ArraySetAsSeries(tsNearests, true); + ArraySetAsSeries(tsMediests, true); + ArraySetAsSeries(tsFarests, true); + ArraySetAsSeries(fis, true); + ArraySetAsSeries(tdBullishs, true); + ArraySetAsSeries(tdBearishs, true); + ArraySetAsSeries(tdSignals, true); + ArraySetAsSeries(lhHhs, true); + ArraySetAsSeries(lhLls, true); + ArraySetAsSeries(lhSignals, true); + ArraySetAsSeries(tms, true); + ArraySetAsSeries(amas, true); + ArraySetAsSeries(obds, true); + ArraySetAsSeries(rsis, true); + ArraySetAsSeries(chmaScFasts, true); + ArraySetAsSeries(chmaScSlows, true); + ArraySetAsSeries(chmaMcFasts, true); + ArraySetAsSeries(chmaMcSlows, true); + ArraySetAsSeries(chmaLcFasts, true); + ArraySetAsSeries(chmaLcSlows, true); + ArraySetAsSeries(chmaHotStates, true); + ArraySetAsSeries(chlhScHHs, true); + ArraySetAsSeries(chlhScLLs, true); + ArraySetAsSeries(chlhMcHHs, true); + ArraySetAsSeries(chlhMcLLs, true); + ArraySetAsSeries(chlhLcHHs, true); + ArraySetAsSeries(chlhLcLLs, true); + ArraySetAsSeries(chlhHotStates, true); + + // + isXTMPeak = false; + isXTMVale = false; + isXTMBullish = false; + isXTMBearish = false; + isXTMNeutural = false; + isXTMEndBullish = false; + isXTMEndBearish = false; + isXTMStartBullish = false; + isXTMStartBearish = false; + isXTMEndBullishByNeutural = false; + isXTMEndBearishByNeutural = false; + isXTMStartBullishAfterNeutural = false; + isXTMStartBearishAfterNeutural = false; + isXAMAPeak = false; + isXAMAVale = false; + isXAMABullish = false; + isXAMABearish = false; + isXAMANeutural = false; + isXAMAEndBullish = false; + isXAMAEndBearish = false; + isXAMAStartBullish = false; + isXAMAStartBearish = false; + isXAMAEndBullishByNeutural = false; + isXAMAEndBearishByNeutural = false; + isXAMAStartBullishAfterNeutural = false; + isXAMAStartBearishAfterNeutural = false; + isXLHHHIncreased = false; + isXLHHHDecreased = false; + isXLHLLIncreased = false; + isXLHLLDecreased = false; + isXLHLowAttachedLL = false; + isXLHHighAttachedHH = false; + isXLHHHSameInLength = false; + isXLHLLSameInLength = false; + isXLHPriceOverSignal = false; + isXLHPriceUnderSignal = false; + isXLHPriceInSignalRange = false; + isXLHPriceCrossedOverSignal = false; + isXLHPriceCrossedUnderSignal = false; + isXTDSignalPeak = false; + isXTDSignalVale = false; + isXTDBullishPeak = false; + isXTDBullishVale = false; + isXTDBearishPeak = false; + isXTDBearishVale = false; + isXTDBullOverBear = false; + isXTDBullUnderBear = false; + isXTDSignalOverBear = false; + isXTDSignalUnderBear = false; + isXTDBullCrossedOverBear = false; + isXTDBullCrossedUnderBear = false; + isXTDSignalCrossedOverBear = false; + isXTDSignalCrossedUnderBear = false; + isXFIPeak = false; + isXFIVale = false; + isXFICrossedOverZero = false; + isXFIOverZero = false; + isXFICrossedUnderZero = false; + isXFIUnderZero = false; + isXTSAllSame = false; + isXTSCurrentMin = false; + isXTSCurrentMax = false; + isXTSCurrentOverFarest = false; + isXTSCurrentOverNearest = false; + isXTSCurrentOverMediest = false; + isXTSCurrentUnderFarest = false; + isXTSCurrentUnderNearest = false; + isXTSCurrentUnderMediest = false; + isXTSCurrentCrossedOverFarest = false; + isXTSCurrentCrossedOverNearest = false; + isXTSCurrentCrossedOverMediest = false; + isXTSCurrentCrossedUnderFarest = false; + isXTSCurrentCrossedUnderNearest = false; + isXTSCurrentCrossedUnderMediest = false; + isXRSIPeak = false; + isXRSIVale = false; + isXRSICrossedOverLongExit = false; + isXRSICrossedOverLongEntry = false; + isXRSICrossedUnderShortExit = false; + isXRSICrossedUnderShortEntry = false; + isXOBDSwingLow = false; + isXOBDSwingHigh = false; + isXCHLHSameHHs = false; + isXCHLHSameLLs = false; + isXCHLHSCMCHHSame = false; + isXCHLHSCMCLLSame = false; + isXCHLHSCLCHHSame = false; + isXCHLHSCLCLLSame = false; + isXCHLHMCLCHHSame = false; + isXCHLHMCLCLLSame = false; + isXCHLHMCOnTopOfLC = false; + isXCHLHMCInBottomOfLC = false; + isXCHMASCOverMax = false; + isXCHMASCOverMin = false; + isXCHMASCUnderMax = false; + isXCHMASCUnderMin = false; + isXCHMASCCrossedOverMax = false; + isXCHMASCCrossedUnderMax = false; + isXCHMASCCrossedOverMin = false; + isXCHMASCCrossedUnderMin = false; + isXCHMASCPeak = false; + isXCHMASCVale = false; + isXCHMASCTrendsUp = false; + isXCHMASCTrendsDown = false; + isXCHMASCFastOverSlow = false; + isXCHMASCFastUnderSlow = false; + isXCHMASCFastCrossedOverSlow = false; + isXCHMASCFastCrossedUnderSlow = false; + isXCHMAMCPeak = false; + isXCHMAMCVale = false; + isXCHMAMCTrendsUp = false; + isXCHMAMCTrendsDown = false; + isXCHMAMCFastOverSlow = false; + isXCHMAMCFastUnderSlow = false; + isXCHMAMCFastCrossedOverSlow = false; + isXCHMAMCFastCrossedUnderSlow = false; + isXCHMALCPeak = false; + isXCHMALCVale = false; + isXCHMALCTrendsUp = false; + isXCHMALCTrendsDown = false; + isXCHMALCFastOverSlow = false; + isXCHMALCFastUnderSlow = false; + isXCHMALCFastCrossedOverSlow = false; + isXCHMALCFastCrossedUnderSlow = false; + } + + // + // Generate Score ... + virtual void GenerateScore( + double &bullishScore, // Bullish Score + double &bearishScore, // Bearish Score + double multiplier = 1 // Score Multiplier + ) + { + // + bullishScore = 0; + bearishScore = 0; + + // + // Normalize Multiplier ... + if (multiplier <= 0) + { + multiplier = 1; + } + + // + double bullScore = 0; + double bearScore = 0; + + // + // Calculate Scores ... + + // + // XTM ... + + // + if (isXTMPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTMVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTMBullish) + { + bullScore++; + } + + // + if (isXTMBearish) + { + bearScore++; + } + + // + if (isXTMNeutural) + { + } + + // + if (isXTMEndBullish) + { + bearScore++; + } + + // + if (isXTMEndBearish) + { + bullScore++; + } + + // + if (isXTMStartBullish) + { + bullScore++; + } + + // + if (isXTMStartBearish) + { + bearScore++; + } + + // + if (isXTMEndBullishByNeutural) + { + bearScore++; + } + + // + if (isXTMEndBearishByNeutural) + { + bullScore++; + } + + // + if (isXTMStartBullishAfterNeutural) + { + bullScore++; + } + + // + if (isXTMStartBearishAfterNeutural) + { + bearScore++; + } + + // + // XAMA ... + + // + if (isXAMAPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXAMAVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXAMABullish) + { + bullScore++; + } + + // + if (isXAMABearish) + { + bearScore++; + } + + // + if (isXAMANeutural) + { + } + + // + if (isXAMAEndBullish) + { + bearScore++; + } + + // + if (isXAMAEndBearish) + { + bullScore++; + } + + // + if (isXAMAStartBullish) + { + bullScore++; + } + + // + if (isXAMAStartBearish) + { + bearScore++; + } + + // + if (isXAMAEndBullishByNeutural) + { + bearScore++; + } + + // + if (isXAMAEndBearishByNeutural) + { + bullScore++; + } + + // + if (isXAMAStartBullishAfterNeutural) + { + bullScore++; + } + + // + if (isXAMAStartBearishAfterNeutural) + { + bearScore++; + } + + // + // XLH ... + + // + if (isXLHHHIncreased) + { + // + bullScore--; + bearScore++; + } + + // + if (isXLHHHDecreased) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHLLIncreased) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHLLDecreased) + { + // + bullScore--; + bearScore++; + } + + // + if (isXLHLowAttachedLL) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHHighAttachedHH) + { + // + bullScore--; + bearScore++; + } + + // + if (isXLHHHSameInLength) + { + } + + // + if (isXLHLLSameInLength) + { + } + + // + if (isXLHPriceOverSignal) + { + bullScore++; + } + + // + if (isXLHPriceUnderSignal) + { + bearScore++; + } + + // + if (isXLHPriceInSignalRange) + { + } + + // + if (isXLHPriceCrossedOverSignal) + { + // + bullScore++; + bearScore--; + } + + // + if (isXLHPriceCrossedUnderSignal) + { + // + bullScore--; + bearScore++; + } + + // + // XTD ... + + // + if (isXTDSignalPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDSignalVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBullishPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDBullishVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBearishPeak) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBearishVale) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDBullOverBear) + { + bullScore++; + } + + // + if (isXTDBullUnderBear) + { + bearScore++; + } + + // + if (isXTDSignalOverBear) + { + bullScore++; + } + + // + if (isXTDSignalUnderBear) + { + bearScore++; + } + + // + if (isXTDBullCrossedOverBear) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBullCrossedUnderBear) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDSignalCrossedOverBear) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDSignalCrossedUnderBear) + { + // + bullScore--; + bearScore++; + } + + // + // XFI ... + + // + if (isXFIPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXFIVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXFICrossedOverZero) + { + // + bullScore++; + bearScore--; + } + + // + if (isXFIOverZero) + { + bullScore++; + } + + // + if (isXFICrossedUnderZero) + { + // + bullScore--; + bearScore++; + } + + // + if (isXFIUnderZero) + { + bearScore++; + } + + // + // XTS ... + + // + if (isXTSAllSame) + { + } + + // + if (isXTSCurrentMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTSCurrentOverFarest) + { + bullScore--; + } + + // + if (isXTSCurrentOverNearest) + { + bullScore--; + } + + // + if (isXTSCurrentOverMediest) + { + bullScore--; + } + + // + if (isXTSCurrentUnderFarest) + { + bearScore--; + } + + // + if (isXTSCurrentUnderNearest) + { + bearScore--; + } + + // + if (isXTSCurrentUnderMediest) + { + bearScore--; + } + + // + if (isXTSCurrentCrossedOverFarest) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentCrossedOverNearest) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentCrossedOverMediest) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTSCurrentCrossedUnderFarest) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTSCurrentCrossedUnderNearest) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTSCurrentCrossedUnderMediest) + { + // + bullScore--; + bearScore++; + } + + // + // XSI ... + + // + if (isXRSIPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXRSIVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXRSICrossedOverLongExit) + { + // + bullScore--; + bearScore++; + } + + // + if (isXRSICrossedOverLongEntry) + { + // + bullScore++; + bearScore--; + } + + // + if (isXRSICrossedUnderShortExit) + { + // + bullScore++; + bearScore--; + } + + // + if (isXRSICrossedUnderShortEntry) + { + // + bullScore--; + bearScore++; + } + + // + // XOBD ... + + // + if (isXOBDSwingLow) + { + bullScore++; + } + + // + if (isXOBDSwingHigh) + { + bearScore++; + } + + // + // XCHLH ... + + // + if (isXCHLHSameHHs) + { + bearScore++; + } + + // + if (isXCHLHSameLLs) + { + bullScore++; + } + + // + if (isXCHLHSCMCHHSame) + { + bearScore++; + } + + // + if (isXCHLHSCMCLLSame) + { + bullScore++; + } + + // + if (isXCHLHSCLCHHSame) + { + bearScore++; + } + + // + if (isXCHLHSCLCLLSame) + { + bullScore++; + } + + // + if (isXCHLHMCLCHHSame) + { + bearScore++; + } + + // + if (isXCHLHMCLCLLSame) + { + bullScore++; + } + + // + if (isXCHLHMCOnTopOfLC) + { + } + + // + if (isXCHLHMCInBottomOfLC) + { + } + + // + // XCHMA ... + + // + if (isXCHMASCOverMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCOverMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCUnderMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCUnderMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCCrossedOverMax) + { + // + bearScore--; + bearScore++; + } + + // + if (isXCHMASCCrossedUnderMax) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCCrossedOverMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCCrossedUnderMin) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCTrendsUp) + { + // + if (isXCHMASCFastOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCFastUnderSlow) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isXCHMASCTrendsDown) + { + // + if (isXCHMASCFastOverSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMASCFastUnderSlow) + { + // + bullScore++; + bearScore--; + } + } + + // + if (isXCHMASCFastOverSlow) + { + bearScore++; + } + + // + if (isXCHMASCFastUnderSlow) + { + bearScore++; + } + + // + if (isXCHMASCFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMASCFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMAMCPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMAMCVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMAMCTrendsUp) + { + // + if (isXCHMAMCFastOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMAMCFastUnderSlow) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isXCHMAMCTrendsDown) + { + // + if (isXCHMAMCFastOverSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMAMCFastUnderSlow) + { + // + bullScore++; + bearScore--; + } + } + + // + if (isXCHMAMCFastOverSlow) + { + bullScore++; + } + + // + if (isXCHMAMCFastUnderSlow) + { + bearScore++; + } + + // + if (isXCHMAMCFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMAMCFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMALCPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMALCVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMALCTrendsUp) + { + // + if (isXCHMALCFastOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMALCFastUnderSlow) + { + // + bullScore--; + bearScore++; + } + } + + // + if (isXCHMALCTrendsDown) + { + // + if (isXCHMALCFastOverSlow) + { + // + bullScore--; + bearScore++; + } + + // + if (isXCHMALCFastUnderSlow) + { + // + bullScore++; + bearScore--; + } + } + + // + if (isXCHMALCFastOverSlow) + { + bullScore++; + } + + // + if (isXCHMALCFastUnderSlow) + { + bearScore++; + } + + // + if (isXCHMALCFastCrossedOverSlow) + { + // + bullScore++; + bearScore--; + } + + // + if (isXCHMALCFastCrossedUnderSlow) + { + // + bullScore--; + bearScore++; + } + + // + // Prepare Final Result ... + + // + bullishScore = bullScore * multiplier; + bearishScore = bearScore * multiplier; + } + + // + // Generate Summary ... + virtual string GenerateSummary( + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + result = GenerateSummaryBody( + onlySummary, + multiplier, + separator, + ignoreFalseConditions + // + ); + + // + // Generating Full Result by Combining parts ... + result = + // + "[" + GetToken() + "]" + separator + + "-----------------------------" + separator + + result + + "" + // + ; + + // + return result; + } + + // + string GenerateSummaryBody( + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + double bullScore = 0; + double bearScore = 0; + GenerateScore( + bullScore, + bearScore, + multiplier // + ); + + // + // Common ... + string commonStr = + // + "Commons: " + separator + + "-----------------------------" + separator + + "Time: " + ToString(TimeCurrent()) + separator + + "-----------" + separator + + "Scores: " + separator + + "-----------" + separator + + "Bullish: " + ToString(bullScore) + separator + + "Bearish: " + ToString(bearScore) + separator + + "-----------------------------" + separator + + // + // TODO: Add Scores Later ... + separator + + "" + // + ; + + // + // XOBD ... + string obdStr = + // + ToString("isXOBDSwingLow", isXOBDSwingLow, ignoreFalseConditions) + + ToString("isXOBDSwingHigh", isXOBDSwingHigh, ignoreFalseConditions) + + "" + // + ; + obdStr = SetLabel("XOBD: ", obdStr, separator); + + // + // ToString("", , ignoreFalseConditions) + + + // + // XFI ... + string fiStr = + // + ToString("isXFIPeak", isXFIPeak, ignoreFalseConditions) + + ToString("isXFIVale", isXFIVale, ignoreFalseConditions) + + ToString("isXFICrossedOverZero", isXFICrossedOverZero, ignoreFalseConditions) + + ToString("isXFIOverZero", isXFIOverZero, ignoreFalseConditions) + + ToString("isXFICrossedUnderZero", isXFICrossedUnderZero, ignoreFalseConditions) + + ToString("isXFIUnderZero", isXFIUnderZero, ignoreFalseConditions) + + "" + // + ; + fiStr = SetLabel("XFI: ", fiStr, separator); + + // + // XRSI ... + string rsiStr = + // + ToString("isXRSIPeak", isXRSIPeak, ignoreFalseConditions) + + ToString("isXRSIVale", isXRSIVale, ignoreFalseConditions) + + ToString("isXRSICrossedOverLongExit", isXRSICrossedOverLongExit, ignoreFalseConditions) + + ToString("isXRSICrossedOverLongEntry", isXRSICrossedOverLongEntry, ignoreFalseConditions) + + ToString("isXRSICrossedUnderShortExit", isXRSICrossedUnderShortExit, ignoreFalseConditions) + + ToString("isXRSICrossedUnderShortEntry", isXRSICrossedUnderShortEntry, ignoreFalseConditions) + + "" + // + ; + rsiStr = SetLabel("XRSI: ", rsiStr, separator); + + // + // XTM ... + string tmStr = + // + ToString("isXTMPeak", isXTMPeak, ignoreFalseConditions) + + ToString("isXTMVale", isXTMVale, ignoreFalseConditions) + + ToString("isXTMBullish", isXTMBullish, ignoreFalseConditions) + + ToString("isXTMBearish", isXTMBearish, ignoreFalseConditions) + + ToString("isXTMNeutural", isXTMNeutural, ignoreFalseConditions) + + ToString("isXTMEndBullish", isXTMEndBullish, ignoreFalseConditions) + + ToString("isXTMEndBearish", isXTMEndBearish, ignoreFalseConditions) + + ToString("isXTMStartBullish", isXTMStartBullish, ignoreFalseConditions) + + ToString("isXTMStartBearish", isXTMStartBearish, ignoreFalseConditions) + + ToString("isXTMEndBullishByNeutural", isXTMEndBullishByNeutural, ignoreFalseConditions) + + ToString("isXTMEndBearishByNeutural", isXTMEndBearishByNeutural, ignoreFalseConditions) + + ToString("isXTMStartBullishAfterNeutural", isXTMStartBullishAfterNeutural, ignoreFalseConditions) + + ToString("isXTMStartBearishAfterNeutural", isXTMStartBearishAfterNeutural, ignoreFalseConditions) + + "" + // + ; + tmStr = SetLabel("XTM: ", tmStr, separator); + + // + // XAMA ... + string amaStr = + // + ToString("isXAMAPeak", isXAMAPeak, ignoreFalseConditions) + + ToString("isXAMAVale", isXAMAVale, ignoreFalseConditions) + + ToString("isXAMABullish", isXAMABullish, ignoreFalseConditions) + + ToString("isXAMABearish", isXAMABearish, ignoreFalseConditions) + + ToString("isXAMANeutural", isXAMANeutural, ignoreFalseConditions) + + ToString("isXAMAEndBullish", isXAMAEndBullish, ignoreFalseConditions) + + ToString("isXAMAEndBearish", isXAMAEndBearish, ignoreFalseConditions) + + ToString("isXAMAStartBullish", isXAMAStartBullish, ignoreFalseConditions) + + ToString("isXAMAStartBearish", isXAMAStartBearish, ignoreFalseConditions) + + ToString("isXAMAEndBullishByNeutural", isXAMAEndBullishByNeutural, ignoreFalseConditions) + + ToString("isXAMAEndBearishByNeutural", isXAMAEndBearishByNeutural, ignoreFalseConditions) + + ToString("isXAMAStartBullishAfterNeutural", isXAMAStartBullishAfterNeutural, ignoreFalseConditions) + + ToString("isXAMAStartBearishAfterNeutural", isXAMAStartBearishAfterNeutural, ignoreFalseConditions) + + "" + // + ; + amaStr = SetLabel("XAMA: ", amaStr, separator); + + // + // XLH ... + string lhStr = + // + ToString("isXLHHHIncreased", isXLHHHIncreased, ignoreFalseConditions) + + ToString("isXLHHHDecreased", isXLHHHDecreased, ignoreFalseConditions) + + ToString("isXLHLLIncreased", isXLHLLIncreased, ignoreFalseConditions) + + ToString("isXLHLLDecreased", isXLHLLDecreased, ignoreFalseConditions) + + ToString("isXLHLowAttachedLL", isXLHLowAttachedLL, ignoreFalseConditions) + + ToString("isXLHHighAttachedHH", isXLHHighAttachedHH, ignoreFalseConditions) + + ToString("isXLHHHSameInLength", isXLHHHSameInLength, ignoreFalseConditions) + + ToString("isXLHLLSameInLength", isXLHLLSameInLength, ignoreFalseConditions) + + ToString("isXLHPriceOverSignal", isXLHPriceOverSignal, ignoreFalseConditions) + + ToString("isXLHPriceUnderSignal", isXLHPriceUnderSignal, ignoreFalseConditions) + + ToString("isXLHPriceInSignalRange", isXLHPriceInSignalRange, ignoreFalseConditions) + + ToString("isXLHPriceCrossedOverSignal", isXLHPriceCrossedOverSignal, ignoreFalseConditions) + + ToString("isXLHPriceCrossedUnderSignal", isXLHPriceCrossedUnderSignal, ignoreFalseConditions) + + "" + // + ; + lhStr = SetLabel("XLH: ", lhStr, separator); + + // + // XTD ... + string tdStr = + // + ToString("isXTDSignalPeak", isXTDSignalPeak, ignoreFalseConditions) + + ToString("isXTDSignalVale", isXTDSignalVale, ignoreFalseConditions) + + ToString("isXTDBullishPeak", isXTDBullishPeak, ignoreFalseConditions) + + ToString("isXTDBullishVale", isXTDBullishVale, ignoreFalseConditions) + + ToString("isXTDBearishPeak", isXTDBearishPeak, ignoreFalseConditions) + + ToString("isXTDBearishVale", isXTDBearishVale, ignoreFalseConditions) + + ToString("isXTDBullOverBear", isXTDBullOverBear, ignoreFalseConditions) + + ToString("isXTDBullUnderBear", isXTDBullUnderBear, ignoreFalseConditions) + + ToString("isXTDSignalOverBear", isXTDSignalOverBear, ignoreFalseConditions) + + ToString("isXTDSignalUnderBear", isXTDSignalUnderBear, ignoreFalseConditions) + + ToString("isXTDBullCrossedOverBear", isXTDBullCrossedOverBear, ignoreFalseConditions) + + ToString("isXTDBullCrossedUnderBear", isXTDBullCrossedUnderBear, ignoreFalseConditions) + + ToString("isXTDSignalCrossedOverBear", isXTDSignalCrossedOverBear, ignoreFalseConditions) + + ToString("isXTDSignalCrossedUnderBear", isXTDSignalCrossedUnderBear, ignoreFalseConditions) + + "" + // + ; + tdStr = SetLabel("XTD: ", tdStr, separator); + + // + // XTS ... + string tsStr = + // + ToString("isXTSAllSame", isXTSAllSame, ignoreFalseConditions) + + ToString("isXTSCurrentMin", isXTSCurrentMin, ignoreFalseConditions) + + ToString("isXTSCurrentMax", isXTSCurrentMax, ignoreFalseConditions) + + ToString("isXTSCurrentOverFarest", isXTSCurrentOverFarest, ignoreFalseConditions) + + ToString("isXTSCurrentOverNearest", isXTSCurrentOverNearest, ignoreFalseConditions) + + ToString("isXTSCurrentOverMediest", isXTSCurrentOverMediest, ignoreFalseConditions) + + ToString("isXTSCurrentUnderFarest", isXTSCurrentUnderFarest, ignoreFalseConditions) + + ToString("isXTSCurrentUnderNearest", isXTSCurrentUnderNearest, ignoreFalseConditions) + + ToString("isXTSCurrentUnderMediest", isXTSCurrentUnderMediest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedOverFarest", isXTSCurrentCrossedOverFarest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedOverNearest", isXTSCurrentCrossedOverNearest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedOverMediest", isXTSCurrentCrossedOverMediest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedUnderFarest", isXTSCurrentCrossedUnderFarest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedUnderNearest", isXTSCurrentCrossedUnderNearest, ignoreFalseConditions) + + ToString("isXTSCurrentCrossedUnderMediest", isXTSCurrentCrossedUnderMediest, ignoreFalseConditions) + + "" + // + ; + tsStr = SetLabel("XTS: ", tsStr, separator); + + // + // XCHLH ... + string chlhStr = + // + ToString("isXCHLHSameHHs", isXCHLHSameHHs, ignoreFalseConditions) + + ToString("isXCHLHSameLLs", isXCHLHSameLLs, ignoreFalseConditions) + + ToString("isXCHLHSCMCHHSame", isXCHLHSCMCHHSame, ignoreFalseConditions) + + ToString("isXCHLHSCMCLLSame", isXCHLHSCMCLLSame, ignoreFalseConditions) + + ToString("isXCHLHSCLCHHSame", isXCHLHSCLCHHSame, ignoreFalseConditions) + + ToString("isXCHLHSCLCLLSame", isXCHLHSCLCLLSame, ignoreFalseConditions) + + ToString("isXCHLHMCLCHHSame", isXCHLHMCLCHHSame, ignoreFalseConditions) + + ToString("isXCHLHMCLCLLSame", isXCHLHMCLCLLSame, ignoreFalseConditions) + + ToString("isXCHLHMCOnTopOfLC", isXCHLHMCOnTopOfLC, ignoreFalseConditions) + + ToString("isXCHLHMCInBottomOfLC", isXCHLHMCInBottomOfLC, ignoreFalseConditions) + + "" + // + ; + chlhStr = SetLabel("XCHLH: ", chlhStr, separator); + + // + // XCHMA ... + string chmaStr = + // + ToString("isXCHMASCOverMax", isXCHMASCOverMax, ignoreFalseConditions) + + ToString("isXCHMASCOverMin", isXCHMASCOverMin, ignoreFalseConditions) + + ToString("isXCHMASCUnderMax", isXCHMASCUnderMax, ignoreFalseConditions) + + ToString("isXCHMASCUnderMin", isXCHMASCUnderMin, ignoreFalseConditions) + + ToString("isXCHMASCCrossedOverMax", isXCHMASCCrossedOverMax, ignoreFalseConditions) + + ToString("isXCHMASCCrossedUnderMax", isXCHMASCCrossedUnderMax, ignoreFalseConditions) + + ToString("isXCHMASCCrossedOverMin", isXCHMASCCrossedOverMin, ignoreFalseConditions) + + ToString("isXCHMASCCrossedUnderMin", isXCHMASCCrossedUnderMin, ignoreFalseConditions) + + ToString("isXCHMASCPeak", isXCHMASCPeak, ignoreFalseConditions) + + ToString("isXCHMASCVale", isXCHMASCVale, ignoreFalseConditions) + + ToString("isXCHMASCTrendsUp", isXCHMASCTrendsUp, ignoreFalseConditions) + + ToString("isXCHMASCTrendsDown", isXCHMASCTrendsDown, ignoreFalseConditions) + + ToString("isXCHMASCFastOverSlow", isXCHMASCFastOverSlow, ignoreFalseConditions) + + ToString("isXCHMASCFastUnderSlow", isXCHMASCFastUnderSlow, ignoreFalseConditions) + + ToString("isXCHMASCFastCrossedOverSlow", isXCHMASCFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isXCHMASCFastCrossedUnderSlow", isXCHMASCFastCrossedUnderSlow, ignoreFalseConditions) + + ToString("isXCHMAMCPeak", isXCHMAMCPeak, ignoreFalseConditions) + + ToString("isXCHMAMCVale", isXCHMAMCVale, ignoreFalseConditions) + + ToString("isXCHMAMCTrendsUp", isXCHMAMCTrendsUp, ignoreFalseConditions) + + ToString("isXCHMAMCTrendsDown", isXCHMAMCTrendsDown, ignoreFalseConditions) + + ToString("isXCHMAMCFastOverSlow", isXCHMAMCFastOverSlow, ignoreFalseConditions) + + ToString("isXCHMAMCFastUnderSlow", isXCHMAMCFastUnderSlow, ignoreFalseConditions) + + ToString("isXCHMAMCFastCrossedOverSlow", isXCHMAMCFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isXCHMAMCFastCrossedUnderSlow", isXCHMAMCFastCrossedUnderSlow, ignoreFalseConditions) + + ToString("isXCHMALCPeak", isXCHMALCPeak, ignoreFalseConditions) + + ToString("isXCHMALCVale", isXCHMALCVale, ignoreFalseConditions) + + ToString("isXCHMALCTrendsUp", isXCHMALCTrendsUp, ignoreFalseConditions) + + ToString("isXCHMALCTrendsDown", isXCHMALCTrendsDown, ignoreFalseConditions) + + ToString("isXCHMALCFastOverSlow", isXCHMALCFastOverSlow, ignoreFalseConditions) + + ToString("isXCHMALCFastUnderSlow", isXCHMALCFastUnderSlow, ignoreFalseConditions) + + ToString("isXCHMALCFastCrossedOverSlow", isXCHMALCFastCrossedOverSlow, ignoreFalseConditions) + + ToString("isXCHMALCFastCrossedUnderSlow", isXCHMALCFastCrossedUnderSlow, ignoreFalseConditions) + + "" + // + ; + chmaStr = SetLabel("XCHMA: ", chmaStr, separator); + + // + // Generating Full Result by Combining parts ... + result = + // + commonStr + + (onlySummary + ? "" + : obdStr + + fiStr + + rsiStr + + tmStr + + amaStr + + lhStr + + tdStr + + tsStr + + chlhStr + + chmaStr // + ) + + "" + // + ; + + // + return result; + } + + // + string GenerateSummary( + string provided, // Additional Info about Type, Provider and Symbol + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ) + { + // + string result = NULL; + + // + result = GenerateSummaryBody( + onlySummary, + multiplier, + separator, + ignoreFalseConditions + // + ); + + // + // Generating Full Result by Combining parts ... + result = + // + "[" + GetToken() + "]" + separator + + provided + separator + + "-----------------------------" + separator + + result + + "" + // + ; + + // + return result; + } + + // + // For Data Collector ... + string GetToken() + { + return GetSpecificToken(this); + } + bool IsModelValid() + { + return false; + } + string ToModelString() + { + return NULL; + } + bool ParseModel(string content) + { + return false; + } + int FindIndex(X5MarketConditions &items[]) + { + return -1; + } +}; + +// +// Class ... + +// +// X5 Provider Class ... +class XSCX5Provider : public XSCBaseProvider +{ + // + // Public ... +public: + // + // Props ... + XSCXTSHelper *tsHelper; + XSCXFIHelper *fiHelper; + XSCXTDHelper *tdHelper; + XSCXLHHelper *lhHelper; + XSCXTMHelper *tmHelper; + XSCXCCHelper *ccHelper; + XSCXCTHelper *ctHelper; + XSCXOBDHelper *obdHelper; + XSCXRSIHelper *rsiHelper; + XSCXAMAHelper *amaHelper; + XSCXCHMAHelper *chmaHelper; + XSCXCHLHHelper *chlhHelper; + + // + // Constructor ... + XSCX5Provider( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + double staticVolume // Static Volume for Positions + ) : XSCBaseProvider(symbol, period, staticVolume) + { + // + tsHelper = new XSCXTSHelper(); + fiHelper = new XSCXFIHelper(); + tdHelper = new XSCXTDHelper(); + lhHelper = new XSCXLHHelper(); + tmHelper = new XSCXTMHelper(); + ccHelper = new XSCXCCHelper(); + ctHelper = new XSCXCTHelper(); + obdHelper = new XSCXOBDHelper(); + rsiHelper = new XSCXRSIHelper(); + amaHelper = new XSCXAMAHelper(); + chmaHelper = new XSCXCHMAHelper(); + chlhHelper = new XSCXCHLHHelper(); + + // + mNumberOfItems = 15; + } + + // + // Properties Gettr(s) / Setter(s) ... + + // + // Overrides ... + + // + // DeInit all Requirements ... + void DeInit() override + { + // + delete tsHelper; + delete fiHelper; + delete tdHelper; + delete lhHelper; + delete tmHelper; + delete ccHelper; + delete ctHelper; + delete obdHelper; + delete rsiHelper; + delete amaHelper; + delete chmaHelper; + delete chlhHelper; + } + + // + // Functions ... + + // + // Init all Requirements ... + bool Init(X5ProviderInputs &inputs) + { + // + bool result = false; + + // + // Validate ... + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + string mSymbol = GetSymbol(); + ENUM_TIMEFRAMES mPeriod = GetPeriod(); + + // + result = tsHelper + .Init( + mSymbol, + mPeriod, + mInputs.tsInputs + // + ); + if (!result) + { + return result; + } + + // + result = fiHelper + .Init( + mSymbol, + mPeriod, + mInputs.fiInputs + // + ); + if (!result) + { + return result; + } + + // + result = tdHelper + .Init( + mSymbol, + mPeriod, + mInputs.tdInputs + // + ); + if (!result) + { + return result; + } + + // + result = lhHelper + .Init( + mSymbol, + mPeriod, + mInputs.lhInputs + // + ); + if (!result) + { + return result; + } + + // + result = tmHelper + .Init( + mSymbol, + mPeriod, + mInputs.tmInputs + // + ); + if (!result) + { + return result; + } + + // + result = ccHelper + .Init( + mSymbol, + mPeriod, + mInputs.ccInputs + // + ); + if (!result) + { + return result; + } + + // + result = ctHelper + .Init( + mSymbol, + mPeriod, + mInputs.ctInputs + // + ); + if (!result) + { + return result; + } + + // + result = obdHelper + .Init( + mSymbol, + mPeriod, + mInputs.obdInputs + // + ); + if (!result) + { + return result; + } + + // + result = rsiHelper + .Init( + mSymbol, + mPeriod, + mInputs.rsiInputs + // + ); + if (!result) + { + return result; + } + + // + result = amaHelper + .Init( + mSymbol, + mPeriod, + mInputs.amaInputs + // + ); + if (!result) + { + return result; + } + + // + result = chmaHelper + .Init( + mSymbol, + mPeriod, + mInputs.chmaInputs + // + ); + if (!result) + { + return result; + } + + // + result = chlhHelper + .Init( + mSymbol, + mPeriod, + mInputs.chlhInputs + // + ); + + // + return result; + } + + // + // Set Default Position's Type ... + // Enable / Disable Long (Buy), Short (Sell) ... + void SetSignalTypeState( + ENUM_POSITION_TYPE type, // Which types are Signals be Targetted + bool state // Which State is going to Set + ) + { + // + if (IsLong(type)) + { + mIsLongEnable = state; + } + else + { + mIsShortEnable = state; + } + } + + // + // Set Signal Providers ... + void SetSignalProviderState( + ENUM_X5_SIGNAL_PROVIDERS provider, // Provider State + bool state // Which state is going to set ... + ) + { + // + if (provider == X5NONE) + { + return; + } + + // + switch (provider) + { + // + case X5XSP: + mIsX5XSPSignalProviderEnable = state; + break; + + // + case XTD: + mIsXTDSignalProviderEnable = state; + break; + + // + case XTAM: + mIsXTAMSignalProviderEnable = state; + break; + + // + case XSI: + mIsXSISignalProviderEnable = state; + break; + + // + case XTSFI: + mIsXTSFISignalProviderEnable = state; + break; + + // + case XOBDLH: + mIsXOBDLHSignalProviderEnable = state; + break; + + // + case XCHMACC: + mIsXCHMACCSignalProviderEnable = state; + break; + + // + case XCHMAMN: + mIsXCHMAMNSignalProviderEnable = state; + break; + + // + case XCHMAMX: + mIsXCHMAMXSignalProviderEnable = state; + break; + } + } + + // + void SetSignalProviderStates( + ENUM_X5_SIGNAL_PROVIDERS &providers[], // Collection of Providers ... + bool state // Which state is going to set ... + ) + { + // + int providersCount = ArraySize(providers); + if (providersCount <= 0) + { + return; + } + + // + for (int i = 0; i < providersCount; i++) + { + SetSignalProviderState(providers[i], state); + } + } + + // + virtual string GetTag() + { + // + string result = NULL; + + // + result = + // + GetToken() + + "[" + + GetSymbol() + + "," + + ToString(GetPeriod()) + + "]" + // + ; + + // + return result; + } + + // + void GetMarketConditions( + X5MarketConditions &mConditions, // Market Conditions Result + int barIndex = 0 // Specified Bar Index + ) + { + // + mConditions.Clear(); + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex >= CountBars()) + { + barIndex = CountBars() + 2; + } + + // + int curr = barIndex + 1; + int prev = curr + 1; + + // + mConditions.symbol = GetSymbol(); + mConditions.period = GetPeriod(); + mConditions.time = iTime( + mConditions.symbol, + mConditions.period, + barIndex); + + // + GetBars( + mConditions.bars, + mConditions.symbol, + mConditions.period, + barIndex, + mNumberOfItems // + ); + + // + // XTM ... + tmHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.tms); + + // + // XAMA ... + amaHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.amas); + + // + // XFI ... + fiHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.fis); + + // + // XOBD ... + obdHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.obds); + + // + // XRSI ... + rsiHelper.CopyMain( + barIndex, + mNumberOfItems, + mConditions.rsis); + + // + // XLH ... + + // + // HH ... + lhHelper.CopyHH( + barIndex, + mNumberOfItems, + mConditions.lhHhs); + + // + // LL ... + lhHelper.CopyLL( + barIndex, + mNumberOfItems, + mConditions.lhLls); + + // + // Signal ... + lhHelper.CopySignal( + barIndex, + mNumberOfItems, + mConditions.lhSignals); + + // + // XTD ... + + // + // Bullish ... + tdHelper.CopyBullish( + barIndex, + mNumberOfItems, + mConditions.tdBullishs); + + // + // Bearish ... + tdHelper.CopyBearish( + barIndex, + mNumberOfItems, + mConditions.tdBearishs); + + // + // Signal ... + tdHelper.CopySignal( + barIndex, + mNumberOfItems, + mConditions.tdSignals); + + // + // XTS ... + + // + // Current ... + tsHelper.CopyCurrent( + barIndex, + mNumberOfItems, + mConditions.tsCurrents); + + // + // Nearest ... + tsHelper.CopyNearest( + barIndex, + mNumberOfItems, + mConditions.tsNearests); + + // + // Mediest ... + tsHelper.CopyMediest( + barIndex, + mNumberOfItems, + mConditions.tsMediests); + + // + // Farest ... + tsHelper.CopyFarest( + barIndex, + mNumberOfItems, + mConditions.tsFarests); + + // + // XCHMA ... + + // + // Short ... + + // + // Fast ... + chmaHelper.CopySCFast( + barIndex, + mNumberOfItems, + mConditions.chmaScFasts); + + // + // Slow ... + chmaHelper.CopySCSlow( + barIndex, + mNumberOfItems, + mConditions.chmaScSlows); + + // + // Medium ... + + // + // Fast ... + chmaHelper.CopyMCFast( + barIndex, + mNumberOfItems, + mConditions.chmaMcFasts); + + // + // Slow ... + chmaHelper.CopyMCSlow( + barIndex, + mNumberOfItems, + mConditions.chmaMcSlows); + + // + // Long ... + + // + // Fast ... + chmaHelper.CopyLCFast( + barIndex, + mNumberOfItems, + mConditions.chmaLcFasts); + + // + // Slow ... + chmaHelper.CopyLCSlow( + barIndex, + mNumberOfItems, + mConditions.chmaLcSlows); + + // + // Hot States ... + chmaHelper.CopyHotState( + barIndex, + mNumberOfItems, + mConditions.chmaHotStates); + + // + // XCHLH ... + + // + // Short ... + + // + // HH ... + chlhHelper.CopySCHH( + barIndex, + mNumberOfItems, + mConditions.chlhScHHs); + + // + // LL ... + chlhHelper.CopySCLL( + barIndex, + mNumberOfItems, + mConditions.chlhScLLs); + + // + // Medium ... + + // + // HH ... + chlhHelper.CopyMCHH( + barIndex, + mNumberOfItems, + mConditions.chlhMcHHs); + + // + // LL ... + chlhHelper.CopyMCLL( + barIndex, + mNumberOfItems, + mConditions.chlhMcLLs); + + // + // Long ... + + // + // HH ... + chlhHelper.CopyLCHH( + barIndex, + mNumberOfItems, + mConditions.chlhLcHHs); + + // + // LL ... + chlhHelper.CopyLCLL( + barIndex, + mNumberOfItems, + mConditions.chlhLcLLs); + + // + // Hot State ... + chlhHelper.CopyHotState( + barIndex, + mNumberOfItems, + mConditions.chlhHotStates); + + // + // Filling Bars ... + mCycle.GetBars( + mConditions.bars, + 0, + mNumberOfItems); + + // + CalculateConditions(mConditions); + } + + // + // Check Market For Signal ... + virtual bool HasSignal( + int barIndex, + XSignal &mSignal, // Hold's Signal if Exists ... + X5MarketConditions &mConditions // Hold's Market Conditions ... + ) + { + // + bool result = false; + + // + // Validate Enable Process ... + result = !CanIgnoreProcess(); + if (!result) + { + return result; + } + + // + mWaitsUntilNewBar = false; + + // + // Validate Enable Type of Signalling ... + result = mIsLongEnable || mIsShortEnable; + if (!result) + { + return result; + } + + // + // Now we Have to Pass the Conditions to Each Signal Provider + // for Retrieving Signals Based On them ... + + // + // Reading Market Conditions ... + GetMarketConditions(mConditions, barIndex); + + // + int signalPusher = 0; + bool hasLong = false; + bool hasShort = false; + string provider = ""; + + // + // Long ... + if (mIsLongEnable) + { + // + signalPusher = 0; + + // + hasLong = HasSpecificSignal( + barIndex, + POSITION_TYPE_BUY, + provider, + signalPusher, + mConditions // + ); + } + + // + // Short ... + if (mIsShortEnable) + { + // + signalPusher = 0; + + // + hasShort = HasSpecificSignal( + barIndex, + POSITION_TYPE_SELL, + provider, + signalPusher, + mConditions // + ); + } + + // + result = hasLong || hasShort; + if (!result) + { + return result; + } + + // + // Prepare Signal ... + + // + if (result) + { + // + // Here We Have to Prepare Signal ... + + // + // TODO: Make this Configurable ... + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + double tpPoint = 30; + double volume = 0.01; + double tpPrice = PointToPrice( + tpPoint, + symbol // + ); + ENUM_POSITION_TYPE type = hasLong + ? POSITION_TYPE_BUY + : POSITION_TYPE_SELL; + ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; + double entry = GetEntry( + symbol, + type // + ); + double tp = hasLong + ? entry + tpPrice + : entry - tpPrice; + double sl = 0; + ENUM_X_SIGNAL_MANAGING_ACTIONS action = X_SIGNAL_USE_NOTHING; + + // + result = mSignal.Prepare( + symbol, + provider, + period, + type, + mode, + entry, + volume, + action, + sl, + tp + // + ); + + // + if (result) + { + mWaitsUntilNewBar = true; + } + } + + // + return result; + } + + // + // Protected ... +protected: + // + X5ProviderInputs mInputs; + + // + // Private ... +private: + // + // Props ... + + // + // Prepare an Instance of Data Collector for MarketConditions ... + XSC5MarketConditionDataCollector mConditionsCollector; + + // + int mNumberOfItems; // Number of Buffer Ites Read in Conditions ... + + // + // Tools ... + + // + // Calculations ... + + // + // Calculate Conditions ... + void CalculateConditions(X5MarketConditions &mConditions) + { + // + CalculateTMConditions(mConditions); + CalculateAMAConditions(mConditions); + CalculateFIConditions(mConditions); + CalculateOBDConditions(mConditions); + CalculateRSIConditions(mConditions); + CalculateCHLHConditions(mConditions); + CalculateLHConditions(mConditions); + CalculateTDConditions(mConditions); + CalculateTSConditions(mConditions); + CalculateCHMAConditions(mConditions); + } + + // + // XTM .. + void CalculateTMConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXTMPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.tms); + + // + mConditions.isXTMVale = IsDecreasing( + mFrom, + mIndex, + mConditions.tms); + + // + mConditions.isXTMBullish = mConditions.bars[mIndex].low > mConditions.tms[mIndex]; + bool isXTMBullishPrev = mConditions.bars[mPrevIndex].low > mConditions.tms[mPrevIndex]; + + // + mConditions.isXTMBearish = mConditions.bars[mIndex].high < mConditions.tms[mIndex]; + bool isXTMBearishPrev = mConditions.bars[mPrevIndex].high < mConditions.tms[mPrevIndex]; + + // + mConditions.isXTMNeutural = !mConditions.isXTMBullish && !mConditions.isXTMBearish; + bool isXTMNeuturalPrev = !isXTMBullishPrev && !isXTMBearishPrev; + + // + mConditions.isXTMEndBullish = + // + !mConditions.isXTMBullish && + isXTMBullishPrev + // + ; + + // + mConditions.isXTMEndBearish = + // + !mConditions.isXTMBearish && + isXTMBearishPrev + // + ; + + // + mConditions.isXTMStartBullish = + // + mConditions.isXTMBullish && + !isXTMBullishPrev + // + ; + + // + mConditions.isXTMStartBearish = + // + mConditions.isXTMBearish && + !isXTMBearishPrev + // + ; + + // + mConditions.isXTMEndBullishByNeutural = + // + mConditions.isXTMNeutural && + isXTMBullishPrev + // + ; + + // + mConditions.isXTMEndBearishByNeutural = + // + mConditions.isXTMNeutural && + isXTMBearishPrev + // + ; + + // + mConditions.isXTMStartBullishAfterNeutural = + // + mConditions.isXTMBullish && + isXTMNeuturalPrev + // + ; + + // + mConditions.isXTMStartBearishAfterNeutural = + // + mConditions.isXTMBearish && + isXTMNeuturalPrev + // + ; + } + + // + // XAMA .. + void CalculateAMAConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXAMAPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.amas); + + // + mConditions.isXAMAVale = IsDecreasing( + mFrom, + mIndex, + mConditions.amas); + + // + mConditions.isXAMABullish = mConditions.bars[mIndex].low > mConditions.amas[mIndex]; + bool isXAMABullishPrev = mConditions.bars[mPrevIndex].low > mConditions.amas[mPrevIndex]; + + // + mConditions.isXAMABearish = mConditions.bars[mIndex].high < mConditions.amas[mIndex]; + bool isXAMABearishPrev = mConditions.bars[mPrevIndex].high < mConditions.amas[mPrevIndex]; + + // + mConditions.isXAMANeutural = !mConditions.isXAMABullish && !mConditions.isXAMABearish; + bool isXAMANeuturalPrev = !isXAMABullishPrev && !isXAMABearishPrev; + + // + mConditions.isXAMAEndBullish = + // + !mConditions.isXAMABullish && + isXAMABullishPrev + // + ; + + // + mConditions.isXAMAEndBearish = + // + !mConditions.isXAMABearish && + isXAMABearishPrev + // + ; + + // + mConditions.isXAMAStartBullish = + // + mConditions.isXAMABullish && + !isXAMABullishPrev + // + ; + + // + mConditions.isXAMAStartBearish = + // + mConditions.isXAMABearish && + !isXAMABearishPrev + // + ; + + // + mConditions.isXAMAEndBullishByNeutural = + // + mConditions.isXAMANeutural && + isXAMABullishPrev + // + ; + + // + mConditions.isXAMAEndBearishByNeutural = + // + mConditions.isXAMANeutural && + isXAMABearishPrev + // + ; + + // + mConditions.isXAMAStartBullishAfterNeutural = + // + mConditions.isXAMABullish && + isXAMANeuturalPrev + // + ; + + // + mConditions.isXAMAStartBearishAfterNeutural = + // + mConditions.isXAMABearish && + isXAMANeuturalPrev + // + ; + } + + // + // XFI ... + void CalculateFIConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXFIPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.fis); + + // + mConditions.isXFIVale = IsDecreasing( + mFrom, + mIndex, + mConditions.fis); + + // + mConditions.isXFIOverZero = mConditions.fis[mIndex] > 0; + + // + mConditions.isXFICrossedOverZero = + // + mConditions.isXFIOverZero && + mConditions.fis[mPrevIndex] <= 0 + // + ; + + // + mConditions.isXFIUnderZero = mConditions.fis[mIndex] < 0; + + // + mConditions.isXFICrossedUnderZero = + // + mConditions.isXFIUnderZero && + mConditions.fis[mPrevIndex] >= 0 + // + ; + } + + // + // XOBD ... + void CalculateOBDConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXOBDSwingLow = mConditions.obds[mIndex] == X_SWING_LOW; + mConditions.isXOBDSwingHigh = mConditions.obds[mIndex] == X_SWING_HIGH; + } + + // + // XRSI ... + void CalculateRSIConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + double shortEntryValue = mInputs.rsiInputs.shortEntryValue; + double shortExitValue = mInputs.rsiInputs.shortExitValue; + double longEntryValue = mInputs.rsiInputs.longEntryValue; + double longExitValue = mInputs.rsiInputs.longExitValue; + + // + mConditions.isXRSIPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.rsis); + + // + mConditions.isXRSIVale = IsDecreasing( + mFrom, + mIndex, + mConditions.rsis); + + // + mConditions.isXRSICrossedOverLongExit = + // + mConditions.rsis[mIndex] > longExitValue && + mConditions.rsis[mPrevIndex] <= longExitValue; + // + ; + + // + mConditions.isXRSICrossedOverLongEntry = + // + mConditions.rsis[mIndex] > longEntryValue && + mConditions.rsis[mPrevIndex] <= longEntryValue; + // + ; + + // + mConditions.isXRSICrossedUnderShortExit = + // + mConditions.rsis[mIndex] < shortExitValue && + mConditions.rsis[mPrevIndex] >= shortExitValue; + // + ; + + // + mConditions.isXRSICrossedUnderShortEntry = + // + mConditions.rsis[mIndex] < shortEntryValue && + mConditions.rsis[mPrevIndex] >= shortEntryValue; + // + ; + } + + // + // XCHLH ... + void CalculateCHLHConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXCHLHSameHHs = + // + mConditions.chlhScHHs[mIndex] == mConditions.chlhMcHHs[mIndex] && + mConditions.chlhMcHHs[mIndex] == mConditions.chlhLcHHs[mIndex] + // + ; + + // + mConditions.isXCHLHSameLLs = + // + mConditions.chlhScLLs[mIndex] == mConditions.chlhMcLLs[mIndex] && + mConditions.chlhMcLLs[mIndex] == mConditions.chlhLcLLs[mIndex] + // + ; + + // + mConditions.isXCHLHSCMCHHSame = + // + mConditions.chlhScHHs[mIndex] == mConditions.chlhMcHHs[mIndex] + // + ; + + // + mConditions.isXCHLHSCMCLLSame = + // + mConditions.chlhScLLs[mIndex] == mConditions.chlhMcLLs[mIndex] + // + ; + + // + mConditions.isXCHLHSCLCHHSame = + // + mConditions.chlhScHHs[mIndex] == mConditions.chlhLcLLs[mIndex] + // + ; + + // + mConditions.isXCHLHSCLCLLSame = + // + mConditions.chlhScLLs[mIndex] == mConditions.chlhLcLLs[mIndex] + // + ; + + // + mConditions.isXCHLHMCLCHHSame = + // + mConditions.chlhMcHHs[mIndex] == mConditions.chlhLcHHs[mIndex] + // + ; + + // + mConditions.isXCHLHMCLCLLSame = + // + mConditions.chlhMcLLs[mIndex] == mConditions.chlhLcLLs[mIndex] + // + ; + + // // + // isXCHLHMCOnTopOfLC = + // // + // // + // ; + + // // + // isXCHLHMCInBottomOfLC = + // // + // // + // ; + } + + // + // XLH ... + void CalculateLHConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXLHHHIncreased = IsIncreasing( + mFrom, + mIndex, + mConditions.lhHhs); + + // + mConditions.isXLHHHDecreased = IsDecreasing( + mFrom, + mIndex, + mConditions.lhHhs); + + // + mConditions.isXLHLLIncreased = IsIncreasing( + mFrom, + mIndex, + mConditions.lhLls); + + // + mConditions.isXLHLLDecreased = IsDecreasing( + mFrom, + mIndex, + mConditions.lhLls); + + // + mConditions.isXLHLowAttachedLL = mConditions.bars[mIndex].low == mConditions.lhLls[mIndex]; + + // + mConditions.isXLHHighAttachedHH = mConditions.bars[mIndex].high == mConditions.lhHhs[mIndex]; + ; + + // + mConditions.isXLHHHSameInLength = IsSame(mConditions.lhHhs); + + // + mConditions.isXLHLLSameInLength = IsSame(mConditions.lhLls); + + // + mConditions.isXLHPriceOverSignal = mConditions.bars[mIndex].low > mConditions.lhSignals[mIndex]; + + // + mConditions.isXLHPriceUnderSignal = mConditions.bars[mIndex].high < mConditions.lhSignals[mIndex]; + + // + mConditions.isXLHPriceInSignalRange = !mConditions.isXLHPriceOverSignal && !mConditions.isXLHPriceUnderSignal; + + // + mConditions.isXLHPriceCrossedOverSignal = + // + mConditions.isXLHPriceOverSignal && + !(mConditions.bars[mPrevIndex].low > mConditions.lhSignals[mPrevIndex]) + // + ; + + // + mConditions.isXLHPriceCrossedUnderSignal = + // + mConditions.isXLHPriceUnderSignal && + !(mConditions.bars[mIndex].high < mConditions.lhSignals[mIndex]) + // + ; + } + + // + // XTD ... + void CalculateTDConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + mConditions.isXTDSignalPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.tdSignals); + + // + mConditions.isXTDSignalVale = IsDecreasing( + mFrom, + mIndex, + mConditions.tdSignals); + + // + mConditions.isXTDBullishPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.tdBullishs); + + // + mConditions.isXTDBullishVale = IsDecreasing( + mFrom, + mIndex, + mConditions.tdBullishs); + + // + mConditions.isXTDBearishPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.tdBearishs); + + // + mConditions.isXTDBearishVale = IsDecreasing( + mFrom, + mIndex, + mConditions.tdBearishs); + + // + mConditions.isXTDBullOverBear = mConditions.tdBullishs[mIndex] > mConditions.tdBearishs[mIndex]; + bool isXTDBullOverBearPrev = mConditions.tdBullishs[mPrevIndex] > mConditions.tdBearishs[mPrevIndex]; + + // + mConditions.isXTDBullUnderBear = mConditions.tdBullishs[mIndex] < mConditions.tdBearishs[mIndex]; + bool isXTDBullUnderBearPrev = mConditions.tdBullishs[mPrevIndex] < mConditions.tdBearishs[mPrevIndex]; + + // + mConditions.isXTDSignalOverBear = mConditions.tdSignals[mIndex] > mConditions.tdBearishs[mIndex]; + bool isXTDSignalOverBearPrev = mConditions.tdSignals[mPrevIndex] > mConditions.tdBearishs[mPrevIndex]; + + // + mConditions.isXTDSignalUnderBear = mConditions.tdSignals[mIndex] < mConditions.tdBearishs[mIndex]; + bool isXTDSignalUnderBearPrev = mConditions.tdSignals[mPrevIndex] < mConditions.tdBearishs[mPrevIndex]; + + // + mConditions.isXTDBullCrossedOverBear = + mConditions.isXTDBullOverBear && + !isXTDBullOverBearPrev; + + // + mConditions.isXTDBullCrossedUnderBear = + mConditions.isXTDBullUnderBear && + !isXTDBullUnderBearPrev; + + // + mConditions.isXTDSignalCrossedOverBear = + mConditions.isXTDSignalOverBear && + !isXTDSignalOverBearPrev; + + // + mConditions.isXTDSignalCrossedUnderBear = + mConditions.isXTDSignalUnderBear && + !isXTDSignalUnderBearPrev; + } + + // + // XTS ... + void CalculateTSConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + double current = mConditions.tsCurrents[mIndex]; + double currentPrev = mConditions.tsCurrents[mPrevIndex]; + + // + double nearest = mConditions.tsNearests[mIndex]; + double nearestPrev = mConditions.tsNearests[mPrevIndex]; + + // + double mediest = mConditions.tsMediests[mIndex]; + double mediestPrev = mConditions.tsMediests[mPrevIndex]; + + // + double farest = mConditions.tsFarests[mIndex]; + double farestPrev = mConditions.tsFarests[mPrevIndex]; + + // + double tsValues[] = {current, nearest, mediest, farest}; + double tsMax = GetMax(tsValues); + double tsMin = GetMin(tsValues); + + // + double tsPrevValues[] = {currentPrev, nearestPrev, mediestPrev, farestPrev}; + double tsPrevMax = GetMax(tsPrevValues); + double tsPrevMin = GetMin(tsPrevValues); + + // + mConditions.isXTSAllSame = + // + current == nearest && + nearest == mediest && + mediest == farest + // + ; + + // + mConditions.isXTSCurrentMin = current == tsMin; + mConditions.isXTSCurrentMax = current == tsMax; + + // + mConditions.isXTSCurrentOverFarest = current > farest; + bool isXTSCurrentOverFarestPrev = currentPrev > farestPrev; + + // + mConditions.isXTSCurrentOverNearest = current > nearest; + bool isXTSCurrentOverNearestPrev = currentPrev > nearestPrev; + + // + mConditions.isXTSCurrentOverMediest = current > mediest; + bool isXTSCurrentOverMediestPrev = currentPrev > mediestPrev; + + // + mConditions.isXTSCurrentUnderFarest = current < farest; + bool isXTSCurrentUnderFarestPrev = currentPrev < farestPrev; + + // + mConditions.isXTSCurrentUnderNearest = current < nearest; + bool isXTSCurrentUnderNearestPrev = currentPrev < nearestPrev; + + // + mConditions.isXTSCurrentUnderMediest = current < mediest; + bool isXTSCurrentUnderMediestPrev = currentPrev < mediestPrev; + + // + mConditions.isXTSCurrentCrossedOverFarest = + mConditions.isXTSCurrentOverFarest && + !isXTSCurrentOverFarestPrev; + + // + mConditions.isXTSCurrentCrossedOverNearest = + mConditions.isXTSCurrentOverNearest && + !isXTSCurrentOverNearestPrev; + + // + mConditions.isXTSCurrentCrossedOverMediest = + mConditions.isXTSCurrentOverMediest && + !isXTSCurrentOverMediestPrev; + + // + mConditions.isXTSCurrentCrossedUnderFarest = + mConditions.isXTSCurrentUnderFarest && + !isXTSCurrentUnderFarestPrev; + + // + mConditions.isXTSCurrentCrossedUnderNearest = + mConditions.isXTSCurrentUnderNearest && + !isXTSCurrentUnderNearestPrev; + + // + mConditions.isXTSCurrentCrossedUnderMediest = + mConditions.isXTSCurrentUnderMediest && + !isXTSCurrentUnderMediestPrev; + } + + // + // XCHMA ... + void CalculateCHMAConditions(X5MarketConditions &mConditions) + { + // + int mIndex = 0; + int mPrevIndex = mIndex + 1; + int mLength = 10; + int mFrom = mIndex + mLength; + + // + double scFast = mConditions.chmaScFasts[mIndex]; + double scSlow = mConditions.chmaScSlows[mIndex]; + double scFastPrev = mConditions.chmaScFasts[mPrevIndex]; + double scSlowPrev = mConditions.chmaScSlows[mPrevIndex]; + + // + double mcFast = mConditions.chmaMcFasts[mIndex]; + double mcSlow = mConditions.chmaMcSlows[mIndex]; + double mcFastPrev = mConditions.chmaMcFasts[mPrevIndex]; + double mcSlowPrev = mConditions.chmaMcSlows[mPrevIndex]; + + // + double lcFast = mConditions.chmaLcFasts[mIndex]; + double lcSlow = mConditions.chmaLcSlows[mIndex]; + double lcFastPrev = mConditions.chmaLcFasts[mPrevIndex]; + double lcSlowPrev = mConditions.chmaLcSlows[mPrevIndex]; + + // + double chmaValues[] = { + scFast, + scSlow, + mcFast, + mcSlow, + lcFast, + lcSlow}; + double chmaNonSCValues[] = { + mcFast, + mcSlow, + lcFast, + lcSlow}; + double chmaMin = GetMin(chmaValues); + double chmaMax = GetMax(chmaValues); + double chmaNonSCMin = GetMin(chmaNonSCValues); + double chmaNonSCMax = GetMax(chmaNonSCValues); + + // + double chmaValuesPrev[] = { + scFastPrev, + scSlowPrev, + mcFastPrev, + mcSlowPrev, + lcFastPrev, + lcSlowPrev}; + double chmaNonSCValuesPrev[] = { + mcFastPrev, + mcSlowPrev, + lcFastPrev, + lcSlowPrev}; + double chmaMinPrev = GetMin(chmaValuesPrev); + double chmaMaxPrev = GetMax(chmaValuesPrev); + double chmaNonSCMinPrev = GetMin(chmaNonSCValuesPrev); + double chmaNonSCMaxPrev = GetMax(chmaNonSCValuesPrev); + + // + mConditions.isXCHMASCOverMax = MathMin(scFast, scSlow) > chmaNonSCMax; + bool isXCHMASCOverMaxPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMaxPrev; + + // + mConditions.isXCHMASCOverMin = MathMin(scFast, scSlow) > chmaNonSCMin; + bool isXCHMASCOverMinPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMinPrev; + + // + mConditions.isXCHMASCUnderMax = MathMax(scFast, scSlow) < chmaNonSCMax; + bool isXCHMASCUnderMaxPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMaxPrev; + + // + mConditions.isXCHMASCUnderMin = MathMax(scFast, scSlow) < chmaNonSCMin; + bool isXCHMASCUnderMinPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMinPrev; + + // + mConditions.isXCHMASCCrossedOverMax = + mConditions.isXCHMASCOverMax && + !isXCHMASCOverMaxPrev; + + // + mConditions.isXCHMASCCrossedUnderMax = + mConditions.isXCHMASCUnderMax && + !isXCHMASCUnderMaxPrev; + + // + mConditions.isXCHMASCCrossedOverMin = + mConditions.isXCHMASCOverMin && + !isXCHMASCOverMinPrev; + + // + mConditions.isXCHMASCCrossedUnderMin = + mConditions.isXCHMASCUnderMin && + !isXCHMASCUnderMinPrev; + + // + // Short ... + + // + mConditions.isXCHMASCPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.chmaScFasts); + + // + mConditions.isXCHMASCVale = IsDecreasing( + mFrom, + mIndex, + mConditions.chmaScFasts); + + // + mConditions.isXCHMASCTrendsUp = IsTrendingUp( + mConditions.chmaScFasts, + mConditions.chmaScSlows); + + // + mConditions.isXCHMASCTrendsDown = IsTrendingDown( + mConditions.chmaScFasts, + mConditions.chmaScSlows); + + // + mConditions.isXCHMASCFastOverSlow = scFast > scSlow; + bool isXCHMASCFastOverSlowPrev = scFastPrev > scSlowPrev; + + // + mConditions.isXCHMASCFastUnderSlow = scFast < scSlow; + bool isXCHMASCFastUnderSlowPrev = scFastPrev < scSlowPrev; + + // + mConditions.isXCHMASCFastCrossedOverSlow = + mConditions.isXCHMASCFastOverSlow && + !isXCHMASCFastOverSlowPrev; + + // + mConditions.isXCHMASCFastCrossedUnderSlow = + mConditions.isXCHMASCFastUnderSlow && + !isXCHMASCFastUnderSlowPrev; + + // + // Medium ... + + // + mConditions.isXCHMAMCPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.chmaMcFasts); + + // + mConditions.isXCHMAMCVale = IsDecreasing( + mFrom, + mIndex, + mConditions.chmaMcFasts); + + // + mConditions.isXCHMAMCTrendsUp = IsTrendingUp( + mConditions.chmaMcFasts, + mConditions.chmaMcSlows); + + // + mConditions.isXCHMAMCTrendsDown = IsTrendingDown( + mConditions.chmaMcFasts, + mConditions.chmaMcSlows); + + // + mConditions.isXCHMAMCFastOverSlow = mcFast > mcSlow; + bool isXCHMAMCFastOverSlowPrev = mcFastPrev > mcSlowPrev; + + // + mConditions.isXCHMAMCFastUnderSlow = mcFast < mcSlow; + bool isXCHMAMCFastUnderSlowPrev = mcFastPrev < mcSlowPrev; + + // + mConditions.isXCHMAMCFastCrossedOverSlow = + mConditions.isXCHMAMCFastOverSlow && + !isXCHMAMCFastOverSlowPrev; + + // + mConditions.isXCHMAMCFastCrossedUnderSlow = + mConditions.isXCHMAMCFastUnderSlow && + !isXCHMAMCFastUnderSlowPrev; + + // + // Long ... + + // + mConditions.isXCHMALCPeak = IsIncreasing( + mFrom, + mIndex, + mConditions.chmaLcFasts); + + // + mConditions.isXCHMALCVale = IsDecreasing( + mFrom, + mIndex, + mConditions.chmaLcFasts); + + // + mConditions.isXCHMALCTrendsUp = IsTrendingUp( + mConditions.chmaLcFasts, + mConditions.chmaLcSlows); + + // + mConditions.isXCHMALCTrendsDown = IsTrendingDown( + mConditions.chmaMcFasts, + mConditions.chmaMcSlows); + + // + mConditions.isXCHMALCFastOverSlow = lcFast > lcSlow; + bool isXCHMALCFastOverSlowPrev = lcFastPrev > lcSlowPrev; + + // + mConditions.isXCHMALCFastUnderSlow = lcFast < lcSlow; + bool isXCHMALCFastUnderSlowPrev = lcFastPrev < lcSlowPrev; + + // + mConditions.isXCHMALCFastCrossedOverSlow = + mConditions.isXCHMALCFastOverSlow && + !isXCHMALCFastOverSlowPrev; + + // + mConditions.isXCHMALCFastCrossedUnderSlow = + mConditions.isXCHMALCFastUnderSlow && + !isXCHMALCFastUnderSlowPrev; + } + + // + // Signallers ... + + // + bool mIsLongEnable; + bool mIsShortEnable; + + // + bool mIsX5XSPSignalProviderEnable; + bool mIsXTDSignalProviderEnable; + bool mIsXTAMSignalProviderEnable; + bool mIsXSISignalProviderEnable; + bool mIsXTSFISignalProviderEnable; + bool mIsXOBDLHSignalProviderEnable; + bool mIsXCHMACCSignalProviderEnable; + bool mIsXCHMAMNSignalProviderEnable; + bool mIsXCHMAMXSignalProviderEnable; + + // + // Check Market Conditions is Ready for Long Signals or not ... + bool IsReadyForLong( + X5MarketConditions &mConditions, // Market Conditions ... + bool checkXCHMAMin = true, // Force Check XCHMA Min State + bool checkXCHMAMax = true, // Force Check XCHMA Max State + bool checkXCHMACycles = true, // Force Check XCHMA Cycles State + bool checkXCHMAPeaks = true, // Force Check XCHMA Peaks State + bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers + bool checkXOBD = true, // Force Check XOBD State + bool checkXTS = true // Force Check XTS State + ) + { + // + bool result = true; + + // + if (checkXCHMAMin) + { + // + result = + // + // XCHMA MIN ... + !( + // + (mConditions.isXCHMASCOverMin || + mConditions.isXCHMASCCrossedOverMin) && + (mConditions.isXCHMASCUnderMin || + mConditions.isXCHMASCCrossedUnderMin) + // + ); + } + + // + if (checkXCHMAMax && result) + { + // + result = + // + // XCHMA MAX ... + !( + // + (mConditions.isXCHMASCOverMax || + mConditions.isXCHMASCCrossedOverMax) && + (mConditions.isXCHMASCUnderMax || + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ; + } + + // + if (checkXCHMACycles && result) + { + // + result = + // + // Check XCHMA Trend Bullish ... + ( + // + // All Cycles Bullish ... + ( + // + // SC ... + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + || + // + // Two Cycle Fully Bullish ... + ( + // + // SC and MC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + || + // + // SC and LC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + || + // + // MC and LC ... + ( + // + // MC ... + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMAPeaks && result) + { + // + result = + // + // XCHMA Check Peaks ... + !( + // + // All Cycles Peak ... + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + || + // + ( + // + // SC MC ... + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) + // + || + // + // SC LC ... + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCPeak) + // + || + // + // MC LC ... + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMATrendPowers && result) + { + // + result = + // + // XCHMA Check Trends Power ... + !( + // + // All Trends Down ... + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + // Twisted pairs ... + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ; + } + + // + if (checkXOBD && result) + { + // + result = + // + // XOBD Check Swings ... + !mConditions.isXOBDSwingLow + // + ; + } + + // + if (checkXTS && result) + { + result = + // + // XTS Check ... + !( + // + mConditions.isXTSCurrentMin && + // + ( + // + // All Under ... + ( + (mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest) && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest)) + // + || + // + // Pairs ... + ( + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest)) + // + || + // + ((mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest) && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest)) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // Check Market Conditions is Ready for Short Signals or not ... + bool IsReadyForShort( + X5MarketConditions &mConditions, // Market Conditions ... + bool checkXCHMAMin = true, // Force Check XCHMA Min State + bool checkXCHMAMax = true, // Force Check XCHMA Max State + bool checkXCHMACycles = true, // Force Check XCHMA Cycles State + bool checkXCHMAVales = true, // Force Check XCHMA Vales State + bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers + bool checkXOBD = true, // Force Check XOBD State + bool checkXTS = true // Force Check XTS State + ) + { + // + bool result = true; + + // + if (checkXCHMAMin) + { + // + result = + // + // XCHMA MIN ... + !( + // + (mConditions.isXCHMASCOverMin || + mConditions.isXCHMASCCrossedOverMin) && + (mConditions.isXCHMASCUnderMin || + mConditions.isXCHMASCCrossedUnderMin) + // + ); + } + + // + if (checkXCHMAMax && result) + { + // + result = + // + // XCHMA MAX ... + !( + // + (mConditions.isXCHMASCOverMax || + mConditions.isXCHMASCCrossedOverMax) && + (mConditions.isXCHMASCUnderMax || + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ; + } + + // + if (checkXCHMACycles && result) + { + // + result = + // + // Check XCHMA Trend Bullish ... + ( + // + // All Cycles Bullish ... + ( + // + // SC ... + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) + // + ) + // + || + // + // Two Cycle Fully Bullish ... + ( + // + // SC and MC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedOverSlow) + // + && + // + // MC ... + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + || + // + // SC and LC ... + ( + // + // SC ... + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) + // + ) + // + || + // + // MC and LC ... + ( + // + // MC ... + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) + // + && + // + // LC ... + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMAVales && result) + { + // + result = + // + // XCHMA Check Vales ... + !( + // + // All Cycles Vale ... + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + ( + // + // SC MC ... + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + || + // + // SC LC ... + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCVale) + // + || + // + // MC LC ... + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ; + } + + // + if (checkXCHMATrendPowers && result) + { + // + result = + // + // XCHMA Check Trends Power ... + !( + // + // All Trends Down ... + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + // Twisted pairs ... + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ; + } + + // + if (checkXOBD && result) + { + // + result = + // + // XOBD Check Swings ... + !mConditions.isXOBDSwingHigh + // + ; + } + + // + if (checkXTS && result) + { + // + result = + // + // XTS Check ... + !( + // + mConditions.isXTSCurrentMax && + // + ( + // + // All Over ... + ( + (mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + || + // + // Pairs ... + ( + // + ((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest)) + // + || + // + ((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + || + // + ((mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // X5XSP ... + + // + // Common Conditions ... + bool X5XSPHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool X5XSPHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = X5XSPHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + result = + // + false + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + result = + // + false + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + result = + // + false + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + result = + // + false + // + ; + } + + // + return result; + } + + // + // X5XSP ... + + // + // Common Conditions ... + bool X5XSPHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool X5XSPHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = X5XSPHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + result = + // + false + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + result = + // + false + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + result = + // + false + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + result = + // + false + // + ; + } + + // + return result; + } + + // + // XTD ... + + // + // Common Conditions ... + bool XTDHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXTDSignalCrossedOverBear + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XTDHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XTDHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest) && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + ( + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMax) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXFICrossedOverZero && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ( + (mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentUnderFarest && + (mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest)) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + || + // + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ( + (mConditions.isXCHMAMCVale && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) && + ( + // + ( + // + mConditions.isXAMANeutural + // + || + // + (mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + || + // + // + ((mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCLLSame && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish && + mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + ) + // + ) + // + || + // + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBearish && + mConditions.isXTDBearishVale && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCVale && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + ) + // + ) + // + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCVale && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXLHHHDecreased && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentUnderFarest && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXAMAVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXFICrossedOverZero && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXCHMASCTrendsUp && + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow))) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + (mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow))) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + ( + // + mConditions.isXCHMASCCrossedOverMax + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ( + // + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDSignalCrossedOverBear) + // + ) && + (mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXAMAStartBullish) + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXTSCurrentMax || + mConditions.isXTSCurrentUnderFarest) && + mConditions.isXTDBearishVale && + mConditions.isXLHLLDecreased && + mConditions.isXLHPriceCrossedOverSignal && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + ( + // + (mConditions.isXCHMASCCrossedOverMin && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXCHMASCCrossedOverMax && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) || + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + // + ( + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + ) + // + ) + // + ) + // + ) + // + || + // + (( + // + (mConditions.isXFICrossedOverZero && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) && + (mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow))) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + || + // + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXTDBearishVale && + mConditions.isXFICrossedOverZero && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXAMAEndBullish && + mConditions.isXCHLHSCMCLLSame && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + ) + // + ) + // + || + // + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMAMCVale && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXRSICrossedOverLongExit && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMAStartBullish && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXAMAStartBullish && + mConditions.isXCHMASCFastCrossedOverSlow) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXTMStartBullish && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXTMNeutural && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalCrossedOverBear && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural || + mConditions.isXTMEndBullish) && + ( + // + (mConditions.isXTDSignalCrossedOverBear && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCTrendsDown || + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHLHSameHHs && + ( + // + ( + // + mConditions.isXLHHighAttachedHH + // + || + // + (mConditions.isXLHLLSameInLength && + mConditions.isXRSICrossedOverLongExit) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXLHHighAttachedHH) && + ( + // + mConditions.isXCHLHSameHHs + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + // XTD Long ... + // Resolve Guard Attacks ... + || + // + ( + // + // XTD Long ... + // isXTSCurrentUnderNearest + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + mConditions.isXTSCurrentCrossedUnderFarest + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHHHSameInLength && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceOverSignal && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXLHPriceUnderSignal + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXLHPriceInSignalRange + // + || + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXLHLLSameInLength) && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + mConditions.isXLHHHSameInLength + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + mConditions.isXLHHHSameInLength + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + mConditions.isXLHLLIncreased + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXLHLLSameInLength && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSameHHs && + ( + // + mConditions.isXLHLLSameInLength + // + || + // + (mConditions.isXTMNeutural || + mConditions.isXTMEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLDecreased) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) || + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish)) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHHHSameInLength) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXLHLLSameInLength) + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXLHPriceInSignalRange) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + mConditions.isXCHMASCCrossedOverMin + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceOverSignal && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXCHMASCCrossedOverMin) && + ( + // + (mConditions.isXTMNeutural && + ( + // + mConditions.isXAMANeutural + // + || + // + mConditions.isXAMAStartBullish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXLHPriceCrossedUnderSignal && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXTDBearishVale && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTSCurrentCrossedOverMediest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXTDBearishVale) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXAMAStartBullish && + mConditions.isXLHPriceUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXTDBearishVale && + ( + // + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMAStartBullish && + mConditions.isXLHLLSameInLength) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHLLSameInLength) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceInSignalRange && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXTDBearishVale && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXTSCurrentUnderMediest + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXLHHHSameInLength && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceInSignalRange) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXLHPriceUnderSignal && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceOverSignal && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceInSignalRange && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + ((mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceUnderSignal && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXTSCurrentUnderFarest + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHHHSameInLength && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXLHLLDecreased) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXTMStartBullish) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXAMABearish + // + || + // + mConditions.isXLHLLSameInLength + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHHHSameInLength && + mConditions.isXLHPriceUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXAMAStartBullish && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTSCurrentCrossedOverNearest + // + || + // + (mConditions.isXAMAVale && + mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMAStartBullish && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXTSCurrentCrossedUnderFarest && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTMNeutural && + ( + // + mConditions.isXAMANeutural + // + || + // + mConditions.isXTMEndBullish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + mConditions.isXCHMASCOverMax + // + || + // + (mConditions.isXTDBearishVale && + ( + // + mConditions.isXAMANeutural + // + || + // + mConditions.isXTMStartBullish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMALCTrendsDown) && + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow)) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXLHLLIncreased) && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceInSignalRange) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHLLDecreased && + mConditions.isXTMStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXCHMAMCFastUnderSlow + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXLHLLSameInLength && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXAMANeutural && + mConditions.isXCHMASCUnderMin) + // + || + // + mConditions.isXTSCurrentCrossedOverNearest + // + ) + // + ) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXTSAllSame && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + mConditions.isXLHHHDecreased + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHPriceUnderSignal) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBullish) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceUnderSignal) + // + || + // + (mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHPriceOverSignal && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHPriceOverSignal) && + ( + // + mConditions.isXTMStartBullish + // + || + // + ((mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXLHLLSameInLength && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXCHMALCFastUnderSlow + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) + // + || + // + ((mConditions.isXOBDSwingHigh && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax) && + ( + // + mConditions.isXTSCurrentCrossedOverNearest + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCVale && + mConditions.isXLHPriceOverSignal && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHPriceOverSignal && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + mConditions.isXLHLLSameInLength + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXLHHHSameInLength && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + mConditions.isXFICrossedOverZero + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXCHMASCOverMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHLLSameInLength) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTSCurrentCrossedOverNearest + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) || + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish)) && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHPriceOverSignal && + mConditions.isXLHLLSameInLength) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXLHHHSameInLength && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXCHMAMCPeak || + mConditions.isXTDBearishVale) && + ( + // + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSameHHs) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + mConditions.isXLHHighAttachedHH + // + || + // + mConditions.isXTSCurrentCrossedOverMediest + // + ) + // + ) + // + ) + // + ) + // + || + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + mConditions.isXLHHHSameInLength + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXCHMASCTrendsDown + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXLHLLDecreased && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXCHMAMCTrendsDown + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXAMAStartBullish && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHPriceUnderSignal) + // + || + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXLHLLSameInLength) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange) + // + || + // + (mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXLHPriceOverSignal) && + ( + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceUnderSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXAMANeutural && + ( + // + mConditions.isXTMNeutural + // + || + // + mConditions.isXCHLHMCLCHHSame + // + || + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXTMBullish && + mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + mConditions.isXAMAEndBearish + // + || + // + (mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXAMANeutural + // + || + // + (mConditions.isXAMAStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTDBearishVale && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXCHLHMCLCHHSame && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // isXCHMALCTrendsDown + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXCHMASCOverMax + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXTMStartBearish && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceInSignalRange && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + mConditions.isXCHLHSameHHs + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXLHHHSameInLength && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCFastCrossedOverSlow) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + mConditions.isXCHMAMCVale + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverFarest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + !mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXTMEndBullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXCHMASCCrossedOverMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + mConditions.isXCHMAMCVale + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXAMANeutural && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTSCurrentUnderFarest + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMEndBullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXAMAEndBullish && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderFarest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTSCurrentUnderMediest + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTSCurrentCrossedOverNearest + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHLLIncreased) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCCrossedOverMin) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentOverFarest) + // + || + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + ( + // + mConditions.isXTDBearishVale + // + || + // + mConditions.isXCHLHMCLCLLSame + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentOverFarest) && + ( + // + mConditions.isXTSCurrentOverNearest + // + || + // + (mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXTMEndBullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXAMANeutural && + mConditions.isXTMStartBullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXLHLLDecreased && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + !mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXCHMASCCrossedOverMax + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXLHHighAttachedHH) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameHHs && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + ((mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + mConditions.isXLHLLIncreased + // + || + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXLHHighAttachedHH + // + || + // + mConditions.isXTDSignalCrossedOverBear + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXLHHighAttachedHH && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // IGnore Cases ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs) && + ( + // + mConditions.isXCHMASCCrossedOverMax + // + || + // + mConditions.isXTSCurrentCrossedOverMediest + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXRSICrossedOverLongExit && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXTSCurrentUnderMediest + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMALCTrendsDown) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXRSICrossedOverLongExit && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXRSICrossedOverLongExit && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCTrendsDown && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXLHLLIncreased + // + || + // + mConditions.isXLHHighAttachedHH + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXRSICrossedUnderShortEntry && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXRSICrossedUnderShortEntry && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXCHMAMCFastCrossedOverSlow && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderFarest) + // + || + // + ( + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHMAMCTrendsDown && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + || + // + // Check if LC Fast Over Slow .. + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if LC Fast Over Slow .. + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp) + // + || + // + (mConditions.isXAMABearish && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMax && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + mConditions.isXRSICrossedOverLongExit + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDBearishVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + || + // + ((mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + mConditions.isXTSCurrentCrossedUnderFarest + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXFIUnderZero && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXFICrossedOverZero && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXTSCurrentUnderFarest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentUnderNearest) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXLHHHIncreased) + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + mConditions.isXLHHighAttachedHH + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMAEndBullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXAMAStartBullish && + mConditions.isXLHHighAttachedHH && + mConditions.isXFICrossedOverZero) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXCHMAMCPeak && + mConditions.isXAMABullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentCrossedUnderFarest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXFICrossedOverZero && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH && + (mConditions.isXTDBullOverBear || + mConditions.isXTDSignalCrossedOverBear)) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXLHHighAttachedHH && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSameHHs) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XTD ... + + // + // Common Conditions ... + bool XTDHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXTDSignalCrossedUnderBear + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XTDHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XTDHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCTrendsDown && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTDBullOverBear && + (mConditions.isXAMANeutural || + mConditions.isXTSCurrentOverFarest)) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) && + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTMStartBearish && + mConditions.isXAMAEndBullish && + mConditions.isXAMANeutural && + mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTSAllSame + // + || + // + mConditions.isXTSCurrentOverFarest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + // XTD Shorts ... + // Resolve Guard Attacks ... + || + ( + // + // XTD Shorts ... + // isXTSCurrentOverNearest + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXTSCurrentOverMediest + (mConditions.isXTSCurrentOverMediest && + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXTSCurrentOverFarest + (mConditions.isXTSCurrentOverFarest && + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXTSCurrentOverMediest + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXTDBullOverBear + (mConditions.isXTDBullOverBear && + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXAMAStartBearish && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + ((mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + mConditions.isXTMNeutural + // + || + // + mConditions.isXAMANeutural + // + ) + // + ) + // + || + // + (mConditions.isXLHLLSameInLength && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXCHMASCFastCrossedUnderSlow && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXLHPriceCrossedUnderSignal && + ( + // + ((mConditions.isXTSAllSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXCHMASCFastOverSlow + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSAllSame && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderMediest) && + ( + // + mConditions.isXTDBullOverBear + // + || + // + mConditions.isXTSCurrentCrossedUnderFarest + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceOverSignal && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXLHPriceOverSignal && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTMStartBearish && + ( + // + mConditions.isXAMANeutural + // + || + // + mConditions.isXAMAStartBearish + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXCHMAMCFastOverSlow + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) || + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish)) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLIncreased && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXCHMALCFastOverSlow + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXCHMASCTrendsDown + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXLHHHSameInLength && + ( + // + (mConditions.isXLHPriceUnderSignal && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // isXCHMALCTrendsDown + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTMStartBearish && + mConditions.isXLHLowAttachedLL && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + // XTD Shorts ... + // Bearish MA ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + mConditions.isXTSCurrentCrossedUnderFarest + // + || + // + mConditions.isXTSCurrentCrossedUnderNearest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXAMAEndBearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderFarest) && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXCHMASCFastCrossedUnderSlow && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXCHMASCFastCrossedUnderSlow && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHMASCTrendsUp && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXAMABullish && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + (mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) && + ( + // + (((mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural)) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullOverBear) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMASCFastOverSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXAMAEndBullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXCHMALCTrendsDown + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTSCurrentOverNearest && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish && + mConditions.isXTSCurrentOverNearest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBearish) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHMALCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTD Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTD Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTD Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XTAM ... + + // + // Common Conditions ... + bool XTAMHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + (mConditions.amas[1] > mConditions.tms[1] && + mConditions.amas[2] > mConditions.tms[2]) + // + && + // + !(mConditions.amas[2] > mConditions.tms[2] && + mConditions.amas[3] > mConditions.tms[3]) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XTAMHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XTAMHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCVale && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCVale && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + ((mConditions.isXCHMAMCVale && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) && + (mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow))) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCVale && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXTMEndBearish && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentUnderMediest)) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + (mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest)) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTSAllSame && + mConditions.isXCHMASCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ( + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXLHHHDecreased + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXAMAStartBullish && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale || + mConditions.isXCHLHSameHHs) && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXLHLLDecreased && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCPeak && + (mConditions.isXCHMAMCTrendsDown || + mConditions.isXCHMAMCFastUnderSlow)) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBearish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH) && + ( + // + mConditions.isXCHLHSameHHs + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + // XTAM Long ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXFIUnderZero && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMALCPeak && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSAllSame && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXLHLLIncreased) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXTDBearishVale && + mConditions.isXTMVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXTSCurrentUnderFarest + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDBearishVale && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXLHHighAttachedHH) && + ( + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXCHMASCCrossedOverMax + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentUnderNearest) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCFastCrossedOverSlow && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + (mConditions.isXLHHighAttachedHH && + ( + // + (mConditions.isXCHLHSameHHs && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCFastCrossedOverSlow && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHLHSCMCHHSame) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXAMAStartBullish && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXRSICrossedOverLongExit && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCCrossedUnderMax) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCCrossedUnderMax) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) && + ( + // + mConditions.isXTDBearishVale + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + mConditions.isXTSAllSame + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXTDSignalUnderBear + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMASCTrendsUp) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDBullUnderBear) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXRSICrossedOverLongExit && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale) && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHHighAttachedHH) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCPeak && + mConditions.isXCHMASCOverMax) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTDSignalOverBear) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMALCTrendsDown) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XTAM ... + + // + // Common Conditions ... + bool XTAMHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + (mConditions.amas[1] < mConditions.amas[1] && + mConditions.amas[2] < mConditions.amas[2]) + // + && + // + !(mConditions.amas[2] < mConditions.amas[2] && + mConditions.amas[3] < mConditions.amas[3]) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XTAMHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XTAMHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXFIOverZero && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural || + mConditions.isXTMEndBullish) && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTSCurrentMin) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + mConditions.isXTDBullishVale + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) && + ( + // + mConditions.isXCHMALCTrendsDown + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXCHMASCVale && + mConditions.isXAMABearish && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCTrendsUp && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullishVale) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + (mConditions.isXTDBullOverBear || + mConditions.isXTSCurrentOverFarest)) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentOverMediest)) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + // XTAM Short ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXTDSignalOverBear) && + ( + // + mConditions.isXTDBullOverBear + // + || + // + (mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSAllSame && + mConditions.isXLHLLDecreased) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXLHLLIncreased) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMALCVale && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXTDSignalOverBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXCHMASCUnderMin + // + || + // + mConditions.isXCHLHMCLCLLSame + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXTDSignalOverBear) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDBullCrossedOverBear) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverFarest) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTSAllSame && + mConditions.isXLHHighAttachedHH) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + ( + // + ((mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin) && + ( + // + mConditions.isXTSCurrentCrossedUnderFarest + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + || + // + ((mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) && + ( + // + mConditions.isXTDSignalOverBear + // + || + // + (mConditions.isXTMBullish && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // All Bearish ... + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCCrossedUnderMax) && + ( + // + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin) && + ( + // + (mConditions.isXTMVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + ((mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL) && + ( + // + mConditions.isXCHMAMCFastCrossedUnderSlow + // + || + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTAM Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMASCCrossedOverMin) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + ((mConditions.isXCHLHSameLLs && + mConditions.isXLHLowAttachedLL) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTMVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverNearest && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHLHSameLLs && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTDSignalOverBear && + ( + // + ((mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentOverNearest) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXRSICrossedOverLongExit) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMASCPeak && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDBullCrossedOverBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMALCTrendsDown + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHMALCTrendsDown && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin) && + ( + // + mConditions.isXLHLowAttachedLL + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + (mConditions.isXLHLowAttachedLL && + ( + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentOverFarest && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXCHMASCPeak && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTAM Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTAM Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XSI ... + + // + // Common Conditions ... + bool XSIHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXRSICrossedOverLongEntry && + mConditions.rsis[3] < mInputs.rsiInputs.longEntryValue + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + true, // XCHMA Cycles + true, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XSIHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XSIHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHLHSameLLs && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentUnderFarest) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBullish) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBearish)) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMAEndBearish && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) + // + && + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + && + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame)) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTMVale && + mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased) + // + || + // + ((mConditions.isXTMVale || + mConditions.isXTMNeutural || + mConditions.isXTMEndBearish) && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // XSI Long ... + // Resolve Stop Outs ... + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + mConditions.isXTSCurrentUnderFarest + // + || + // + mConditions.isXTSCurrentCrossedUnderNearest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (((mConditions.isXTMVale && + mConditions.isXAMAVale) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural)) && + ( + // + mConditions.isXTSCurrentUnderFarest + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXCHMAMCVale + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // XSI Long ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) && + ( + // + mConditions.isXTSCurrentUnderMediest + // + || + // + mConditions.isXTSCurrentUnderFarest + // + || + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + ((mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMAMCVale) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCVale) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXCHMAMCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXAMAEndBearish) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale) + // + || + // + ((mConditions.isXTMVale && + mConditions.isXTMBearish && + mConditions.isXCHMASCVale) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXLHLLDecreased) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXTSAllSame && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMASCTrendsUp) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTSAllSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXCHMASCFastCrossedOverSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXRSICrossedOverLongEntry) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMax && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMASCTrendsUp + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XSI ... + + // + // Common Conditions ... + bool XSIHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXRSICrossedUnderShortEntry && + mConditions.rsis[3] > mInputs.rsiInputs.shortEntryValue + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + true, // XCHMA Cycles + true, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XSIHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XSIHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXLHHHIncreased && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalOverBear) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish)) && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + )) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverNearest) + // + || + // + (((mConditions.isXTMBullish || + mConditions.isXTMStartBullish) && + (mConditions.isXAMABullish || + mConditions.isXAMAStartBullish)) && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXFIOverZero && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXTMEndBullish && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBearish) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentOverFarest) && + ( + // + mConditions.isXTMNeutural + // + || + // + mConditions.isXTSCurrentOverMediest + // + || + // + (mConditions.isXTMBullish && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXLHLLIncreased) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + (mConditions.isXTDSignalOverBear || + mConditions.isXTDSignalCrossedOverBear)) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + (mConditions.isXFIOverZero || + mConditions.isXTSCurrentOverFarest)) + // + || + // + (mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // XSI Short ... + // Resolve Stop Outs ... + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTMBullish && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalOverBear && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) && + ( + // + (mConditions.isXLHHHIncreased && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + mConditions.isXCHMAMCFastCrossedOverSlow + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + mConditions.isXTSCurrentOverFarest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedOverMin && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCPeak && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDBearishVale && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + ( + // + mConditions.isXCHMAMCPeak + // + || + // + mConditions.isXCHMALCVale + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + mConditions.isXCHMAMCFastCrossedOverSlow + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMAMCFastCrossedOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // XSI Short ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + mConditions.isXCHMASCPeak + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + ((mConditions.isXTSAllSame && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTSCurrentCrossedUnderNearest + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXTSCurrentOverMediest + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXTSCurrentOverMediest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXTDBearishVale && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCFastCrossedOverSlow && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCFastCrossedOverSlow && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XSI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXRSICrossedUnderShortExit && + mConditions.isXRSICrossedUnderShortEntry) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHLHSameLLs && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMASCCrossedOverMin) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXTSCurrentOverFarest && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCVale && + mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalOverBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XSI Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XSI Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XSI Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XTSFI ... + + // + // Common Conditions ... + bool XTSFIHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double tsValues[] = { + mConditions.tsCurrents[1], + mConditions.tsNearests[1], + mConditions.tsMediests[1], + mConditions.tsFarests[1], + }; + + // + double tsMin = GetMin(tsValues); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + tsMin == mConditions.tsFarests[1] && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest) && + (mConditions.tsCurrents[1] < mConditions.tsNearests[1] || + mConditions.tsCurrents[1] < mConditions.tsMediests[1]) && + !(mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XTSFIHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XTSFIHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXAMAEndBearish && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) && + mConditions.isXCHLHSameHHs && + mConditions.isXLHLLIncreased && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCPeak && + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCOverMin && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXLHLLDecreased && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXTMNeutural || + mConditions.isXTMStartBullish) && + mConditions.isXLHHHDecreased && + (mConditions.isXAMANeutural || + mConditions.isXAMAStartBearish) && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCPeak && + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCPeak && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish)) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHMALCVale && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) && + mConditions.isXTMStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCPeak && + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMAStartBullish && + mConditions.isXFICrossedOverZero && + mConditions.isXTDBullCrossedOverBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // XTSFI Long ... + // Resolve Stop Outs ... + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBullish) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Neutural States ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXAMABearish + // + || + // + mConditions.isXAMANeutural + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check Bearish State ... + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTMBearish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check Bearish State ... + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTMBearish + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // XTSFI Long ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax) && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax) + // + || + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXFIUnderZero && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHLHSameHHs && + mConditions.isXTMEndBullish && + mConditions.isXCHMASCOverMax) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXAMANeutural && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXFIUnderZero && + mConditions.isXFICrossedUnderZero && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXRSICrossedOverLongExit && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBearish && + mConditions.isXCHMASCOverMax) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMABearish) && + ( + // + mConditions.isXTMEndBearish + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXAMAVale && + ( + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + mConditions.isXCHMAMCVale + // + || + // + mConditions.isXCHLHMCLCHHSame + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + ((mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXTDBearishVale) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + mConditions.isXTMBearish + // + || + // + mConditions.isXTMNeutural + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale) && + ( + // + (mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXTMEndBullish) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) && + ( + // + ( + mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXTDBullOverBear + // + || + // + mConditions.isXTDSignalUnderBear + // + || + // + mConditions.isXTDSignalCrossedUnderBear + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + ( + // + mConditions.isXLHPriceCrossedUnderSignal + // + || + // + (mConditions.isXAMANeutural && + ( + // + mConditions.isXTDSignalUnderBear + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Otherwise ... + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + mConditions.isXRSICrossedUnderShortExit + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXRSICrossedUnderShortExit) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBullish && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax && + mConditions.isXFICrossedUnderZero) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXTMEndBullish + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCOverMax && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + (mConditions.isXTDBearishVale && + ( + // + mConditions.isXTSCurrentCrossedOverNearest + // + || + // + mConditions.isXTSCurrentCrossedUnderMediest + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHLHMCLCHHSame && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCHHSame) + // + || + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + mConditions.isXTSCurrentCrossedOverNearest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXLHHHDecreased) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCUnderMin && + mConditions.isXFICrossedUnderZero && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXLHHHDecreased && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + || + // + ((mConditions.isXFIUnderZero && + mConditions.isXFICrossedUnderZero) && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + mConditions.isXTDSignalCrossedOverBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + mConditions.isXTDSignalCrossedUnderBear + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXCHMALCTrendsDown + // + ) + // + ) + // + || + // + ((mConditions.isXCHLHSameHHs && + mConditions.isXTDBearishVale) && + ( + // + mConditions.isXLHHHIncreased + // + || + // + mConditions.isXTSCurrentCrossedOverNearest + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) + // + || + // + (mConditions.isXAMAStartBullish && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + mConditions.isXCHLHSCMCHHSame + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // All Bearish ... + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCLLSame) && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + mConditions.isXTSCurrentCrossedOverNearest + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCLLSame) && + ( + // + mConditions.isXTMNeutural + // + || + // + mConditions.isXAMANeutural + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) && + ( + // + mConditions.isXAMANeutural + // + || + // + (mConditions.isXTMNeutural && + ( + // + (mConditions.isXAMABearish && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXTDBullCrossedUnderBear + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXTMEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTDBearishVale + // + || + // + mConditions.isXCHLHMCLCHHSame + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXCHMAMCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + || + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXTDBullUnderBear + // + || + // + mConditions.isXTDBullCrossedUnderBear + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTSCurrentUnderMediest) && + ( + // + ( + // + mConditions.isXTDSignalUnderBear + // + || + // + mConditions.isXTDBullCrossedUnderBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalCrossedUnderBear && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ( + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSameHHs && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSameHHs) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + ((mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXTDBullUnderBear + // + || + // + mConditions.isXTDBullCrossedUnderBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXCHMALCVale + // + || + // + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + (mConditions.isXCHMASCUnderMax || + mConditions.isXCHMASCCrossedUnderMax)) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXCHMASCFastCrossedOverSlow && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMBearish && + mConditions.isXTMStartBearish && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXAMAVale && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + (mConditions.isXAMABearish && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMStartBullish && + mConditions.isXCHMALCTrendsDown && + mConditions.isXFICrossedUnderZero && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXAMAStartBullish && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown) && + ( + // + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCHHSame) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDBullUnderBear) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCFastUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXLHHHDecreased + // + || + // + mConditions.isXFICrossedOverZero + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCUnderMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXTMEndBearish) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + mConditions.isXTDSignalCrossedUnderBear + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXFICrossedUnderZero) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXCHMAMCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) || + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish)) && + ( + // + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXFIUnderZero && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXFICrossedUnderZero) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTMEndBullish && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXTMEndBearish && + mConditions.isXLHHHIncreased && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXTDBullUnderBear + // + || + // + mConditions.isXTDBullCrossedUnderBear + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXTDBullUnderBear + // + || + // + mConditions.isXTDBullCrossedUnderBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) || + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish)) && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedUnderBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullCrossedUnderBear) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + mConditions.isXCHMAMCTrendsUp + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXTDBullUnderBear + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax) + // + || + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMALCTrendsUp) + // + ) + // + ) + // + || + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDBullCrossedUnderBear) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXAMAVale && + (mConditions.isXTMBearish || + mConditions.isXAMABearish) && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderMediest) && + ( + // + mConditions.isXTDBullCrossedUnderBear + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) && + ( + // + mConditions.isXTDBullOverBear + // + || + (mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXCHMAMCFastCrossedOverSlow && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame) + // + || + // + (mConditions.isXCHMASCOverMax && + mConditions.isXAMAStartBullish && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastOverSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameHHs && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDSignalUnderBear) && + ( + // + mConditions.isXTDBullUnderBear + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XTSFI ... + + // + // Common Conditions ... + bool XTSFIHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double tsValues[] = { + mConditions.tsCurrents[1], + mConditions.tsNearests[1], + mConditions.tsMediests[1], + mConditions.tsFarests[1], + }; + + // + double tsMax = GetMax(tsValues); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + tsMax == mConditions.tsFarests[1] && + (mConditions.isXTSCurrentUnderFarest || + mConditions.isXTSCurrentCrossedUnderFarest) && + (mConditions.tsCurrents[1] > mConditions.tsNearests[1] || + mConditions.tsCurrents[1] > mConditions.tsMediests[1]) && + !(mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XTSFIHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XTSFIHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXCHMASCTrendsDown + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (((mConditions.isXTMVale || + mConditions.isXTMNeutural) && + mConditions.isXAMANeutural) && + (mConditions.isXFIOverZero || + mConditions.isXFICrossedOverZero) && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBullish) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCPeak && + (mConditions.isXTMNeutural || + mConditions.isXTMEndBullish) && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + (mConditions.isXFIOverZero || + mConditions.isXFICrossedOverZero)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXAMANeutural && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) && + ( + // + mConditions.isXTMNeutural + // + || + // + (mConditions.isXTMBullish && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + (mConditions.isXTMBullish || + mConditions.isXTMStartBullish) && + mConditions.isXAMABullish && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDBullCrossedOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXFICrossedOverZero && + mConditions.isXTDBullCrossedOverBear) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXFIOverZero && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBullish || + mConditions.isXTMStartBullish) && + (mConditions.isXAMABullish || + mConditions.isXAMAStartBullish) && + (mConditions.isXFIOverZero || + mConditions.isXFICrossedOverZero) && + mConditions.isXCHLHSameLLs) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedUnderFarest) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) && + ( + // + mConditions.isXTSCurrentUnderNearest + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXFIOverZero && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + mConditions.isXOBDSwingLow + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + mConditions.isXCHMALCPeak + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXFIOverZero && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXFIOverZero && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXFICrossedOverZero) + // + || + // + (mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame && + (mConditions.isXTMNeutural || + mConditions.isXTMEndBearish)) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXTMStartBearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCVale) && + ( + // + mConditions.isXLHPriceCrossedUnderSignal + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXTMBullish || + mConditions.isXTMNeutural || + mConditions.isXTMStartBullish) && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + (mConditions.isXTMStartBullish || + mConditions.isXTMEndBullish)) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXFIOverZero && + mConditions.isXTMEndBearish && + mConditions.isXFICrossedOverZero) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentOverMediest) && + ( + // + mConditions.isXLHHHDecreased + // + || + // + mConditions.isXTSCurrentCrossedOverMediest + // + || + // + (mConditions.isXTMVale && + mConditions.isXTMNeutural && + mConditions.isXAMAVale && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXFIOverZero && + mConditions.isXTMEndBearish && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDSignalUnderBear) && + ( + // + mConditions.isXTDBullCrossedUnderBear + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHHHIncreased && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + (mConditions.isXCHLHMCLCHHSame && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXTMStartBearish) + // + || + // + ((mConditions.isXTMNeutural || + mConditions.isXTMEndBearish) && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBearish)) + // + || + // + (mConditions.isXTMVale && + mConditions.isXCHMAMCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXTMEndBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXLHHHDecreased && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXAMAVale && + mConditions.isXCHMALCPeak) && + ( + // + mConditions.isXTMNeutural + // + || + // + (mConditions.isXTMVale && + mConditions.isXTMEndBearish && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + || + // + (mConditions.isXTMVale && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverMediest) && + ( + // + mConditions.isXCHMAMCTrendsDown + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTMBullish) + // + || + // + (mConditions.isXAMAVale && + (mConditions.isXTMNeutural || + mConditions.isXTMEndBearish)) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXFIOverZero && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXAMABullish && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHHHDecreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish || + mConditions.isXTMStartBullish) + // + && + // + (mConditions.isXAMABullish || + mConditions.isXAMAStartBullish)) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMBullish || + mConditions.isXTMStartBullish) && + (mConditions.isXAMABullish || + mConditions.isXAMAStartBullish) && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest)) + // + )) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTMStartBearish) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameLLs) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // XTSFI Short ... + // Resolve Stop Outs ... + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCFastCrossedOverSlow && + ( + // + (mConditions.isXAMANeutural && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXTMNeutural) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXFIOverZero && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXLHHHIncreased && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Current Over Mediest ... + (mConditions.isXTSCurrentOverMediest && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXAMABullish && + ( + // + mConditions.isXTDBullOverBear + // + || + // + mConditions.isXTDBullCrossedOverBear + // + ) + // + ) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXFICrossedOverZero) && + ( + // + mConditions.isXCHMASCUnderMin + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + mConditions.isXAMAVale && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale) && + ( + // + (mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentCrossedUnderFarest) + // + || + // + (mConditions.isXCHMASCOverMin && + mConditions.isXCHMASCUnderMax && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXLHLLIncreased && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXFIUnderZero && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentUnderFarest) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) + // + || + // + mConditions.isXTSCurrentCrossedOverMediest + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHLHMCLCLLSame && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXAMABearish && + mConditions.isXTMStartBearish && + mConditions.isXCHMALCTrendsDown) + // + || + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + || + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXCHMASCUnderMin && + ( + // + mConditions.isXAMAVale + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXLHLowAttachedLL + // + || + // + mConditions.isXTSCurrentCrossedUnderNearest + // + || + // + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXLHLowAttachedLL) + // + || + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // XTSFI Short ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXAMANeutural && + ( + // + mConditions.isXTMBullish + // + || + // + mConditions.isXTMStartBullish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXAMANeutural && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXCHMASCUnderMin && + mConditions.isXFICrossedUnderZero) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXTMBullish + // + || + // + mConditions.isXTMStartBullish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + (mConditions.isXAMAVale && + ( + // + mConditions.isXTMNeutural + // + || + // + mConditions.isXTMEndBullish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTMStartBearish && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXTMNeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + mConditions.isXCHLHSCMCLLSame + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXAMAEndBearish && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXFIUnderZero && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXFIUnderZero && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXFICrossedUnderZero && + mConditions.isXTDBullCrossedUnderBear) && + ( + // + mConditions.isXCHMAMCVale + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // XTD Bearish ... + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXTMNeutural + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMStartBearish && + ( + // + mConditions.isXAMANeutural + // + || + // + mConditions.isXAMAStartBearish + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMALCPeak && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXFIOverZero && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMABullish && + mConditions.isXTMNeutural) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXAMABullish && + mConditions.isXTMNeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXFIOverZero) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXCHMALCVale + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + ((mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXAMANeutural && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + mConditions.isXTMStartBearish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + ( + // + (mConditions.isXAMANeutural && + ( + // + mConditions.isXCHMAMCVale + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + mConditions.isXTMStartBearish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXTMStartBearish) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMEndBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXFIOverZero && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXAMANeutural && + ( + // + mConditions.isXTMBullish + // + || + // + mConditions.isXTMStartBullish + // + ) + // + ) + // + || + // + (mConditions.isXAMAVale && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXTMVale + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXFIOverZero && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXAMANeutural + // + || + // + mConditions.isXAMAEndBearish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTMVale && + mConditions.isXTMEndBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // All Other Wises ... + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXFIOverZero && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXTDSignalOverBear + // + || + // + mConditions.isXTDSignalCrossedOverBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCCrossedUnderMin) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + (mConditions.isXAMAVale && + ( + // + mConditions.isXTMVale + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXLHPriceCrossedUnderSignal && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXTMVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Other Wises ... + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXRSICrossedOverLongEntry + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXLHLLIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + mConditions.isXAMAVale + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XTSFI Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTSCurrentCrossedOverMediest + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCFastCrossedOverSlow) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTMEndBullish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXAMAStartBearish && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCVale) && + ( + // + mConditions.isXCHLHSCMCLLSame + // + || + // + mConditions.isXCHMASCUnderMin + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCUnderMin && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXFIOverZero && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXAMAStartBearish && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXCHMASCCrossedUnderMax && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTDBullOverBear + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBullish && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTDBullOverBear + // + || + // + mConditions.isXCHLHSCMCLLSame + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMASCUnderMin && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXRSICrossedUnderShortExit) + // + || + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + (mConditions.isXCHMALCTrendsDown && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMASCFastCrossedOverSlow && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXAMAVale && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + mConditions.isXCHMALCPeak + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXFICrossedOverZero && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCFastOverSlow && + ( + // + (mConditions.isXTMVale && + mConditions.isXCHMASCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + mConditions.isXCHMASCUnderMin + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs && + mConditions.isXLHHHDecreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXFICrossedOverZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXTSCurrentCrossedOverMediest + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMASCFastOverSlow) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCFastOverSlow && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCFastOverSlow && + ( + // + (mConditions.isXTMBullish && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCTrendsUp) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs && + mConditions.isXLHHHDecreased) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameLLs && + mConditions.isXTDSignalVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXCHMAMCFastOverSlow && + ( + // + (mConditions.isXCHMAMCTrendsUp && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTMEndBullish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXAMABullish && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXLHLLDecreased && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMNeutural && + ( + // + mConditions.isXAMANeutural + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXLHPriceCrossedOverSignal && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + mConditions.isXLHPriceCrossedOverSignal + // + || + // + (mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTMEndBullish && + mConditions.isXTDBearishVale) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHIncreased && + mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHLHMCLCLLSame) + // + || + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMASCUnderMin && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverMediest && + mConditions.isXRSICrossedOverLongEntry) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + ((mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSameLLs && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMAMCVale && + !mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBullishVale && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullUnderBear) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMASCFastCrossedUnderSlow && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXTMNeutural && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXAMABearish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXTMEndBearish && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXCHMASCCrossedOverMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXRSICrossedUnderShortExit) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXCHMAMCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest) && + ( + // + mConditions.isXTDSignalCrossedOverBear + // + || + // + (mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXTDSignalOverBear) && + ( + // + mConditions.isXLHPriceCrossedOverSignal + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XTSFI Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XTSFI Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XTSFI Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XOBDLH ... + + // + // Common Conditions ... + bool XOBDLHHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + X5MarketConditions mConditions2; + GetMarketConditions( + mConditions, + 2 // + ); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions2.isXOBDSwingLow && + mConditions2.isXLHLowAttachedLL && + mConditions.lhLls[1] >= mConditions.lhLls[2] + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + false, // XOBD + false // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XOBDLHHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XOBDLHHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXTMVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame) + // + || + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) + // + || + // + ((mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXLHLowAttachedLL + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCPeak && + mConditions.isXTMEndBearish && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCLLSame) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTSAllSame && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHLHSameLLs) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCTrendsUp && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + // XOBDLH Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMAMCVale) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastUnderSlow) && + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastUnderSlow)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XOBDLH ... + + // + // Common Conditions ... + bool XOBDLHHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + X5MarketConditions mConditions2; + GetMarketConditions( + mConditions, + 2 // + ); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions2.isXOBDSwingHigh && + mConditions2.isXLHHighAttachedHH && + mConditions.lhHhs[1] <= mConditions.lhHhs[2] + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + false, // XOBD + false // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XOBDLHHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XOBDLHHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCCrossedUnderMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsUp) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullOverBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTMEndBullish && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTMEndBullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXFIOverZero && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXFIOverZero && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMALCTrendsUp) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastOverSlow) && + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastOverSlow)) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBullish && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHMALCTrendsUp && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear) && + (mConditions.isXTSAllSame && + mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMALCFastUnderSlow)) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHHHIncreased && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMASCTrendsDown) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XOBDLH Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XOBDLH Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XCHMACC ... + + // + // Common Conditions ... + bool XCHMACCHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.chmaScFasts[1] > mConditions.chmaScSlows[1] && + mConditions.chmaMcFasts[1] > mConditions.chmaMcSlows[1] && + mConditions.chmaLcFasts[1] > mConditions.chmaLcSlows[1] && + // + mConditions.chmaScFasts[2] > mConditions.chmaScSlows[2] && + mConditions.chmaMcFasts[2] > mConditions.chmaMcSlows[2] && + mConditions.chmaLcFasts[2] > mConditions.chmaLcSlows[2] && + // + !( + // + mConditions.chmaScFasts[3] > mConditions.chmaScSlows[3] && + mConditions.chmaMcFasts[3] > mConditions.chmaMcSlows[3] && + mConditions.chmaLcFasts[3] > mConditions.chmaLcSlows[3] + // + ) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XCHMACCHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XCHMACCHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTDSignalCrossedUnderBear)) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTMStartBullish && + mConditions.isXFICrossedUnderZero) + // + || + // + ( + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + ) + // + ) + // + )) + // + || + // + (((mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXFICrossedUnderZero) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear)) + // + && + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXCHMALCTrendsDown + // + || + // + (mConditions.isXCHLHMCLCHHSame && + (mConditions.isXTDSignalUnderBear || + mConditions.isXTDSignalCrossedUnderBear)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXAMAVale && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish && + mConditions.isXFICrossedUnderZero) + // + || + // + ((mConditions.isXAMANeutural || + mConditions.isXAMAEndBearish) && + mConditions.isXTMStartBullish && + mConditions.isXFICrossedOverZero) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXAMABearish && + (mConditions.isXTMNeutural || + mConditions.isXTMBearish)) && + mConditions.isXTSCurrentUnderMediest && + (mConditions.isXTDBullCrossedUnderBear || + (mConditions.isXTDBullUnderBear && + mConditions.isXFICrossedUnderZero))) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + (mConditions.isXAMABearish && + mConditions.isXTDBullCrossedOverBear) + // + || + // + (mConditions.isXTMStartBullish && + ( + // + ( + // + mConditions.isXAMAStartBullish + // + || + // + (mConditions.isXAMAEndBearish && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + (mConditions.isXLHLLDecreased && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXTSCurrentMax && + (mConditions.isXTMBullish || + mConditions.isXTMStartBullish) && + (mConditions.isXAMABullish || + mConditions.isXAMAStartBullish) && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + mConditions.isXTDBearishVale + // + || + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXFIUnderZero && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsDown)) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + ( + // + mConditions.isXCHMALCTrendsDown + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ( + mConditions.isXTDSignalUnderBear && + ( + // + mConditions.isXTSAllSame + // + || + // + ((mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest)) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal && + (mConditions.isXCHMAMCTrendsDown && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow))) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCPeak && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + (mConditions.isXCHMALCTrendsDown && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameHHs && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest) + // + || + // + ( + (mConditions.isXAMABullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ( + (mConditions.isXCHMAMCTrendsDown && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + || + (mConditions.isXLHLLDecreased && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + )) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHLHSameHHs && + (mConditions.isXTSCurrentUnderNearest || + mConditions.isXTSCurrentCrossedUnderNearest) && + (mConditions.isXTSCurrentUnderMediest || + mConditions.isXTSCurrentCrossedUnderMediest)) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXTMEndBullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCTrendsDown && + ( + // + (((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax) && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedOverZero) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXTMEndBullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTSCurrentUnderNearest + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCTrendsDown && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + (mConditions.isXTSCurrentMin || + mConditions.isXTSCurrentMax)) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXLHLLIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased) + // + || + // + ((mConditions.isXCHMASCVale && + mConditions.isXTMBearish) && + ( + // + mConditions.isXAMABearish + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + mConditions.isXTDSignalCrossedOverBear + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXAMAEndBullish && + !mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentCrossedUnderFarest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXTSCurrentUnderFarest + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + !mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXTMStartBullish && + mConditions.isXTDBullCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMax) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCVale) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXAMAStartBullish + // + || + // + (mConditions.isXLHLLDecreased && + mConditions.isXTDBullCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXTMStartBullish) + // + || + // + ((mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCOverMin && + mConditions.isXTMStartBullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXTMStartBullish + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXTSCurrentUnderFarest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXAMANeutural && + ( + // + mConditions.isXTMNeutural + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTMStartBullish) + // + ) + // + ) + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXFICrossedUnderZero) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBearishVale && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + || + // + (mConditions.isXTDBearishVale && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCPeak && + mConditions.isXLHLLDecreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBearishVale && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCPeak && + mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXCHMASCOverMax) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHHighAttachedHH && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXLHPriceCrossedOverSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTDSignalOverBear && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTDSignalCrossedOverBear) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBullUnderBear && + ( + // + mConditions.isXRSICrossedOverLongExit + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHLHSCMCHHSame && + ( + // + mConditions.isXTDBullCrossedOverBear + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCCrossedOverMax) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXCHMALCPeak && + ( + // + mConditions.isXCHLHSameHHs + // + || + // + mConditions.isXLHLLIncreased + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTSCurrentMax && + ( + // + mConditions.isXTDSignalUnderBear + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear) && + ( + // + (mConditions.isXAMABullish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTMStartBullish && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCOverMax && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // All Bullish ... + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + mConditions.isXTSCurrentUnderMediest + // + || + // + mConditions.isXTSCurrentCrossedUnderNearest + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow ... + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHMASCOverMax && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXRSICrossedOverLongExit) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXRSICrossedOverLongExit) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTDBearishVale && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + ((mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + // XCHMACC Longs ... + // Guard Attacks Resolves ... + || + // + ( + // + (mConditions.isXTSCurrentUnderNearest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + mConditions.isXTSCurrentCrossedUnderNearest + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentCrossedUnderNearest && + ( + // + (mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXCHMASCCrossedOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderMediest && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + mConditions.isXTMNeutural + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullUnderBear && + ( + // + (mConditions.isXTDSignalUnderBear && + ( + // + (mConditions.isXCHMASCFastOverSlow && + (mConditions.isXCHMASCTrendsDown || + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown))) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalUnderBear && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax) && + ( + // + mConditions.isXLHPriceCrossedOverSignal + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCOverMax) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHMCLCHHSame) && + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMALCPeak) && + ( + // + mConditions.isXTMStartBullish + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear) && + ( + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal) + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow && + (mConditions.isXCHMAMCTrendsDown || + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown))) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + mConditions.isXLHPriceCrossedOverSignal + // + || + // + ((mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDBullCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentUnderFarest && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXFICrossedUnderZero) + // + ) + // + ) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXFICrossedUnderZero) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax) && + ( + // + (mConditions.isXTDBearishVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTMEndBullish && + mConditions.isXLHHHDecreased && + mConditions.isXTDSignalCrossedOverBear) + // + || + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + mConditions.isXCHMASCPeak + // + || + // + mConditions.isXCHMALCPeak + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXLHHighAttachedHH) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLIncreased && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMax && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedOverBear) + // + || + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMASCOverMin && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDSignalCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXRSICrossedOverLongExit) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXCHMALCPeak + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedOverBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCOverMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + mConditions.isXCHLHMCLCHHSame + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + mConditions.isXRSICrossedOverLongExit + // + || + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XCHMACC ... + + // + // Common Conditions ... + bool XCHMACCHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.chmaScFasts[1] < mConditions.chmaScSlows[1] && + mConditions.chmaMcFasts[1] < mConditions.chmaMcSlows[1] && + mConditions.chmaLcFasts[1] < mConditions.chmaLcSlows[1] && + // + mConditions.chmaScFasts[2] < mConditions.chmaScSlows[2] && + mConditions.chmaMcFasts[2] < mConditions.chmaMcSlows[2] && + mConditions.chmaLcFasts[2] < mConditions.chmaLcSlows[2] && + // + !( + // + mConditions.chmaScFasts[3] < mConditions.chmaScSlows[3] && + mConditions.chmaMcFasts[3] < mConditions.chmaMcSlows[3] && + mConditions.chmaLcFasts[3] < mConditions.chmaLcSlows[3] + // + ) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong(mConditions) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XCHMACCHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XCHMACCHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXFIOverZero && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) && + ( + // + (mConditions.isXAMAStartBearish && + mConditions.isXFICrossedOverZero) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + ( + // + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXLHLLIncreased && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverNearest) + // + || + // + (((mConditions.isXTMNeutural || + mConditions.isXTMEndBearish) && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish)) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXCHMALCTrendsUp && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + ((mConditions.isXTMEndBearish || + mConditions.isXTMNeutural) && + (mConditions.isXAMABearish || + mConditions.isXAMANeutural) && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + || + // + ((mConditions.isXTMNeutural || + mConditions.isXTMEndBearish) && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBearish) && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMABearish && + mConditions.isXTMEndBearish && + mConditions.isXTDBullOverBear) && + ( + // + mConditions.isXCHLHSCMCLLSame + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + ( + // + mConditions.isXCHMALCTrendsDown + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXFICrossedUnderZero && + mConditions.isXTDBullCrossedUnderBear) + // + || + // + (mConditions.isXCHMALCTrendsUp && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXFICrossedUnderZero && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCTrendsDown && + mConditions.isXTSCurrentOverNearest) + // + || + // + (mConditions.isXCHMALCVale && + (mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverFarest || + mConditions.isXTSCurrentCrossedOverFarest)) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp) + // + || + // + ((mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHMASCVale) + // + || + // + ((mConditions.isXCHLHSameLLs && + mConditions.isXLHHHIncreased && + mConditions.isXLHLowAttachedLL) && + ( + // + mConditions.isXCHMAMCTrendsDown + // + || + // + mConditions.isXCHMASCCrossedUnderMin + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTDBullCrossedUnderBear) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) + // + || + // + (mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMEndBearish && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCVale && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverMediest) + // + || + // + (mConditions.isXFIUnderZero && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXFIOverZero && + mConditions.isXTMStartBullish && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBullish && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullishVale && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCOverMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest) + // + || + // + ((mConditions.isXTMNeutural || + mConditions.isXTMEndBearish) && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBearish) && + mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXFIOverZero && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHMALCTrendsUp && + mConditions.isXAMAStartBearish) + // + || + // + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXAMAEndBullish && + mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Otherwises ... + (mConditions.isXTDBullOverBear && + ( + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMASCUnderMin) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTMStartBearish) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXLHHHIncreased && + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + mConditions.isXTSCurrentMin + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMStartBearish && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMABullish && + mConditions.isXTMStartBearish && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXTSCurrentMax + // + || + // + mConditions.isXCHMASCCrossedUnderMin + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + mConditions.isXTSCurrentCrossedOverNearest + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLLSameInLength && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXFIOverZero && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Under Signal ... + // Other wises ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price In Signal Range ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Stop Outs ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + || + // + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTDBullCrossedUnderBear) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXCHLHMCLCLLSame) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price In Signal Range ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTMStartBearish && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + (mConditions.isXTSAllSame || + mConditions.isXTSCurrentMin)) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Under Signal ... + // All TM/AMA Bullish ... + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBearish && + ( + // + mConditions.isXAMANeutural + // + || + // + (mConditions.isXAMABearish && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHLHMCLCLLSame && + ( + // + (mConditions.isXAMAStartBearish && + ( + // + mConditions.isXTMStartBearish + // + || + // + mConditions.isXTSCurrentUnderMediest + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ( + mConditions.isXTSCurrentMax && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentMax && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXTMStartBearish) && + (mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish)) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXTMStartBearish && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // Both HH and LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXFIOverZero && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((!mConditions.isXCHMALCTrendsUp && + !mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLIncreased && + mConditions.isXLHPriceCrossedUnderSignal && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXFIOverZero && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // LL Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTSAllSame && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXTSCurrentCrossedUnderFarest) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + || + // + ((!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSAllSame && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMASCUnderMin && + (mConditions.isXCHLHSameLLs || + mConditions.isXCHLHSCMCLLSame)) && + ( + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price In Signal Range ... + // All Neutural ... + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXLHHHIncreased) + // + || + // + (mConditions.isXTSCurrentCrossedOverNearest && + ( + // + ((mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCLLSame) && + ( + // + (mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + ( + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + (mConditions.isXLHLowAttachedLL && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + mConditions.isXCHLHSCMCLLSame + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + mConditions.isXTDBullCrossedUnderBear + // + || + // + mConditions.isXLHPriceCrossedUnderSignal + // + || + // + (!mConditions.isXCHMASCTrendsUp && + !mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTSCurrentCrossedOverMediest && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXAMABearish && + mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHLHSCMCLLSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Under Signal ... + // Otherwises ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDSignalOverBear && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + ((mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + ((!mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + ( + // + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + ( + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price In Signal Range ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Under Signal ... + // All Bearish ... + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTSCurrentOverMediest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Over Signal ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if SC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if MC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // Resolve Guard Attacks ... + // not LL and HH Same In Length ... + // Price Free ... + // Check if LC Fast Under Slow But Trends Down ... + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTDBullCrossedUnderBear && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverNearest) + // + || + // + ((mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear) && + ( + // + mConditions.isXTSCurrentCrossedUnderFarest + // + || + // + (mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXLHLowAttachedLL && + mConditions.isXRSICrossedUnderShortExit) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMax && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXLHLowAttachedLL && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMASCTrendsUp && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsUp) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXAMABullish && + mConditions.isXTDBullOverBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentOverNearest && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + // XCHMA Shorts ... + // Resolve Guard Attacks ... + || + // + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTSCurrentCrossedOverNearest && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXCHMALCVale && + mConditions.isXAMAEndBullish) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + (mConditions.isXAMABullish || + mConditions.isXAMAStartBullish)) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow && + (mConditions.isXCHMAMCTrendsDown || + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown))) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + (mConditions.isXTDSignalCrossedOverBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTMStartBearish && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) || + (mConditions.isXTMEndBearish && + mConditions.isXAMAEndBearish)) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCVale && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMAStartBearish && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMAMCPeak && + mConditions.isXTMEndBearish && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullOverBear && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + mConditions.isXLHHHIncreased + // + || + // + (mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMASCUnderMin && + mConditions.isXLHPriceInSignalRange) && + ( + // + mConditions.isXTSAllSame + // + || + // + (mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin) && + ( + // + mConditions.isXTSCurrentMin + // + || + // + mConditions.isXTSCurrentOverFarest + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow && + (mConditions.isXCHMAMCTrendsDown || + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown))) && + ( + // + ((mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin) && + ( + // + (mConditions.isXTDBullishVale && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXTDSignalVale && + ( + // + mConditions.isXCHLHSameLLs + // + || + // + mConditions.isXCHLHMCLCHHSame + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXAMAEndBullish + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXLHHHIncreased && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXLHHHIncreased && + mConditions.isXTMStartBearish && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceOverSignal && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTMEndBearish && + mConditions.isXTSCurrentMin && + mConditions.isXLHHHIncreased && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXRSICrossedUnderShortExit && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalVale && + mConditions.isXTDBullishVale) + // + ) + // + ) + // + || + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXCHMASCUnderMin + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTDBullCrossedOverBear && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHLLDecreased && + mConditions.isXCHMASCUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXTSCurrentCrossedUnderNearest) && + ( + // + (mConditions.isXLHLLDecreased && + ( + // + (mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL) + // + || + // + (mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHHHSameInLength && + mConditions.isXLHLLSameInLength && + mConditions.isXLHPriceInSignalRange) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedOverFarest) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverNearest) + // + || + // + ((mConditions.isXCHMAMCVale && + !mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverMediest && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTSCurrentOverFarest && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTDBearishVale && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + || + // + (((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest)) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXAMABullish && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame) + // + || + // + ((mConditions.isXAMANeutural || + mConditions.isXAMAEndBullish) && + (mConditions.isXTMStartBearish) && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHLHMCLCHHSame && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + mConditions.isXAMANeutural + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDBullOverBear && + (mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest)) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHMASCUnderMin) + // + || + // + ((mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + (mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXRSICrossedUnderShortExit) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHMASCUnderMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedUnderSignal) + // + || + // + ((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCUnderMin && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXRSICrossedUnderShortExit) + // + || + // + ((mConditions.isXTSCurrentOverNearest || + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXCHLHMCLCHHSame) && + ( + // + (mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedOverZero) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCUnderMin && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + mConditions.isXRSICrossedUnderShortExit + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) + // + || + // + (mConditions.isXTDBullOverBear && + (mConditions.isXTSCurrentOverMediest || + mConditions.isXTSCurrentCrossedOverMediest)) + // + || + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXLHLowAttachedLL && + mConditions.isXCHMASCCrossedUnderMin) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + ((mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMACC Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMACC Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMACC Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XCHMAMN ... + + // + // Common Conditions ... + bool XCHMAMNHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedOverMin && + mConditions.chmaScFasts[2] < nonSCMin2 && + mConditions.chmaScSlows[2] < nonSCMin2 + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XCHMAMNHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XCHMAMNHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) && + ( + // + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMAMCVale && + mConditions.isXCHLHMCLCLLSame) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased && + mConditions.isXTMStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXLHHHDecreased && + mConditions.isXLHLLDecreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + (((mConditions.isXTMVale || + mConditions.isXTMNeutural) && + mConditions.isXTMEndBearish) && + (mConditions.isXAMANeutural || + mConditions.isXAMAEndBearish) && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXLHLLDecreased && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + // LC Vale ... + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + mConditions.isXCHMASCTrendsDown + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXLHLLIncreased && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + ((mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp && + (mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow)) && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) && + ( + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale) && + ( + // + mConditions.isXCHMAMCVale + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXLHHHDecreased && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXCHLHMCLCLLSame) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest) + // + || + // + (mConditions.isXCHMALCVale && + ( + // + mConditions.isXCHMASCTrendsDown + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale) + // + || + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTMStartBullish && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMALCTrendsDown && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + (mConditions.isXCHLHMCLCHHSame || + mConditions.isXCHLHMCLCLLSame) && + mConditions.isXTSCurrentUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) && + ( + // + mConditions.isXCHMALCVale + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + ((mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + (mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullUnderBear) + // + ) + // + ) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDSignalUnderBear) + // + || + // + mConditions.isXCHMASCTrendsDown + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // LC Vale ... + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXCHMAMCVale && + ( + // + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Under Slow ... + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCTrendsUp && + ( + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXTDSignalUnderBear + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp) + // + || + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXLHHHIncreased && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXCHMASCFastCrossedOverSlow && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHHighAttachedHH && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Under Slow ... + ((mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow) && + ( + // + (mConditions.isXCHMALCTrendsUp && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) || + (mConditions.isXTMEndBullish && + mConditions.isXAMAEndBullish)) && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDSignalUnderBear) + // + || + // + (mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedOverBear) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXCHMASCFastCrossedUnderSlow && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXAMAVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXTDSignalCrossedOverBear && + mConditions.isXTSCurrentCrossedOverNearest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXLHLLIncreased && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow)) && + ( + // + (mConditions.isXTDSignalVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullishVale && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow)) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax && + mConditions.isXTDSignalUnderBear) && + ( + // + mConditions.isXLHPriceCrossedOverSignal + // + || + // + (mConditions.isXTDBullUnderBear && + mConditions.isXCHMASCFastCrossedOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverNearest) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXTSCurrentMax && + mConditions.isXCHMASCTrendsDown) + // + || + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXTSCurrentMax) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedUnderNearest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverFarest && + mConditions.isXTSCurrentCrossedOverMediest) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXAMAStartBullish && + mConditions.isXTDBullUnderBear && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + ((mConditions.isXCHMASCPeak && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastOverSlow) && + ( + // + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXTSCurrentMax && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedOverFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCVale && + mConditions.isXTSCurrentMax && + mConditions.isXLHHHDecreased && + mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMax && + mConditions.isXTMStartBullish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullOverBear && + mConditions.isXAMAStartBullish && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCFastUnderSlow && + mConditions.isXCHMALCFastUnderSlow && + mConditions.isXLHPriceCrossedOverSignal && + mConditions.isXTSCurrentCrossedOverMediest) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + ((mConditions.isXCHMALCVale && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XCHMAMN ... + + // + // Common Conditions ... + bool XCHMAMNHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedUnderMin && + mConditions.chmaScFasts[2] > nonSCMin2 && + mConditions.chmaScSlows[2] > nonSCMin2 + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XCHMAMNHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XCHMAMNHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMBearish || + mConditions.isXTMNeutural) && + mConditions.isXAMANeutural && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXLHLLIncreased && + mConditions.isXTSCurrentOverNearest) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) && + ( + // + (mConditions.isXFIOverZero && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + mConditions.isXAMANeutural && + mConditions.isXAMAEndBullish && + mConditions.isXTMStartBearish) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentOverMediest && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXFICrossedUnderZero && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + mConditions.isXRSICrossedUnderShortExit + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTSCurrentOverFarest && + (mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow)) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMAStartBearish) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCVale && + mConditions.isXCHMALCVale && + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow))) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTMEndBearish && + mConditions.isXTSCurrentOverMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if SC Fast Over Slow ... + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXTSAllSame && + mConditions.isXAMABearish && + mConditions.isXLHLLDecreased && + mConditions.isXCHMALCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXFIOverZero && + mConditions.isXTDBullOverBear && + mConditions.isXFICrossedOverZero) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMASCTrendsDown) + // + || + // + (mConditions.isXCHMAMCVale && + mConditions.isXCHMAMCTrendsDown) + // + || + // + (mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + || + // + (mConditions.isXTMVale && + mConditions.isXAMAVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCFastOverSlow && + mConditions.isXTSCurrentOverNearest) + // + || + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCCrossedUnderMin && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMN Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMN Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XCHMAMX ... + + // + // Common Conditions ... + bool XCHMAMXHasLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedOverMax && + mConditions.chmaScFasts[2] < nonSCMax2 && + mConditions.chmaScSlows[2] < nonSCMax2 && + MathAbs(nonSCMax2 - mConditions.chmaScFasts[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) && + MathAbs(nonSCMax2 - mConditions.chmaScSlows[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForLong( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XCHMAMXHasSpecifiedLongSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XCHMAMXHasLongSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCPeak && + ( + // + (mConditions.isXCHMALCTrendsDown && + ( + // + ( + // + mConditions.isXCHMASCPeak + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSameHHs && + mConditions.isXLHHighAttachedHH && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (((mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow) && + (mConditions.isXCHMALCFastUnderSlow || + mConditions.isXCHMALCFastCrossedUnderSlow)) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXLHPriceCrossedOverSignal) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + || + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + || + // + (((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMALCTrendsDown) || + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown) || + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown)) && + ( + // + (mConditions.isXCHMAMCPeak + // + || + // + mConditions.isXRSICrossedOverLongExit) + // + || + // + ((mConditions.isXCHMAMCFastUnderSlow || + mConditions.isXCHMAMCFastCrossedUnderSlow) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMEndBullish && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentUnderNearest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMax && + mConditions.isXTDBearishVale && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMASCFastCrossedOverSlow && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow)) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTMStartBearish && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTDBearishVale && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentUnderFarest && + mConditions.isXTSCurrentUnderMediest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ( + mConditions.isXCHMAMCPeak && + ( + // + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && + ( + // + (mConditions.isXTSCurrentMax && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) + // + ) + // + ) + // + ) + // + ) + // + )) + // + ) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Long ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Long ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // XCHMAMX ... + bool XCHMAMXHasShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + double nonSC2[] = { + mConditions.chmaMcFasts[2], + mConditions.chmaMcSlows[2], + mConditions.chmaLcFasts[2], + mConditions.chmaLcSlows[2], + }; + + // + double nonSCMax2 = GetMax(nonSC2); + double nonSCMin2 = GetMax(nonSC2); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + // each Strategy must has a Base Conditions, which they are usually common combinations + // of Market Properties that must be happens to lookup for signals ... + ( + // + mConditions.isXCHMASCCrossedUnderMax && + mConditions.chmaScFasts[2] > nonSCMax2 && + mConditions.chmaScSlows[2] > nonSCMax2 + // + ) + // + && + // + // Next Step is combine sorts of Conditions which make our choice + // so Exact in Market ... + ( + // + IsReadyForShort( + mConditions, + true, // XCHMA Min + true, // XCHMA Max + false, // XCHMA Cycles + false, // XCHMA Peaks + false, // XCHMA Trend Powers + true, // XOBD + true // XTS + ) + // + ) + // + ; + + // + return result; + } + + // + // Symbol and Type Specific Conditions ... + bool XCHMAMXHasSpecifiedShortSignal( + X5MarketConditions &mConditions // + ) + { + // + bool result = false; + + // + // Check Common Signal Conditions ... + result = XCHMAMXHasShortSignal(mConditions); + if (!result) + { + return result; + } + + // + // Validate Symbol ... + result = IsValidSymbolPeriod(); + if (!result) + { + return result; + } + + // + // Now We Can Filter Conditions based on Each Supported Symbol + // since we are in Correct Period ... + // NOTE: since base Common Conditions Checked Before, + // there is no need to double check them ... + + // + bool isEURUSD = IsEURUSD(); + if (isEURUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXCHMASCVale && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin) + // + || + // + (((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + (mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverFarest) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXLHHHIncreased && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak) && + ( + // + (mConditions.isXTMVale && + mConditions.isXAMAVale) + // + || + // + (mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHMAMCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXCHMAMCPeak && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXLHHHDecreased && + mConditions.isXTMStartBearish && + mConditions.isXCHMALCTrendsUp && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + mConditions.isXCHMALCPeak + // + || + // + (mConditions.isXTSAllSame && + mConditions.isXAMAEndBullish && + mConditions.isXTMStartBearish && + mConditions.isXTDBullOverBear && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow)) && + ( + // + ( + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXCHLHSameLLs && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL && + ((mConditions.isXCHMASCFastOverSlow || + mConditions.isXCHMASCFastCrossedOverSlow) && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + (mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow))) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMAMCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHMAMCTrendsUp) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp && + (mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow)) + // + || + // + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMASCVale && + mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMBearish && + mConditions.isXCHMAMCPeak && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + mConditions.isXTSCurrentOverFarest + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMALCTrendsDown) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXAMANeutural && + mConditions.isXTMStartBearish) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMASCTrendsUp && + (mConditions.isXCHMASCFastUnderSlow || + mConditions.isXCHMASCFastCrossedUnderSlow)) && + ( + // + (mConditions.isXFIUnderZero && + (mConditions.isXTMBearish || + mConditions.isXTMStartBearish) && + (mConditions.isXAMABearish || + mConditions.isXAMAStartBearish) && + (mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear)) + // + ) + // + ) + // + ) + // + ) + // + || + // + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + || + // + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + false + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDJPY = IsUSDJPY(); + if (isUSDJPY) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isUSDCHF = IsUSDCHF(); + if (isUSDCHF) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check LC Fast Over Slow ... + ((mConditions.isXCHMALCFastOverSlow || + mConditions.isXCHMALCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHLHSameLLs && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXLHLowAttachedLL) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + (mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMASCFastOverSlow) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + // Check if MC Fast Over Slow ... + ((mConditions.isXCHMAMCFastOverSlow || + mConditions.isXCHMAMCFastCrossedOverSlow) && + ( + // + (mConditions.isXCHMALCFastOverSlow && + ( + // + (mConditions.isXTSAllSame && + mConditions.isXCHMALCPeak && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + bool isXAUUSD = IsXAUUSD(); + if (isXAUUSD) + { + // + // Start Analysing Market based On Conditions ... + result = + // + // Exceptions: + // there some commonly Exceptions which makes our choice incorrect, + // here we are combined knownly Exceptions ... + !( + // + // for Exception we used XLH Conditions as follow ... + // + // Check Conditions if Price In Signal Range ... + (mConditions.isXLHPriceInSignalRange && + // + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + (!mConditions.isXCHMAMCTrendsUp && + !mConditions.isXCHMAMCTrendsDown) && + mConditions.isXCHMAMCFastOverSlow) + // + || + // + (((mConditions.isXTMNeutural && + mConditions.isXTMEndBearish) && + (mConditions.isXAMANeutural && + mConditions.isXAMAEndBearish)) && + ( + // + (mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow)) && + ( + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + (mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow)) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTSCurrentMin && + mConditions.isXTDSignalUnderBear && + mConditions.isXTDBullCrossedUnderBear && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + (mConditions.isXCHMASCVale && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastOverSlow && + mConditions.isXCHMAMCFastOverSlow && + mConditions.isXCHMALCFastOverSlow) + // + || + // + (mConditions.isXTSCurrentMin && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTDBullUnderBear && + mConditions.isXCHMALCTrendsDown && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMALCFastUnderSlow) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTMStartBearish && + mConditions.isXLHLowAttachedLL && + mConditions.isXAMAStartBearish && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHLHSameHHs && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTDSignalOverBear && + mConditions.isXCHMAMCFastOverSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceInSignalRange ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL) && + ( + // + mConditions.isXTDSignalCrossedUnderBear + // + || + // + (mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTMNeutural && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXAMAStartBearish && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalOverBear && + mConditions.isXTSCurrentCrossedUnderFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Under Signal ... + ( + // + ((mConditions.isXLHPriceUnderSignal || + mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + (mConditions.isXLHHHDecreased && + mConditions.isXTSCurrentOverFarest && + mConditions.isXLHPriceCrossedUnderSignal) + // + ) + // + ) + // + || + // + ((mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear) && + ( + // + ((mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish) && + ( + // + (mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedUnderNearest) + // + || + // + (((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow)) && + ( + // + mConditions.isXTSCurrentOverFarest + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHMCLCHHSame && + mConditions.isXTMStartBearish && + mConditions.isXAMAStartBearish && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCPeak && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest + // + ) + // + ) + // + || + // + ((mConditions.isXTMBearish && + mConditions.isXAMABearish) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + ((mConditions.isXCHMALCPeak && + mConditions.isXCHMALCTrendsUp && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXTDBullOverBear && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXLHLowAttachedLL && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + || + // + (mConditions.isXTMBearish && + mConditions.isXAMABearish && + mConditions.isXCHMALCPeak && + mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCLLSame && + mConditions.isXTDBullUnderBear && + mConditions.isXLHLowAttachedLL && + mConditions.isXTDSignalUnderBear && + mConditions.isXCHMASCFastCrossedUnderSlow && + mConditions.isXTSCurrentCrossedUnderNearest) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceUnderSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is Over Signal ... + ( + // + ((mConditions.isXLHPriceOverSignal || + mConditions.isXLHPriceCrossedOverSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + (mConditions.isXTDBullOverBear && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTDSignalCrossedUnderBear) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMAMCPeak && + mConditions.isXCHMAMCTrendsUp && + mConditions.isXCHMAMCFastOverSlow) && + ( + // + ((mConditions.isXTMNeutural && + mConditions.isXAMANeutural) && + ( + // + (mConditions.isXTSCurrentMin && + mConditions.isXTDBullOverBear) + // + || + // + (mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest) + // + ) + // + ) + // + ) + // + ) + // + || + // + (((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow)) && + ( + // + (mConditions.isXAMABullish && + mConditions.isXTSCurrentMin && + mConditions.isXTDBullUnderBear && + mConditions.isXTDSignalUnderBear && + mConditions.isXTSCurrentCrossedUnderFarest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + || + // + (mConditions.isXCHMALCPeak && + mConditions.isXAMABullish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentCrossedUnderMediest) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastOverSlow) && + ( + // + (mConditions.isXAMANeutural && + mConditions.isXTSCurrentMin && + mConditions.isXAMAEndBullish && + mConditions.isXTDBullOverBear && + mConditions.isXTMStartBearish && + mConditions.isXCHLHMCLCLLSame && + mConditions.isXCHMASCCrossedUnderMax && + mConditions.isXTDSignalCrossedUnderBear && + mConditions.isXCHMASCFastCrossedUnderSlow) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + // + (((mConditions.isXCHMASCTrendsDown && + mConditions.isXCHMASCFastUnderSlow) && + (mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow)) && + ( + // + (mConditions.isXTMBearish && + mConditions.isXAMABullish && + mConditions.isXTDBullOverBear && + mConditions.isXTSCurrentOverFarest && + mConditions.isXTSCurrentOverNearest && + mConditions.isXTSCurrentCrossedOverNearest) + // + ) + // + ) + // + ) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceOverSignal ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + || + // + // Check Conditions if Price is not has clear state ... + ( + // + ((!mConditions.isXLHPriceOverSignal && + !mConditions.isXLHPriceUnderSignal && + !mConditions.isXLHPriceInSignalRange && + !mConditions.isXLHPriceCrossedOverSignal && + !mConditions.isXLHPriceCrossedUnderSignal) && + ( + // + // Next Step is to Check LL and HH Same Style ... + // + // XCHMAMX Short ... + // PriceFree ... + // Check if Both LL and HH Same In Length ... + ((mConditions.isXLHLLSameInLength && + mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Check If LL Same In Length ... + ((mConditions.isXLHLLSameInLength && + !mConditions.isXLHHHSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Check If HH is Same In Length ... + ((mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + || + // + // XCHMAMX Short ... + // PriceFree ... + // Not Same LL or HH in Lenght ... + ((!mConditions.isXLHHHSameInLength && + !mConditions.isXLHLLSameInLength) && + // + ( + false) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ; + } + + // + return result; + } + + // + // Signal Conditions Filtering ... + + // + // Here we have to Implement all Signals Conditional Filtering ... + // this Filtering works based on Symbol and Period .... + // this means each signaller (Provider) has their own implementation based on + // Specific Period/Symbol parir ... + + // + bool IsEURUSD() + { + // + string symbolIdentifiers[] = { + "EUR", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + GetSymbol() // + ); + + // + return result; + } + + // + bool IsUSDJPY() + { + // + string symbolIdentifiers[] = { + "USD", + "JPY" // + }; + + // + bool result = Contains( + symbolIdentifiers, + GetSymbol() // + ); + + // + return result; + } + + // + bool IsUSDCHF() + { + // + string symbolIdentifiers[] = { + "USD", + "CHF" // + }; + + // + bool result = Contains( + symbolIdentifiers, + GetSymbol() // + ); + + // + return result; + } + + // + bool IsXAUUSD() + { + // + string symbolIdentifiers[] = { + "XAU", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + GetSymbol() // + ); + + // + return result; + } + + // + bool IsValidSymbol() + { + // + bool isEURUSD = IsEURUSD(); + bool isUSDJPY = IsUSDJPY(); + bool isUSDCHF = IsUSDCHF(); + bool isXAUUSD = IsXAUUSD(); + + // + bool result = + // + isEURUSD + // + || + // + isUSDJPY + // + || + // + isUSDCHF + // + || + // + isXAUUSD + // + ; + + // + return result; + } + + // + bool IsValidPeriod() + { + // + ENUM_TIMEFRAMES period = GetPeriod(); + + // + bool result = period == PERIOD_M5; + + // + return result; + } + + // + bool IsValidSymbolPeriod() + { + // + bool result = + // + IsValidSymbol() + // + && + // + IsValidPeriod() + // + ; + + // + return result; + } + + // + // Detect Signal ... + bool HasSpecificSignal( + int barIndex, // Specified Bar Index ... + ENUM_POSITION_TYPE mType, // Specific Signal Type ... + string &provider, // Signal Provider ... + int &signalPusher, // Number Of Same Time Signals ... + X5MarketConditions &mConditions // Specified Market Conition ... + ) + { + // + bool result = false; + + // + // Validate Signal Type is Enables ... + bool isLong = IsLong(mType); + result = + (isLong && mIsLongEnable) || + (!isLong && mIsShortEnable); + if (!result) + { + return result; + } + + // + // Now we have to Filter based on Enabled Signal Providers ... + + // + // Long ... + if (isLong && mIsLongEnable) + { + // + XSignal lSignal; + + // + signalPusher = 0; + + // + bool hasX5XSPSignal = false; + bool hasXTDSignal = false; + bool hasXTAMSignal = false; + bool hasXSISignal = false; + bool hasXTSFISignal = false; + bool hasXOBDLHSignal = false; + bool hasXCHMACCSignal = false; + bool hasXCHMAMNSignal = false; + bool hasXCHMAMXSignal = false; + + // + // XPS ... + if (mIsX5XSPSignalProviderEnable) + { + // + hasX5XSPSignal = X5XSPHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasX5XSPSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X5XSP); + } + + // + signalPusher++; + } + } + + // + // XTD ... + if (mIsXTDSignalProviderEnable) + { + // + hasXTDSignal = XTDHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXTDSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTD); + } + + // + signalPusher++; + } + } + + // + // XTAM ... + if (mIsXTAMSignalProviderEnable) + { + // + hasXTAMSignal = XTAMHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXTAMSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTAM); + } + + // + signalPusher++; + } + } + + // + // XSI ... + if (mIsXSISignalProviderEnable) + { + // + hasXSISignal = XSIHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXSISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XSI); + } + + // + signalPusher++; + } + } + + // + // XTSFI ... + if (mIsXTSFISignalProviderEnable) + { + // + hasXTSFISignal = XTSFIHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXTSFISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTSFI); + } + + // + signalPusher++; + } + } + + // + // XOBDLH ... + if (mIsXOBDLHSignalProviderEnable) + { + // + hasXOBDLHSignal = XOBDLHHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXOBDLHSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XOBDLH); + } + + // + signalPusher++; + } + } + + // + // XCHMACC ... + if (mIsXCHMACCSignalProviderEnable) + { + // + hasXCHMACCSignal = XCHMACCHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXCHMACCSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMACC); + } + + // + signalPusher++; + } + } + + // + // XCHMAMN ... + if (mIsXCHMAMNSignalProviderEnable) + { + // + hasXCHMAMNSignal = XCHMAMNHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXCHMAMNSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMN); + } + + // + signalPusher++; + } + } + + // + // XCHMAMX ... + if (mIsXCHMAMXSignalProviderEnable) + { + // + hasXCHMAMXSignal = XCHMAMXHasSpecifiedLongSignal( + mConditions // + ); + + // + if (hasXCHMAMXSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMX); + } + + // + signalPusher++; + } + } + + // + result = + // + hasX5XSPSignal + // + || + // + hasXTDSignal + // + || + // + hasXTAMSignal + // + || + // + hasXSISignal + // + || + // + hasXTSFISignal + // + || + // + hasXOBDLHSignal + // + || + // + hasXCHMACCSignal + // + || + // + hasXCHMAMNSignal + // + || + // + hasXCHMAMXSignal + // + ; + + // + if (result) + { + return result; + } + } + + // + // Short ... + if (!isLong && mIsShortEnable) + { + // + XSignal sSignal; + + // + signalPusher = 0; + + // + bool hasX5XSPSignal = false; + bool hasXTDSignal = false; + bool hasXTAMSignal = false; + bool hasXSISignal = false; + bool hasXTSFISignal = false; + bool hasXOBDLHSignal = false; + bool hasXCHMACCSignal = false; + bool hasXCHMAMNSignal = false; + bool hasXCHMAMXSignal = false; + + // + // XPS ... + if (mIsX5XSPSignalProviderEnable) + { + // + hasX5XSPSignal = X5XSPHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasX5XSPSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(X5XSP); + } + + // + signalPusher++; + } + } + + // + // XTD ... + if (mIsXTDSignalProviderEnable) + { + // + hasXTDSignal = XTDHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXTDSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTD); + } + + // + signalPusher++; + } + } + + // + // XTAM ... + if (mIsXTAMSignalProviderEnable) + { + // + hasXTAMSignal = XTAMHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXTAMSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTAM); + } + + // + signalPusher++; + } + } + + // + // XSI ... + if (mIsXSISignalProviderEnable) + { + // + hasXSISignal = XSIHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXSISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XSI); + } + + // + signalPusher++; + } + } + + // + // XTSFI ... + if (mIsXTSFISignalProviderEnable) + { + // + hasXTSFISignal = XTSFIHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXTSFISignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XTSFI); + } + + // + signalPusher++; + } + } + + // + // XOBDLH ... + if (mIsXOBDLHSignalProviderEnable) + { + // + hasXOBDLHSignal = XOBDLHHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXOBDLHSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XOBDLH); + } + + // + signalPusher++; + } + } + + // + // XCHMACC ... + if (mIsXCHMACCSignalProviderEnable) + { + // + hasXCHMACCSignal = XCHMACCHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXCHMACCSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMACC); + } + + // + signalPusher++; + } + } + + // + // XCHMAMN ... + if (mIsXCHMAMNSignalProviderEnable) + { + // + hasXCHMAMNSignal = XCHMAMNHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXCHMAMNSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMN); + } + + // + signalPusher++; + } + } + + // + // XCHMAMX ... + if (mIsXCHMAMXSignalProviderEnable) + { + // + hasXCHMAMXSignal = XCHMAMXHasSpecifiedShortSignal( + mConditions // + ); + + // + if (hasXCHMAMXSignal) + { + // + if (!IsValid(provider)) + { + provider = ToString(XCHMAMX); + } + + // + signalPusher++; + } + } + + // + result = + // + hasX5XSPSignal + // + || + // + hasXTDSignal + // + || + // + hasXTAMSignal + // + || + // + hasXSISignal + // + || + // + hasXTSFISignal + // + || + // + hasXOBDLHSignal + // + || + // + hasXCHMACCSignal + // + || + // + hasXCHMAMNSignal + // + || + // + hasXCHMAMXSignal + // + ; + + // + if (result) + { + return result; + } + } + + // + return result; + } +}; + +// +// Tools ... + +// +// Model Provider Descriptor ... +struct X5ProviderDescriptor +{ + // + string symbol; // Trading Symbol + ENUM_TIMEFRAMES period; // Trading Timeframe + double staticVolume; // Static Volume for Positions + bool allowLong; // Allow Long Signals + bool allowShort; // Allow Short Signals + ENUM_X5_SIGNAL_PROVIDERS signallers[]; // Allowed Signal Providers + + // + X5ProviderInputs inputs; + XSCX5Provider *provider; + + // + XSignal signal; + X5MarketConditions conditions; + + // + // Tools ... + + // + bool Init() + { + // + bool result = false; + + // + result = this.Init( + this.symbol, + this.period, + this.signallers, + this.allowLong, + this.allowShort, + this.staticVolume // + ); + + // + return result; + } + + // + bool Init( + ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers + bool mAllowLong = true, // Allow Long Signals + bool mAllowShort = true, // Allow Short Signals + double mStaticVolume = 0.01 // Static Volume for Positions + ) + { + // + bool result = false; + + // + result = this.Init( + this.symbol, + this.period, + mSignallers, + mAllowLong, + mAllowShort, + mStaticVolume // + ); + + // + return result; + } + + // + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mPeriod, // Trading Timeframe + ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers + bool mAllowLong = true, // Allow Long Signals + bool mAllowShort = true, // Allow Short Signals + double mStaticVolume = 0.01 // Static Volume for Positions + ) + { + // + bool result = false; + + // + result = + // + inputs.IsValid() && + IsValid(mSymbol) && + IsValid(mPeriod) && + NotEmpty(mStaticVolume) && + (allowLong || allowShort) && + ArraySize(mSignallers) > 0 + // + ; + if (!result) + { + return result; + } + + // + this.symbol = mSymbol; + this.period = mPeriod; + this.allowLong = mAllowLong; + this.allowShort = mAllowShort; + this.staticVolume = mStaticVolume; + + // + ENUM_X5_SIGNAL_PROVIDERS tmp[]; + Copy( + mSignallers, + tmp // + ); + Copy( + tmp, + this.signallers // + ); + + // + // Instantiate Provider ... + provider = new XSCX5Provider( + this.symbol, + this.period, + this.staticVolume // + ); + + // + // Set Long/Short State ... + + // + provider + .SetSignalTypeState( + POSITION_TYPE_BUY, + this.allowLong // + ); + + // + provider + .SetSignalTypeState( + POSITION_TYPE_SELL, + this.allowShort // + ); + + // + // Enable Required Signallers ... + provider + .SetSignalProviderStates( + this.signallers, + true // + ); + + // + // Now Must to Initialize Provider ... + result = provider.Init( + this.inputs // + ); + + // + return result; + } + + // + // Cleanup ... + void Clean() + { + // + signal.Clean(); + conditions.Clear(); + } + + // + // Validate ... + bool IsValid(bool validateInputs = true) + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + IsValid(period) && + NotEmpty(staticVolume) && + (validateInputs + ? inputs.IsValid() + : true) && + (allowLong || allowShort) && + ArraySize(signallers) > 0 + // + ; + + // + return result; + } + + // + // Check Signal ... + bool HasSignal(int barIndex = 0) + { + // + bool result = false; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + // Clear Signal and Conditions ... + Clean(); + + // + result = provider.HasSignal( + barIndex, + signal, + conditions // + ); + + // + return result; + } +}; + +// +void GetAllX5SignalProviders(ENUM_X5_SIGNAL_PROVIDERS &result[]) +{ + // + Clean(result); + + // + Add(X5NONE, result); + Add(X5XSP, result); + Add(XTD, result); + Add(XTAM, result); + Add(XSI, result); + Add(XTSFI, result); + Add(XOBDLH, result); + Add(XCHMACC, result); + Add(XCHMAMN, result); + Add(XCHMAMX, result); +} + +// +string ToString(ENUM_X5_SIGNAL_PROVIDERS value) +{ + return EnumToString(value); +} + +// +ENUM_X5_SIGNAL_PROVIDERS ToX5SignalProvider(string content) +{ + // + ENUM_X5_SIGNAL_PROVIDERS result = X5NONE; + + // + if (!IsValid(content)) + { + return result; + } + + // + if (content == ToString(X5NONE)) + { + result = X5NONE; + } + else if (content == ToString(X5XSP)) + { + result = X5XSP; + } + else if (content == ToString(XTD)) + { + result = XTD; + } + else if (content == ToString(XTAM)) + { + result = XTAM; + } + else if (content == ToString(XSI)) + { + result = XSI; + } + else if (content == ToString(XTSFI)) + { + result = XTSFI; + } + else if (content == ToString(XOBDLH)) + { + result = XOBDLH; + } + else if (content == ToString(XCHMACC)) + { + result = XCHMACC; + } + else if (content == ToString(XCHMAMN)) + { + result = XCHMAMN; + } + else if (content == ToString(XCHMAMX)) + { + result = XCHMAMX; + } + + // + return result; +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.xea.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.xea.class.mq5 new file mode 100644 index 0000000..e03f148 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.x5.xea.class.mq5 @@ -0,0 +1,308 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCX5EA +// Description: provides all X5 EA requirements ... +// - X5 Provider; +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xea.class.mq5" +#include "../Classes/x-saherelm.x5.provider.class.mq5" + +// +// Define On Signal Event Handler Type Specified for X5 ... +typedef void (*TX5OnSignal)(X5ProviderDescriptor &descriptor); + +// +// Class Definition ... + +class XSCX5EA : public XSCBaseEA +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCX5EA( + // + // XTrade Class Requirements ... + int slippage, // Specify Slippage + ulong magicNumber, // Specify Magic Number + int manageInterval, // Manager Check Intervals Seconds + double maxAllowedSpread, // Max Allowed Spred for Opening Trades + int maxAllowedPositions, // Max Allowed Positions + double maxAllowedDrawdownFactor, // Max Allowed Drawdown Factor + double staticVolume, // Static Volume for Positions + // + // Position Management ... + bool allowLong = true, // Allow Long Trades + bool allowShort = true, // Allow Short Trades + double minProfitPerTrade = 0, // Min Profit Per Trade based On Volume Factor (Hedge) + double minProfitPerVolumeFactor = 0, // Min Volume Factor for Calculating Profit (Hedge) + // + // Event Handlers ... + TOnStopLoss onStopLossTriggered = NULL, // On StopLoass Triggered Event Handler + TOnTakeProfit onTakeProfitTriggered = NULL, // On TakeProfit Triggered Event Handler + TOnDealsChanged onDealsChangedHandler = NULL, // On Deals Changed Event Handler + TOnOrdersChanged onOrdersChangedHandler = NULL, // On Orders Changed Event Handler + TOnPositionsChanged onPositionsChangedHandler = NULL, // On Positions Changed Event Handler + TOnTradeStateChanged onTradeStateChangedHandler = NULL, // On Trade State Changed Event Handler + // + TOnSignal onSignalHandler = NULL, // On Signal Event Handler + // + // Log Handler ... + bool enableAlerts = true, // Enable Alerts + bool logAlerts = true, // Log Alerts + bool terminalAlerts = false, // Terminal Alerts + bool mailAlerts = false, // Mail Alerts + bool pushAlerts = false // Push Alerts + ) : XSCBaseEA(slippage, + magicNumber, + manageInterval, + maxAllowedSpread, + maxAllowedPositions, + maxAllowedDrawdownFactor, + allowLong, + allowShort, + minProfitPerTrade, + minProfitPerVolumeFactor, + staticVolume, + onStopLossTriggered, + onTakeProfitTriggered, + onDealsChangedHandler, + onOrdersChangedHandler, + onPositionsChangedHandler, + onTradeStateChangedHandler, + enableAlerts, + logAlerts, + terminalAlerts, + mailAlerts, + pushAlerts // + ) + { + } + + // + // Deconstructor ... + ~XSCX5EA() {} + + // + // Properties Getter(s) / Setter(s) ... + + // + // Add X5 Specified Signal Event Handler ... + void AddOnSignalEventHandler(TX5OnSignal listener) + { + // + Add( + listener, + mX5OnSignalEventHandlers + // + ); + } + + // + // Add Specified X5 Provider ... + bool AddProvider(X5ProviderDescriptor &descriptor) + { + // + bool result = false; + + // + // Validate Inputs ... + result = descriptor.Init(); + if (!result) + { + return result; + } + + // + AddRef( + descriptor, + mDescriptors // + ); + + // + return result; + } + + // + // Overrides ... + + // + // Customize Token ... + string GetToken() override + { + return GetSpecificToken(this); + } + + // + string GetTag() override + { + return this.GetToken(); + } + + // + // Check Provider for any Guards ... + bool CheckForGuard(XGuard &guards[]) override + { + // + // TODO: Implement this ... + return false; + } + + // + // Request Provider to Collect all + // Potentially Signals and then + // filters theme here and passed them + // for Executing ... + int RequestForSignal( + XSignal &signals[] // Holds Signals ... + ) override + { + // + bool result = 0; + + // + Clean(signals); + + // + int descriptorsCount = CountDescriptors(); + if (descriptorsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < descriptorsCount; i++) + { + // + X5ProviderDescriptor iDescriptor = mDescriptors[i]; + + // + bool iHasSignal = iDescriptor.HasSignal(); + if (iHasSignal) + { + // + // Here we Can double check Signals by Conditions + // for Score Base Filtering ... + + // + AddRef( + iDescriptor.signal, + signals + // + ); + + // + NotifyX5OnSignalEventHandlers(iDescriptor); + } + } + + // + result = ArraySize(signals); + + // + return result; + } + + // + // Handl Management Actions ... + // if returns true, it is going to prevent for processing forward ... + bool HandleStateManagement(XSignal &signals[]) override + { + // + // TODO: Implement this ... + return false; + } + + // + // Request for Support Signals using Guard ... + bool RequestForSupport( + XSignal &support, // Holds Support Signal, if Provided + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame + ) override + { + // + // TODO: Implement this ... + return false; + } + + // + // Tools ... + + // + // Protected ... +protected: + // + // Tools ... + + // + void NotifyX5OnSignalEventHandlers(X5ProviderDescriptor &descriptor) + { + // + int listenersCount = ArraySize(mX5OnSignalEventHandlers); + if (listenersCount <= 0) + { + return; + } + + // + for (int i = 0; i < listenersCount; i++) + { + // + TX5OnSignal iListener = mX5OnSignalEventHandlers[i]; + + // + iListener(descriptor); + } + } + + // + // Private ... +private: + // + // Props ... + + // + // Collection of Signal Event Listeners ... + TX5OnSignal mX5OnSignalEventHandlers[]; + + // + // a Collection of X5 Provider Descriptors ... + X5ProviderDescriptor mDescriptors[]; + + // + int CountDescriptors() + { + return ArraySize(mDescriptors); + } + + // + // Tools ... +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xaccount.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xaccount.class.mq5 new file mode 100644 index 0000000..66169f5 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xaccount.class.mq5 @@ -0,0 +1,398 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCAccount +// Description: provides all Account requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// START Definitions ... +// + +// +// END Definitions ... +// + +// +// START Import and Inclused requirements ... +// + +// +// Includes ... +#include +#include "../Classes/x-saherelm.base.class.mq5" + +// +// END Import and Inclused requirements ... +// + +// +// START Overrides ... +// + +// +// END Overrides ... +// + +// +// a Class for Manage Account ... +class XSCAccount : public XSCBase +{ + // + // Public ... +public: + // + // Constructor ... + void XSCAccount() + { + // + mAccountInfo = new CAccountInfo(); + } + + // + // Deconstructor ... + void ~XSCAccount() + { + } + + // + // START Provided Functions ... + // + + // + // User Account ... + long GetUserAccount() + { + return mAccountInfo.Login(); + } + + // + // Account Leverage ... + long GetLeverage() + { + return mAccountInfo.Leverage(); + } + + // + // Get Trade Expert State ... + bool CanExpertTrade() + { + return mAccountInfo.TradeExpert(); + } + + // + // User Account Trade Mopde (ENUM_ACCOUNT_TRADE_MODE) ... + // -------------------------- + // ACCOUNT_TRADE_MODE_DEMO + // ACCOUNT_TRADE_MODE_CONTEST + // ACCOUNT_TRADE_MODE_REAL + ENUM_ACCOUNT_TRADE_MODE GetTradeMode() + { + return mAccountInfo.TradeMode(); + } + + // + // Get Account Balance ... + double GetBalance() + { + return mAccountInfo.Balance(); + } + + // + // Get the amount of give Credit ... + double GetCredit() + { + return mAccountInfo.Credit(); + } + + // + // Get the amount of current Profit on account ... + double GetProfit() + { + return mAccountInfo.Profit(); + } + + // + // Get the amount of current Equity on account ... + double GetEquity() + { + return mAccountInfo.Equity(); + } + + // + // Get the amount of reserved Margin ... + double GetMargin() + { + return mAccountInfo.Margin(); + } + + // + // Get the amount of free Margin ... + double GetFreeMargin() + { + return mAccountInfo.FreeMargin(); + } + + // + // Get the Level of Margin ... + double GetMarginLevel() + { + return mAccountInfo.MarginLevel(); + } + + // + // Get the Level Of Margin for a Deposit ... + double GetMarginCall() + { + return mAccountInfo.MarginCall(); + } + + // + // Get the Level of Margin for Stop out ... + double GetMarginStopOut() + { + return mAccountInfo.MarginStopOut(); + } + + // + // Get the Client Name ... + string GetName() + { + return mAccountInfo.Name(); + } + + // + // Get the Trade Server Name ... + string GetServerName() + { + return mAccountInfo.Server(); + } + + // + // Get deposit Currency Name ... + string GetCurrency() + { + return mAccountInfo.Currency(); + } + + // + // Get the Company Name that serves an Account ... + string GetCompany() + { + return mAccountInfo.Company(); + } + + // + // Calculate Profits for the current account based on passed parameters ... + double CalculateTradeProfit( + const string symbol, // trading symbol + ENUM_ORDER_TYPE type, // order type + double volume, // volume + double entry, // open price + double exit // close price + ) + { + // + double result = mAccountInfo.OrderProfitCheck( + symbol, + type, + volume, + entry, + exit); + + // + return result; + } + + // + // Calculate amount of margin which required for trade operation ... + double CalculateMarging( + const string symbol, // trading symbol + ENUM_ORDER_TYPE type, // order type + double volume, // volume + double entry // open price + ) + { + // + double result = mAccountInfo.MarginCheck( + symbol, + type, + volume, + entry); + + // + return result; + } + + // + // Calculate amount of free margin left after trade operation ... + double CalculateFreeMarging( + const string symbol, // trading symbol + ENUM_ORDER_TYPE type, // order type + double volume, // volume + double entry // open price + ) + { + // + double result = mAccountInfo.FreeMarginCheck( + symbol, + type, + volume, + entry); + + // + return result; + } + + // + // Calculate the Maximum possible volume of trade operation ... + double CalculateMaxVolume( + const string symbol, // trading symbol + ENUM_ORDER_TYPE type, // order type + double entry, // open price + double percent = 100 // percent of available margin + ) + { + // + double result = mAccountInfo.MaxLotCheck( + symbol, + type, + entry, + percent); + + // + return result; + } + + // + // Calculate Point Value for Given Symbol based on Account ... + double GetPointValue( + string symbol // trading symbol + ) + { + // + double result = 0; + + // + double tickSize = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE); + double tickValue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE); + double point = SymbolInfoDouble(symbol, SYMBOL_POINT); + + // + double ticksPerPoint = tickSize / point; + + // + result = tickValue / ticksPerPoint; + + // + return result; + } + + // + // Calculate Risk Amount based on account Currency by Providing: + // Points and Volume ... + double CalculateRiskAmount( + string symbol, // trading symbol + double points, // amount of Risk Points + double volume // position Volume + ) + { + // + double result = 0; + + // + double pointValue = GetPointValue(symbol); + + // + result = pointValue * volume * points; + + // + return result; + } + + // + // Calculate Risk Points based on account Currency by Providing: + // Volume and Amount ... + double CalculateRiskPoints( + string symbol, // trading symbol + double volume, // position Volume + double amount // amount of Risk based on Account Currency + ) + { + // + double result = 0; + + // + double pointValue = GetPointValue(symbol); + + // + result = amount / (pointValue * volume); + + // + return result; + } + + // + // Calculate Volume based on account Currency by Providing: + // Amount and Risk Points ... + double CalculateVolume( + string symbol, // trading symbol + double amount, // amount of Risk based on Account Currency + double points // amount of Risk Points + ) + { + // + double result = 0; + + // + points = + points <= 0 + ? 10 + : points; + + // + double pointValue = GetPointValue(symbol); + + // + result = amount / (pointValue * points); + + // + return result; + } + + // + // END Provided Functions ... + // + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Account Info ... + CAccountInfo mAccountInfo; +}; + +// +// START Usefull Functions ... +// + +// +// END Usefull Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xalert.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xalert.class.mq5 new file mode 100644 index 0000000..de28ce2 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xalert.class.mq5 @@ -0,0 +1,1363 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCAlert +// Description: provides all Alerts requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.base.class.mq5" + +// +// Class Definition ... + +class XSCAlert : public XSCBase +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructor ... + XSCAlert() {} + XSCAlert( + string prefix = "X-Alert", // Alerts Prefixe + bool enableAlerts = true, // Enable Alerts + bool logAlerts = true, // Log Alerts + bool terminalAlerts = false, // Terminal Alerts + bool mailAlerts = false, // Mail Alerts + bool pushAlerts = false // Push Alerts + ) + { + // + mPrefix = prefix; + mLogAlerts = logAlerts; + mMailAlerts = mailAlerts; + mPushAlerts = pushAlerts; + mEnableAlerts = enableAlerts; + mTerminalAlerts = terminalAlerts; + + // + // Normalize Prefix if Not Provided ... + if (!IsValid(mPrefix)) + { + mPrefix = GetTag(); + } + } + + // + // Deconstructor ... + ~XSCAlert() {} + + // + // Override ... + string GetTag() override + { + return GetSpecificToken(this); + } + + // + // Properties Getter(s) / Setter(s) ... + + // + string GetPrefix() + { + return mPrefix; + } + + // + void SetPrefix(string value) + { + mPrefix = value; + } + + // + bool GetLogAlerts() + { + return mLogAlerts; + } + + // + void SetLogAlerts(bool value) + { + mLogAlerts = value; + } + + // + bool GetEnableAlerts() + { + return mEnableAlerts; + } + + // + void SetEnableAlerts(bool value) + { + mEnableAlerts = value; + } + + // + bool GetPushAlerts() + { + return mPushAlerts; + } + + // + void SetPushAlerts(bool value) + { + mPushAlerts = value; + } + + // + bool GetMailAlerts() + { + return mMailAlerts; + } + + // + void SetMailAlerts(bool value) + { + mMailAlerts = value; + } + + // + bool GetTerminalAlerts() + { + return mTerminalAlerts; + } + + // + void SetTerminalAlerts(bool value) + { + mTerminalAlerts = value; + } + + // + // Tools Funtions ... + + // + // Alerts ... + + // + // Logging an Alert ... + void LogAlert(string message) + { + // + // Validate Args ... + if (!CanLogAlert()) + { + return; + } + + // + Log(message); + } + + // + // Terminal Alert ... + void TerminalAlert(string message) + { + // + // Validate Args ... + if (!CanTerminalAlert()) + { + return; + } + + // + // Prepare Message ... + message = PrepareMessage(message); + + // Send Terminal Alert ... + Alert(message); + } + + // + // Mail Alert ... + void MailAlert(string message) + { + // + // Validate Args ... + if (!CanMailAlert()) + { + return; + } + + // + // Send Mail Alert ... + SendMail(GetPrefix(), message); + } + + // + // Send Push Notification ... + void PushAlert(string message) + { + // + // Validate Args ... + if (!CanPushAlert()) + { + return; + } + + // + // Prepare Message ... + message = PrepareMessage(message); + + // + // Send Push Notification Alert ... + SendNotification(message); + } + + // + // Send an Alert by Handling all Different Specified + // type's of Alert's if they are Enabled ... + void Alert(string message) + { + // + // Handle Log, if Enabled ... + LogAlert(message); + + // + // Handle Mail if Enabled ... + MailAlert(message); + + // + // Handle Push if Enabled ... + PushAlert(message); + + // + // Handle Terminal if Enabled ... + TerminalAlert(message); + } + + // + // Logs ... + + // + // Log a Message ... + void Log(string message) + { + // + if (!CanLog()) + { + return; + } + + // + Print(GetPrefix(), " > ", message); + } + void Log(string tag, string message) + { + // + if (!CanLog()) + { + return; + } + + // + Print(GetPrefix(), "_", tag, " > ", message); + } + void LogEmpty() + { + // + if (!CanLog()) + { + return; + } + + // + Print(" "); + } + + // + // Log Specific Array ... + template + void LogArray( + T &array[], // Array to Log + string label = NULL // Array Label + ) + { + // + if (!CanLog()) + { + return; + } + + // + Print(GetPrefix(), ">", (IsValid(label) ? label : "")); + ArrayPrint(array); + } + + // + // Error ... + + // + // Log an Error ... + void LogError( + int error = -1 // Specific Error, if it's equal to -1, use Last Error ... + ) + { + // + if (!CanLog()) + { + return; + } + + // + if (error <= -1) + { + error = GetLastError(); + } + + // + string errorMsg = GetErrorDescription(error); + + // + Log("Error: " + errorMsg); + } + + // + // Retrieve Specified Error Code Description ... + string GetErrorDescription(int err_code) + { + // + string result = ""; + + // + switch (err_code) + { + // + //--- Constant Description + + // + case ERR_SUCCESS: + result = "The operation completed successfully"; + break; + + // + case ERR_INTERNAL_ERROR: + result = "Unexpected internal error"; + break; + + // + case ERR_WRONG_INTERNAL_PARAMETER: + result = "Wrong parameter in the inner call of the client terminal function"; + break; + + // + case ERR_INVALID_PARAMETER: + result = "Wrong parameter when calling the system function"; + break; + + // + case ERR_NOT_ENOUGH_MEMORY: + result = "Not enough memory to perform the system function"; + break; + + // + case ERR_STRUCT_WITHOBJECTS_ORCLASS: + result = "The structure contains objects of strings and/or dynamic arrays and/or structure of such objects and/or classes"; + break; + + // + case ERR_INVALID_ARRAY: + result = "Array of a wrong type, wrong size, or a damaged object of a dynamic array"; + break; + + // + case ERR_ARRAY_RESIZE_ERROR: + result = "Not enough memory for the relocation of an array, or an attempt to change the size of a static array"; + break; + + // + case ERR_STRING_RESIZE_ERROR: + result = "Not enough memory for the relocation of string"; + break; + + // + case ERR_NOTINITIALIZED_STRING: + result = "Not initialized string"; + break; + + // + case ERR_INVALID_DATETIME: + result = "Invalid date and/or time"; + break; + + // + case ERR_ARRAY_BAD_SIZE: + result = "Requested array size exceeds 2 GB"; + break; + + // + case ERR_INVALID_POINTER: + result = "Wrong pointer"; + break; + + // + case ERR_INVALID_POINTER_TYPE: + result = "Wrong type of pointer"; + break; + + // + case ERR_FUNCTION_NOT_ALLOWED: + result = "System function is not allowed to call"; + break; + + // + //--- Charts + + // + case ERR_CHART_WRONG_ID: + result = "Wrong chart ID"; + break; + + // + case ERR_CHART_NO_REPLY: + result = "Chart does not respond"; + break; + + // + case ERR_CHART_NOT_FOUND: + result = "Chart not found"; + break; + + // + case ERR_CHART_NO_EXPERT: + result = "No Expert Advisor in the chart that could handle the event"; + break; + + // + case ERR_CHART_CANNOT_OPEN: + result = "Chart opening error"; + break; + + // + case ERR_CHART_CANNOT_CHANGE: + result = "Failed to change chart symbol and period"; + break; + + // + case ERR_CHART_CANNOT_CREATE_TIMER: + result = "Failed to create timer"; + break; + + // + case ERR_CHART_WRONG_PROPERTY: + result = "Wrong chart property ID"; + break; + + // + case ERR_CHART_SCREENSHOT_FAILED: + result = "Error creating screenshots"; + break; + + // + case ERR_CHART_NAVIGATE_FAILED: + result = "Error navigating through chart"; + break; + + // + case ERR_CHART_TEMPLATE_FAILED: + result = "Error applying template"; + break; + + // + case ERR_CHART_WINDOW_NOT_FOUND: + result = "Subwindow containing the indicator was not found"; + break; + + // + case ERR_CHART_INDICATOR_CANNOT_ADD: + result = "Error adding an indicator to chart"; + break; + + // + case ERR_CHART_INDICATOR_CANNOT_DEL: + result = "Error deleting an indicator from the chart"; + break; + + // + case ERR_CHART_INDICATOR_NOT_FOUND: + result = "Indicator not found on the specified chart"; + break; + + // + //--- Graphical Objects + case ERR_OBJECT_ERROR: + result = "Error working with a graphical object"; + break; + + // + case ERR_OBJECT_NOT_FOUND: + result = "Graphical object was not found"; + break; + + // + case ERR_OBJECT_WRONG_PROPERTY: + result = "Wrong ID of a graphical object property"; + break; + + // + case ERR_OBJECT_GETDATE_FAILED: + result = "Unable to get date corresponding to the value"; + break; + + // + case ERR_OBJECT_GETVALUE_FAILED: + result = "Unable to get value corresponding to the date"; + break; + + // + //--- MarketInfo + + // + case ERR_MARKET_UNKNOWN_SYMBOL: + result = "Unknown symbol"; + break; + + // + case ERR_MARKET_NOT_SELECTED: + result = "Symbol is not selected in MarketWatch"; + break; + + // + case ERR_MARKET_WRONG_PROPERTY: + result = "Wrong identifier of a symbol property"; + break; + + // + case ERR_MARKET_LASTTIME_UNKNOWN: + result = "Time of the last tick is not known (no ticks)"; + break; + + // + case ERR_MARKET_SELECT_ERROR: + result = "Error adding or deleting a symbol in MarketWatch"; + break; + + // + //--- History Access + + // + case ERR_HISTORY_NOT_FOUND: + result = "Requested history not found"; + break; + + // + case ERR_HISTORY_WRONG_PROPERTY: + result = "Wrong ID of the history property"; + break; + + // + //--- Global_Variables + + // + case ERR_GLOBALVARIABLE_NOT_FOUND: + result = "Global variable of the client terminal is not found"; + break; + + // + case ERR_GLOBALVARIABLE_EXISTS: + result = "Global variable of the client terminal with the same name already exists"; + break; + + // + case ERR_MAIL_SEND_FAILED: + result = "Email sending failed"; + break; + + // + case ERR_PLAY_SOUND_FAILED: + result = "Sound playing failed"; + break; + + // + case ERR_MQL5_WRONG_PROPERTY: + result = "Wrong identifier of the program property"; + break; + + // + case ERR_TERMINAL_WRONG_PROPERTY: + result = "Wrong identifier of the terminal property"; + break; + + // + case ERR_FTP_SEND_FAILED: + result = "File sending via ftp failed"; + break; + + // + case ERR_NOTIFICATION_SEND_FAILED: + result = "Error in sending notification"; + break; + + // + //--- Custom Indicator Buffers + + // + case ERR_BUFFERS_NO_MEMORY: + result = "Not enough memory for the distribution of indicator buffers"; + break; + + // + case ERR_BUFFERS_WRONG_INDEX: + result = "Wrong indicator buffer index"; + break; + + // + //--- Custom Indicator Properties + + // + case ERR_CUSTOM_WRONG_PROPERTY: + result = "Wrong ID of the custom indicator property"; + break; + + // + //--- Account + + // + case ERR_ACCOUNT_WRONG_PROPERTY: + result = "Wrong account property ID"; + break; + + // + case ERR_TRADE_WRONG_PROPERTY: + result = "Wrong trade property ID"; + break; + + // + case ERR_TRADE_DISABLED: + result = "Trading by Expert Advisors prohibited"; + break; + + // + case ERR_TRADE_POSITION_NOT_FOUND: + result = "Position not found"; + break; + + // + case ERR_TRADE_ORDER_NOT_FOUND: + result = "Order not found"; + break; + + // + case ERR_TRADE_DEAL_NOT_FOUND: + result = "Deal not found"; + break; + + // + case ERR_TRADE_SEND_FAILED: + result = "Trade request sending failed"; + break; + + // + //--- Indicators + + // + case ERR_INDICATOR_UNKNOWN_SYMBOL: + result = "Unknown symbol"; + break; + + // + case ERR_INDICATOR_CANNOT_CREATE: + result = "Indicator cannot be created"; + break; + + // + case ERR_INDICATOR_NO_MEMORY: + result = "Not enough memory to add the indicator"; + break; + + // + case ERR_INDICATOR_CANNOT_APPLY: + result = "The indicator cannot be applied to another indicator"; + break; + + // + case ERR_INDICATOR_CANNOT_ADD: + result = "Error applying an indicator to chart"; + break; + + // + case ERR_INDICATOR_DATA_NOT_FOUND: + result = "Requested data not found"; + break; + + // + case ERR_INDICATOR_WRONG_HANDLE: + result = "Wrong indicator handle"; + break; + + // + case ERR_INDICATOR_WRONG_PARAMETERS: + result = "Wrong number of parameters when creating an indicator"; + break; + + // + case ERR_INDICATOR_PARAMETERS_MISSING: + result = "No parameters when creating an indicator"; + break; + + // + case ERR_INDICATOR_CUSTOM_NAME: + result = "The first parameter in the array must be the name of the custom indicator"; + break; + + // + case ERR_INDICATOR_PARAMETER_TYPE: + result = "Invalid parameter type in the array when creating an indicator"; + break; + + // + case ERR_INDICATOR_WRONG_INDEX: + result = "Wrong index of the requested indicator buffer"; + break; + + // + //--- Depth of Market + + // + case ERR_BOOKS_CANNOT_ADD: + result = "Depth Of Market can not be added"; + break; + + // + case ERR_BOOKS_CANNOT_DELETE: + result = "Depth Of Market can not be removed"; + break; + + // + case ERR_BOOKS_CANNOT_GET: + result = "The data from Depth Of Market can not be obtained"; + break; + + // + case ERR_BOOKS_CANNOT_SUBSCRIBE: + result = "Error in subscribing to receive new data from Depth Of Market"; + break; + + // + //--- File Operations + + // + case ERR_TOO_MANY_FILES: + result = "More than 64 files cannot be opened at the same time"; + break; + + // + case ERR_WRONG_FILENAME: + result = "Invalid file name"; + break; + + // + case ERR_TOO_LONG_FILENAME: + result = "Too long file name"; + break; + + // + case ERR_CANNOT_OPEN_FILE: + result = "File opening error"; + break; + + // + case ERR_FILE_CACHEBUFFER_ERROR: + result = "Not enough memory for cache to read"; + break; + + // + case ERR_CANNOT_DELETE_FILE: + result = "File deleting error"; + break; + + // + case ERR_INVALID_FILEHANDLE: + result = "A file with this handle was closed, or was not opening at all"; + break; + + // + case ERR_WRONG_FILEHANDLE: + result = "Wrong file handle"; + break; + + // + case ERR_FILE_NOTTOWRITE: + result = "The file must be opened for writing"; + break; + + // + case ERR_FILE_NOTTOREAD: + result = "The file must be opened for reading"; + break; + + // + case ERR_FILE_NOTBIN: + result = "The file must be opened as a binary one"; + break; + + // + case ERR_FILE_NOTTXT: + result = "The file must be opened as a text"; + break; + + // + case ERR_FILE_NOTTXTORCSV: + result = "The file must be opened as a text or CSV"; + break; + + // + case ERR_FILE_NOTCSV: + result = "The file must be opened as CSV"; + break; + + // + case ERR_FILE_READERROR: + result = "File reading error"; + break; + + // + case ERR_FILE_BINSTRINGSIZE: + result = "String size must be specified, because the file is opened as binary"; + break; + + // + case ERR_INCOMPATIBLE_FILE: + result = "A text file must be for string arrays, for other arrays - binary"; + break; + + // + case ERR_FILE_IS_DIRECTORY: + result = "This is not a file, this is a directory"; + break; + + // + case ERR_FILE_NOT_EXIST: + result = "File does not exist"; + break; + + // + case ERR_FILE_CANNOT_REWRITE: + result = "File can not be rewritten"; + break; + + // + case ERR_WRONG_DIRECTORYNAME: + result = "Wrong directory name"; + break; + + // + case ERR_DIRECTORY_NOT_EXIST: + result = "Directory does not exist"; + break; + + // + case ERR_FILE_ISNOT_DIRECTORY: + result = "This is a file, not a directory"; + break; + + // + case ERR_CANNOT_DELETE_DIRECTORY: + result = "The directory cannot be removed"; + break; + + // + case ERR_CANNOT_CLEAN_DIRECTORY: + result = "Failed to clear the directory (probably one or more files are blocked and removal operation failed)"; + break; + + // + case ERR_FILE_WRITEERROR: + result = "Failed to write a resource to a file"; + break; + + // + //--- String Casting + + // + case ERR_NO_STRING_DATE: + result = "No date in the string"; + break; + + // + case ERR_WRONG_STRING_DATE: + result = "Wrong date in the string"; + break; + + // + case ERR_WRONG_STRING_TIME: + result = "Wrong time in the string"; + break; + + // + case ERR_STRING_TIME_ERROR: + result = "Error converting string to date"; + break; + + // + case ERR_STRING_OUT_OF_MEMORY: + result = "Not enough memory for the string"; + break; + + // + case ERR_STRING_SMALL_LEN: + result = "The string length is less than expected"; + break; + + // + case ERR_STRING_TOO_BIGNUMBER: + result = "Too large number, more than ULONG_MAX"; + break; + + // + case ERR_WRONG_FORMATSTRING: + result = "Invalid format string"; + break; + + // + case ERR_TOO_MANY_FORMATTERS: + result = "Amount of format specifiers more than the parameters"; + break; + + // + case ERR_TOO_MANY_PARAMETERS: + result = "Amount of parameters more than the format specifiers"; + break; + + // + case ERR_WRONG_STRING_PARAMETER: + result = "Damaged parameter of string type"; + break; + + // + case ERR_STRINGPOS_OUTOFRANGE: + result = "Position outside the string"; + break; + + // + case ERR_STRING_ZEROADDED: + result = "0 added to the string end, a useless operation"; + break; + + // + case ERR_STRING_UNKNOWNTYPE: + result = "Unknown data type when converting to a string"; + break; + + // + case ERR_WRONG_STRING_OBJECT: + result = "Damaged string object"; + break; + + // + //--- Operations with Arrays + + // + case ERR_INCOMPATIBLE_ARRAYS: + result = "Copying incompatible arrays. String array can be copied only to a string array, and a numeric array - in numeric array only"; + break; + + // + case ERR_SMALL_ASSERIES_ARRAY: + result = "The receiving array is declared as AS_SERIES, and it is of insufficient size"; + break; + + // + case ERR_SMALL_ARRAY: + result = "Too small array, the starting position is outside the array"; + break; + + // + case ERR_ZEROSIZE_ARRAY: + result = "An array of zero length"; + break; + + // + case ERR_NUMBER_ARRAYS_ONLY: + result = "Must be a numeric array"; + break; + + // + case ERR_ONEDIM_ARRAYS_ONLY: + result = "Must be a one-dimensional array"; + break; + + // + case ERR_SERIES_ARRAY: + result = "Timeseries cannot be used"; + break; + + // + case ERR_DOUBLE_ARRAY_ONLY: + result = "Must be an array of type double"; + break; + + // + case ERR_FLOAT_ARRAY_ONLY: + result = "Must be an array of type float"; + break; + + // + case ERR_LONG_ARRAY_ONLY: + result = "Must be an array of type long"; + break; + + // + case ERR_INT_ARRAY_ONLY: + result = "Must be an array of type int"; + break; + + // + case ERR_SHORT_ARRAY_ONLY: + result = "Must be an array of type short"; + break; + + // + case ERR_CHAR_ARRAY_ONLY: + result = "Must be an array of type char"; + break; + + // + //--- Operations with OpenCL + + // + case ERR_OPENCL_NOT_SUPPORTED: + result = "OpenCL functions are not supported on this computer"; + break; + + // + case ERR_OPENCL_INTERNAL: + result = "Internal error occurred when running OpenCL"; + break; + + // + case ERR_OPENCL_INVALID_HANDLE: + result = "Invalid OpenCL handle"; + break; + + // + case ERR_OPENCL_CONTEXT_CREATE: + result = "Error creating the OpenCL context"; + break; + + // + case ERR_OPENCL_QUEUE_CREATE: + result = "Failed to create a run queue in OpenCL"; + break; + + // + case ERR_OPENCL_PROGRAM_CREATE: + result = "Error occurred when compiling an OpenCL program"; + break; + + // + case ERR_OPENCL_TOO_LONG_KERNEL_NAME: + result = "Too long kernel name (OpenCL kernel)"; + break; + + // + case ERR_OPENCL_KERNEL_CREATE: + result = "Error creating an OpenCL kernel"; + break; + + // + case ERR_OPENCL_SET_KERNEL_PARAMETER: + result = "Error occurred when setting parameters for the OpenCL kernel"; + break; + + // + case ERR_OPENCL_EXECUTE: + result = "OpenCL program runtime error"; + break; + + // + case ERR_OPENCL_WRONG_BUFFER_SIZE: + result = "Invalid size of the OpenCL buffer"; + break; + + // + case ERR_OPENCL_WRONG_BUFFER_OFFSET: + result = "Invalid offset in the OpenCL buffer"; + break; + + // + case ERR_OPENCL_BUFFER_CREATE: + result = "Failed to create and OpenCL buffer"; + break; + + // + //--- User-Defined Errors + default: + result = "UNKNOWN Erro ..."; + break; + } + + // + return result; + } + + // + // Retrieve Specified Error Code Description ... + string GetTradeServerReturnCodeDescription(int return_code) + { + // + string result = ""; + + // + switch (return_code) + { + // + case TRADE_RETCODE_REQUOTE: + result = "Requote"; + break; + + // + case TRADE_RETCODE_REJECT: + result = "Request rejected"; + break; + + // + case TRADE_RETCODE_CANCEL: + result = "Request canceled by trader"; + break; + + // + case TRADE_RETCODE_PLACED: + result = "Order placed"; + break; + + // + case TRADE_RETCODE_DONE: + result = "Request completed"; + break; + + // + case TRADE_RETCODE_DONE_PARTIAL: + result = "Only part of the request was completed"; + break; + + // + case TRADE_RETCODE_ERROR: + result = "Request processing error"; + break; + + // + case TRADE_RETCODE_TIMEOUT: + result = "Request canceled by timeout"; + break; + + // + case TRADE_RETCODE_INVALID: + result = "Invalid request"; + break; + + // + case TRADE_RETCODE_INVALID_VOLUME: + result = "Invalid volume in the request"; + break; + + // + case TRADE_RETCODE_INVALID_PRICE: + result = "Invalid price in the request"; + break; + + // + case TRADE_RETCODE_INVALID_STOPS: + result = "Invalid stops in the request"; + break; + + // + case TRADE_RETCODE_TRADE_DISABLED: + result = "Trade is disabled"; + break; + + // + case TRADE_RETCODE_MARKET_CLOSED: + result = "Market is closed"; + break; + + // + case TRADE_RETCODE_NO_MONEY: + result = "There is not enough money to complete the request"; + break; + + // + case TRADE_RETCODE_PRICE_CHANGED: + result = "Prices changed"; + break; + + // + case TRADE_RETCODE_PRICE_OFF: + result = "There are no quotes to process the request"; + break; + + // + case TRADE_RETCODE_INVALID_EXPIRATION: + result = "Invalid order expiration date in the request"; + break; + + // + case TRADE_RETCODE_ORDER_CHANGED: + result = "Order state changed"; + break; + + // + case TRADE_RETCODE_TOO_MANY_REQUESTS: + result = "Too frequent requests"; + break; + + // + case TRADE_RETCODE_NO_CHANGES: + result = "No changes in request"; + break; + + // + case TRADE_RETCODE_SERVER_DISABLES_AT: + result = "Autotrading disabled by server"; + break; + + // + case TRADE_RETCODE_CLIENT_DISABLES_AT: + result = "Autotrading disabled by client terminal"; + break; + + // + case TRADE_RETCODE_LOCKED: + result = "Request locked for processing"; + break; + + // + case TRADE_RETCODE_FROZEN: + result = "Order or position frozen"; + break; + + // + case TRADE_RETCODE_INVALID_FILL: + result = "Invalid order filling type"; + break; + + // + case TRADE_RETCODE_CONNECTION: + result = "No connection with the trade server"; + break; + + // + case TRADE_RETCODE_ONLY_REAL: + result = "Operation is allowed only for live accounts"; + break; + + // + case TRADE_RETCODE_LIMIT_ORDERS: + result = "The number of pending orders has reached the limit"; + break; + + // + case TRADE_RETCODE_LIMIT_VOLUME: + result = "The volume of orders and positions for the symbol has reached the limit"; + break; + + // + default: + result = "Invalid return code of the trade server"; + break; + } + + // + return result; + } + + // + // Protected ... +protected: + // + // Private ... + + // + bool CanLog() + { + return mLogAlerts; + } + + // + bool CanLogAlert() + { + // + bool result = GetEnableAlerts() && GetLogAlerts(); + + // + return result; + } + + // + bool CanTerminalAlert() + { + // + bool result = GetEnableAlerts() && GetTerminalAlerts(); + + // + return result; + } + + // + bool CanMailAlert() + { + // + bool result = GetEnableAlerts() && GetMailAlerts(); + + // + return result; + } + + // + bool CanPushAlert() + { + // + bool result = GetEnableAlerts() && GetPushAlerts(); + + // + return result; + } + +private: + // + // Props ... + string mPrefix; // Alerts Prefixe + bool mEnableAlerts; // Enable Alerts + bool mLogAlerts; // Log Alerts + bool mTerminalAlerts; // Terminal Alerts + bool mMailAlerts; // Mail Alerts + bool mPushAlerts; // Push Alerts + + // + // Tools ... + + // + // Clear Escape String and + // Attach Alert Prefix to Message ... + string PrepareMessage(string message) + { + // + StringReplace(message, "\n", " | "); + + // + StringConcatenate(message, GetPrefix(), " > ", message); + + // + return message; + } +}; \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xdata-collector.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xdata-collector.class.mq5 new file mode 100644 index 0000000..8160865 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xdata-collector.class.mq5 @@ -0,0 +1,481 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCDataCollector +// Description: provides Data Collection Requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.base.class.mq5" + +// +template +class XSCDataCollector : public XSCBase +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + void XSCDataCollector( + string path = NULL, // Base Folder for Data Store + string fileName = NULL // File Name for Data Store + ) + { + // + if (!IsValid(path)) + { + path = GetType(); + } + + // + if (!IsValid(fileName)) + { + fileName = GetType() + ".txt"; + } + + // + Path(path); + FileName(fileName); + } + + // + // Deconstructor ... + void ~XSCDataCollector() {} + + // + // Properties ... + + // + bool Path(string value) + { + // + bool result = false; + + // + result = IsValid(value); + if (!result) + { + return result; + } + + // + result = value != mPath; + if (!result) + { + return result; + } + + // + mPath = value; + + // + return result; + } + + // + string Path() + { + return mPath; + } + + // + bool FileName(string value) + { + // + bool result = false; + + // + result = IsValid(value); + if (!result) + { + return result; + } + + // + result = value != mFileName; + if (!result) + { + return result; + } + + // + mFileName = value; + + // + return result; + } + + // + string FileName() + { + return mFileName; + } + + // + // Tools ... + + // + // Clear Exists Collected Data ... + void Clear() + { + // + ResetLastError(); + + // + string dataStorePath = GetStorePath(); + + // + // Check Data Store Exists or not ... + bool isExists = FileIsExist(dataStorePath); + if (!isExists) + { + return; + } + + // + FileDelete(dataStorePath); + } + + // + // Collect All Stored Items ... + int Collect( + T &items[] // Hold Result + ) + { + // + int result = 0; + + // + Clean(items); + + // + // Reading Store Whole Content ... + + // + string storePath = GetStorePath(); + int mFileHandler = FileOpen( + storePath, + FILE_READ | FILE_TXT); + result = mFileHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + // Parse Store Content and Read Data ... + while (!FileIsEnding(mFileHandler)) + { + // + // Each Line Represent One Model ... + string content = FileReadString(mFileHandler); + + // + T iItem; + bool isValid = iItem.ParseModel(content); + if (isValid) + { + // + AddRef( + iItem, + items + // + ); + } + } + + // + // Close File ... + FileClose(mFileHandler); + + // + result = ArraySize(items); + + // + return result; + } + + // + // Add Item ... + bool Add( + T &item // Item to Store + ) + { + // + bool result = false; + + // + result = item.IsModelValid(); + if (!result) + { + return result; + } + + // + string content = item.ToModelString(); + result = IsValid(content); + if (!result) + { + return result; + } + + // + string storePath = GetStorePath(); + int mFileHandler = FileOpen( + storePath, + FILE_READ | FILE_WRITE | FILE_TXT); + result = mFileHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + FileSeek(mFileHandler, 0, SEEK_END); + FileWrite(mFileHandler, content); + FileFlush(mFileHandler); + FileClose(mFileHandler); + + // + return result; + } + + // + // Add Item ... + bool Add( + string content // Content + ) + { + // + bool result = false; + + // + result = IsValid(content); + if (!result) + { + return result; + } + + // + string storePath = GetStorePath(); + int mFileHandler = FileOpen( + storePath, + FILE_READ | FILE_WRITE | FILE_TXT); + result = mFileHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + FileSeek(mFileHandler, 0, SEEK_END); + FileWrite(mFileHandler, content); + FileFlush(mFileHandler); + FileClose(mFileHandler); + + // + return result; + } + + // + // Add Items ... + int Add( + T &items[] // Items to Add ... + ) + { + // + int result = 0; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + T iItem = items[i]; + + // + if (!iItem.IsModelValid()) + { + continue; + } + + // + bool isAdded = Add(iItem); + if (isAdded) + { + result++; + } + } + + // + return result; + } + + // + // Remove Item ... + bool Remove( + T &item // Item to Remove + ) + { + // + bool result = false; + + // + result = item.IsModelValid(); + if (!result) + { + return result; + } + + // + T items[]; + int itemsCount = Collect(items); + if (itemsCount <= 0) + { + return result; + } + + // + int itemIndex = item.FindIndex(items); + result = ArrayRemove( + items, + itemIndex, + 1); + if (!result) + { + return result; + } + + // + Clear(); + + // + int itemsAdded = Add(items); + + // + result = itemsAdded == ArraySize(items); + + // + return result; + } + + // + // Protected ... +protected: + // + // Tools ... + + // + // Retrieve Type of Class as String ... + string GetType() + { + // + string mType = (string) typename(T); + + // + string result = mType; + + // + string parts[]; + int partsCount = SplitContent( + parts, + result, + " " + // + ); + if (partsCount <= 0) + { + // + result = mType; + return result; + } + + // + bool hasLastPart = GetLastItem( + result, + parts + // + ); + if (!hasLastPart) + { + // + result = mType; + return result; + } + + // + return result; + } + + // + // Pricate ... +private: + // + // Props ... + + // + string mPath; // Path + string mFileName; // Data Store File Name + + // + // Tools ... + + // + // Generate Full File Path ... + string GetFilePath(string fileName) + { + // + string result = ""; + + // + result = + // + Path() + "\\" + fileName + // + ; + + // + return result; + } + + // + // Retrieve Data Store File Address ... + string GetStorePath() + { + // + string result = NULL; + + // + result = GetFilePath(mFileName); + + // + return result; + } +}; + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xea.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xea.class.mq5 new file mode 100644 index 0000000..2d59995 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xea.class.mq5 @@ -0,0 +1,3950 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCBaseEA +// Description: provides all Base EA requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include +#include "../Classes/x-saherelm.base.class.mq5" +#include "../Classes/x-saherelm.xalert.class.mq5" +#include "../Classes/x-saherelm.xtrade.class.mq5" + +// +// Define On Signal Event Handler Type ... +typedef void (*TOnSignal)(XSignal &signals[]); + +// +// Tokens ... +string XINProfitToken = "INP"; +string XINDrawdownToken = "IND"; +string XProfitsToken = "PFS"; +string XTimesToken = "TMS"; +string XPricessToken = "PCS"; + +// +enum ENUM_X_PROFIT_TRACK_FIELDS +{ + X_PROFIT_TRACK_PROFIT, + X_PROFIT_TRACK_LONGS_PROFIT, + X_PROFIT_TRACK_SHORTS_PROFIT, +}; + +// +// Model Account Profits ... +struct XProfitTrack +{ + // + int longs; // Number of Long ... + int shorts; // Number of Short ... + + // + double profit; // Profit of All ... + double longsProfit; // Profits of Longs ... + double shortsProfit; // Profits of Shorts ... + + // + double profitFrom; // Profit of All ... + double longsProfitFrom; // Profits of Longs ... + double shortsProfitFrom; // Profits of Shorts ... + + // + double volume; // Volume ... + double longsVolume; // Volume of Longs ... + double shortsVolume; // Volume of Shorts ... + + // + datetime time; // Check Time ... + + // + XProfitTrack() + { + Clean(); + } + + // + // Tools ... + + // + // Initialization ... + bool Init(XSCTrade *mTrader) + { + // + bool result = false; + + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions(positions); + result = positionsCount > 0; + if (!result) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + bool isLong = IsLong(iPosition.type); + + // + if (isLong) + { + // + longs++; + longsVolume += iPosition.volume; + longsProfit += iPosition.profit; + } + else + { + // + shorts++; + shortsVolume += iPosition.volume; + shortsProfit += iPosition.profit; + } + + // + profit += iPosition.profit; + volume += iPosition.volume; + } + + // + result = IsValid(); + if (result) + { + time = TimeCurrent(); + } + + // + return result; + } + + // + double SelectField(ENUM_X_PROFIT_TRACK_FIELDS field) + { + // + double result = profit; + + // + switch (field) + { + // + case X_PROFIT_TRACK_LONGS_PROFIT: + result = longsProfit; + break; + + // + case X_PROFIT_TRACK_SHORTS_PROFIT: + result = shortsProfit; + break; + + // + default: + case X_PROFIT_TRACK_PROFIT: + result = profit; + break; + } + + // + return result; + } + + // + // Cleanup ... + void Clean() + { + // + longs = 0; + shorts = 0; + profit = 0; + volume = 0; + profitFrom = 0; + longsVolume = 0; + longsProfit = 0; + shortsVolume = 0; + shortsProfit = 0; + longsProfitFrom = 0; + shortsProfitFrom = 0; + + // + time = NULL; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + (longs > 0 || shorts > 0) + // + && + // + volume > 0 + // + ; + + // + return result; + } + + // +}; + +// +// Track Specific Position ... +struct XPositionTrack +{ + // + ulong ticket; // Position Ticket + string symbol; // Position Symbol + ENUM_POSITION_TYPE type; // Position Type + ENUM_TIMEFRAMES period; // Position Period + + // + double price[]; // Check Price ... + double profit[]; // Check Profit ... + datetime time[]; // Check Time ... + + // + double tp; // Current TP + double sl; // Current SL + double volume; // Current Volume + double entry; // Position Entry + datetime openAt; // Position Open Time + + // + int inProfitCount; // Number of Cross in DrawDown + int inDrawdownCount; // Number of Crossed in Profit + + // + // Constructor ... + XPositionTrack() + { + Clean(); + } + + // + // Tools ... + + // + // Initialization ... + bool Init( + XPosition &position // Source Position + ) + { + // + bool result = false; + + // + Clean(); + + // + result = position.IsValid(); + if (!result) + { + return result; + } + + // + ticket = position.ticket; + symbol = position.symbol; + period = position.period; + type = position.type; + tp = position.tp; + sl = position.sl; + entry = position.entry; + volume = position.volume; + openAt = position.openAt; + + // + datetime cTime = TimeCurrent(); + Add( + cTime, + time // + ); + + // + Add( + position.profit, + profit // + ); + + // + Add( + position.price, + price // + ); + + // + result = IsValid(); + + // + return result; + } + + // + bool Update( + XPosition &position // Source Position + ) + { + // + bool result = false; + + // + // Check Current Model is Valid or not ... + result = IsValid(); + if (!result) + { + return result; + } + + // + // Check Position is a Valid Model ... + result = position.IsValid(); + if (!result) + { + return result; + } + + // + // Check Current Model belongs to Given Position ... + result = + // + entry == position.entry && + openAt == position.openAt && + symbol == position.symbol && + period == position.period && + type == position.type && + ticket == position.ticket + // + ; + if (!result) + { + return result; + } + + // + tp = position.tp; + sl = position.sl; + volume = position.volume; + + // + datetime cTime = TimeCurrent(); + + // + SetArrayStates(false); + + // + Add( + cTime, + time // + ); + + // + Add( + position.profit, + profit // + ); + + // + Add( + position.price, + price // + ); + + // + SetArrayStates(true); + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + // Fill In Profit or Drawdown Counters ... + + // + bool isCrossInProfit = IsCrossedInProfit(); + if (isCrossInProfit) + { + inProfitCount++; + } + + // + bool isCrossedInDrawdown = IsCrossedInDrawdown(); + if (isCrossedInDrawdown) + { + inDrawdownCount++; + } + + // + return result; + } + + // + // Cleanup ... + void + Clean() + { + // + ticket = 0; + type = NULL; + symbol = NULL; + period = NULL; + + // + tp = 0; + sl = 0; + volume = 0; + entry = 0; + openAt = NULL; + + // + inProfitCount = 0; + inDrawdownCount = 0; + + // + Clean(price); + Clean(profit); + Clean(time); + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + ticket > 0 && + type != NULL && + period != NULL && + volume > 0 && + entry > 0 && + openAt > 0 + // + ; + + // + return result; + } + + // + void SetArrayStates(bool state) + { + // + ArraySetAsSeries(price, state); + ArraySetAsSeries(profit, state); + ArraySetAsSeries(time, state); + } + + // + bool IsCrossedInProfit() + { + // + bool result = false; + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + result = ArraySize(time) > 1; + if (!result) + { + return result; + } + + // + result = + // + profit[0] > 0 && + profit[1] < 0 + // + ; + + // + return result; + } + + // + bool IsCrossedInDrawdown() + { + // + bool result = false; + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + result = ArraySize(time) > 1; + if (!result) + { + return result; + } + + // + result = + // + profit[0] < 0 && + profit[1] > 0 + // + ; + + // + return result; + } + + // + // Collector Tools ... + + // + string GetToken() + { + return GetToken(this); + } + + // + bool IsModelValid() + { + return IsValid(); + } + + // + bool IsSameAs(XPositionTrack &track) + { + // + bool result = false; + + // + result = + // + track.IsValid() && + type == track.type && + ticket == track.ticket && + symbol == track.symbol && + period == track.period && + openAt == track.openAt + // + ; + + // + return result; + } + + // + int FindIndex( + const XPositionTrack &values[] // Collection + ) + { + // + return FindIndex( + this, + values + // + ); + } + + // + // Converts a Model to String Representation ... + string ToModelString() + { + // + string result = NULL; + + // + if (!IsValid()) + { + return result; + } + + // + // For Modeling a PositionTrack Object ... + // - tp + // - sl + // - type + // - entry + // - ticket + // - symbol + // - period + // - openAt + // - volume + // - inProfitCount + // - inDrawdownCount + // - time[] + // - price[] + // - profit[] + + // + // Ticket ... + string ticketStr = Surround(XIDToken, ticket); + + // + // Symbol ... + string SymbolStr = Surround(XSymbolToken, symbol); + + // + // Type ... + string typeStr = Surround(XTypeToken, type); + + // + // Period ... + int iPeriodInt = (int)period; + string periodStr = Surround(XPeriodToken, iPeriodInt); + + // + // TP ... + string tpStr = Surround(XTPToken, tp); + + // + // SL ... + string slStr = Surround(XSLToken, sl); + + // + // Volume ... + string volumeStr = Surround(XVolumeToken, volume); + + // + // Entry ... + string entryStr = Surround(XEntryToken, entry); + + // + // OpenAt ... + string timeStr = Surround(XTimeToken, openAt); + + // + // InProfitCount ... + string inProfitCountStr = Surround(XINProfitToken, inProfitCount); + + // + // InDrawdownCount ... + string inDrawdownCountStr = Surround(XINDrawdownToken, inDrawdownCount); + + // + // Time(s) ... + string timesContentStr = ToString(time); + string timesStr = Surround(XTimesToken, timesContentStr); + + // + // Price(s) ... + string pricesContentStr = ToString(price); + string pricesStr = Surround(XPricessToken, pricesContentStr); + + // + // Profit(s) ... + string profitsContentStr = ToString(profit); + string profitsStr = Surround(XProfitsToken, profitsContentStr); + + // + string token = GetToken(); + + // + result = + // + token + + "[" + + // + ticketStr + + SymbolStr + + typeStr + + periodStr + + tpStr + + slStr + + volumeStr + + entryStr + + timeStr + + inProfitCountStr + + inDrawdownCountStr + + timesStr + + pricesStr + + profitsStr + + // + "]" + // + ; + + // + return result; + } + + // + // Pres and Fill Model based on it's String Representation ... + bool ParseModel(string value) + { + // + bool result = false; + + // + Clean(); + + // + result = IsValid(value); + if (!result) + { + return result; + } + + // + // For Modeling a PositionTrack Object ... + // - tp + // - sl + // - type + // - entry + // - ticket + // - symbol + // - period + // - openAt + // - volume + // - inProfitCount + // - inDrawdownCount + // - time[] + // - price[] + // - profit[] + + // + // TP ... + tp = ParseDoubleSurrounded(value, XTPToken); + + // + // SL ... + tp = ParseDoubleSurrounded(value, XSLToken); + + // + // Type ... + type = ((ENUM_POSITION_TYPE)ParseIntSurrounded(value, XTypeToken)); + + // + // Entry ... + entry = ParseDoubleSurrounded(value, XEntryToken); + + // + // Ticket ... + ticket = ParseLongSurrounded(value, XIDToken); + + // + // Symbol ... + symbol = ParseStringSurrounded(value, XSymbolToken); + + // + // Period ... + period = ((ENUM_TIMEFRAMES)ParseIntSurrounded(value, XPeriodToken)); + + // + // Open At ... + openAt = ParseTimeSurrounded(value, XTimeToken); + + // + // Volume ... + volume = ParseDoubleSurrounded(value, XVolumeToken); + + // + // InProfitCount ... + inProfitCount = ParseIntSurrounded(value, XINProfitToken); + + // + // InDrawdownCount ... + inDrawdownCount = ParseIntSurrounded(value, XINDrawdownToken); + + // + // Time(s) ... + ParseTimeArraySurrounded( + time, + value, + XTimesToken + // + ); + + // + // Price(s) ... + ParseDoubleArraySurrounded( + price, + value, + XPricessToken + // + ); + + // + // Profit(s) ... + ParseDoubleArraySurrounded( + profit, + value, + XProfitsToken + // + ); + + // + result = IsValid(); + + // + return result; + } +}; + +// +// Type Definitions for XPosition Tracker Events ... +typedef void (*TOnPositionState)(const XPositionTrack &track); + +// +// an Struct for Holding Event Handled Items for Position Tracker ... +struct XPositionTrackerState +{ + // + XPositionTrack inProfits[]; + XPositionTrack inDrawdowns[]; + + // + XPositionTrack onProfits[]; + XPositionTrack onDrawdowns[]; + + // + XPositionTrackerState() + { + Clean(); + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + Clean(inProfits); + Clean(inDrawdowns); + + // + Clean(onProfits); + Clean(onDrawdowns); + } +}; + +// +// Position Tracker Class ... +class XSCPositionTracker +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructor ... + void XSCPositionTracker(bool cleanStore = false) + { + // + XSCDataCollector mBase; + + // + if (cleanStore) + { + mBase.Clear(); + } + } + + // + // Tools ... + + // + // Cleaning Store ... + void Clear() + { + // + XSCDataCollector mBase; + + // + mBase.Clear(); + } + + // + // Collect All Store ... + int Collect(XPositionTrack &result[]) + { + // + int mResult = 0; + + // + XSCDataCollector mBase; + + // + mResult = mBase.Collect(result); + + // + return mResult; + } + + // + // Add Item To Store ... + bool Add(XPositionTrack &item) + { + // + bool result = false; + + // + XSCDataCollector mBase; + + // + result = mBase.Add(item); + + // + return result; + } + + // + // Add Item(s) To Store ... + int Add(XPositionTrack &items[]) + { + // + int result = 0; + + // + XSCDataCollector mBase; + + // + result = mBase.Add(items); + + // + return result; + } + + // + // Remove an Item from Store ... + bool Remove(XPositionTrack &item) + { + // + bool result = false; + + // + XSCDataCollector mBase; + + // + result = mBase.Remove(item); + + // + return result; + } + + // + // Custom Functions ... + + // + // Sync all Content using Specific Trader Class ... + int Sync( + XPositionTrackerState &state, // Hold all Changes State ... + XSCTrade *mTrader // XSCTrade Instance for Synchronize ... + ) + { + // + int result = 0; + + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions(positions); + + // + ulong trackTickets[]; + XPositionTrack trackers[]; + int trackersCount = Collect(trackers); + + // + // Nothing to Do ... + if (positionsCount <= 0 && trackersCount <= 0) + { + return result; + } + + // + // Collect Exists Trackers Ticket's For Managing ... + for (int i = 0; i < trackersCount; i++) + { + // + XPositionTrack iTrack = trackers[i]; + + // + bool isValid = iTrack.IsValid(); + if (isValid) + { + // + AddSpecific( + iTrack.ticket, + trackTickets // + ); + } + } + + // + // Clear Tracker Store for Update Later ... + Clear(); + + // + // Collect All Required to Add/Update Trackers here ... + XPositionTrack syncedTracks[]; + + // + // a Flag for Synchronization Performance ... + bool hasTracker = trackersCount > 0; + + // + // Loop through Position for Managing Trackers ... + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + // if there isn't any Track before ... + if (!hasTracker) + { + // + XPositionTrack iTrack; + bool isInited = iTrack.Init(iPosition); + if (isInited) + { + // + AddRef( + iTrack, + syncedTracks // + ); + + // + FillState( + iTrack, + state // + ); + } + + // + continue; + } + + // + // if there was some tracks ... + + // + // Try to Find Position Ticket in Track Tickets ... + int iTicketIdx = FindIndex( + iPosition.ticket, + trackTickets // + ); + bool isTrackedBefore = iTicketIdx >= 0; + + // + // Add new Track ... + if (!isTrackedBefore) + { + // + XPositionTrack iTrack; + bool isInited = iTrack.Init(iPosition); + if (isInited) + { + // + AddRef( + iTrack, + syncedTracks // + ); + + // + FillState( + iTrack, + state // + ); + } + } + // + // Update Exists Track ... + else + { + // + XPositionTrack iTrack = trackers[iTicketIdx]; + bool isUpdated = iTrack.Update(iPosition); + if (isUpdated) + { + // + AddRef( + iTrack, + syncedTracks // + ); + + // + FillState( + iTrack, + state // + ); + } + } + } + + // + // Check Synced Tracks ... + int syncedTracksCount = ArraySize(syncedTracks); + if (syncedTracksCount <= 0) + { + return result; + } + + // + result = Add(syncedTracks); + + // + return result; + } + + // + // Event Handlers ... + + // + // Add Profit Event Handler ... + void AddOnProfitEventHandler(TOnPositionState handler) + { + // + AddSpecific( + handler, + mOnProfitEventHandlers // + ); + } + + // + // Add Drawdown Event Handler ... + void AddOnDrawdownEventHandler(TOnPositionState handler) + { + // + AddSpecific( + handler, + mOnDrawdownEventHandlers // + ); + } + + // + // Protected ... +protected: + // + // Tools ... + + // + // Event Handlers ... + + // + // OnProfit ... + void NotifyOnProfitEvent(XPositionTrack &track) + { + // + int count = ArraySize(mOnProfitEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnPositionState iHandler = mOnProfitEventHandlers[i]; + iHandler(track); + } + } + + // + // OnDrawdown ... + void NotifyOnDrawdownEvent(XPositionTrack &track) + { + // + int count = ArraySize(mOnDrawdownEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnPositionState iHandler = mOnDrawdownEventHandlers[i]; + iHandler(track); + } + } + + // + // Private ... +private: + // + // Props ... + + // + TOnPositionState mOnProfitEventHandlers[]; + TOnPositionState mOnDrawdownEventHandlers[]; + + // + void FillState( + XPositionTrack &track, + XPositionTrackerState &state // + ) + { + // + // In Profit ... + bool isInProfit = track.profit[0] > 0; + if (isInProfit) + { + // + AddRef( + track, + state.inProfits // + ); + } + + // + // In Drawdown ... + bool isInDrawdown = track.profit[0] < 0; + if (isInDrawdown) + { + // + AddRef( + track, + state.inDrawdowns // + ); + } + + // + // On Profit ... + bool isOnProfit = track.IsCrossedInProfit(); + if (isOnProfit) + { + // + AddRef( + track, + state.onProfits // + ); + } + + // + // On Drawdown ... + bool isOnDrawdown = track.IsCrossedInDrawdown(); + if (isOnDrawdown) + { + // + AddRef( + track, + state.onDrawdowns // + ); + } + } +}; + +// +class XSCPositionHolder +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructor(s) ... + + // + XSCPositionHolder() + { + Clear(); + } + + // + // Tools ... + + // + // Cleanup ... + void Clear() + { + Clean(mItems); + } + + // + bool AddItem(XPosition &item) + { + // + bool result = false; + + // + result = item.IsValid(); + if (!result) + { + return result; + } + + // + result = !HasItem(item); + if (!result) + { + return result; + } + + // + AddRef( + item, + mItems // + ); + + // + return result; + } + + // + int AddItems(XPosition &items[]) + { + // + int result = 0; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = items[i]; + + // + bool isAdded = AddItem(iItem); + if (isAdded) + { + result++; + } + } + + // + return result; + } + + // + bool AddOrUpdateItem(XPosition &item) + { + // + bool result = false; + + // + result = item.IsValid(); + if (!result) + { + return result; + } + + // + bool hasItem = HasItem(item); + if (!hasItem) + { + result = AddItem(item); + } + else + { + // + result = RemoveItem(item); + if (result) + { + result = AddItem(item); + } + } + + // + return result; + } + + // + int AddOrUpdateItem(XPosition &items[]) + { + // + int result = 0; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = items[i]; + + // + bool isAddOrUpdated = AddOrUpdateItem(iItem); + if (isAddOrUpdated) + { + result++; + } + } + + // + return result; + } + + // + bool HasItem(XPosition &item) + { + // + bool result = false; + + // + int itemIDX = FindItem(item); + result = itemIDX >= 0; + + // + return result; + } + + // + int FindItem(XPosition &item) + { + // + int result = -1; + + // + if (!item.IsValid()) + { + return result; + } + + // + int itemsCount = CountItems(); + if (itemsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isSame = IsItemSameAs(item, iItem); + if (isSame) + { + // + result = i; + break; + } + } + + // + return result; + } + + // + bool GetByIndex( + int index, + XPosition &item // + ) + { + // + bool result = false; + + // + NormalizeIndex( + index, + mItems // + ); + + // + item = mItems[index]; + + // + result = item.IsValid(); + + // + return result; + } + + // + bool RemoveItem(XPosition &item) + { + // + bool result = false; + + // + result = HasItem(item); + if (!result) + { + return result; + } + + // + int itemIDX = FindItem(item); + result = ArrayRemove( + mItems, + itemIDX, + 1 // + ); + + // + return result; + } + + // + int RemoveItems(XPosition &items[]) + { + // + int result = 0; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = items[i]; + + // + bool isRemoved = RemoveItem(iItem); + if (isRemoved) + { + result++; + } + } + + // + return result; + } + + // + int CountItems() + { + return ArraySize(mItems); + } + + // + bool IsItemSameAs( + XPosition &source, + XPosition &dest // Compare Source with this ... + ) + { + // + bool result = false; + + // + result = + // + dest.IsValid() && + source.IsValid() && + source.symbol == dest.symbol && + source.period == dest.period && + source.ticket == dest.ticket && + source.openAt == dest.openAt && + source.provider == dest.provider + // + ; + + // + return result; + } + + // + // Custom Functions ... + + // + bool GetMaxInDrawdown( + XPosition &item // Result + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + int maxIDX = -1; + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool canSelect = + // + iItem.profit < 0 + // + && + // + ( + // + (maxIDX == -1 && !item.IsValid()) + ? true + : item.profit < iItem.profit + // + ) + // + ; + if (canSelect) + { + // + maxIDX = i; + item = iItem; + } + } + + // + result = maxIDX > -1 && item.IsValid(); + + // + return result; + } + + // + bool GetMaxInProfit( + XPosition &item // Result + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + int maxIDX = -1; + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool canSelect = + // + iItem.profit > 0 + // + && + // + ( + // + (maxIDX == -1 && !item.IsValid()) + ? true + : item.profit < iItem.profit + // + ) + // + ; + if (canSelect) + { + // + maxIDX = i; + item = iItem; + } + } + + // + result = maxIDX > -1 && item.IsValid(); + + // + return result; + } + + // + bool GetFarestEntry( + XPosition &item, // Result + string symbol = NULL, + string provider = NULL, + ENUM_TIMEFRAMES period = NULL, + ENUM_POSITION_TYPE type = NULL // + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isFiltersPassed = + // + iItem.IsFiltersPassed( + symbol, + provider, + period, + type // + ) + // + ; + + // + if (!isFiltersPassed) + { + continue; + } + + // + // Do Additional Filtering ... + bool isValidEntry = + // + !item.IsValid() + ? true + : item.entry < iItem.entry + // + ; + if (isValidEntry) + { + // + item = iItem; + } + } + + // + result = item.IsValid(); + + // + return result; + } + + // + bool GetNearestEntry( + XPosition &item, // Result + string symbol = NULL, + string provider = NULL, + ENUM_TIMEFRAMES period = NULL, + ENUM_POSITION_TYPE type = NULL // + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isFiltersPassed = + // + iItem.IsFiltersPassed( + symbol, + provider, + period, + type // + ) + // + ; + + // + if (!isFiltersPassed) + { + continue; + } + + // + // Do Additional Filtering ... + bool isValidEntry = + // + !item.IsValid() + ? true + : item.entry > iItem.entry + // + ; + if (isValidEntry) + { + // + item = iItem; + } + } + + // + result = item.IsValid(); + + // + return result; + } + + // + bool GetFarestSL( + XPosition &item, // Result + string symbol = NULL, + string provider = NULL, + ENUM_TIMEFRAMES period = NULL, + ENUM_POSITION_TYPE type = NULL // + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isFiltersPassed = + // + iItem.IsFiltersPassed( + symbol, + provider, + period, + type // + ) + // + ; + + // + if (!isFiltersPassed) + { + continue; + } + + // + // Do Additional Filtering ... + bool isValidEntry = + // + !item.IsValid() + ? true + : item.sl < iItem.sl + // + ; + if (isValidEntry) + { + // + item = iItem; + } + } + + // + result = item.IsValid(); + + // + return result; + } + + // + bool GetNearestSL( + XPosition &item, // Result + string symbol = NULL, + string provider = NULL, + ENUM_TIMEFRAMES period = NULL, + ENUM_POSITION_TYPE type = NULL // + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isFiltersPassed = + // + iItem.IsFiltersPassed( + symbol, + provider, + period, + type // + ) + // + ; + + // + if (!isFiltersPassed) + { + continue; + } + + // + // Do Additional Filtering ... + bool isValidEntry = + // + !item.IsValid() + ? true + : item.sl > iItem.sl + // + ; + if (isValidEntry) + { + // + item = iItem; + } + } + + // + result = item.IsValid(); + + // + return result; + } + + // + bool GetFarestTP( + XPosition &item, // Result + string symbol = NULL, + string provider = NULL, + ENUM_TIMEFRAMES period = NULL, + ENUM_POSITION_TYPE type = NULL // + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isFiltersPassed = + // + iItem.IsFiltersPassed( + symbol, + provider, + period, + type // + ) + // + ; + + // + if (!isFiltersPassed) + { + continue; + } + + // + // Do Additional Filtering ... + bool isValidEntry = + // + !item.IsValid() + ? true + : item.tp < iItem.tp + // + ; + if (isValidEntry) + { + // + item = iItem; + } + } + + // + result = item.IsValid(); + + // + return result; + } + + // + bool GetNearestTP( + XPosition &item, // Result + string symbol = NULL, + string provider = NULL, + ENUM_TIMEFRAMES period = NULL, + ENUM_POSITION_TYPE type = NULL // + ) + { + // + bool result = false; + + // + item.Clean(); + + // + int itemsCount = CountItems(); + result = IsValidSize(itemsCount); + if (!result) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = mItems[i]; + + // + bool isFiltersPassed = + // + iItem.IsFiltersPassed( + symbol, + provider, + period, + type // + ) + // + ; + + // + if (!isFiltersPassed) + { + continue; + } + + // + // Do Additional Filtering ... + bool isValidEntry = + // + !item.IsValid() + ? true + : item.tp > iItem.tp + // + ; + if (isValidEntry) + { + // + item = iItem; + } + } + + // + result = item.IsValid(); + + // + return result; + } + + // + // Private ... +private: + // + // Props ... + XPosition mItems[]; +}; + +// +// Class Definition ... + +class XSCBaseEA : public XSCBase +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructor ... + XSCBaseEA( + // + // XTrade Class Requirements ... + int slippage, // Specify Slippage + ulong magicNumber, // Specify Magic Number + int manageInterval, // Manager Check Intervals Seconds + double maxAllowedSpread, // Max Allowed Spred for Opening Trades + int maxAllowedPositions, // Max Allowed Positions + double maxAllowedDrawdownFactor, // Max Allowed Drawdown Factor + double staticVolume, // Static Volume for Positions + // + // Position Management ... + bool allowLong = true, // Allow Long Trades + bool allowShort = true, // Allow Short Trades + double minProfitPerTrade = 0, // Min Profit Per Trade based On Volume Factor (Hedge) + double minProfitPerVolumeFactor = 0, // Min Volume Factor for Calculating Profit (Hedge) + // + // Event Handlers ... + TOnStopLoss onStopLossTriggered = NULL, // On StopLoass Triggered Event Handler + TOnTakeProfit onTakeProfitTriggered = NULL, // On TakeProfit Triggered Event Handler + TOnDealsChanged onDealsChangedHandler = NULL, // On Deals Changed Event Handler + TOnOrdersChanged onOrdersChangedHandler = NULL, // On Orders Changed Event Handler + TOnPositionsChanged onPositionsChangedHandler = NULL, // On Positions Changed Event Handler + TOnTradeStateChanged onTradeStateChangedHandler = NULL, // On Trade State Changed Event Handler + // + // Log Handler ... + bool enableAlerts = true, // Enable Alerts + bool logAlerts = true, // Log Alerts + bool terminalAlerts = false, // Terminal Alerts + bool mailAlerts = false, // Mail Alerts + bool pushAlerts = false // Push Alerts + ) + { + // + // Instance XSCTrade Class ... + mTrader = new XSCTrade( + slippage, + magicNumber, + manageInterval, + maxAllowedSpread, + maxAllowedPositions, + maxAllowedDrawdownFactor + // + ); + + // + mIsInTestMode = IsRunningOnTestMode(); + + // + // Position Management ... + mAllowLong = allowLong; + mAllowShort = allowShort; + mMinProfitPerTrade = minProfitPerTrade; + mMinProfitPerVolumeFactor = minProfitPerVolumeFactor; + mStaticVolume = staticVolume; + + // + // Set Event Handlers ... + mOnStopLossTriggered = onStopLossTriggered; + mOnTakeProfitTriggered = onTakeProfitTriggered; + mOnDealsChangedHandler = onDealsChangedHandler; + mOnOrdersChangedHandler = onOrdersChangedHandler; + mOnPositionsChangedHandler = onPositionsChangedHandler; + mOnTradeStateChangedHandler = onTradeStateChangedHandler; + + // + // Add Event Listeners to XTrade Class if they Provided ... + if (mOnStopLossTriggered != NULL) + { + mTrader.AddOnStopLossEventHandler(mOnStopLossTriggered); + } + + // + if (mOnTakeProfitTriggered != NULL) + { + mTrader.AddOnTakeProfitEventHandler(mOnTakeProfitTriggered); + } + + // + if (mOnDealsChangedHandler != NULL) + { + mTrader.AddOnDealsChangedEventHandler(mOnDealsChangedHandler); + } + + // + if (mOnOrdersChangedHandler != NULL) + { + mTrader.AddOnOrdersChangedEventHandler(mOnOrdersChangedHandler); + } + + // + if (mOnPositionsChangedHandler != NULL) + { + mTrader.AddOnPositionsChangedEventHandler(mOnPositionsChangedHandler); + } + + // + if (mOnTradeStateChangedHandler != NULL) + { + mTrader.AddOnTradeStateChangedEventHandler(mOnTradeStateChangedHandler); + } + + // + // Instantiate Alert Class ... + mAlert = new XSCAlert( + GetTag(), + enableAlerts, + logAlerts, + terminalAlerts, + mailAlerts, + pushAlerts + // + ); + + // + // Instantiate XPositionTracker Class ... + mPositionTracker = new XSCPositionTracker(); + + // + // Do Synchronisation after Instantiate everything ... + XPositionTrackerState state; + mPositionTracker.Sync( + state, + mTrader // + ); + } + + // + // Deconstractor ... + ~XSCBaseEA() + { + // + delete mTrader; + delete mAlert; + delete mPositionTracker; + } + + // + // Properties Getter(s) / Setter(s) ... + + // + // Retrieve Slippage ... + int GetSlippage() + { + return mTrader.GetSlippage(); + } + + // + // Retrieve Magic Number ... + ulong GetMagicNumber() + { + return mTrader.GetMagicNumber(); + } + + // + // Retrieve Max Allowed Spread for Trading ... + double GetMaxAllowedSpread() + { + return mTrader.GetMaxAllowedSpread(); + } + + // + // Retrieve Max Allowed Same Time Positions Count ... + int GetMaxAllowedPositions() + { + return mTrader.GetMaxAllowedPositions(); + } + + // + // Retrieve Max Allowed Drawdown for Opening new Trades ... + double GetMaxAllowedDrawdownFactor() + { + return mTrader.GetMaxAllowedDrawdownFactor(); + } + + // + double GetStaticVolume() + { + return mStaticVolume; + } + + // + void SetStaticVolume(double value) + { + // + if (value <= 0) + { + value = 0.01; + } + + // + mStaticVolume = value; + } + + // + bool GetAllowLong() + { + return mAllowLong; + } + + // + void SetAllowLong(bool value) + { + mAllowLong = value; + } + + // + bool GetAllowShort() + { + return mAllowShort; + } + + // + void SetAllowShort(bool value) + { + mAllowShort = value; + } + + // + double GetMinProfitPerTrade() + { + return mMinProfitPerTrade; + } + + // + void SetMinProfitPerTrade(double value) + { + // + if (value <= 0) + { + value = 0; + } + + // + if (value == mMinProfitPerTrade) + { + return; + } + + // + mMinProfitPerTrade = value; + } + + // + double GetMinProfitPerVolumeFactor() + { + return mMinProfitPerVolumeFactor; + } + + // + void SetMinProfitPerVolumeFactor(double value) + { + // + if (value <= 0) + { + value = 0; + } + + // + if (value == mMinProfitPerVolumeFactor) + { + return; + } + + // + mMinProfitPerVolumeFactor = value; + } + + // + // Alert ... + + // + bool GetLogAlerts() + { + return mAlert.GetLogAlerts(); + } + + // + void SetLogAlerts(bool value) + { + mAlert.SetLogAlerts(value); + } + + // + bool GetEnableAlerts() + { + return mAlert.GetEnableAlerts(); + } + + // + void SetEnableAlerts(bool value) + { + mAlert.SetEnableAlerts(value); + } + + // + bool GetPushAlerts() + { + return mAlert.GetPushAlerts(); + } + + // + void SetPushAlerts(bool value) + { + mAlert.SetPushAlerts(value); + } + + // + bool GetMailAlerts() + { + return mAlert.GetMailAlerts(); + } + + // + void SetMailAlerts(bool value) + { + mAlert.SetMailAlerts(value); + } + + // + bool GetTerminalAlerts() + { + return mAlert.GetTerminalAlerts(); + } + + // + void SetTerminalAlerts(bool value) + { + mAlert.SetTerminalAlerts(value); + } + + // + // Event Listeners ... + void AddOnSignalEventHandler(TOnSignal listener) + { + // + Add( + listener, + mOnSignalEventHandlers + // + ); + } + + // + // Overrides ... + + // + // Customize Token ... + virtual string GetToken() + { + return GetSpecificToken(this); + } + + // + virtual string GetTag() + { + return this.GetToken(); + } + + // + // Virtual Functions ... + + // + // Handle Chart Events ... + virtual void OnChartEvent( + const int id, // event ID + const long &lparam, // long type event parameter + const double &dparam, // double type event parameter + const string &sparam // string type event parameter + ) + { + } + + // + // OnTick Handler ... + virtual void OnTick() + { + // + // Draw ... + Draw(); + + // + // Check Trade Events ... + OnTrade(); + + // + HandleProfitManageMent(); + + // + // First Check For Any Guard Actions ... + // then Handle Guards if Provided ... + XGuard guards[]; + bool hasGuard = CheckForGuard(guards); + if (hasGuard) + { + DoGuards(guards); + } + + // + XSignal signals[]; + + // + // Second Check for Position Management or Equity Management + // Actions like Supports or etc ... + bool isIgnored = HandleStateManagement(signals); + if (isIgnored) + { + return; + } + + // + // Second Check For Signals ... + // then Execute Signals if Provided ... + int signalsCount = RequestForSignal(signals); + if (signalsCount <= 0) + { + return; + } + + // + // Execute Signals ... + HandleSignalsExecution(signals); + } + + // + // Handle StopLoss Event ... + virtual void OnStopLossTriggered(const XDeal &deal) {} + + // + // Handle TakeProfit Event ... + virtual void OnTakeProfitTriggered(const XDeal &deal) {} + + // + // Handle Deals Changed Event ... + virtual void OnDealsChangedHandler(int count) {} + + // + // Handle Order Changed Event ... + virtual void OnOrdersChangedHandler(int count) {} + + // + // Handle Position Changed Event ... + virtual void OnPositionsChangedHandler(int count) {} + + // + // Handle Trade State Changed ... + virtual void OnTradeStateChangedHandler(const XOnTradeHandlerState &state) {} + + // + // Handle On Trade ... + virtual void OnTrade() + { + // + XOnTradeHandlerState state = mTrader.HandleOnTrade(); + + // + if ( + !state.hasNewDeal && + !state.hasNewOrder && + !state.hasNewPosition && + !state.hasNewHistoryOrder) + { + return; + } + + // + // STATE ... + + // + // Notfy Trade State Changed Event ... + OnTradeStateChangedHandler(state); + + // + // DEALS ... + if (state.hasNewDeal) + { + // + // Notfy Deals Changed Event ... + OnDealsChangedHandler(state.newDeals); + + // + // Retrieve Last Deal ... + XDeal deals[]; + mTrader.GetDeals(deals); + int dealsCount = ArraySize(deals); + if (dealsCount > 0) + { + // + XDeal lastDeal = deals[0]; + + // + if (lastDeal.reason == DEAL_REASON_TP) + { + OnTakeProfitTriggered(lastDeal); + } + else if (lastDeal.reason == DEAL_REASON_SL) + { + OnStopLossTriggered(lastDeal); + } + } + } + + // + // ORDERS ... + if (state.hasNewOrder || state.hasNewHistoryOrder) + { + // + // Notfy Orders Changed Event ... + OnOrdersChangedHandler(state.newOrders + state.newHistoryOrders); + } + + // + // POSITIONS ... + if (state.hasNewPosition) + { + // + // Notfy Positions Changed Event ... + OnPositionsChangedHandler(state.newPositions); + } + } + + // + // Retrieve Dept Of Market ... + virtual void OnBookEvent(const string &symbol) + { + // + // TODO: Implement this ... + } + + // + // Draw On Chart if anything is required ... + virtual void Draw() {} + + // + // Check For any Guard Actions ... + virtual bool CheckForGuard(XGuard &guards[]) + { + return false; + } + + // + // When a Guard Notified to Do Support Signal ... + // this Method Calls For Retrieve Support Signal ... + // if it's Provided, Execute it ... + virtual bool RequestForSupport( + XSignal &support, // Holds Support Signal, if Provided + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame + ) + { + return false; + } + + // + // Handle Position(s)/ Order(s) or EQM Supporting Action ... + // if returns false, prevent for process Tick ... + virtual bool HandleStateManagement(XSignal &signals[]) + { + return false; + } + + // + // Regulary Filtered Signals passed to this + // and here we can do Additional Signal Filtering + // for Signal Management such as (Providers and etc) ... + virtual int HandleSignalManagement(XSignal &signals[]) + { + // + int result = ArraySize(signals); + + // + return result; + } + + // + // Here we Have to Check Market based + // on our Strategy for Trading ... + // and if a Good Entry founded ... + // model it as an XSignal struct and passed it to result ... + virtual int RequestForSignal( + XSignal &signals[] // Holds Signals ... + ) + { + return 0; + } + + // + // Execute Provided Signals ... + virtual void HandleSignalsExecution(XSignal &signals[]) + { + // + int signalsCount = ArraySize(signals); + if (signalsCount <= 0) + { + return; + } + + // + // Filter Signals Based on their Types ... + XSignal filteredSignals[]; + + // + // Try to Filter Signals ... + for (int i = 0; i < signalsCount; i++) + { + // + XSignal iSignal = signals[i]; + + // + bool isLong = IsLong(iSignal.type); + + // + if ((isLong && !GetAllowLong()) || (!isLong && !GetAllowShort())) + { + continue; + } + + // + AddRef( + iSignal, + filteredSignals // + ); + } + + // + int filteredSignalsCount = ArraySize(filteredSignals); + if (filteredSignalsCount <= 0) + { + return; + } + + // + int managedSignalsCount = HandleSignalManagement(filteredSignals); + if (managedSignalsCount <= 0) + { + return; + } + + // + // Try to Execute Signals ... + ENUM_X_SIGNAL_EXECUTION_RESULT reasons[]; + int executedSignalsCount = mTrader.ExecuteSignals( + filteredSignals, + reasons + // + ); + + // + string message = NULL; + if (executedSignalsCount == 0) + { + // + message = "(" + ToString(filteredSignalsCount) + ") Signals Execution Failed ..."; + + // + for (int j = 0; j < ArraySize(reasons); j++) + { + // + string iReason = ToString(reasons[j]); + + // + message += "\n" + ToString(j) + ": " + iReason; + } + } + else if (executedSignalsCount < filteredSignalsCount) + { + // + int diff = filteredSignalsCount - executedSignalsCount; + + // + message = "Failed to Execute (" + ToString(diff) + ") Signals ..."; + } + else if (executedSignalsCount == filteredSignalsCount) + { + message = "(" + ToString(executedSignalsCount) + ") Signals Executed Successfully ..."; + } + + // + if (IsValid(message)) + { + mAlert.Alert(message); + } + } + + // + virtual void OnGoingToProfit(XProfitTrack &track) {} + virtual void OnLongsGoingToProfit(XProfitTrack &track) {} + virtual void OnShortsGoingToProfit(XProfitTrack &track) {} + + // + virtual void OnGoingToDrawdown(XProfitTrack &track) {} + virtual void OnLongsGoingToDrawdown(XProfitTrack &track) {} + virtual void OnShortsGoingToDrawdown(XProfitTrack &track) {} + + // + virtual void OnPositionGoingInProfit(XPositionTrack &track) {} + virtual void OnPositionGoingToDrawdown(XPositionTrack &track) {} + + // + // Protected ... +protected: + // + // Props ... + + // + // Trade Class Instance ... + XSCTrade *mTrader; + XSCAlert *mAlert; + XSCPositionTracker *mPositionTracker; + + // + // Check in Test Mode or not ... + bool mIsInTestMode; + + // + // Tools ... + + // + // Signal Event Listeners ... + void NotifyOnSignalEventHandlers(XSignal &signals[]) + { + // + int listenersCount = ArraySize(mOnSignalEventHandlers); + if (listenersCount <= 0) + { + return; + } + + // + for (int i = 0; i < listenersCount; i++) + { + // + TOnSignal iListener = mOnSignalEventHandlers[i]; + + // + iListener(signals); + } + } + + // + // Position Management ... + + // + // Calculate Required Profit for Hedging ... + double CalculateRequiredProfitForHedge( + XPosition &positions[] // Source + ) + { + // + double result = SpecifiedCalculateRequiredProfitForHedge( + positions, + mMinProfitPerTrade, + mMinProfitPerVolumeFactor // + ); + + // + return result; + } + + // + // Calculate Positions Profit Summary ... + double CalculatePositionsProfit( + XPosition &positions[] // Source + ) + { + // + double result = SpecifiedCalculatePositionsProfit(positions); + + // + return result; + } + + // + // Profit Tracker ... + + // + XProfitTrack mProfitTracks[]; + + // + bool GetProfitTrack( + XProfitTrack &track, + int index = 0 // + ) + { + // + bool result = false; + + // + if (index < 0) + { + index = 0; + } + + // + int tracksCount = CountProfitTracks(); + result = tracksCount > 0 && index < tracksCount; + if (!result) + { + return result; + } + + // + track.Clean(); + + // + track = mProfitTracks[index]; + + // + result = track.IsValid(); + + // + return result; + } + + // + int CountProfitTracks() + { + return ArraySize(mProfitTracks); + } + + // + void AddProfitTrack() + { + // + XProfitTrack track; + bool isValid = track.Init(mTrader); + if (!isValid) + { + return; + } + + // + ArraySetAsSeries(mProfitTracks, false); + + // + AddRef( + track, + mProfitTracks // + ); + + // + ArraySetAsSeries(mProfitTracks, true); + } + + // + // Extract Specified Field Vales of XProfit Track Struct ... + int ExtractProfitTrackField( + double &result[], + ENUM_X_PROFIT_TRACK_FIELDS field, + int start = 0, + int count = 10 // + ) + { + // + Clean(result); + + // + if (start < 0) + { + start = 0; + } + + // + int end = start + count; + + // + int tracksCount = CountProfitTracks(); + if (end > tracksCount) + { + end = tracksCount; + } + + // + for (int i = start; i < end; i++) + { + // + XProfitTrack iTrack; + bool isValid = GetProfitTrack( + iTrack, + i // + ); + + // + if (!isValid) + { + continue; + } + + // + double iValue = iTrack.SelectField(field); + Add( + iValue, + result // + ); + } + + // + int mResult = ArraySize(result); + + // + return mResult; + } + + // + double AverageProfitTrackField( + ENUM_X_PROFIT_TRACK_FIELDS field, + int start = 0, + int count = 10 // + ) + { + // + double result = EMPTY_VALUE; + + // + double items[]; + int itemsCount = ExtractProfitTrackField( + items, + field, + start, + count // + ); + if (itemsCount <= 0) + { + return result; + } + + // + result = GetAverage(items); + + // + return result; + } + + // + bool IsProfitTrackFieldIncreasing( + ENUM_X_PROFIT_TRACK_FIELDS field, + int start = 0, + int count = 10 // + ) + { + // + bool result = false; + + // + double items[]; + int itemsCount = ExtractProfitTrackField( + items, + field, + start, + count // + ); + if (itemsCount <= 0) + { + return result; + } + + // + int from = itemsCount - 1; + int to = 0; + + // + result = IsIncreasing( + from, + to, + items // + ); + + // + return result; + } + + // + bool IsProfitTrackFieldDecreasing( + ENUM_X_PROFIT_TRACK_FIELDS field, + int start = 0, + int count = 10 // + ) + { + // + bool result = false; + + // + double items[]; + int itemsCount = ExtractProfitTrackField( + items, + field, + start, + count // + ); + if (itemsCount <= 0) + { + return result; + } + + // + int from = itemsCount - 1; + int to = 0; + + // + result = IsDecreasing( + from, + to, + items // + ); + + // + return result; + } + + // + void HandleProfitManageMent() + { + // + // Check Tracking Interval ... + + // + static datetime lastProfitTracked = NULL; + datetime cTime = TimeCurrent(); + + // + int profitManagementInterval = PeriodSeconds(PERIOD_M5); + int timeDiff = (int)cTime - (int)lastProfitTracked; + + // + bool canManage = + // + lastProfitTracked == NULL + ? true + : timeDiff >= profitManagementInterval + // + ; + if (!canManage) + { + return; + } + + // + lastProfitTracked = cTime; + + // + // Do Track ... + + // + AddProfitTrack(); + + // + int profitsCount = CountProfitTracks(); + if (profitsCount <= 1) + { + return; + } + + // + XProfitTrack cT; + bool isValid = GetProfitTrack( + cT, + 0 // + ); + if (!isValid) + { + return; + } + + // + XProfitTrack pT; + isValid = GetProfitTrack( + pT, + 1 // + ); + if (!isValid) + { + return; + } + + // + cT.profitFrom = pT.profit; + cT.longsProfitFrom = pT.longsProfit; + cT.shortsProfitFrom = pT.shortsProfit; + + // + bool isGoningToProfit = + // + cT.profit > 0 && + pT.profit <= 0 + // + ; + if (isGoningToProfit) + { + // + OnGoingToProfit(cT); + } + + // + bool isLongsGoningToProfit = + // + cT.longsProfit > 0 && + pT.longsProfit <= 0 + // + ; + if (isLongsGoningToProfit) + { + OnLongsGoingToProfit(cT); + } + + // + bool isShortsGoningToProfit = + // + cT.shortsProfit > 0 && + pT.shortsProfit <= 0 + // + ; + if (isShortsGoningToProfit) + { + OnShortsGoingToProfit(cT); + } + + // + bool isGoningToDrawdown = + // + cT.profit < 0 && + pT.profit >= 0 + // + ; + if (isGoningToDrawdown) + { + OnGoingToDrawdown(cT); + } + + bool isLongsGoningToDrawdown = + // + cT.longsProfit < 0 && + pT.longsProfit >= 0 + // + ; + if (isLongsGoningToDrawdown) + { + OnLongsGoingToDrawdown(cT); + } + + bool isShortsGoningToDrawdown = + // + cT.shortsProfit < 0 && + pT.shortsProfit >= 0 + // + ; + if (isShortsGoningToDrawdown) + { + OnShortsGoingToDrawdown(cT); + } + } + + // + // Synchronize Positions and Position Tracker ... + void SyncPositionTracker() + { + // + // Check Syncing Interval ... + + // + static datetime lastSyncPositionTracker = NULL; + datetime cTime = TimeCurrent(); + + // + int syncInterval = PeriodSeconds(PERIOD_M5); + int lastDiff = (int)cTime - (int)lastSyncPositionTracker; + + // + bool canSync = + // + lastSyncPositionTracker == NULL + ? true + : lastDiff >= syncInterval + // + ; + if (!canSync) + { + return; + } + + // + lastSyncPositionTracker = cTime; + + // + // Do Sync ... + + // + XPositionTrackerState state; + int synced = mPositionTracker.Sync( + state, + mTrader // + ); + if (synced > 0) + { + // + // Check State and Do What we Want ... + int onProfitsCount = ArraySize(state.onProfits); + int onDrawdownCount = ArraySize(state.onDrawdowns); + + // + // Do What we want whe a Position Dropped to Prefit ... + if (onProfitsCount > 0) + { + // + for (int i = 0; i < onProfitsCount; i++) + { + // + XPositionTrack iTrack = state.onProfits[i]; + + // + OnPositionGoingInProfit(iTrack); + } + } + + // + // Do what we want when a Position Dropped to Drawdown ... + if (onDrawdownCount > 0) + { + // + for (int i = 0; i < onDrawdownCount; i++) + { + // + XPositionTrack iTrack = state.onDrawdowns[i]; + + // + OnPositionGoingToDrawdown(iTrack); + } + } + } + } + + // + // Guards ... + + // + // Do All Provided Guards ... + void DoGuards(XGuard &guards[]) + { + // + int guardsCount = ArraySize(guards); + if (guardsCount <= 0) + { + return; + } + + // + for (int i = 0; i < guardsCount; i++) + { + // + XGuard iGuard = guards[i]; + + // + switch (iGuard.action) + { + // + // Hedge In Profit Specified Positions ... + case X_GUARD_ACTION_HEDGE: + HandleGuardHedgeAction( + iGuard.provider, + iGuard.symbol, + iGuard.type, + iGuard.period); + break; + + // + // Trail Stop Loss in Specified Positions ... + case X_GUARD_ACTION_TRAIL_STOP: + HandleGuardTrailingStopAction( + iGuard.provider, + iGuard.symbol, + iGuard.type, + iGuard.period, + iGuard.dblPayLoad); + break; + + // + // Force Close Specified Positions ... + case X_GUARD_ACTION_FORCE_CLOSE: + HandleGuardForceCloseAction( + iGuard.provider, + iGuard.symbol, + iGuard.type, + iGuard.period); + break; + + // + // Generate and Place Support Signals ... + case X_GUARD_ACTION_ADD_SUPPORT_SIGNAL: + HandleGuardAddSupportPositionAction( + iGuard.provider, + iGuard.symbol, + iGuard.type, + iGuard.period); + break; + + // + // Delete All Placed Pending Orders ... + case X_GUARD_ACTION_CANCEL_PENDING_ORDERS: + HandleGuardCancelPendingOrdersAction( + iGuard.provider, + iGuard.symbol, + iGuard.type, + iGuard.period); + break; + } + } + } + + // + // Close All Specified Provider's Positions in Profit Summary ... + void HandleGuardHedgeAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + double minProfitForHedging = 1 // Specified Profit for Hedge + ) + { + // + XPosition positions[]; + int positionsCount = mTrader + .GetPositions( + positions, + symbol, + provider, + period, + type + // + ); + if (positionsCount <= 1) + { + return; + } + + // + double profit = CalculatePositionsProfit(positions); + double requiredProfit = CalculateRequiredProfitForHedge(positions); + + // + bool isReadyForHedge = profit >= requiredProfit; + if (!isReadyForHedge) + { + return; + } + + // + string comment = "Guard Hedge " + provider; + int closed = mTrader.Close( + positions, + comment + // + ); + if (closed > 0) + { + // + string message = "Guard Hedge " + provider + "'s Positions on Profit: " + ToString(profit); + + // + mAlert.Alert(message); + } + } + + // + // Close Max In Profit Trade Guard Action ... + void HandleGuardCloseInProfitAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method + ) + { + // + XPosition positions[]; + int positionsCount = mTrader + .GetInProfitPositions( + positions, + symbol, + provider, + period, + type, + method + // + ); + if (positionsCount <= 0) + { + return; + } + + // + string comment = "Close InProfit ..."; + mTrader.Close( + positions, + comment + // + ); + + // + string message = "Guard Close (" + ToString(positionsCount) + ") Postion(s) In Profit ..."; + + // + mAlert.Alert(message); + } + + // + // Close Max In Drawdown Trade Guard Action ... + void HandleGuardCloseInDrawdownAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method + ) + { + // + XPosition positions[]; + int positionsCount = mTrader + .GetInDrawdownPositions( + positions, + symbol, + provider, + period, + type, + method + // + ); + if (positionsCount <= 0) + { + return; + } + + // + string comment = "Close InDrawdown ..."; + mTrader.Close( + positions, + comment + // + ); + + // + string message = "Guard Close (" + ToString(positionsCount) + ") Position(s) In Drawdown ..."; + + // + mAlert.Alert(message); + } + + // + // Force Close Specified Set Of Position ... + void HandleGuardForceCloseAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + ulong ticket = 0 // Specific Ticket + ) + { + // + string comment = ""; + + // + // Close All Positions ... + if (ticket == 0) + { + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions( + positions, + symbol, + provider, + period, + type + // + ); + if (positionsCount <= 0) + { + return; + } + + // + comment = provider + " Force Close Guard ..."; + + // + mTrader.Close( + positions, + comment + // + ); + } + // + // Close Specific Position ... + else + { + // + XPosition position; + bool hasPosition = mTrader + .GetPosition( + ticket, + position + // + ); + + // + if (hasPosition) + { + // + comment = provider + "(" + ToString(ticket) + ")" + " Force Close Guard ..."; + + // + mTrader.Close( + ticket, + comment + // + ); + } + } + + // + if (IsValid(comment)) + { + mAlert.Alert(comment); + } + } + + // + // Trailing Specified Set Of Positions Stop Losses ... + void HandleGuardTrailingStopAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + double sl // Desired SL Value ... + ) + { + // + if (sl <= 0) + { + return; + } + + // + NormalizePrice( + sl, + symbol + // + ); + + // + XPosition positions[]; + int positionsCount = mTrader + .GetPositions( + positions, + symbol, + provider, + period, + type + // + ); + if (positionsCount <= 0) + { + return; + } + + // + int modified = 0; + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + string comment = PrepareSLTrailTag(iPosition.comment); + + // + if (iPosition.sl == sl) + { + continue; + } + + // + bool isModified = mTrader.Modify( + iPosition.ticket, + sl, + iPosition.tp, + comment); + if (isModified) + { + modified++; + } + } + + // + if (modified > 0) + { + // + string message = "(" + ToString(modified) + ") Position's Stop Trailed Successfully ..."; + + // + mAlert.Alert(message); + } + } + + // + // Add Support Signal for Specified Positions ... + void HandleGuardAddSupportPositionAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame + ) + { + // + XSignal support; + bool hasSupport = RequestForSupport( + support, + provider, + symbol, + type, + period + // + ); + + // + if (!hasSupport || !support.IsValid()) + { + return; + } + + // + // TODO: May be need to add Support Tag to comments ... + + // + ENUM_X_SIGNAL_EXECUTION_RESULT reason = NULL; + bool isExecuted = mTrader.ExecuteSignal( + support, + reason); + + // + string comment = NULL; + if (!isExecuted) + { + comment = "Support Execution Failed doue " + ToString(reason); + } + else + { + comment = "Guard Support Signal Executed Successfully ..."; + } + + // + if (IsValid(comment)) + { + mAlert.Alert(comment); + } + } + + // + // Cancel all Placed Orders ... + void HandleGuardCancelPendingOrdersAction( + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame + ) + { + // + XOrder orders[]; + int ordersCount = mTrader.GetOrders( + orders, + symbol, + provider, + period, + ToOrderType(type), + ORDER_STATE_PLACED, + true // Filter by Magic ... + // + ); + if (ordersCount <= 0) + { + return; + } + + // + int canceledOrdersCount = mTrader.CancelOrders(orders); + + // + if (canceledOrdersCount > 0) + { + // + string message = "Guard Cancel (" + ToString(canceledOrdersCount) + ") Pending Orders ..."; + + // + mAlert.Alert(message); + } + } + + // + // Position Filter ... + + // + int FilterSymbolBasedPositions( + string &symbols[], // Hold Symbols ... + XSCPositionHolder *&holders[] // Holder Class Instances ... + ) + { + // + int result = 0; + + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions( + positions // + ); + if (!IsValidSize(positionsCount)) + { + return result; + } + + // + // Create a HashMap for Holding Positions ... + CHashMap symbolMap; + + // + // Loop Through Positions ... + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + bool hasIKey = symbolMap.ContainsKey(iPosition.symbol); + + // + // Empty Class Pointer ... + XSCPositionHolder *mHolder = NULL; + + // + // Add new to Map ... + if (!hasIKey) + { + // + mHolder = new XSCPositionHolder(); + if (symbolMap.TrySetValue(iPosition.symbol, mHolder)) + { + mHolder.AddOrUpdateItem(iPosition); + } + } + // + // Update Exists in Map ... + else + { + // + if (symbolMap.TryGetValue(iPosition.symbol, mHolder)) + { + mHolder.AddOrUpdateItem(iPosition); + } + } + } + + // + // Now we Have a Map which Filled Based on Separate Symbols and InDrawDown Positions ... + int mapCount = symbolMap.Count(); + if (!IsValidSize(mapCount)) + { + return result; + } + + // + result = symbolMap.CopyTo( + symbols, + holders // + ); + + // + return result; + } + + // + // Private ... +private: + // + // Props ... + + // + // Signal Event Listeners ... + TOnSignal mOnSignalEventHandlers[]; + + // + // Position Management ... + bool mAllowLong; // Allow Long Trades + bool mAllowShort; // Allow Short Trades + double mMinProfitPerTrade; // Min Profit Per Trade based On Volume Factor (Hedge) + double mMinProfitPerVolumeFactor; // Min Volume Factor for Calculating Profit (Hedge) + double mStaticVolume; // Static Volume for Positions + + // + // Event Handlers ... + TOnStopLoss mOnStopLossTriggered; + TOnTakeProfit mOnTakeProfitTriggered; + TOnDealsChanged mOnDealsChangedHandler; + TOnOrdersChanged mOnOrdersChangedHandler; + TOnPositionsChanged mOnPositionsChangedHandler; + TOnTradeStateChanged mOnTradeStateChangedHandler; +}; + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhelper.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhelper.class.mq5 new file mode 100644 index 0000000..966eb8d --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhelper.class.mq5 @@ -0,0 +1,148 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCBaseHelper +// Description: provides all Base Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Includes ... +#include "../Classes/x-saherelm.base.class.mq5" + +// +// Definitions ... + +// +// a Class for Handle base requirements ... +// for indicators ... +class XSCBaseHelper : public XSCBase +{ + // + // Public ... +public: + // + // Constructor ... + void XSCBaseHelper( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period // Trading Time Frame + ) + { + // + mSymbol = symbol; + mPeriod = period; + } + + // + // Deconstructor ... + void ~XSCBaseHelper() + { + // + IndicatorRelease(mHandler); + } + + // + // Setter(s) / Getter(s) ... + + // + // Symbol ... + string GetSymbol() + { + return mSymbol; + } + + // + // Period ... + ENUM_TIMEFRAMES GetPeriod() + { + return mPeriod; + } + + // + // Retrieve Bars ... + int CountBars() + { + // + int result = + Bars( + mSymbol, + mPeriod + // + ); + + // + return result; + } + + // + // Retrieve Indicator Calculated Bars ... + int CountCalculatedBars() + { + return BarsCalculated(mHandler); + } + + // + // Generate Tag ... + virtual string GetTag() + { + // + string result = NULL; + + // + result = + // + GetToken() + + "[" + + GetSymbol() + "|" + + ToString(GetPeriod()) + + "]" + // + ; + + // + return result; + } + + // + // Functions ... + + // + // Protected ... +protected: + // + // Props ... + + // + // Symbol ... + string mSymbol; + + // + // Period ... + ENUM_TIMEFRAMES mPeriod; + + // + // Indicator Handler ... + int mHandler; + + // + // Private ... +private: + // +}; + +// +// Tools .... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhttp.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhttp.class.mq5 new file mode 100644 index 0000000..82adadb --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xhttp.class.mq5 @@ -0,0 +1,373 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCHttp +// Description: provides all HTTP requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Definitions ... + +// +enum X_HTTP_METHOD +{ + X_HTTP_GET, + X_HTTP_POST +}; + +// +// Imports ... + +// +// Includes ... +#include "../Classes/x-saherelm.base.class.mq5" +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// a Class for Manage Account ... +class XSCHttp : public XSCBase +{ + // + // Public ... +public: + // + // Constructor ... + void XSCHttp() + { + XSCHttp("", 10000); + } + void XSCHttp( + string path, // Base Folder to Store Data + int timeout // base timeout for Requests + ) + { + // + Path(path); + Timeout(timeout); + } + + // + // Deconstructor ... + void ~XSCHttp() + { + } + + // + // Properties Getter(s) / Setter(s) ... + + // + // Path ... + void Path(string value) + { + // + mPath = value; + + // + if (!IsValid(mPath)) + { + mPath = GetTag(); + } + } + + string Path() + { + return mPath; + } + + // + // Timeout ... + void Timeout(int value) + { + mTimeout = value; + } + + // + int Timeout() + { + return mTimeout; + } + + // + // Error ... + int Error() + { + return mError; + } + + // + // Response ... + string Response() + { + return mResponse; + } + + // + // Overrides ... + string GetTag() override + { + return GetSpecificToken(this); + } + + // + // Tools ... + + // + // Send Global Request ... + int SendRequest( + X_HTTP_METHOD method, // Httm Request Method + const string url, // Server Address + const string headers, // Headers providing + const char &payload[], // the Data which needs to Send + char &response[], // Response of request + string responseHeaders, // Response Headers + int timeout = 500 // Timeout for response default is 500 + ) + { + // + int result = -1; + + // + string strMethod = ToString(method); + if (StringLen(strMethod) == 0) + { + return result; + } + + // + // Reset State ... + ResetState(); + + // + result = WebRequest( + strMethod, + url, + headers, + timeout, + payload, + response, + responseHeaders); + + // + if (result < 0) + { + mError = GetLastError(); + } + else + { + mResponse = CharArrayToString(response); + } + + // + return result; + } + + // + // Get Request ... + int GetRequest( + const string url, // Server Address + const string headers, // Headers providing + const char &payload[], // the Data which needs to Send + char &response[], // Response of request + string responseHeaders, // Response Headers + int timeout = 500 // Timeout for response default is 500 + ) + { + // + int result = SendRequest( + X_HTTP_GET, + url, + headers, + payload, + response, + responseHeaders, + timeout); + + // + return result; + } + + // + // Post Request ... + int PostRequest( + const string url, // Server Address + const string headers, // Headers providing + const char &payload[], // the Data which needs to Send + char &response[], // Response of request + string responseHeaders, // Response Headers + int timeout = 500 // Timeout for response default is 500 + ) + { + // + int result = SendRequest( + X_HTTP_POST, + url, + headers, + payload, + response, + responseHeaders, + timeout); + + // + return result; + } + + // + // Handle Download Specific URL Content to Specific Path and File Name ... + bool Download( + string url, // the URL address which going to download + string fileName // Specify Destination file name to Store Response + ) + { + // + bool result = false; + + // + string filePath = GetFilePath(fileName); + string cookie = NULL; + string referer = NULL; + int timeout = Timeout(); + + // + char payload[]; + string headers; + char response[]; + string responseHeaders; + + // + // Send Request ... + int requestResult = GetRequest( + url, + headers, + payload, + response, + responseHeaders, + timeout); + + // + // Define File Handler ... + int mFileHandler = FileOpen( + filePath, + FILE_WRITE | FILE_BIN); + if (mFileHandler == INVALID_HANDLE) + { + // + mError = GetLastError(); + return result; + } + + // + // Write Response to File ... + uint writed = FileWriteArray( + mFileHandler, + response, + 0, + ArraySize(response)); + FileFlush(mFileHandler); + FileClose(mFileHandler); + + // + result = writed > 0; + + // + return result; + } + + // + // END Provided Functions ... + // + + // + // Protected ... +protected: + // + // Destintion Folder Path ... + string mPath; + + // + // WEB Request Timeout Value ... + int mTimeout; + + // + // WEB Request's Response ... + string mResponse; + + // + // Error Value ... + int mError; + + // + // Private ... +private: + // + // Reset Errors State ... + void ResetState() + { + // + // Reset Errors ... + mError = -1; + mResponse = ""; + ResetLastError(); + } + + // + // Generate Full File Path ... + string GetFilePath(string fileName) + { + // + string result = ""; + + // + result = + // + Path() + "\\" + fileName + // + ; + + // + return result; + } +}; + +// +// Tools ... + +// +// Convert enum to String ... +string ToString(X_HTTP_METHOD method) +{ + // + string result = ""; + + // + switch (method) + { + // + case X_HTTP_GET: + result = "GET"; + break; + + // + case X_HTTP_POST: + result = "POST"; + break; + } + + // + return result; +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xmd5.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xmd5.class.mq5 new file mode 100644 index 0000000..3311aa5 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xmd5.class.mq5 @@ -0,0 +1,441 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCMD5 +// Description: Provides MD5 Hashing Requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// START Definitions ... +// + +// +static uchar _md5_PADDING[64] = + { + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// +#define _md5_F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define _md5_G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define _md5_H(x, y, z) ((x) ^ (y) ^ (z)) +#define _md5_I(x, y, z) ((y) ^ ((x) | (~z))) +#define _md5_ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + +// +#define _md5_FF(a, b, c, d, x, s, ac) \ + { \ + (a) += _md5_F((b), (c), (d)) + (x) + (uint)(ac); \ + (a) = _md5_ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } + +// +#define _md5_GG(a, b, c, d, x, s, ac) \ + { \ + (a) += _md5_G((b), (c), (d)) + (x) + (uint)(ac); \ + (a) = _md5_ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } + +// +#define _md5_HH(a, b, c, d, x, s, ac) \ + { \ + (a) += _md5_H((b), (c), (d)) + (x) + (uint)(ac); \ + (a) = _md5_ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } + +// +#define _md5_II(a, b, c, d, x, s, ac) \ + { \ + (a) += _md5_I((b), (c), (d)) + (x) + (uint)(ac); \ + (a) = _md5_ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } + +// +#define _md5_INIT_STATE_0 0x67452301 +#define _md5_INIT_STATE_1 0xefcdab89 +#define _md5_INIT_STATE_2 0x98badcfe +#define _md5_INIT_STATE_3 0x10325476 + +// +#define _md5_S11 7 +#define _md5_S12 12 +#define _md5_S13 17 +#define _md5_S14 22 + +// +#define _md5_S21 5 +#define _md5_S22 9 +#define _md5_S23 14 +#define _md5_S24 20 + +// +#define _md5_S31 4 +#define _md5_S32 11 +#define _md5_S33 16 +#define _md5_S34 23 + +// +#define _md5_S41 6 +#define _md5_S42 10 +#define _md5_S43 15 +#define _md5_S44 21 + +// +// END Definitions ... +// + +// +// XCMD5 a library for Hashing ... +class XSCMD5 +{ + // + // Public Provides ... +public: + // + // Protected Provides ... + + // + // Constructor ... + XSCMD5(void) {} + + // + // Deconstructor ... + ~XSCMD5(void) {} + + // + // Hash Specified Char Array ... + string Hash( + uchar &mSource[], // Specify Char Array to Hash + int mLength = 0 // Specify Length of Char Array which required to hash + ) + { + // + string result = ""; + + // + int sourceCount = ArraySize(mSource); + + // + // Validate Args ... + if ( + sourceCount <= 0 || + (sourceCount > 0 && mLength > sourceCount)) + { + return result; + } + + // + // Normalize Args ... + if (mLength == 0) + { + mLength = sourceCount; + } + + // + // Init MD5 ... + MD5Init(); + + // + // Update Buffer ... + MD5Update(mSource, mLength); + + // + // Calculate Result ... + result = MD5Final(); + + // + return result; + } + + // + // Hash Specified String ... + string Hash( + string mSource // Specified String + ) + { + // + string result = ""; + + // + // Converts String to Char Array ... + uchar bytes[]; + StringToCharArray( + mSource, + bytes, + 0, + StringLen(mSource)); + + // + result = Hash( + bytes, + ArraySize(bytes)); + + // + return result; + } + +protected: + // + // Private Provides ... +private: + // + uint m_lMD5[4]; + uint m_nCount[2]; + uchar m_lpszBuffer[64]; + + // + // Convert Byte to DWord ... + void ByteToDWord(int &out[], uint &in[], uint len) + { + // + uint i = 0; + uint j = 0; + + // + for (; j < len; i++, j += 4) + { + out[i] = (int)in[j] | (int)in[j + 1] << 8 | (int)in[j + 2] << 16 | (int)in[j + 3] << 24; + } + } + + // + // Convert DWord to Byte ... + void DWordToByte(uchar &out[], int &in[], uint len) + { + // + uint i = 0; + uint j = 0; + + // + for (; j < len; i++, j += 4) + { + // + out[j] = (uchar)(in[i] & 0xff); + out[j + 1] = (uchar)((in[i] >> 8) & 0xff); + out[j + 2] = (uchar)((in[i] >> 16) & 0xff); + out[j + 3] = (uchar)((in[i] >> 24) & 0xff); + } + } + + // + // Init MD5 Array ... + void MD5Init() + { + // + ArrayInitialize(m_lpszBuffer, 64); + + // + m_nCount[0] = m_nCount[1] = 0; + m_lMD5[0] = _md5_INIT_STATE_0; + m_lMD5[1] = _md5_INIT_STATE_1; + m_lMD5[2] = _md5_INIT_STATE_2; + m_lMD5[3] = _md5_INIT_STATE_3; + } + + // + // Update MD5 ... + void MD5Update(uchar &inBuf[], uint inLen) + { + // + int i, ii; + int mdi; + + // + uint in[16]; + int i0 = 0; + + // + mdi = (int)((m_nCount[0] >> 3) & 0x3F); + + // + if ((m_nCount[0] + ((uint)inLen << 3)) < m_nCount[0]) + { + m_nCount[1]++; + } + + // + m_nCount[0] += ((uint)inLen << 3); + m_nCount[1] += ((uint)inLen >> 29); + + // + while ((inLen--) > 0) + { + // + m_lpszBuffer[mdi++] = inBuf[i0++]; + if (mdi == 0x40) + { + // + for (i = 0, ii = 0; i < 16; i++, ii += 4) + { + in[i] = (((uint)m_lpszBuffer[ii + 3]) << 24) | (((uint)m_lpszBuffer[ii + 2]) << 16) | (((uint)m_lpszBuffer[ii + 1]) << 8) | ((uint)m_lpszBuffer[ii]); + } + + // + Transform(m_lMD5, in); + + // + mdi = 0; + } + } + } + + // + // Finalize an MD5 Expression ... + string MD5Final() + { + // + uchar bits[8]; + int nIndex; + uint nPadLen; + const int nMD5Size = 16; + uchar lpszMD5[16]; + string temp; + string out = ""; + int i; + + // + DWordToByte(bits, m_nCount, 8); + nIndex = (int)((m_nCount[0] >> 3) & 0x3f); + nPadLen = (nIndex < 56) ? (56 - nIndex) : (120 - nIndex); + MD5Update(_md5_PADDING, nPadLen); + MD5Update(bits, 8); + DWordToByte(lpszMD5, m_lMD5, nMD5Size); + + // + for (i = 0; i < nMD5Size; i++) + { + // + if (lpszMD5[i] == 0) + { + temp = "00"; + } + else if (lpszMD5[i] <= 15) + { + temp = StringFormat("0%x", lpszMD5[i]); + } + else + { + temp = StringFormat("%x", lpszMD5[i]); + } + + // + out += temp; + } + + // + lpszMD5[0] = '\0'; + + // + return (out); + } + + // + // Transform Buffers ... + void Transform(uint &buf[], uint &in[]) + { + // + uint a = buf[0], b = buf[1], c = buf[2], d = buf[3]; + + // + _md5_FF(a, b, c, d, in[0], _md5_S11, 0xD76AA478); + _md5_FF(d, a, b, c, in[1], _md5_S12, 0xE8C7B756); + _md5_FF(c, d, a, b, in[2], _md5_S13, 0x242070DB); + _md5_FF(b, c, d, a, in[3], _md5_S14, 0xC1BDCEEE); + _md5_FF(a, b, c, d, in[4], _md5_S11, 0xF57C0FAF); + _md5_FF(d, a, b, c, in[5], _md5_S12, 0x4787C62A); + _md5_FF(c, d, a, b, in[6], _md5_S13, 0xA8304613); + _md5_FF(b, c, d, a, in[7], _md5_S14, 0xFD469501); + _md5_FF(a, b, c, d, in[8], _md5_S11, 0x698098D8); + _md5_FF(d, a, b, c, in[9], _md5_S12, 0x8B44F7AF); + _md5_FF(c, d, a, b, in[10], _md5_S13, 0xFFFF5BB1); + _md5_FF(b, c, d, a, in[11], _md5_S14, 0x895CD7BE); + _md5_FF(a, b, c, d, in[12], _md5_S11, 0x6B901122); + _md5_FF(d, a, b, c, in[13], _md5_S12, 0xFD987193); + _md5_FF(c, d, a, b, in[14], _md5_S13, 0xA679438E); + _md5_FF(b, c, d, a, in[15], _md5_S14, 0x49B40821); + + // + _md5_GG(a, b, c, d, in[1], _md5_S21, 0xF61E2562); + _md5_GG(d, a, b, c, in[6], _md5_S22, 0xC040B340); + _md5_GG(c, d, a, b, in[11], _md5_S23, 0x265E5A51); + _md5_GG(b, c, d, a, in[0], _md5_S24, 0xE9B6C7AA); + _md5_GG(a, b, c, d, in[5], _md5_S21, 0xD62F105D); + _md5_GG(d, a, b, c, in[10], _md5_S22, 0x02441453); + _md5_GG(c, d, a, b, in[15], _md5_S23, 0xD8A1E681); + _md5_GG(b, c, d, a, in[4], _md5_S24, 0xE7D3FBC8); + _md5_GG(a, b, c, d, in[9], _md5_S21, 0x21E1CDE6); + _md5_GG(d, a, b, c, in[14], _md5_S22, 0xC33707D6); + _md5_GG(c, d, a, b, in[3], _md5_S23, 0xF4D50D87); + _md5_GG(b, c, d, a, in[8], _md5_S24, 0x455A14ED); + _md5_GG(a, b, c, d, in[13], _md5_S21, 0xA9E3E905); + _md5_GG(d, a, b, c, in[2], _md5_S22, 0xFCEFA3F8); + _md5_GG(c, d, a, b, in[7], _md5_S23, 0x676F02D9); + _md5_GG(b, c, d, a, in[12], _md5_S24, 0x8D2A4C8A); + + // + _md5_HH(a, b, c, d, in[5], _md5_S31, 0xFFFA3942); + _md5_HH(d, a, b, c, in[8], _md5_S32, 0x8771F681); + _md5_HH(c, d, a, b, in[11], _md5_S33, 0x6D9D6122); + _md5_HH(b, c, d, a, in[14], _md5_S34, 0xFDE5380C); + _md5_HH(a, b, c, d, in[1], _md5_S31, 0xA4BEEA44); + _md5_HH(d, a, b, c, in[4], _md5_S32, 0x4BDECFA9); + _md5_HH(c, d, a, b, in[7], _md5_S33, 0xF6BB4B60); + _md5_HH(b, c, d, a, in[10], _md5_S34, 0xBEBFBC70); + _md5_HH(a, b, c, d, in[13], _md5_S31, 0x289B7EC6); + _md5_HH(d, a, b, c, in[0], _md5_S32, 0xEAA127FA); + _md5_HH(c, d, a, b, in[3], _md5_S33, 0xD4EF3085); + _md5_HH(b, c, d, a, in[6], _md5_S34, 0x04881D05); + _md5_HH(a, b, c, d, in[9], _md5_S31, 0xD9D4D039); + _md5_HH(d, a, b, c, in[12], _md5_S32, 0xE6DB99E5); + _md5_HH(c, d, a, b, in[15], _md5_S33, 0x1FA27CF8); + _md5_HH(b, c, d, a, in[2], _md5_S34, 0xC4AC5665); + + // + _md5_II(a, b, c, d, in[0], _md5_S41, 0xF4292244); + _md5_II(d, a, b, c, in[7], _md5_S42, 0x432AFF97); + _md5_II(c, d, a, b, in[14], _md5_S43, 0xAB9423A7); + _md5_II(b, c, d, a, in[5], _md5_S44, 0xFC93A039); + _md5_II(a, b, c, d, in[12], _md5_S41, 0x655B59C3); + _md5_II(d, a, b, c, in[3], _md5_S42, 0x8F0CCC92); + _md5_II(c, d, a, b, in[10], _md5_S43, 0xFFEFF47D); + _md5_II(b, c, d, a, in[1], _md5_S44, 0x85845DD1); + _md5_II(a, b, c, d, in[8], _md5_S41, 0x6FA87E4F); + _md5_II(d, a, b, c, in[15], _md5_S42, 0xFE2CE6E0); + _md5_II(c, d, a, b, in[6], _md5_S43, 0xA3014314); + _md5_II(b, c, d, a, in[13], _md5_S44, 0x4E0811A1); + _md5_II(a, b, c, d, in[4], _md5_S41, 0xF7537E82); + _md5_II(d, a, b, c, in[11], _md5_S42, 0xBD3AF235); + _md5_II(c, d, a, b, in[2], _md5_S43, 0x2AD7D2BB); + _md5_II(b, c, d, a, in[9], _md5_S44, 0xEB86D391); + + // + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; + } +}; diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xprovider.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xprovider.class.mq5 new file mode 100644 index 0000000..753864d --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xprovider.class.mq5 @@ -0,0 +1,267 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCBaseProvider +// Description: provides all Base Provider +// requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Includes ... +#include "../Classes/x-saherelm.base.class.mq5" +#include "../Libraries/x-saherelm.xtrade.lib.mq5" + +// +// Definitions ... + +// +// Base Provider Inputs ... +class XSCBaseProviderInpts : public XSCBase +{ + // + // Public ... +public: + // + // Validate Input ... + virtual bool IsValid(); + + // + // Cleanup ... + virtual void Clean(); + + // + // Default ... + virtual void Default(); + + // + // Max ... + virtual int Max(); +}; + +// +// Base Market Conditions Class ... +class XSCBaseProviderMarketConditions : public XSCBase +{ + // + // Public ... +public: + // + // Props ... + string symbol; // Symbol + ENUM_TIMEFRAMES period; // Period + datetime time; // Time + + // + XOHCL bars[]; // Number of Bars ... + + // + // Buffers ... + + // + // Conditions ... + + // + // Generate Score ... + virtual void GenerateScore( + double &bullishScore, // Bullish Score + double &bearishScore, // Bearish Score + double multiplier = 1 // Score Multiplier + ); + + // + // Generate Summary ... + virtual string GenerateSummary( + const bool onlySummary = false, // Only Generate Conditions Summary + double multiplier = 1, // Score Multiplier + const string separator = "\n", // Separator + const bool ignoreFalseConditions = true // Ignore False Conditions + ); +}; + +// +// Class ... + +// +// Base Provider Class ... +class XSCBaseProvider : public XSCBase +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructor ... + XSCBaseProvider( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + double staticVolume // Static Volume for Positions + ) + { + // + // Initialize Cycle ... + mCycle.Init( + symbol, + period, + X_MARKET_CYCLE_SHORT, + X_PERIOD_MANUALLY, + period, + "HOST Period" + // + ); + + // + mStaticVolume = staticVolume; + } + + // + // Deconstructor ... + ~XSCBaseProvider() + { + DeInit(); + } + + // + // Properties Gettr(s) / Setter(s) ... + + // + // Inheritance ... + + // + // Init all Requirements ... + virtual bool Init(XSCBaseProviderInpts &inputs); + + // + // Get Inputs ... + virtual void GetInputs(XSCBaseProviderInpts &inputs); + + // + // Set Inputs and Reinitial ... + virtual bool setInputs(XSCBaseProviderInpts &inputs); + + // + // DeInit all Requirements ... + virtual void DeInit(); + + // + virtual void GetMarketConditions( + XSCBaseProviderMarketConditions &conditions, // Market Conditions Result + int barIndex = 0 // Specified Bar Index + ); + + // + // Check Market For Signal ... + virtual bool HasSignal( + int barIndex, + XSignal &signal, // Hold's Signal if Exists ... + XSCBaseProviderMarketConditions &conditions // Hold's Market Conditions ... + ); + + // + // Functions ... + + // + string GetSymbol() + { + return mCycle.symbol; + } + + // + ENUM_TIMEFRAMES GetPeriod() + { + return mCycle.hostPeriod; + } + + // + double GetStaticVolume() + { + return mStaticVolume; + } + + // + // Count Bars ... + int CountBars() + { + // + return mCycle + .CountBars(); + } + + // + // Check New Bar ... + bool IsNewBar() + { + // + return mCycle + .IsNewBar(); + } + + // + // Protected ... +protected: + // + // Props ... + + // + double mStaticVolume; // Static Volume for Positions + + // + XMarketCycle mCycle; + + // + bool mWaitsUntilNewBar; + + // + // Can Ignore Process ... + bool CanIgnoreProcess() + { + // + bool result = false; + + // + result = + // + IsRunningOnTestMode() + ? !IsNewBar() + : !IsNewBar() && mWaitsUntilNewBar + // + ; + + // + return result; + } + + // + // Toggle Waititng Until New Candle ... + void ToggleWaitingUntilNewBar() + { + mWaitsUntilNewBar = !mWaitsUntilNewBar; + } + + // + // Private ... +private: + // + // Props ... + + // + // Tools ... +}; + +// +// Tools ... diff --git a/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xtrade.class.mq5 b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xtrade.class.mq5 new file mode 100644 index 0000000..db02f9f --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Classes/x-saherelm.xtrade.class.mq5 @@ -0,0 +1,3635 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCTrade +// Description: provides all Trade requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.base.class.mq5" +#include "../Libraries/x-saherelm.xtrade.lib.mq5" +#include "../Classes/x-saherelm.xaccount.class.mq5" + +// +// Definitions ... + +// +// Overrides ... + +// +// XCTrade Base Class ... +class XSCTradeBase : public CTrade +{ +public: + // + // Modify Specific Position, by Specific Comment ... + bool PositionModify( + const string symbol, // Symbol + const double sl, // Stop Loss + const double tp, // Take Profit + const string comment = "" // Comment For Modify + ) + { + // + // check stopped + if (IsStopped(__FUNCTION__)) + { + return (false); + } + + // + // check position existence + if (!SelectPosition(symbol)) + { + return (false); + } + + // + // clean + ClearStructures(); + + // + // setting request + m_request.action = TRADE_ACTION_SLTP; + m_request.symbol = symbol; + m_request.magic = m_magic; + m_request.sl = sl; + m_request.tp = tp; + m_request.position = PositionGetInteger(POSITION_TICKET); + + // + // Specified Comment ... + if (StringLen(comment) > 0) + { + m_request.comment = comment; + } + + // + // action and return the result + return (OrderSend(m_request, m_result)); + } + bool PositionModify( + const ulong ticket, // Position Ticket + const double sl, // Stop Loss + const double tp, // Take Profit + const string comment = "" // Comment For Modify + ) + { + // + // check stopped + if (IsStopped(__FUNCTION__)) + { + return (false); + } + + // + // check position existence + if (!PositionSelectByTicket(ticket)) + { + return (false); + } + + // + // clean + ClearStructures(); + + // + // setting request + m_request.action = TRADE_ACTION_SLTP; + m_request.position = ticket; + m_request.symbol = PositionGetString(POSITION_SYMBOL); + m_request.magic = m_magic; + m_request.sl = sl; + m_request.tp = tp; + + // + // Specified Comment ... + if (StringLen(comment) > 0) + { + m_request.comment = comment; + } + + // + // action and return the result + return (OrderSend(m_request, m_result)); + } + + // + // Close Specific Position, by Specific Comment ... + bool PositionClose( + const string symbol, // Symbol + const ulong deviation, // Deviation + const string comment = "" // Comment For Close + ) + { + // + bool partial_close = false; + int retry_count = 10; + uint retcode = TRADE_RETCODE_REJECT; + + // + // check stopped + if (IsStopped(__FUNCTION__)) + { + return (false); + } + + // + // clean + ClearStructures(); + + // + // check filling + if (!FillingCheck(symbol)) + { + return (false); + } + + // + do + { + // + // check + if (SelectPosition(symbol)) + { + // + if ((ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) + { + // + // prepare request for close BUY position + m_request.type = ORDER_TYPE_SELL; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_BID); + } + else + { + // + // prepare request for close SELL position + m_request.type = ORDER_TYPE_BUY; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_ASK); + } + } + else + { + // + // position not found + m_result.retcode = retcode; + return (false); + } + + // + // setting request + m_request.action = TRADE_ACTION_DEAL; + m_request.symbol = symbol; + m_request.volume = PositionGetDouble(POSITION_VOLUME); + m_request.magic = m_magic; + m_request.deviation = (deviation == ULONG_MAX) ? m_deviation : deviation; + m_request.position = PositionGetInteger(POSITION_TICKET); + + // + // Specify Comment ... + m_request.comment = comment; + + // + // check volume + double max_volume = SymbolInfoDouble(symbol, SYMBOL_VOLUME_MAX); + if (m_request.volume > max_volume) + { + // + m_request.volume = max_volume; + partial_close = true; + } + else + { + partial_close = false; + } + + // + // hedging? just send order + if (IsHedging()) + { + return (OrderSend(m_request, m_result)); + } + + // + // order send + if (!OrderSend(m_request, m_result)) + { + // + if (--retry_count != 0) + { + continue; + } + + // + if (retcode == TRADE_RETCODE_DONE_PARTIAL) + { + m_result.retcode = retcode; + } + + // + return (false); + } + + // + //--- WARNING. If position volume exceeds the maximum volume allowed for deal, + //--- and when the asynchronous trade mode is on, for safety reasons, position is closed not completely, + //--- but partially. It is decreased by the maximum volume allowed for deal. + if (m_async_mode) + { + break; + } + + // + retcode = TRADE_RETCODE_DONE_PARTIAL; + if (partial_close) + { + Sleep(1000); + } + } while (partial_close); + + // + // succeed + return (true); + } + bool PositionClose( + const ulong ticket, // Position Ticket + const ulong deviation, // Deviation + const string comment = "" // Comment For Close + ) + { + // + // check stopped + if (IsStopped(__FUNCTION__)) + { + return (false); + } + + // + // check position existence + if (!PositionSelectByTicket(ticket)) + { + return (false); + } + + // + string symbol = PositionGetString(POSITION_SYMBOL); + + // + // clean + ClearStructures(); + + // + // check filling + if (!FillingCheck(symbol)) + { + return (false); + } + + // + // check + if ((ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) + { + // + // prepare request for close BUY position + m_request.type = ORDER_TYPE_SELL; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_BID); + } + else + { + // + // prepare request for close SELL position + m_request.type = ORDER_TYPE_BUY; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_ASK); + } + + // + // setting request + m_request.action = TRADE_ACTION_DEAL; + m_request.position = ticket; + m_request.symbol = symbol; + m_request.volume = PositionGetDouble(POSITION_VOLUME); + m_request.magic = m_magic; + m_request.deviation = (deviation == ULONG_MAX) ? m_deviation : deviation; + + // + // Specify Comment ... + m_request.comment = comment; + + // + // close position + return (OrderSend(m_request, m_result)); + } + + // + // Partial Close Specific Position, by Specific Comment ... + bool PositionClosePartial( + const string symbol, // Symbol + const double volume, // Partial Closing Volume + const ulong deviation, // Deviation + const string comment = "" // Comment For Close + ) + { + // + uint retcode = TRADE_RETCODE_REJECT; + + // + // check stopped + if (IsStopped(__FUNCTION__)) + { + return (false); + } + + // + // for hedging mode only + if (!IsHedging()) + { + return (false); + } + + // + // clean + ClearStructures(); + + // + // check filling + if (!FillingCheck(symbol)) + { + return (false); + } + + // + // check + if (SelectPosition(symbol)) + { + // + if ((ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) + { + // + // prepare request for close BUY position + m_request.type = ORDER_TYPE_SELL; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_BID); + } + else + { + // + // prepare request for close SELL position + m_request.type = ORDER_TYPE_BUY; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_ASK); + } + } + else + { + // + // position not found + m_result.retcode = retcode; + return (false); + } + + // + // check volume + double position_volume = PositionGetDouble(POSITION_VOLUME); + if (position_volume > volume) + { + position_volume = volume; + } + + // + // setting request + m_request.action = TRADE_ACTION_DEAL; + m_request.symbol = symbol; + m_request.volume = position_volume; + m_request.magic = m_magic; + m_request.deviation = (deviation == ULONG_MAX) ? m_deviation : deviation; + m_request.position = PositionGetInteger(POSITION_TICKET); + + // + // Specifieng Comment ... + m_request.comment = comment; + + // + // hedging? just send order + return (OrderSend(m_request, m_result)); + } + bool PositionClosePartial( + const ulong ticket, // Position Ticket + const double volume, // Partial Closing Volume + const ulong deviation, // Deviation + const string comment = "" // Comment For Close + ) + { + // + // check stopped + if (IsStopped(__FUNCTION__)) + { + return (false); + } + + // + // for hedging mode only + if (!IsHedging()) + { + return (false); + } + + // + // check position existence + if (!PositionSelectByTicket(ticket)) + { + return (false); + } + + // + string symbol = PositionGetString(POSITION_SYMBOL); + + // + // clean + ClearStructures(); + + // + // check filling + if (!FillingCheck(symbol)) + { + return (false); + } + + // + // check + if ((ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) + { + // + // prepare request for close BUY position + m_request.type = ORDER_TYPE_SELL; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_BID); + } + else + { + // + // prepare request for close SELL position + m_request.type = ORDER_TYPE_BUY; + m_request.price = SymbolInfoDouble(symbol, SYMBOL_ASK); + } + + // + // check volume + double position_volume = PositionGetDouble(POSITION_VOLUME); + if (position_volume > volume) + { + position_volume = volume; + } + + // + // setting request + m_request.action = TRADE_ACTION_DEAL; + m_request.position = ticket; + m_request.symbol = symbol; + m_request.volume = position_volume; + m_request.magic = m_magic; + m_request.deviation = (deviation == ULONG_MAX) ? m_deviation : deviation; + + // + // Specifieng Comment ... + m_request.comment = comment; + + // + // close position + return (OrderSend(m_request, m_result)); + } +}; + +// +// Implementation ... + +// +// a Class For Manage Trades and Handle Trading Actions ... +class XSCTrade : public XSCBase +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + void XSCTrade( + int slippage, // Specify Slippage + ulong magicNumber, // Specify Magic Number + int manageInterval, // Manager Check Intervals Seconds + double maxAllowedSpread, // Max Allowed Spred for Opening Trades + int maxAllowedPositions, // Max Allowed Positions + double maxAllowedDrawdownFactor // Max Allowed Drawdown Factor + ) + { + // + // Setting Props ... + mSlippage = slippage; + mMagicNumber = magicNumber; + + // + mManageInterval = manageInterval; + + // + mMaxAllowedSpread = maxAllowedSpread; + mMaxAllowedPositions = maxAllowedPositions; + mMaxAllowedDrawdownFactor = maxAllowedDrawdownFactor; + + // + mAccount = new XSCAccount(); + + // + // Instance Base Trader Class ... + mTrader = new XSCTradeBase(); + + // + // Configuring Base Trader Class ... + mTrader.SetAsyncMode(false); + mTrader.SetDeviationInPoints(mSlippage); + mTrader.SetExpertMagicNumber(mMagicNumber); + + // + // Setting Log Level ... + mTrader.LogLevel(LOG_LEVEL_ERRORS); + + // + // OnTrade Context ... + + // + mDaysForRead = 1; + mScanStarted = false; + + // + // Reset On Trade Counter ... + ResetOnTradeContext(); + + // + // Init On Trade Context ... + InitOnTradeContext(); + } + + // + // Deconstructor ... + ~XSCTrade() + { + // + // Remove Pointer ... + delete mTrader; + delete mAccount; + } + + // + // Props ... + + // + // Retrieve Slippage ... + int GetSlippage() + { + return mSlippage; + } + + // + // Retrieve Magic Number ... + ulong GetMagicNumber() + { + return mMagicNumber; + } + + // + int GetManageInterval() + { + return mManageInterval; + } + + // + double GetMaxAllowedSpread() + { + return mMaxAllowedSpread; + } + + // + int GetMaxAllowedPositions() + { + return mMaxAllowedPositions; + } + + // + double GetMaxAllowedDrawdownFactor() + { + return mMaxAllowedDrawdownFactor; + } + + // + // Add Event Listeners ... + + // + // Add New Deals Changed Event Handler ... + void AddOnTradeStateChangedEventHandler(TOnTradeStateChanged handler) + { + // + Add( + handler, + mTradeStateChangedEventHandlers + // + ); + } + + // + // Add New Deals Changed Event Handler ... + void AddOnDealsChangedEventHandler(TOnDealsChanged handler) + { + // + Add( + handler, + mDealsChangedEventHandlers + // + ); + } + + // + // Add New Orders Changed Event Handler ... + void AddOnOrdersChangedEventHandler(TOnOrdersChanged handler) + { + // + Add( + handler, + mOrdersChangedEventHandlers + // + ); + } + + // + // Add New Positions Changed Event Handler ... + void AddOnPositionsChangedEventHandler(TOnPositionsChanged handler) + { + // + Add( + handler, + mPositionsChangedEventHandlers + // + ); + } + + // + // Add New Stop Loss Event Handler ... + void AddOnStopLossEventHandler(TOnStopLoss handler) + { + // + Add( + handler, + mStopLossEventHandlers + // + ); + } + + // + // Add New Stop Loss Event Handler ... + void AddOnTakeProfitEventHandler(TOnTakeProfit handler) + { + // + Add( + handler, + mTakeProfitEventHandlers + // + ); + } + + // + // Functions ... + + // + // Handlers ... + + // + // Process On Trade Requirement ... + // this Only Used when we Have to Proccess OnTrade Event in EA(s) ... + void HandleOnTradeEvent( + XOnTradeHandlerState &result // Hold's Result + ) + { + // + result.Clean(); + + // + if (mScanStarted) + { + // + ProcessOnTradeContext(result); + } + else + { + // + // Init Trade Context ... + InitOnTradeContext(); + + // + return; + } + + // + // Here we Can Check the Start ... + bool isValid = + // + result.IsValid() && + // + !result.hasNewDeal && + !result.hasNewOrder && + !result.hasNewPosition && + !result.hasNewHistoryOrder + // + ; + if (!isValid) + { + return; + } + + // + // State ... + + // + // Notfy Trade State Changed Event ... + NotifyTradeStateChangeEvent(result); + + // + // Deals ... + if (result.hasNewDeal) + { + // + // Notfy Deals Changed Event ... + NotifyDealsChangeEvent(result.newDeals); + + // + // Retrieve Last Deal ... + XDeal deals[]; + int dealsCount = GetDeals(deals); + if (dealsCount > 0) + { + // + XDeal lastDeal = deals[0]; + + // + if (lastDeal.reason == DEAL_REASON_TP) + { + NotifyTakeProfitEvent(lastDeal); + } + else if (lastDeal.reason == DEAL_REASON_SL) + { + NotifyStopLossEvent(lastDeal); + } + } + } + + // + // Orders ... + if (result.hasNewOrder || result.hasNewHistoryOrder) + { + // + // Notfy Orders Changed Event ... + NotifyOrdersChangeEvent(result.newOrders + result.newHistoryOrders); + } + + // + // Positions ... + if (result.hasNewPosition) + { + // + // Notfy Positions Changed Event ... + NotifyPositionsChangeEvent(result.newPositions); + } + } + + // + // This Must be Called Every time OnTrade Event Happening ... + // this Used for Implementing Custom Senarios ... + XOnTradeHandlerState HandleOnTrade() + { + // + // Handle OnTrade Event ... + XOnTradeHandlerState state; + HandleOnTradeEvent(state); + if ( + !state.hasNewDeal && + !state.hasNewOrder && + !state.hasNewPosition && + !state.hasNewHistoryOrder) + { + return state; + } + + // + // State ... + + // + // Notfy Trade State Changed Event ... + NotifyTradeStateChangeEvent(state); + + // + // DEALS ... + if (state.hasNewDeal) + { + // + // Notfy Deals Changed Event ... + NotifyDealsChangeEvent(state.newDeals); + + // + // Retrieve Last Deal ... + XDeal deals[]; + GetDeals(deals); + int dealsCount = ArraySize(deals); + if (dealsCount > 0) + { + // + XDeal lastDeal = deals[0]; + + // + if (lastDeal.reason == DEAL_REASON_TP) + { + NotifyTakeProfitEvent(lastDeal); + } + else if (lastDeal.reason == DEAL_REASON_SL) + { + NotifyStopLossEvent(lastDeal); + } + } + } + + // + // ORDERS ... + if (state.hasNewOrder || state.hasNewHistoryOrder) + { + // + // Notfy Orders Changed Event ... + NotifyOrdersChangeEvent(state.newOrders + state.newHistoryOrders); + } + + // + // POSITIONS ... + if (state.hasNewPosition) + { + // + // Notfy Positions Changed Event ... + NotifyPositionsChangeEvent(state.newPositions); + } + + // + return state; + } + + // + // Trade Actions ... + + // + // Main ... + + // + // Policies ... + + // + // Check Acocunt Balance is Allow new Trades or not ... + bool CheckEquityForTrade() + { + // + bool result = false; + + // + if (mMaxAllowedDrawdownFactor <= 0) + { + // + result = true; + return result; + } + + // + double equity = mAccount.GetEquity(); + double balance = mAccount.GetBalance(); + + // + double selectedBalance = MathMax(equity, balance) - MathMin(equity, balance); + + // + double maxAllowedBalanceDrawDown = GetMaxAllowedEquity(); + + // + result = equity > balance || + (equity <= balance && + selectedBalance <= maxAllowedBalanceDrawDown); + + // + return result; + } + + // + // Check Max Allowed Positions Policy for Trade ... + bool CheckPositionsForTrade() + { + // + bool result = false; + + // + if (mMaxAllowedPositions <= 0) + { + // + result = true; + return result; + } + + // + XPosition positions[]; + int positionsCount = GetPositions(positions); + if (positionsCount <= 0) + { + // + result = true; + return result; + } + + // + result = positionsCount < mMaxAllowedPositions; + + // + return result; + } + + // + // Check Spread is Ok for Executing Specific Signal ... + bool CheckSpreadForSignalExecution(XSignal &mSignal) + { + // + bool result = false; + + // + bool isSpreadCheckEnable = mMaxAllowedSpread > 0; + if (!isSpreadCheckEnable) + { + result = true; + } + else + { + // + // Retrieve Signal Spread ... + double spread = mSignal.GetSpread(); + result = spread <= mMaxAllowedSpread; + } + + // + return result; + } + + // + // Check Account Policy ... + bool CheckAccountPolicy( + XSignal &mSignal, // For Executing Signal + ENUM_X_SIGNAL_EXECUTION_RESULT &state // State Holder + ) + { + // + bool result = false; + + // + // Check Positions For Trade ... + result = CheckPositionsForTrade(); + if (!result) + { + // + state = X_SIGNAL_EXECUTION_FAILED_MAX_REACHED; + return result; + } + + // + // Check Equity For Trade ... + result = CheckEquityForTrade(); + if (!result) + { + // + state = X_SIGNAL_EXECUTION_FAILED_NO_EQUITY; + return result; + } + + // + // Check Spread for Trade ... + result = CheckSpreadForSignalExecution(mSignal); + if (!result) + { + // + state = X_SIGNAL_EXECUTION_FAILED_SPREAD; + return result; + } + + // + return result; + } + + // + // Manage ... + // this must be Call on OnTick for Manage + // Positions ... + // NOTE: Call this Before Checking IsNewBar ... + void Manage() + { + // // + // // All required Position Managements Actions implemented here ... + // datetime tmc = TimeCurrent(); + // bool canManage = !IsValid(mLastManageOn) + // ? true + // : mLastManageOn + mManageInterval >= tmc; + // if (!canManage) + // { + // return; + // } + + // // + // mLastManageOn = tmc; + + // + // - [] Partial Close; + // - [] Risk Free; + // - [] Trail Stop; + // - [] SLS; + // - [] TPS; + + // + // - [] Data Collector; + // - [] Profit Management; + + // + // TODO: Implement them ... + + // + // Implement Signal Collector Inside this Class + // and Manipulate Signals when SL/TP/Partial Close/Trail Stop/Profit/Close/ Modify and etc Happens ... + } + + // + // Execute a Signal ... + bool ExecuteSignal( + XSignal &mSignal, // Signal + ENUM_X_SIGNAL_EXECUTION_RESULT &state, // Result + ENUM_ORDER_TYPE_TIME lifetime = ORDER_TIME_GTC, // Order LifeTime + datetime expiration = NULL, // order expiration time + bool checkPolicies = true // Check Account Policies + ) + { + // + bool result = false; + state = X_SIGNAL_EXECUTION_UNKNOWN; + + // + double currentEntry = GetEntry( + mSignal.symbol, + mSignal.type + // + ); + bool isLong = IsLong(mSignal.type); + + // + // Select SL and TP ... + + // + double selectedSL = 0; + mSignal.RegularSL(selectedSL); + + // + double selectedTP = 0; + mSignal.RegularTP(selectedTP); + + // + if (!mSignal.IsValid()) + { + // + state = X_SIGNAL_EXECUTION_FAILED_INVALID_PARAMS; + return result; + } + + // + // Prepare Signal Comment ... + string mSComment = mSignal.GenerateComment(); + mSignal.comment += mSComment; + + // + // Handle Market Execution ... + if (mSignal.mode == X_ORDER_MODE_MARKET) + { + // + // Do Apply Policies here ... + bool hasPolicy = !checkPolicies + ? true + : CheckAccountPolicy(mSignal, state); + if (!hasPolicy) + { + result = false; + } + else + { + // + if (isLong) + { + // + result = Buy( + mSignal.symbol, + mSignal.period, + mSignal.volume, + mSignal.entry, + selectedSL, + selectedTP, + mSignal.comment + // + ); + } + else + { + // + result = Sell( + mSignal.symbol, + mSignal.period, + mSignal.volume, + mSignal.entry, + selectedSL, + selectedTP, + mSignal.comment + // + ); + } + } + } + // + // Handle Stop Execution ... + else if (mSignal.mode == X_ORDER_MODE_STOP) + { + + // + // Check Conditions ... + + // + // Check Price ... + result = isLong + ? mSignal.entry > currentEntry + : mSignal.entry < currentEntry; + if (!result) + { + // + state = X_SIGNAL_EXECUTION_FAILED_PRICE_ERROR; + return result; + } + + // + // Execute Order ... + if (isLong) + { + // + result = BuyStop( + mSignal.symbol, + mSignal.period, + mSignal.volume, + mSignal.entry, + selectedSL, + selectedTP, + lifetime, + expiration, + mSignal.comment + // + ); + } + else + { + // + result = SellStop( + mSignal.symbol, + mSignal.period, + mSignal.volume, + mSignal.entry, + selectedSL, + selectedTP, + lifetime, + expiration, + mSignal.comment + // + ); + } + } + // + // Handle Limit Execution ... + else if (mSignal.mode == X_ORDER_MODE_LIMIT) + { + // + // Check Conditions ... + + // + // Check Price ... + result = isLong + ? mSignal.entry < currentEntry + : mSignal.entry > currentEntry; + if (!result) + { + // + state = X_SIGNAL_EXECUTION_FAILED_PRICE_ERROR; + return result; + } + + // + // Execute Order ... + if (isLong) + { + // + result = BuyLimit( + mSignal.symbol, + mSignal.period, + mSignal.volume, + mSignal.entry, + selectedSL, + selectedTP, + lifetime, + expiration, + mSignal.comment + // + ); + } + else + { + // + result = SellLimit( + mSignal.symbol, + mSignal.period, + mSignal.volume, + mSignal.entry, + selectedSL, + selectedTP, + lifetime, + expiration, + mSignal.comment + // + ); + } + } + + // + // Handle Ticket ... + if (result) + { + // + state = X_SIGNAL_EXECUTION_SUCCEED; + + // + ulong ticket; + if (mSignal.mode == X_ORDER_MODE_MARKET) + { + ticket = GetLastOpenPositionTicket(); + } + else + { + ticket = GetLastPlacedOrderTicket(); + } + + // + mSignal.positionId = ticket; + + // + // Handle Store XPositionInfo ... + if (mSignal.mode == X_ORDER_MODE_MARKET) + { + // + // TODO: Implement this ... + } + + // + // Handle Executing Support Signals ... + int supportsCount = ArraySize(mSignal.supports); + if (supportsCount > 0) + { + // + int executed = 0; + for (int i = 0; i < supportsCount; i++) + { + // + XSignal iSupport = mSignal.supports[i]; + + // + int supIndex = i + 1; + string iComment = GenerateSupportTag(ticket); + + // + bool isExecuted = ExecuteSignal( + iSupport, + state, + lifetime, + expiration + // + ); + if (isExecuted) + { + executed++; + } + } + + // + result = executed == supportsCount; + } + } + + // + return result; + } + + // + // Execute a Collection Of Signals ... + int ExecuteSignals( + XSignal &signals[], // Collection of Signal for Execution + ENUM_X_SIGNAL_EXECUTION_RESULT &states[], // Signal Execution Result + ENUM_ORDER_TYPE_TIME lifetime = ORDER_TIME_GTC, // Order LifeTime + datetime expiration = NULL, // order expiration time + bool checkPolicies = true // Check Account Policies + ) + { + // + int result = 0; + + // + Clean(states); + + // + int signalsCount = ArraySize(signals); + if (signalsCount <= 0) + { + return result; + } + + // + ArrayResize(states, signalsCount); + ArrayInitialize(states, X_SIGNAL_EXECUTION_UNKNOWN); + for (int i = 0; i < signalsCount; i++) + { + // + bool isExecuted = ExecuteSignal( + signals[i], + states[i], + lifetime, + expiration + // + ); + + // + if (isExecuted) + { + result++; + } + } + + // + return result; + } + + // + // Regular Trade Actions ... + + // + // Buy ... + + // + // Force Open a Buy/Long Position ... + bool Buy( + string symbol, // Specified Symbol + ENUM_TIMEFRAMES period, // Specified Trade's Period + double volume, // position volume + double price, // execution price + double sl = 0, // stop loss price + double tp = 0, // take profit price + string comment = NULL // comment + ) + { + // + bool result = false; + + // + ENUM_TIMEFRAMES mPeriod = ExtractPeriod(comment); + if (!IsValid(comment) || + !IsValid(mPeriod)) + { + // + string mPeriodStr = GeneratePeriodTag(period); + + // + comment += mPeriodStr; + } + + // + result = mTrader.Buy( + volume, + symbol, + price, + sl, + tp, + comment + // + ); + + // + return result; + } + + // + // Send BUY LIMIT order ... + bool BuyLimit( + string symbol, // Specified Symbol + ENUM_TIMEFRAMES period, // Specified Trade's Period + double volume, // order volume + double price, // order price + double sl = 0.0, // stop loss price + double tp = 0.0, // take profit price + ENUM_ORDER_TYPE_TIME typeTime = ORDER_TIME_GTC, // order lifetime + datetime expiration = 0, // order expiration time + string comment = NULL // comment + ) + { + // + bool result = false; + + // + ENUM_TIMEFRAMES mPeriod = ExtractPeriod(comment); + if (!IsValid(comment) || + !IsValid(mPeriod)) + { + // + string mPeriodStr = GeneratePeriodTag(period); + + // + comment += mPeriodStr; + } + + // + result = mTrader.BuyLimit( + volume, + price, + symbol, + sl, + tp, + typeTime, + expiration, + comment + // + ); + + // + return result; + } + + // + // Send BUY STOP order ... + bool BuyStop( + string symbol, // Specified Symbol + ENUM_TIMEFRAMES period, // Specified Trade's Period + double volume, // order volume + double price, // order price + double sl = 0.0, // stop loss price + double tp = 0.0, // take profit price + ENUM_ORDER_TYPE_TIME typeTime = ORDER_TIME_GTC, // order lifetime + datetime expiration = 0, // order expiration time + string comment = NULL // comment + ) + { + // + bool result = false; + + // + ENUM_TIMEFRAMES mPeriod = ExtractPeriod(comment); + if (!IsValid(comment) || + !IsValid(mPeriod)) + { + // + string mPeriodStr = GeneratePeriodTag(period); + + // + comment += mPeriodStr; + } + + // + result = mTrader.BuyStop( + volume, + price, + symbol, + sl, + tp, + typeTime, + expiration, + comment + // + ); + + // + return result; + } + + // + // Sell ... + + // + // Force Open a Sell/Short Position ... + bool Sell( + string symbol, // Specified Symbol + ENUM_TIMEFRAMES period, // Specified Trade's Period + double volume, // position volume + double price, // execution price + double sl = 0, // stop loss price + double tp = 0, // take profit price + string comment = NULL // comment + ) + { + // + bool result = false; + + // + ENUM_TIMEFRAMES mPeriod = ExtractPeriod(comment); + if (!IsValid(comment) || + !IsValid(mPeriod)) + { + // + string mPeriodStr = GeneratePeriodTag(period); + + // + comment += mPeriodStr; + } + + // + result = mTrader.Sell( + volume, + symbol, + price, + sl, + tp, + comment + // + ); + + // + return result; + } + + // + // Send SELL LIMIT order ... + bool SellLimit( + string symbol, // Specified Symbol + ENUM_TIMEFRAMES period, // Specified Trade's Period + double volume, // order volume + double price, // order price + double sl = 0.0, // stop loss price + double tp = 0.0, // take profit price + ENUM_ORDER_TYPE_TIME typeTime = ORDER_TIME_GTC, // order lifetime + datetime expiration = 0, // order expiration time + string comment = NULL // comment + ) + { + // + bool result = false; + + // + ENUM_TIMEFRAMES mPeriod = ExtractPeriod(comment); + if (!IsValid(comment) || + !IsValid(mPeriod)) + { + // + string mPeriodStr = GeneratePeriodTag(period); + + // + comment += mPeriodStr; + } + + // + result = mTrader.SellLimit( + volume, + price, + symbol, + sl, + tp, + typeTime, + expiration, + comment + // + ); + + // + return result; + } + + // + // Send SELL STOP order ... + bool SellStop( + string symbol, // Specified Symbol + ENUM_TIMEFRAMES period, // Specified Trade's Period + double volume, // order volume + double price, // order price + double sl = 0.0, // stop loss price + double tp = 0.0, // take profit price + ENUM_ORDER_TYPE_TIME typeTime = ORDER_TIME_GTC, // order lifetime + datetime expiration = 0, // order expiration time + string comment = NULL // comment + ) + { + // + bool result = false; + + // + ENUM_TIMEFRAMES mPeriod = ExtractPeriod(comment); + if (!IsValid(comment) || + !IsValid(mPeriod)) + { + // + string mPeriodStr = GeneratePeriodTag(period); + + // + comment += mPeriodStr; + } + + // + result = mTrader.SellStop( + volume, + price, + symbol, + sl, + tp, + typeTime, + expiration, + comment + // + ); + + // + return result; + } + + // + // Check a Position is Exists Open or not ... + bool IsOpen( + ulong ticket // Specified Position Ticket + ) + { + // + bool result = false; + + // + result = mPositionInfo + .SelectByTicket(ticket); + + // + return result; + } + + // + // Modify Position ... + bool Modify( + const ulong ticket, // position ticket + double sl = 0, // stop loss price + double tp = 0, // take profit + string comment = NULL // comment + ) + { + // + bool result = false; + + // + // Validate Args ... + result = + IsOpen(ticket) && + (tp >= 0 || sl >= 0); + if (!result) + { + return result; + } + + // + // Use Position Comment when there isn't new One ... + if (!IsValid(comment) == 0) + { + // + // if there isn't provided Comment + // Use Position Comment for default ... + comment = "Modify " + GetPositionComment(ticket); + } + + // + result = mTrader.PositionModify( + ticket, + sl, + tp, + comment + // + ); + + // + return result; + } + + // + // Close Position By Ticket ... + bool Close( + ulong ticket, // Position Ticket + string comment = NULL // Close Position By Specific Comment + ) + { + // + bool result = false; + + // + // Check Position Open ... + result = IsOpen(ticket); + if (!result) + { + return result; + } + + // + // Use Default Position Comment if it's Not Provided ... + if (!IsValid(comment)) + { + comment = "Close " + GetPositionComment(ticket); + } + + // + // Close Position By Specific Comment ... + result = mTrader.PositionClose( + ticket, + mSlippage, + comment + // + ); + + // + return result; + } + + // + // Close Specified Positions ... + int Close( + string comment = NULL, // Close Position By Specific Comment + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) + bool filterByMagic = true // Get Only Self Open Positions + ) + { + // + int result = 0; + + // + XPosition positions[]; + int positionsCount = GetPositions( + positions, + symbol, + provider, + period, + type, + filterByMagic); + if (positionsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + bool isClosed = Close( + iPosition.ticket, + comment + // + ); + if (isClosed) + { + result++; + } + } + + // + return result; + } + + // + // Close a Collection of Positions ... + int Close( + XPosition &positions[], // Collection of Positions + string comment // Close Comment + ) + { + // + int result = 0; + + // + int positionsCount = ArraySize(positions); + if (positionsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + bool isClosed = Close( + iPosition.ticket, + comment + // + ); + if (isClosed) + { + result++; + } + } + + // + return result; + } + + // + // Close Partial By Ticket ... + bool ClosePartial( + ulong ticket, // Position Ticket + double volume, // Volume Size for Partial Closing + string comment = NULL // Close Position By Specific Comment + ) + { + // + bool result = false; + + // + result = IsOpen(ticket); + if (!result) + { + return result; + } + + // + // Use Default Partial Close Comment ... + if (!IsValid(comment)) + { + // + comment += "PClose " + GetPositionComment(ticket); + } + + // + result = mTrader.PositionClosePartial( + ticket, + volume, + mSlippage, + comment + // + ); + + // + return result; + } + + // + // Cancel Specific Order ... + bool CancelOrder(ulong ticket) + { + return mTrader + .OrderDelete(ticket); + } + + // + // Cancel Specific Orders ... + int CancelOrders( + XOrder &orders[] // Specified Orders ... + ) + { + // + int result = 0; + + // + int ordersCount = ArraySize(orders); + if (ordersCount <= 0) + { + return result; + } + + // + for (int i = 0; i < ordersCount; i++) + { + // + XOrder iOrder = orders[i]; + + // + bool isDeleted = mTrader + .OrderDelete(iOrder.ticket); + if (isDeleted && !result) + { + result++; + } + } + + // + return result; + } + + // + // Extractors ... + + // + // Positions ... + + // + // Calculate Positions Profit ... + double Profit( + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) + bool filterByMagic = true // Get Only Self Open Positions + ) + { + // + double result = 0; + + // + // Retrieve Positions ... + XPosition positions[]; + int positionsCount = GetPositions( + positions, + symbol, + provider, + period, + type, + filterByMagic + // + ); + if (positionsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + result += positions[i].profit; + } + + // + return result; + } + + // + // Retrieve Specific Position by Index ... + bool GetPosition( + int index, // Specified Index + XPosition &result // Hold's Result + ) + { + // + return result + .ByIndex(index); + } + + // + // Retrieve Specific Position by Ticket ... + bool GetPosition( + ulong ticket, // Specified Ticket + XPosition &result // Hold's Result + ) + { + // + return result + .ByTicket(ticket); + } + + // + // Retrieve Positions ... + int GetPositions( + XPosition &result[], // Hold's Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) + bool filterByMagic = true, // Get Only Self Open Positions + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + // Count Positions ... + int itemsCount = PositionsTotal(); + if (itemsCount <= 0) + { + return mResult; + } + + // + // Loop Through all Positions ... + for (int i = itemsCount - 1; i >= 0; i--) + { + // + XPosition iItem; + bool isLoaded = iItem.ByIndex(i); + if (!isLoaded) + { + continue; + } + + // + // Now we have to Check Given Filters ... + bool isFiltersPassed = + iItem.IsFiltersPassed( + symbol, + provider, + period, + type, + mMagicNumber, + filterByMagic + // + ); + if (!isFiltersPassed) + { + continue; + } + + // + // Add Filtered Item into Result ... + AddRef( + iItem, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // Select In Profit Positions ... + int GetInProfitPositions( + XPosition &result[], // Hold's Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) + ENUM_X_POSITION_SELECT_METHODS method = NULL, // Selection Method + bool filterByMagic = true, // Get Only Self Open Positions + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + XPosition positions[]; + int positionsCount = GetPositions( + positions, + symbol, + provider, + period, + type, + filterByMagic, + forceClean); + if (positionsCount <= 0) + { + return mResult; + } + + // + XPosition min; + XPosition max; + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + if (iPosition.profit <= 0) + { + continue; + } + + // + // Calculate Min and Max ... + + // + // Min ... + if (!min.IsValid() || min.profit <= 0 || min.profit > iPosition.profit) + { + min = iPosition; + } + + // + // Max ... + if (!max.IsValid() || max.profit <= 0 || max.profit < iPosition.profit) + { + max = iPosition; + } + + // + bool isSelectionMethodFilterPassed = + // + (method == NULL || + method == X_POSITION_SELECT_ALL) + ? true + : false; + // + ; + if (!isSelectionMethodFilterPassed) + { + continue; + } + + // + AddRef( + iPosition, + result + // + ); + } + + // + if (min.IsValid() && + (method == X_POSITION_SELECT_MIN || + method == X_POSITION_SELECT_BOTH)) + { + // + AddRef( + min, + result + // + ); + } + + // + if (max.IsValid() && + (method == X_POSITION_SELECT_MAX || + method == X_POSITION_SELECT_BOTH)) + { + // + AddRef( + max, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // Select In Drawdown Positions ... + int GetInDrawdownPositions( + XPosition &result[], // Hold's Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) + ENUM_X_POSITION_SELECT_METHODS method = NULL, // Selection Method + bool filterByMagic = true, // Get Only Self Open Positions + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + XPosition positions[]; + int positionsCount = GetPositions( + positions, + symbol, + provider, + period, + type, + filterByMagic, + forceClean); + if (positionsCount <= 0) + { + return mResult; + } + + // + XPosition min; + XPosition max; + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + if (iPosition.profit >= 0) + { + continue; + } + + // + // Calculate Min and Max ... + + // + // Min ... + if (!min.IsValid() || min.profit <= 0 || min.profit > iPosition.profit) + { + min = iPosition; + } + + // + // Max ... + if (!max.IsValid() || max.profit <= 0 || max.profit < iPosition.profit) + { + max = iPosition; + } + + // + bool isSelectionMethodFilterPassed = + // + (method == NULL || + method == X_POSITION_SELECT_ALL) + ? true + : false; + // + ; + if (!isSelectionMethodFilterPassed) + { + continue; + } + + // + AddRef( + iPosition, + result + // + ); + } + + // + if (min.IsValid() && + (method == X_POSITION_SELECT_MIN || + method == X_POSITION_SELECT_BOTH)) + { + // + AddRef( + min, + result + // + ); + } + + // + if (max.IsValid() && + (method == X_POSITION_SELECT_MAX || + method == X_POSITION_SELECT_BOTH)) + { + // + AddRef( + max, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // Orders ... + + // + // Retrieve Specific Order by Index ... + bool GetOrder( + int index, // Specified Index + XOrder &result // Hold's Result + ) + { + // + return result + .ByIndex(index); + } + + // + // Retrieve Specific Positions Orders ... + int GetOrders( + ulong ticket, // Positions Ticket + XOrder &result[], // Hold's Result + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + // Select History by Specified Ticket ... + bool isHistorySelected = HistorySelectByPosition(ticket); + if (!isHistorySelected) + { + return mResult; + } + + // + int ordersCount = HistoryOrdersTotal(); + if (ordersCount <= 0) + { + return mResult; + } + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + for (int i = 0; i < ordersCount; i++) + { + // + XOrder iOrder; + bool isLoaded = iOrder.HistoryByIndex(i); + if (!isLoaded) + { + continue; + } + + // + bool isTicketFilterPassed = + // + iOrder.ticket = ticket + // + ; + if (!isTicketFilterPassed) + { + continue; + } + + // + AddRef( + iOrder, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // Retrieve All Orders ... + int GetOrders( + XOrder &result[], // Hold's Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_ORDER_TYPE type = NULL, // Long (Buy) or Short (Sell) + ENUM_ORDER_STATE state = NULL, // Order State + bool filterByMagic = true, // Get Only Self Open Positions + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + // Count Positions ... + int itemsCount = OrdersTotal(); + if (itemsCount <= 0) + { + return mResult; + } + + // + // Loop Through all Positions ... + for (int i = itemsCount - 1; i >= 0; i--) + { + // + XOrder iItem; + bool isLoaded = iItem.ByIndex(i); + if (!isLoaded) + { + continue; + } + + // + // Now we have to Check Given Filters ... + bool isFiltersPassed = + iItem.IsFiltersPassed( + symbol, + provider, + period, + type, + state, + mMagicNumber, + filterByMagic + // + ); + if (!isFiltersPassed) + { + continue; + } + + // + // Add Filtered Item into Result ... + AddRef( + iItem, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // Retrieve Historical Orders ... + int GetOrders( + XOrder &result[], // Hold's Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_ORDER_TYPE type = NULL, // Long (Buy) or Short (Sell) + ENUM_ORDER_STATE state = NULL, // Order State + datetime startDate = NULL, // Specify Start Date + datetime endDate = NULL, // Specify End Date + bool filterByMagic = true, // Get Only Self Open Positions + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + endDate = NormalizeTime(endDate); + + // + if (!IsValid(startDate)) + { + startDate = endDate - PeriodSeconds(PERIOD_D1); + } + + // + bool isHistorySelected = HistorySelect( + startDate, + endDate); + if (!isHistorySelected) + { + return mResult; + } + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + // Count Positions ... + int itemsCount = OrdersTotal(); + if (itemsCount <= 0) + { + return mResult; + } + + // + // Loop Through all Positions ... + for (int i = itemsCount - 1; i >= 0; i--) + { + // + XOrder iItem; + bool isLoaded = iItem.HistoryByIndex(i); + if (!isLoaded) + { + continue; + } + + // + // Now we have to Check Given Filters ... + bool isFiltersPassed = + iItem.IsFiltersPassed( + symbol, + provider, + period, + type, + state, + mMagicNumber, + filterByMagic + // + ); + if (!isFiltersPassed) + { + continue; + } + + // + // Add Filtered Item into Result ... + AddRef( + iItem, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // Deals ... + + // + // Retrieve Specific Deal by Index ... + bool GetDeal( + int index, // Specified Index + XDeal &result // Hold's Result + ) + { + // + return result + .ByIndex(index); + } + + // + // Retrieve Specified Deal's History ... + int GetDealsHistory( + XDeal &deal, // Specified Deal + XOrder &history[], // Deals History + bool forceClean = true // Clean Result Array + ) + { + // + int result = 0; + + // + if (!deal.IsValid()) + { + return result; + } + + // + result = GetOrders( + deal.positionId, + history, + forceClean); + + // + return result; + } + + // + // Retrieve All Deals ... + int GetDeals( + XDeal &result[], // Hold's Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Period + ENUM_DEAL_TYPE type = NULL, // Deal Type + ENUM_DEAL_ENTRY entry = NULL, // Deal Entry + ENUM_DEAL_REASON reason = NULL, // Deal Reason + datetime startDate = NULL, // Specify Start Date + datetime endDate = NULL, // Specify End Date + bool filterByMagic = true, // Get Only Self Open Positions + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + endDate = NormalizeTime(endDate); + + // + if (!IsValid(startDate)) + { + startDate = endDate - PeriodSeconds(PERIOD_D1); + } + + // + bool isHistorySelected = HistorySelect( + startDate, + endDate); + if (!isHistorySelected) + { + return mResult; + } + + // + int before = ArraySize(result); + + // + if (forceClean) + { + Clean(result); + } + + // + // Count Positions ... + int itemsCount = HistoryDealsTotal(); + if (itemsCount <= 0) + { + return mResult; + } + + // + // Loop Through all Positions ... + for (int i = itemsCount - 1; i >= 0; i--) + { + // + XDeal iItem; + bool isLoaded = iItem.ByIndex(i); + if (!isLoaded) + { + continue; + } + + // + // Now we have to Check Given Filters ... + bool isFiltersPassed = + iItem.IsFiltersPassed( + symbol, + provider, + period, + type, + entry, + reason, + mMagicNumber, + filterByMagic + // + ); + if (!isFiltersPassed) + { + continue; + } + + // + // Add Filtered Item into Result ... + AddRef( + iItem, + result + // + ); + } + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; + } + + // + // XPosition Pack ... + + // + // Extract specific Positions Pack ... + // in this senario there is no need to Position exists itself ... + bool GetPositionPack( + ulong ticket, // Specified Positions Ticket + string symbol, // Specified Position Symbol + ENUM_TIMEFRAMES period, // Specified Position Period + XPositionPack &pack // Hold Result + ) + { + // + bool result = false; + + // + pack.Clean(); + + // + XPosition position; + bool hasPosition = GetPosition( + ticket, + position + // + ); + if (hasPosition) + { + pack.position = position; + } + + // + XOrder supportOrders[]; + XPosition supportPositions[]; + + // + XOrder orders[]; + GetOrders( + orders, + symbol, // Specified Symbol + NULL, // All Providers + period, // Specified Period + NULL, // All Types + ORDER_STATE_PLACED, // Just UnTriggered Orders + true // Filter by Magic + ); + int ordersCount = ArraySize(orders); + + // + // Select Orders ... + if (ordersCount > 0) + { + // + for (int i = 0; i < ordersCount; i++) + { + // + XOrder iOrder = orders[i]; + + // + // Retrieve Order Supported Ticket ... + ulong parentTicket = ExtractSupportedTicket(iOrder.comment); + if (NotEmpty(parentTicket) && parentTicket == ticket) + { + // + AddRef( + iOrder, + supportOrders + // + ); + } + } + } + + // + int supportOrdersCount = ArraySize(supportOrders); + if (supportOrdersCount > 0) + { + // + pack.supportOrdersCount = supportOrdersCount; + + // + Copy( + supportOrders, + pack.supportOrders); + } + + // + XPosition positions[]; + GetPositions( + positions, + symbol, // Specified Symbol ... + NULL, // All Providers ... + period // Specified Period ... + ); + int positionsCount = ArraySize(positions); + + // + // Select Positions ... + if (positionsCount > 0) + { + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + ulong parentTicket = ExtractSupportedTicket(iPosition.comment); + if (NotEmpty(parentTicket) && parentTicket == ticket) + { + // + AddRef( + iPosition, + supportPositions + // + ); + } + } + } + + // + int supportPositionsCount = ArraySize(supportPositions); + if (supportPositionsCount > 0) + { + // + pack.supportPositionsCount = supportPositionsCount; + + // + Copy( + supportPositions, + pack.supportPositions); + } + + // + result = pack.IsValid(); + + // + return result; + } + + // + // Close Position Pack ... + bool ClosePositionPack( + XPositionPack &pack, // Specified Position Pack + string comment, // Specified Close Comment + bool inProfit = false, // if it's true only close Pack if in profit + double minProfitPerTrade = 0, // Min Profit based On Volume Factor ... + double minProfitPerVolumeFactor = 0 // Min Volume Factor ... + ) + { + // + bool result = false; + + // + ulong ticket = pack.ticket; + + // + XPosition positions[]; + + // + XPosition pPosition; + result = GetPosition( + ticket, + pPosition // + ); + if (result) + { + // + AddRef( + pPosition, + positions // + ); + } + + // + if (pack.supportPositionsCount > 0) + { + // + for (int i = 0; i < pack.supportPositionsCount; i++) + { + // + XPosition iPosition = pack.supportPositions[i]; + + // + AddRef( + iPosition, + positions // + ); + } + } + + // + // Force Close ... + if (!inProfit) + { + // + int closed = Close( + positions, + comment // + ); + + // + int cancelled = 0; + if (pack.supportOrdersCount > 0) + { + cancelled = CancelOrders(pack.supportOrders); + } + + // + result = (closed + cancelled) == (pack.supportPositionsCount + pack.supportOrdersCount + 1); + } + else + { + // + bool canHedge = SpecifiedIsPositionsReadyForHedge( + positions, + minProfitPerTrade, + minProfitPerVolumeFactor // + ); + if (canHedge) + { + // + int closed = Close( + positions, + comment // + ); + + // + int cancelled = 0; + if (pack.supportOrdersCount > 0) + { + cancelled = CancelOrders(pack.supportOrders); + } + + // + result = (closed + cancelled) == (pack.supportPositionsCount + pack.supportOrdersCount + 1); + } + else + { + result = false; + } + } + + // + return result; + } + bool ClosePositionPack( + ulong ticket, // Specified Position Pack + string symbol, // Specified Position Symbol + ENUM_TIMEFRAMES period, // Specified Position Period + string comment, // Specified Close Comment + bool inProfit = false, // if it's true only close Pack if in profit + double minProfitPerTrade = 0, // Min Profit based On Volume Factor ... + double minProfitPerVolumeFactor = 0 // Min Volume Factor ... + ) + { + // + bool result = false; + + // + XPositionPack pack; + result = GetPositionPack( + ticket, + symbol, + period, + pack // + ); + if (!result) + { + return result; + } + + // + result = ClosePositionPack( + pack, + comment, + inProfit, + minProfitPerTrade, + minProfitPerVolumeFactor // + ); + + // + return result; + } + + // + // Close Positions Pack ... + int ClosePositionsPack( + XPosition &positions[], // Positions ... + string comment, // Specified Close Comment + bool inProfit = false, // if it's true only close Pack if in profit + double minProfitPerTrade = 0, // Min Profit based On Volume Factor ... + double minProfitPerVolumeFactor = 0 // Min Volume Factor ... + ) + { + // + int result = 0; + + // + int positionsCount = ArraySize(positions); + if (positionsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + bool isClosed = ClosePositionPack( + iPosition.ticket, + iPosition.symbol, + iPosition.period, + comment, + inProfit, + minProfitPerTrade, + minProfitPerVolumeFactor // + ); + if (isClosed) + { + result++; + } + } + + // + return result; + } + + // + // Protected ... +protected: + // + // Props ... + + // + // Event Listener Notifiers ... + + // + // State ... + void NotifyTradeStateChangeEvent(const XOnTradeHandlerState &state) + { + // + int count = ArraySize(mTradeStateChangedEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnTradeStateChanged iHandler = mTradeStateChangedEventHandlers[i]; + iHandler(state); + } + } + + // + // Deals ... + void NotifyDealsChangeEvent(int changes) + { + // + int count = ArraySize(mDealsChangedEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnDealsChanged iHandler = mDealsChangedEventHandlers[i]; + iHandler(changes); + } + } + + // + // Orders ... + void NotifyOrdersChangeEvent(int changes) + { + // + int count = ArraySize(mOrdersChangedEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnOrdersChanged iHandler = mOrdersChangedEventHandlers[i]; + iHandler(changes); + } + } + + // + // Positions ... + void NotifyPositionsChangeEvent(int changes) + { + // + int count = ArraySize(mPositionsChangedEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnPositionsChanged iHandler = mPositionsChangedEventHandlers[i]; + iHandler(changes); + } + } + + // + // StopLoss ... + void NotifyStopLossEvent(const XDeal &deal) + { + // + int count = ArraySize(mStopLossEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnStopLoss iHandler = mStopLossEventHandlers[i]; + iHandler(deal); + } + } + + // + // Take Profit ... + void NotifyTakeProfitEvent(const XDeal &deal) + { + // + int count = ArraySize(mTakeProfitEventHandlers); + if (count <= 0) + { + return; + } + + // + for (int i = 0; i < count; i++) + { + // + TOnTakeProfit iHandler = mTakeProfitEventHandlers[i]; + iHandler(deal); + } + } + + // + // Tools ... + + // + // Retrieve Specified Position Comment ... + string GetPositionComment(ulong ticket) + { + // + string result = NULL; + + // + if (!IsOpen(ticket)) + { + return result; + } + + // + XPosition position; + bool isLoaded = position.ByTicket(ticket); + if (!isLoaded) + { + return result; + } + + // + result = position.comment; + + // + return result; + } + + // + // Retrieve Last Open Position Ticket ... + ulong GetLastOpenPositionTicket() + { + // + ulong result = 0; + + int positionsCount = PositionsTotal(); + if (positionsCount <= 0) + { + return result; + } + + // + result = PositionGetTicket(PositionsTotal() - 1); + + // + return result; + } + + // + // Retrieve Last Placed Order Ticket ... + ulong GetLastPlacedOrderTicket() + { + // + ulong result = 0; + + int ordersCount = OrdersTotal(); + if (ordersCount <= 0) + { + return result; + } + + // + if (mOrderInfo.SelectByIndex(ordersCount - 1)) + { + result = mOrderInfo.Ticket(); + } + + // + return result; + } + + // + // Extract Specific Deals Position's Pack ... + // this used when a Position SL or TP triggered and we want to close + // all it's Supported Packs ... + bool GetDealPack( + XDeal &deal, + XPositionPack &pack // + ) + { + // + bool result = false; + + // + ulong ticket = deal.positionId; + ENUM_TIMEFRAMES dealPeriod = GetDealPeriod(deal); + string dealSymbol = deal.symbol; + + // + // So We Have to Get Positions Pack ... + result = GetPositionPack( + ticket, + dealSymbol, + dealPeriod, + pack + // + ); + + // + return result; + } + + // + ENUM_TIMEFRAMES GetDealPeriod(XDeal &deal) + { + // + ENUM_TIMEFRAMES result = NULL; + + // + XOrder orders[]; + int ordersCount = GetDealsHistory( + deal, + orders); + if (!ordersCount) + { + return result; + } + + // + for (int i = 0; i < ordersCount; i++) + { + // + XOrder iOrder = orders[i]; + + // + if (IsValid(iOrder.comment)) + { + // + ENUM_TIMEFRAMES iPeriod = ExtractPeriod(iOrder.comment); + if (IsValid(iPeriod)) + { + result = iPeriod; + break; + } + } + } + + // + return result; + } + + // + double GetMaxAllowedEquity() + { + // + double equity = mAccount.GetEquity(); + double balance = mAccount.GetBalance(); + + // + double balanceForFactor = MathAbs(equity - balance); + if (balanceForFactor <= 0) + { + balanceForFactor = balance; + } + else + { + balanceForFactor = equity; + } + + // + double result = balanceForFactor * mMaxAllowedDrawdownFactor; + + // + return result; + } + + // + // Private ... +private: + // + // Props ... + + // + int mSlippage; // Slippage ... + ulong mMagicNumber; // Magic Number (Unique Identifier) ... + + // + datetime mLastManageOn; // Last Manager Check + int mManageInterval; // Manager Check Intervals Seconds + + // + double mMaxAllowedSpread; // Max Allowed Spred for Opening Trades + int mMaxAllowedPositions; // Max Allowed Same Positions + double mMaxAllowedDrawdownFactor; // Max Allowed Drawdown Factor + + // + XSCAccount *mAccount; // Account Info Provider + XSCTradeBase *mTrader; // Base CTrade Manipulated Instance ... + + // + CDealInfo mDealInfo; // Deals Info ... + COrderInfo mOrderInfo; // Order Info ... + CPositionInfo mPositionInfo; // Positions Info + CHistoryOrderInfo mHistoryOrderInfo; // History Orders Info ... + + // + // Position Info Collector ... + + // + // Tools ... + + // + // OnTrade Event Handlers Section ... + + // + // Props ... + + // + int mDaysForRead; // Reading Dates for Trade History Checker ... + datetime mEndDate; // End Date for Trade history Checking ... + datetime mStartDate; // Start Date for Trade history Checking ... ... + int mOrdersCount; // Number of Active orders ... + int mPositionsCount; // Number of Open positions ... + int mDealsCount; // Number of Deals in the Trade History Checking ... + int mHistoryOrdersCount; // Number of Orders in the Trade History Checking ... + bool mScanStarted; // a Flag of counter relevance ... + + // + // Event Listeners ... + + // + // Deals Changed Event Handlers ... + TOnDealsChanged mDealsChangedEventHandlers[]; + + // + // Orders Changed Event Handlers ... + TOnOrdersChanged mOrdersChangedEventHandlers[]; + + // + // Positions Changed Event Handlers ... + TOnPositionsChanged mPositionsChangedEventHandlers[]; + + // + // Trade State Changed Event Handlers ... + TOnTradeStateChanged mTradeStateChangedEventHandlers[]; + + // + // TPSL ... + TOnStopLoss mStopLossEventHandlers[]; + TOnTakeProfit mTakeProfitEventHandlers[]; + + // + // Reset On Trade Scanner Context ... + void ResetOnTradeContext() + { + // + mEndDate = TimeCurrent(); + mStartDate = mEndDate - (mDaysForRead * PeriodSeconds(PERIOD_D1)); + } + + // + // Initial Context Of Trade Scanner ... + void InitOnTradeContext() + { + // + ResetLastError(); + + // + mOrdersCount = OrdersTotal(); + mPositionsCount = PositionsTotal(); + + // + // load history ... + bool selected = HistorySelect(mStartDate, mEndDate); + if (!selected) + { + return; + } + + // + // get the current value ... + mDealsCount = HistoryDealsTotal(); + mHistoryOrdersCount = HistoryOrdersTotal(); + + // + mScanStarted = true; + } + + // + // Check Statrt Date In Trade History ... + void CheckStartDateInTradeHistory() + { + // + // initial interval, if we were to start working right now .. + datetime currStart = TimeCurrent() - (mDaysForRead * PeriodSeconds(PERIOD_D1)); + + // + // make sure that the start limit of the trade history has not gone + // more than 1 day over the intended date ... + if (currStart - mStartDate > PeriodSeconds(PERIOD_D1)) + { + // + // correct the start date of history to be loaded in the cache ... + mStartDate = currStart; + + // + // now reload the trade history for the updated interval ... + HistorySelect(mStartDate, mEndDate); + + // + // correct the deal and order counters in history for further comparison + mHistoryOrdersCount = HistoryOrdersTotal(); + mDealsCount = HistoryDealsTotal(); + } + } + + // + // Process On Trade Context ... + void ProcessOnTradeContext( + XOnTradeHandlerState &result // Hold's Result + ) + { + // + mEndDate = TimeCurrent(); + + // + ResetLastError(); + + // + // download trading history from the specified interval to the program cache ... + bool selected = HistorySelect(mStartDate, mEndDate); + if (!selected) + { + return; + } + + // + // get the current values ... + int currOrders = OrdersTotal(); + int currPositions = PositionsTotal(); + int currDeals = HistoryDealsTotal(); + int currHistoryOrders = HistoryOrdersTotal(); + + // + // Orders ... + // check if the number of active orders has been changed ... + if (currOrders != mOrdersCount) + { + // + // number of active orders has been changed ... + result.hasNewOrder = true; + result.newOrders = currOrders - mOrdersCount; + + // + // update the value ... + mOrdersCount = currOrders; + } + + // + // Positions ... + // changes in the number of open positions ... + if (currPositions != mPositionsCount) + { + // + // number of open positions has been changed ... + result.hasNewPosition = true; + result.newPositions = currPositions - mPositionsCount; + + // + // update the value ... + mPositionsCount = currPositions; + } + + // + // Deals ... + // changes in the number of deals in the trade history cache ... + if (currDeals != mDealsCount) + { + // + // number of deals in the trade history cache has been changed ... + result.hasNewDeal = true; + result.newDeals = currDeals - mDealsCount; + + // + // update the value ... + mDealsCount = currDeals; + } + + // + // History Orders ... + // changes in the number of history orders in the trade history cache ... + if (currHistoryOrders != mHistoryOrdersCount) + { + // + // number of history orders in the trade history cache has been changed ... + result.hasNewHistoryOrder = true; + result.newHistoryOrders = currHistoryOrders - mHistoryOrdersCount; + + // + // update the value ... + mHistoryOrdersCount = currHistoryOrders; + } + + // + // checking if it is necessary to change the limits of the trade history to be requested in cache ... + CheckStartDateInTradeHistory(); + } +}; + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x121ea.mq5 b/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x121ea.mq5 new file mode 100644 index 0000000..51acdcc --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x121ea.mq5 @@ -0,0 +1,967 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center X121EA MQL5 Expert Advisor +// ------------------------------------------------- +// Name: X121EA +// Description: an Exper Advisor which used RSI and MA +// to Analyse Market ... +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +//////////////////////////////////////////////////////x +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X121EA" +#property strict + +// +#define ShortName "X121EA" + +// +#include "../Classes/x-saherelm.x121.xea.class.mq5" + +// +// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb" +// "EURUSDb,USDCHFb,USDJPYb,GBPUSDb,XAUUSDb,AUDUSDb,USDCADb,NZDUSDb" + +// +// Inputs ... +long x121EAMagicNumber = 78692110; // Magic Number +int x121EASlippage = 10; // Slippgae +string x121EASymbols = "EURUSDb,USDCHFb,GBPUSDb"; // Symbols +// +bool x121EAAllowLong = true; // Allow Long Trades +bool x121EAAllowShort = true; // Allow Short Trades +int x121EAManageInterval = 0; // Manager Check Intervals Seconds +int x121EAMaxAllowedPositions = 5; // Max Allowed Positions +double x121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades +double x121EAMinProfitPerTrade = 3; // Min Profit Per Trade based On Volume Factor (Hedge) +double x121EAMinProfitPerVolumeFactor = 0.01; // Min Volume Factor for Calculating Profit (Hedge) +double x121EAMaxAllowedDrawdownFactor = 0.003; // Max Allowed Drawdown Factor +// +double x121EAVolume = 0.01; + +// +// Vars ... +string x121EASymbol; +ENUM_TIMEFRAMES x121EAPeriod; + +// +MqlTick x121EATick; + +// +// X121EA ... +XSCX121EA *mX121EA; + +// +// Event Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + if (x121EASymbol == NULL || StringLen(x121EASymbol) <= 0) + { + x121EASymbol = _Symbol; + } + + // + if (x121EAPeriod == NULL) + { + x121EAPeriod = _Period; + } + + // + // Validate Inputs ... + if (!X121EAValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Initial EA ... + if (!InitialEA()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // TesterHideIndicators(true); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // De Initialize X121EA Providers ... +} + +// +// On Tick Handler ... +void OnTick() +{ + // + // Reading Tick ... + if (!SymbolInfoTick(x121EASymbol, x121EATick)) + { + return; + } + + // + mX121EA.OnTick(); +} + +// +// Custom Functions ... + +// +// Validate Variables nd Inputs ... +bool X121EAValidateInputs() +{ + // + bool result = false; + + // + result = + // + x121EASlippage > 0 && + x121EAMagicNumber > 0 + // + ; + + // + return result; +} + +// +// Initialize Specific Providers ... +bool InitialEA() +{ + // + bool result = false; + + // + // Here We Have to Initial 4 instance of X5Provider ... + // - EURUSD/M5; + // - USDCHF/M5; + // - USDJPY/M5; + // - XAUUSD/M5; + + // + result = IsValid(x121EASymbols); + if (!result) + { + return result; + } + + // + string symbols[]; + int symbolsCount = SplitContent( + symbols, + x121EASymbols); + result = symbolsCount > 0; + if (!result) + { + return result; + } + + // + // Define Signallers ... + ENUM_X121_SIGNAL_PROVIDERS signallers[]; + Add(X786, signallers); + Add(X110, signallers); + Add(X121, signallers); + Add(X128, signallers); + Add(X92, signallers); + // GetAllX121SignalProviders(signallers); + + // + // Instantiate X121EA Class ... + mX121EA = new XSCX121EA( + x121EASlippage, // Slippgae + x121EAMagicNumber, // Magic Number + x121EAManageInterval, // Manager Check Intervals Seconds + x121EAMaxAllowedSpread, // Max Allowed Spred for Opening Trades + x121EAMaxAllowedPositions, // Max Allowed Positions + x121EAMaxAllowedDrawdownFactor, // Max Allowed Drawdown Factor + x121EAVolume, // Static Volume for Positions + x121EAAllowLong, // Allow Long Trades + x121EAAllowShort, // Allow Short Trades + x121EAMinProfitPerTrade, // Min Profit Per Trade based On Volume Factor (Hedge) + x121EAMinProfitPerVolumeFactor // Min Volume Factor for Calculating Profit (Hedge) + ); + + // + // Prepare Providers and Add them into mX121EA class ... + for (int i = 0; i < symbolsCount; i++) + { + // + // Requirements ... + string iSymbol = symbols[i]; + ENUM_TIMEFRAMES iPeriod = PERIOD_M5; + + // + // Define Structure ... + X121ProviderDescriptor iDescriptor; + + // + iDescriptor.symbol = iSymbol; + iDescriptor.period = iPeriod; + iDescriptor.staticVolume = x121EAVolume; + iDescriptor.allowLong = x121EAAllowLong; + iDescriptor.allowShort = x121EAAllowShort; + Copy( + signallers, + iDescriptor.signallers); + + // + // Set Inputs to Default ... + iDescriptor.inputs.Default(); + + // + // Prepare Input Requirements ... + + // + iDescriptor.inputs.symbol = iSymbol; + iDescriptor.inputs.period = iPeriod; + + // + ConfigureDescriptor(iDescriptor); + + // + // Init Inputs ... + result = iDescriptor.inputs.Init(); + if (!result) + { + return result; + } + + // + // Validate Inputs ... + bool isInputsValid = iDescriptor.inputs.IsValid(); + if (!isInputsValid) + { + continue; + } + + // + result = mX121EA.AddProvider(iDescriptor); + if (!result) + { + break; + } + } + + // + return result; +} + +// +// Configurators ... + +// +// Configuring Descriptors ... +void ConfigureDescriptor( + X121ProviderDescriptor &iDescriptor // +) +{ + // + // XHK ... + iDescriptor.inputs.tmInputs.showLine = false; + + // + // XAMA ... + iDescriptor.inputs.amaInputs.showLine = false; + + // + // XHK ... + iDescriptor.inputs.hkInputs.drawHikenAshi = false; + iDescriptor.inputs.hkInputs.drawSmoothedHikenAshi = false; + + // + // XMRB ... + iDescriptor.inputs.mrbInputs.showFastMa = false; + iDescriptor.inputs.mrbInputs.showSlowMa = false; + iDescriptor.inputs.mrbInputs.showRibbon = false; + + // + // XMC ... + iDescriptor.inputs.mcInputs.showFastMa = false; + iDescriptor.inputs.mcInputs.showSlowMa = false; + iDescriptor.inputs.mcInputs.showVerifierMa = false; + + // + // XICH ... + iDescriptor.inputs.ichInputs.showKumo = false; + iDescriptor.inputs.ichInputs.showKijunSen = false; + iDescriptor.inputs.ichInputs.showTenkanSen = false; + iDescriptor.inputs.ichInputs.showChikouSpan = false; + iDescriptor.inputs.ichInputs.showSenkouSpanA = false; + iDescriptor.inputs.ichInputs.showSenkouSpanB = false; + iDescriptor.inputs.ichInputs.showKijunSenPlus = false; + iDescriptor.inputs.ichInputs.showKijunSenNegative = false; + + // + // XCHE ... + iDescriptor.inputs.cheInputs.showLongExit1Line = false; + iDescriptor.inputs.cheInputs.showShortExit1Line = false; + iDescriptor.inputs.cheInputs.showLongExit2Line = false; + iDescriptor.inputs.cheInputs.showShortExit2Line = false; + + // + // XPV ... + iDescriptor.inputs.pvInputs.showPeaksAndVales = true; + iDescriptor.inputs.pvInputs.showLevels = false; + iDescriptor.inputs.pvInputs.showConsolidations = false; + iDescriptor.inputs.pvInputs.showFibo1Levels = false; + iDescriptor.inputs.pvInputs.showFibo2Levels = false; + iDescriptor.inputs.pvInputs.showFibo3Levels = false; + iDescriptor.inputs.pvInputs.showFibo4Levels = false; + iDescriptor.inputs.pvInputs.showFibo5Levels = false; + + // + // XZG ... + iDescriptor.inputs.zgInputs.showZigZag = true; + iDescriptor.inputs.zgInputs.showPeaksAndVales = true; + + // + // XDON ... + iDescriptor.inputs.donInputs.showOpen = false; + iDescriptor.inputs.donInputs.showHigh = false; + iDescriptor.inputs.donInputs.showClose = false; + iDescriptor.inputs.donInputs.showLow = false; + + // + // XSTR ... + iDescriptor.inputs.strInputs.showTrends = false; + iDescriptor.inputs.strInputs.fillTrends = false; + + // + // Short MArket ... + iDescriptor.inputs.sMarketPeriod = NULL; + iDescriptor.inputs.sMarketMethod = X_PERIOD_AUTO; + + // + // Medium Market ... + iDescriptor.inputs.mMarketPeriod = NULL; + iDescriptor.inputs.mMarketMethod = X_PERIOD_AUTO; + + // + // Long Market ... + iDescriptor.inputs.lMarketPeriod = NULL; + iDescriptor.inputs.lMarketMethod = X_PERIOD_AUTO; + + // + int fontSize = 12; + double fontAngel = 90; + string fontName = "Arial"; + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER; + + // + // Current Market ... + ConfigureCurrentMarketDrawSpecs( + // + iDescriptor, + // + "Current", + // + false, // Draw Labels ... + false, // Draw C Bar ... + false, // Draw P Bar ... + false, // Draw C Bar Mid Line ... + false, // Draw P Bar Mid Line ... + // + fontSize, + fontAngel, + fontName, + fontAnchor // , + // + // cBarPrefix + // pBarPrefix + // openLabel + // closeLabel + // highLabel + // lowLabel + // midLineLabel + ); + + // + // Short Market ... + ConfigureShortMarketDrawSpecs( + // + iDescriptor, + // + iDescriptor.inputs.sMarketPeriod, + iDescriptor.inputs.sMarketMethod, + // + "Short", + // + false, // Draw Labels ... + false, // Draw C Bar ... + false, // Draw P Bar ... + false, // Draw C Bar Mid Line ... + false, // Draw P Bar Mid Line ... + // + fontSize, + fontAngel, + fontName, + fontAnchor // , + // + // cBarPrefix + // pBarPrefix + // openLabel + // closeLabel + // highLabel + // lowLabel + // midLineLabel + ); + + // + // Medium Market ... + ConfigureMediumMarketDrawSpecs( + // + iDescriptor, + // + iDescriptor.inputs.mMarketPeriod, + iDescriptor.inputs.mMarketMethod, + // + "Medium", + // + false, // Draw Labels ... + false, // Draw C Bar ... + false, // Draw P Bar ... + false, // Draw C Bar Mid Line ... + false, // Draw P Bar Mid Line ... + // + fontSize, + fontAngel, + fontName, + fontAnchor // , + // + // cBarPrefix + // pBarPrefix + // openLabel + // closeLabel + // highLabel + // lowLabel + // midLineLabel + ); + + // + // Long Market ... + ConfigureLongMarketDrawSpecs( + // + iDescriptor, + // + iDescriptor.inputs.lMarketPeriod, + iDescriptor.inputs.lMarketMethod, + // + "Long", + // + false, // Draw Labels ... + false, // Draw C Bar ... + false, // Draw P Bar ... + false, // Draw C Bar Mid Line ... + false, // Draw P Bar Mid Line ... + // + fontSize, + fontAngel, + fontName, + fontAnchor // , + // + // cBarPrefix + // pBarPrefix + // openLabel + // closeLabel + // highLabel + // lowLabel + // midLineLabel + ); + + // + // Hind Market ... + ConfigureHindMarketDrawSpecs( + // + iDescriptor, + // + iDescriptor.inputs.hMarketPeriod, + iDescriptor.inputs.hMarketMethod, + // + "Hind", + // + false, // Draw Labels ... + false, // Draw C Bar ... + false, // Draw P Bar ... + false, // Draw C Bar Mid Line ... + false, // Draw P Bar Mid Line ... + // + fontSize, + fontAngel, + fontName, + fontAnchor // , + // + // cBarPrefix + // pBarPrefix + // openLabel + // closeLabel + // highLabel + // lowLabel + // midLineLabel + ); +} + +// +// Current ... +void ConfigureCurrentMarketDrawSpecs( + X121ProviderDescriptor &iDescriptor, + string prefix = "Current", + bool drawLabels = false, + bool drawCBar = false, + bool drawPBar = false, + bool drawCBarMid = false, + bool drawPBarMid = false, + int fontSize = 12, + double fontAngel = 90, + string fontName = "Arial", + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER, + string cBarPrefix = "C", + string pBarPrefix = "P", + string openLabel = "O", + string closeLabel = "C", + string highLabel = "H", + string lowLabel = "L", + string midLineLabel = "Mid" // +) +{ + // + ConfigureMarketDrawSpecs( + iDescriptor.inputs.cMarketInputs, + // + drawLabels, + drawCBar, + drawPBar, + drawCBarMid, + drawPBarMid, + fontSize, + fontAngel, + fontName, + fontAnchor, + prefix, + cBarPrefix, + pBarPrefix, + openLabel, + closeLabel, + highLabel, + lowLabel, + midLineLabel // + ); +} + +// +// Short ... +void ConfigureShortMarketDrawSpecs( + X121ProviderDescriptor &iDescriptor, + ENUM_TIMEFRAMES period = NULL, + ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO, + string prefix = "Short", + bool drawLabels = false, + bool drawCBar = false, + bool drawPBar = false, + bool drawCBarMid = false, + bool drawPBarMid = false, + int fontSize = 12, + double fontAngel = 90, + string fontName = "Arial", + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER, + string cBarPrefix = "C", + string pBarPrefix = "P", + string openLabel = "O", + string closeLabel = "C", + string highLabel = "H", + string lowLabel = "L", + string midLineLabel = "Mid" // +) +{ + // + // Short Market ... + iDescriptor.inputs.sMarketPeriod = period; + iDescriptor.inputs.sMarketMethod = method; + + // + ConfigureMarketDrawSpecs( + iDescriptor.inputs.sMarketInputs, + // + drawLabels, + drawCBar, + drawPBar, + drawCBarMid, + drawPBarMid, + fontSize, + fontAngel, + fontName, + fontAnchor, + prefix, + cBarPrefix, + pBarPrefix, + openLabel, + closeLabel, + highLabel, + lowLabel, + midLineLabel // + ); +} + +// +// Medium ... +void ConfigureMediumMarketDrawSpecs( + X121ProviderDescriptor &iDescriptor, + ENUM_TIMEFRAMES period = NULL, + ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO, + string prefix = "Medium", + bool drawLabels = false, + bool drawCBar = false, + bool drawPBar = false, + bool drawCBarMid = false, + bool drawPBarMid = false, + int fontSize = 12, + double fontAngel = 90, + string fontName = "Arial", + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER, + string cBarPrefix = "C", + string pBarPrefix = "P", + string openLabel = "O", + string closeLabel = "C", + string highLabel = "H", + string lowLabel = "L", + string midLineLabel = "Mid" // +) +{ + // + // Medium Market ... + iDescriptor.inputs.mMarketPeriod = period; + iDescriptor.inputs.mMarketMethod = method; + + // + ConfigureMarketDrawSpecs( + iDescriptor.inputs.mMarketInputs, + // + drawLabels, + drawCBar, + drawPBar, + drawCBarMid, + drawPBarMid, + fontSize, + fontAngel, + fontName, + fontAnchor, + prefix, + cBarPrefix, + pBarPrefix, + openLabel, + closeLabel, + highLabel, + lowLabel, + midLineLabel // + ); +} + +// +// Long ... +void ConfigureLongMarketDrawSpecs( + X121ProviderDescriptor &iDescriptor, + ENUM_TIMEFRAMES period = NULL, + ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO, + string prefix = "Long", + bool drawLabels = false, + bool drawCBar = false, + bool drawPBar = false, + bool drawCBarMid = false, + bool drawPBarMid = false, + int fontSize = 12, + double fontAngel = 90, + string fontName = "Arial", + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER, + string cBarPrefix = "C", + string pBarPrefix = "P", + string openLabel = "O", + string closeLabel = "C", + string highLabel = "H", + string lowLabel = "L", + string midLineLabel = "Mid" // +) +{ + // + // Long Market ... + iDescriptor.inputs.lMarketPeriod = period; + iDescriptor.inputs.lMarketMethod = method; + + // + ConfigureMarketDrawSpecs( + iDescriptor.inputs.lMarketInputs, + // + drawLabels, + drawCBar, + drawPBar, + drawCBarMid, + drawPBarMid, + fontSize, + fontAngel, + fontName, + fontAnchor, + prefix, + cBarPrefix, + pBarPrefix, + openLabel, + closeLabel, + highLabel, + lowLabel, + midLineLabel // + ); +} + +// +// Hind ... +void ConfigureHindMarketDrawSpecs( + X121ProviderDescriptor &iDescriptor, + ENUM_TIMEFRAMES period = NULL, + ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO, + string prefix = "Hind", + bool drawLabels = false, + bool drawCBar = false, + bool drawPBar = false, + bool drawCBarMid = false, + bool drawPBarMid = false, + int fontSize = 12, + double fontAngel = 90, + string fontName = "Arial", + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER, + string cBarPrefix = "C", + string pBarPrefix = "P", + string openLabel = "O", + string closeLabel = "C", + string highLabel = "H", + string lowLabel = "L", + string midLineLabel = "Mid" // +) +{ + // + // Hind Market ... + iDescriptor.inputs.hMarketPeriod = period; + iDescriptor.inputs.hMarketMethod = method; + + // + ConfigureMarketDrawSpecs( + iDescriptor.inputs.hMarketInputs, + // + drawLabels, + drawCBar, + drawPBar, + drawCBarMid, + drawPBarMid, + fontSize, + fontAngel, + fontName, + fontAnchor, + prefix, + cBarPrefix, + pBarPrefix, + openLabel, + closeLabel, + highLabel, + lowLabel, + midLineLabel // + ); +} + +// +// Configure Market ... +void ConfigureMarketDrawSpecs( + X121MCycleInputs &inputs, + bool drawLabels = false, + bool drawCBar = false, + bool drawPBar = false, + bool drawCBarMid = false, + bool drawPBarMid = false, + int fontSize = 12, + double fontAngel = 90, + string fontName = "Arial", + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER, + string prefix = "", + string cBarPrefix = "C", + string pBarPrefix = "P", + string openLabel = "O", + string closeLabel = "C", + string highLabel = "H", + string lowLabel = "L", + string midLineLabel = "Mid" // +) +{ + inputs.drawLabels = drawLabels; + inputs.drawCBar = drawCBar; + inputs.drawPBar = drawPBar; + inputs.drawCBarMid = drawCBarMid; + inputs.drawPBarMid = drawPBarMid; + inputs.cBarDrawSpecs.Default(); + inputs.pBarDrawSpecs.Default(); + + // + if (drawCBarMid) + { + inputs.cBarMidDrawSpecs.clr = clrYellow; + } + + // + if (drawPBarMid) + { + inputs.pBarMidDrawSpecs.clr = clrYellow; + } + + // + if (drawLabels) + { + // + string cBarStr = prefix + " " + cBarPrefix + " "; + string pBarStr = prefix + " " + pBarPrefix + " "; + + // + if (drawCBar) + { + // + inputs.cBarDrawSpecs.openStyle.Label( + cBarStr + openLabel, + inputs.cBarDrawSpecs.openStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + inputs.cBarDrawSpecs.highStyle.Label( + cBarStr + highLabel, + inputs.cBarDrawSpecs.highStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + inputs.cBarDrawSpecs.closeStyle.Label( + cBarStr + closeLabel, + inputs.cBarDrawSpecs.closeStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + inputs.cBarDrawSpecs.lowStyle.Label( + cBarStr + lowLabel, + inputs.cBarDrawSpecs.lowStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + } + + // + if (drawPBar) + { + // + inputs.pBarDrawSpecs.openStyle.Label( + pBarStr + openLabel, + inputs.pBarDrawSpecs.openStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + inputs.pBarDrawSpecs.highStyle.Label( + pBarStr + highLabel, + inputs.pBarDrawSpecs.highStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + inputs.pBarDrawSpecs.closeStyle.Label( + pBarStr + closeLabel, + inputs.pBarDrawSpecs.closeStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + inputs.pBarDrawSpecs.lowStyle.Label( + pBarStr + lowLabel, + inputs.pBarDrawSpecs.lowStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + } + + // + if (drawCBarMid) + { + // + inputs.cBarMidDrawSpecs.Label( + cBarStr + midLineLabel, + clrYellow, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + } + + // + if (drawPBarMid) + { + // + inputs.pBarMidDrawSpecs.Label( + pBarStr + midLineLabel, + clrYellow, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + } + } +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5121ea.mq5 b/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5121ea.mq5 new file mode 100644 index 0000000..2081bdd --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5121ea.mq5 @@ -0,0 +1,1169 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center X5121EA MQL5 Expert Advisor +// ------------------------------------------------- +// Name: X5121EA and X121EA +// Description: an Exper Advisor which used RSI and MA +// to Analyse Market ... +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +//////////////////////////////////////////////////////x +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X5121EA" +#property strict + +// +#define ShortName "X5121EA" + +// +#include "../Classes/x-saherelm.xalert.class.mq5" +#include "../Classes/x-saherelm.xtrade.class.mq5" +#include "../Classes/x-saherelm.x5.provider.class.mq5" +#include "../Classes/x-saherelm.x121.provider.class.mq5" + +// +// a Provider Descriptor which holds +// X5 and X121 Provider at the Same time ... +struct X5121ProviderDescriptor +{ + // + string symbol; // Trading Symbol + ENUM_TIMEFRAMES period; // Trading Timeframe + bool allowLong; // Allow Long Signals + bool allowShort; // Allow Short Signals + double staticVolume; // Static Volume for Positions + ENUM_X5_SIGNAL_PROVIDERS signallers[]; // Allowed Signal Providers + + // + X5ProviderInputs x5Inputs; + XSCX5Provider *x5Provider; + + // + X121ProviderInputs x121Inputs; + XSCX121Provider *x121Provider; + + // + XSignal signal; + X5MarketConditions x5Conditions; + X121MarketConditions x121Conditions; + + // + // Tools ... + + // + // Initial Provider ... + // + bool Init() + { + // + bool result = false; + + // + result = this.Init( + this.symbol, + this.period, + this.signallers, + this.allowLong, + this.allowShort, + this.staticVolume // + ); + + // + return result; + } + + // + bool Init( + ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers + bool mAllowLong = true, // Allow Long Signals + bool mAllowShort = true, // Allow Short Signals + double mStaticVolume = 0.01 // Static Volume for Positions + ) + { + // + bool result = false; + + // + result = this.Init( + this.symbol, + this.period, + mSignallers, + mAllowLong, + mAllowShort, + mStaticVolume // + ); + + // + return result; + } + + // + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mPeriod, // Trading Timeframe + ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers + bool mAllowLong = true, // Allow Long Signals + bool mAllowShort = true, // Allow Short Signals + double mStaticVolume = 0.01 // Static Volume for Positions + ) + { + // + bool result = false; + + // + result = + // + x5Inputs.IsValid() && + IsValid(mSymbol) && + IsValid(mPeriod) && + NotEmpty(mStaticVolume) && + (allowLong || allowShort) && + ArraySize(mSignallers) > 0 + // + ; + if (!result) + { + return result; + } + + // + this.symbol = mSymbol; + this.period = mPeriod; + this.allowLong = mAllowLong; + this.allowShort = mAllowShort; + this.staticVolume = mStaticVolume; + + // + ENUM_X5_SIGNAL_PROVIDERS tmp[]; + Copy( + mSignallers, + tmp // + ); + Copy( + tmp, + this.signallers // + ); + + // + // Instantiate Provider ... + x5Provider = new XSCX5Provider( + this.symbol, + this.period, + this.staticVolume // + ); + + // + // Instantiate Provider ... + x121Provider = new XSCX121Provider( + this.symbol, + this.period, + this.staticVolume // + ); + + // + // Set Long/Short State ... + + // + x5Provider + .SetSignalTypeState( + POSITION_TYPE_BUY, + this.allowLong // + ); + + // + x5Provider + .SetSignalTypeState( + POSITION_TYPE_SELL, + this.allowShort // + ); + + // + x121Provider + .SetSignalTypeState( + POSITION_TYPE_BUY, + this.allowLong // + ); + + // + x121Provider + .SetSignalTypeState( + POSITION_TYPE_SELL, + this.allowShort // + ); + + // + // Enable Required Signallers ... + x5Provider + .SetSignalProviderStates( + this.signallers, + true // + ); + + // + // Now Must to Initialize Provider ... + result = x5Provider.Init( + this.x5Inputs // + ); + if (!result) + { + return result; + } + + // + result = x121Provider.Init( + this.x121Inputs // + ); + + // + return result; + } + + // + // Cleanup ... + void Clean() + { + // + signal.Clean(); + x5Conditions.Clear(); + x121Conditions.Clear(); + } + + // + // Validate ... + bool IsValid(bool validateInputs = true) + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + IsValid(period) && + NotEmpty(staticVolume) && + (validateInputs + ? x5Inputs.IsValid() && x121Inputs.IsValid() + : true) && + (allowLong || allowShort) && + ArraySize(signallers) > 0 + // + ; + + // + return result; + } + + // + // Check Signal ... + bool HasSignal(int barIndex = 0) + { + // + bool result = false; + + // + result = x5Inputs.IsValid(); + if (!result) + { + return result; + } + + // + result = x121Inputs.IsValid(); + if (!result) + { + return result; + } + + // + // Clear Signal and Conditions ... + Clean(); + + // + result = x5Provider + .HasSignal( + barIndex, + signal, + x5Conditions // + ); + + // + if (result) + { + // + x121Provider + .GetMarketConditions( + x121Conditions, + barIndex // + ); + } + + // + return result; + } + + // + void GenerateScore( + double &bullishScore, + double &bearishScore // + ) + { + // + double x5BullishScore = 5; + double x5BearishScore = 5; + + // + GenerateX5Score( + x5BullishScore, + x5BearishScore // + ); + + // + double x121BullishScore = 5; + double x121BearishScore = 5; + + // + GenerateX121Score( + x121BullishScore, + x121BearishScore // + ); + + // + bullishScore = x5BullishScore + x121BullishScore; + bearishScore = x5BearishScore + x121BearishScore; + } + + // + void GenerateX5Score( + double &bullishScore, + double &bearishScore // + ) + { + // + x5Conditions.GenerateScore( + bullishScore, + bearishScore // + ); + } + + // + void GenerateX121Score( + double &bullishScore, + double &bearishScore // + ) + { + // + x121Conditions.GenerateScore( + bullishScore, + bearishScore // + ); + } + + // + string GenerateSummary( + const bool onlySummary = false, + bool ignoreFalseConditions = true // + ) + { + // + string x5Str = GenerateX5Summary( + onlySummary, + ignoreFalseConditions // + ); + + // + string x121Str = GenerateX121Summary( + onlySummary, + ignoreFalseConditions // + ); + + // + string result = + // + x5Str + "\n" + x121Str + // + ; + + // + return result; + } + + // + string GenerateX5Summary( + const bool onlySummary = false, + bool ignoreFalseConditions = true // + ) + { + return x5Conditions.GenerateSummary( + onlySummary, + 1, + "\n", + ignoreFalseConditions // + ); + } + + // + string GenerateX121Summary( + const bool onlySummary = false, + bool ignoreFalseConditions = true // + ) + { + return x121Conditions.GenerateSummary( + onlySummary, + 1, + 1.1, + 1.2, + 1.6, + 1.8, + "\n", + NULL, + ignoreFalseConditions // + ); + } +}; + +// +// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb" + +// +// Inputs ... +long x5121EAMagicNumber = 78692110; // Magic Number +int x5121EASlippage = 10; // Slippgae +string x5121EASymbols = "EURUSDb"; // Symbols +// +bool x5121EAAllowLong = true; // Allow Long Trades +bool x5121EAAllowShort = true; // Allow Short Trades +int x5121EAManageInterval = 5; // Manager Check Intervals Seconds +int x5121EAMaxAllowedPositions = 15; // Max Allowed Positions +double x5121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades +double x5121EAMinProfitPerTrade = 0; // Min Profit Per Trade based On Volume Factor (Hedge) +double x5121EAMinProfitPerVolumeFactor = 0; // Min Volume Factor for Calculating Profit (Hedge) +double x5121EAMaxAllowedDrawdownFactor = 0; // Max Allowed Drawdown Factor +// +double x5121EAVolume = 0.01; +// +bool x5121EAEnableAlerts = true; // Enable Alerts +bool x5121EALogAlerts = true; // Log Alerts +bool x5121EATerminalAlerts = false; // Terminal Alerts +bool x5121EAMailAlerts = false; // Mail Alerts +bool x5121EAPushAlerts = false; // Push Alerts + +// +// Vars ... +string x5121EASymbol; +ENUM_TIMEFRAMES x5121EAPeriod; + +// +MqlTick x5121EATick; + +// +// Trade Class Instance ... +XSCTrade *x5121EATrader; +XSCAlert *x5121EAAlert; + +// +// Providers ... +X5121ProviderDescriptor x5121EAProviders[]; + +// +// Event Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + if (x5121EASymbol == NULL || StringLen(x5121EASymbol) <= 0) + { + x5121EASymbol = _Symbol; + } + + // + if (x5121EAPeriod == NULL) + { + x5121EAPeriod = _Period; + } + + // + // Validate Inputs ... + if (!X5121EAValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Initial EA ... + if (!InitialEA()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // TesterHideIndicators(true); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // De Initialize X5121EA Providers ... +} + +// +// On Tick Handler ... +void OnTick() +{ + // + // Reading Tick ... + if (!SymbolInfoTick(x5121EASymbol, x5121EATick)) + { + return; + } + + // + // Draw ... + HandleOnDraw(); + + // + // Check Trade Events ... + XOnTradeHandlerState tState; + x5121EATrader.HandleOnTradeEvent(tState); + + // + // First Check For Any Guard Actions ... + // then Handle Guards if Provided ... + XGuard guards[]; + bool hasGuard = CheckForGuard(guards); + if (hasGuard) + { + // + // TODO: Complete this ... + // DoGuards(guards); + } + + // + // Second Check for Position Management or Equity Management + // Actions like Supports or etc ... + bool isIgnored = HandleStateManagement(); + if (isIgnored) + { + return; + } + + // + // Second Check For Signals ... + // then Execute Signals if Provided ... + XSignal signals[]; + int signalsCount = RequestForSignal(signals); + if (signalsCount <= 0) + { + return; + } + + // + // Execute Signals ... + HandleSignalsExecution(signals); +} + +// +// Custom Functions ... + +// +// Validate Variables nd Inputs ... +bool X5121EAValidateInputs() +{ + // + bool result = false; + + // + result = + // + x5121EASlippage > 0 && + x5121EAMagicNumber > 0 + // + ; + + // + return result; +} + +// +// Initialize Specific Providers ... +bool InitialEA() +{ + // + bool result = false; + + // + // Here We Have to Initial 4 instance of X5Provider ... + // - EURUSD/M5; + // - USDCHF/M5; + // - USDJPY/M5; + // - XAUUSD/M5; + + // + result = IsValid(x5121EASymbols); + if (!result) + { + return result; + } + + // + string symbols[]; + int symbolsCount = SplitContent( + symbols, + x5121EASymbols); + result = symbolsCount > 0; + if (!result) + { + return result; + } + + // + // Instance XSCTrade Class ... + x5121EATrader = new XSCTrade( + x5121EASlippage, + x5121EAMagicNumber, + x5121EAManageInterval, + x5121EAMaxAllowedSpread, + x5121EAMaxAllowedPositions, + x5121EAMaxAllowedDrawdownFactor + // + ); + + // + // Instantiate Alert Class ... + x5121EAAlert = new XSCAlert( + "X5121EA", + x5121EAEnableAlerts, + x5121EALogAlerts, + x5121EATerminalAlerts, + x5121EAMailAlerts, + x5121EAPushAlerts + // + ); + + // + // Define Signallers ... + ENUM_X5_SIGNAL_PROVIDERS signallers[]; + GetAllX5SignalProviders(signallers); + + // + Clean(x5121EAProviders); + + // + // Prepare Providers and Add them into mX5121EA class ... + for (int i = 0; i < symbolsCount; i++) + { + // + // Define Structure ... + X5121ProviderDescriptor iDescriptor; + + // + iDescriptor.symbol = symbols[i]; + iDescriptor.period = PERIOD_M5; + iDescriptor.staticVolume = x5121EAVolume; + iDescriptor.allowLong = x5121EAAllowLong; + iDescriptor.allowShort = x5121EAAllowShort; + Copy( + signallers, + iDescriptor.signallers); + + // + // Set Inputs to Default ... + iDescriptor.x5Inputs.Default(); + iDescriptor.x121Inputs.Default(); + + // + // X121 Inputs ... + // + // Prepare Input Requirements ... + + // + // XMC ... + iDescriptor.x121Inputs.mcInputs.showFastMa = false; + iDescriptor.x121Inputs.mcInputs.showSlowMa = false; + iDescriptor.x121Inputs.mcInputs.showVerifierMa = false; + + // + // XICH ... + iDescriptor.x121Inputs.ichInputs.showKumo = false; + iDescriptor.x121Inputs.ichInputs.showKijunSen = false; + iDescriptor.x121Inputs.ichInputs.showTenkanSen = false; + iDescriptor.x121Inputs.ichInputs.showChikouSpan = false; + iDescriptor.x121Inputs.ichInputs.showSenkouSpanA = false; + iDescriptor.x121Inputs.ichInputs.showSenkouSpanB = false; + iDescriptor.x121Inputs.ichInputs.showKijunSenPlus = false; + iDescriptor.x121Inputs.ichInputs.showKijunSenNegative = false; + + // + // XSTR ... + iDescriptor.x121Inputs.cheInputs.showLongExit1Line = false; + iDescriptor.x121Inputs.cheInputs.showShortExit1Line = false; + iDescriptor.x121Inputs.cheInputs.showLongExit2Line = false; + iDescriptor.x121Inputs.cheInputs.showShortExit2Line = false; + + // + // XPV ... + iDescriptor.x121Inputs.pvInputs.showPeaksAndVales = true; + iDescriptor.x121Inputs.pvInputs.showLevels = false; + iDescriptor.x121Inputs.pvInputs.showConsolidations = false; + iDescriptor.x121Inputs.pvInputs.showFibo1Levels = false; + iDescriptor.x121Inputs.pvInputs.showFibo2Levels = false; + iDescriptor.x121Inputs.pvInputs.showFibo3Levels = true; + iDescriptor.x121Inputs.pvInputs.showFibo4Levels = false; + iDescriptor.x121Inputs.pvInputs.showFibo5Levels = false; + + // + // XZG ... + iDescriptor.x121Inputs.zgInputs.showZigZag = false; + iDescriptor.x121Inputs.zgInputs.showPeaksAndVales = false; + + // + // XDON ... + iDescriptor.x121Inputs.donInputs.showOpen = true; + iDescriptor.x121Inputs.donInputs.showHigh = true; + iDescriptor.x121Inputs.donInputs.showClose = true; + iDescriptor.x121Inputs.donInputs.showLow = true; + + // + // XSTR ... + iDescriptor.x121Inputs.strInputs.showTrends = true; + iDescriptor.x121Inputs.strInputs.fillTrends = false; + + // + iDescriptor.x121Inputs.symbol = iDescriptor.symbol; + iDescriptor.x121Inputs.period = iDescriptor.period; + + // + // Short MArket ... + iDescriptor.x121Inputs.sMarketPeriod = NULL; + iDescriptor.x121Inputs.sMarketMethod = X_PERIOD_AUTO; + + // + // Medium Market ... + iDescriptor.x121Inputs.mMarketPeriod = NULL; + iDescriptor.x121Inputs.mMarketMethod = X_PERIOD_AUTO; + + // + // Long Market ... + iDescriptor.x121Inputs.lMarketPeriod = NULL; + iDescriptor.x121Inputs.lMarketMethod = X_PERIOD_AUTO; + + // + int fontSize = 12; + double fontAngel = 90; + string fontName = "Arial"; + ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER; + + // + // Hind Market ... + iDescriptor.x121Inputs.hMarketPeriod = NULL; + iDescriptor.x121Inputs.hMarketMethod = X_PERIOD_AUTO; + iDescriptor.x121Inputs.hMarketInputs.drawLabels = false; + iDescriptor.x121Inputs.hMarketInputs.drawCBar = true; + iDescriptor.x121Inputs.hMarketInputs.drawPBar = true; + iDescriptor.x121Inputs.hMarketInputs.drawCBarMid = true; + iDescriptor.x121Inputs.hMarketInputs.drawPBarMid = true; + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.Default(); + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.Default(); + + // + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.openStyle.Label( + "C Hind Open", + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.openStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.highStyle.Label( + "C Hind High", + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.highStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.closeStyle.Label( + "C Hind Close", + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.closeStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.lowStyle.Label( + "C Hind Low", + iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.lowStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.openStyle.Label( + "P Hind Open", + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.openStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.highStyle.Label( + "P Hind High", + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.highStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.closeStyle.Label( + "P Hind Close", + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.closeStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.lowStyle.Label( + "P Hind Low", + iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.lowStyle.clr, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + iDescriptor.x121Inputs.hMarketInputs.cBarMidDrawSpecs.clr = clrYellow; + iDescriptor.x121Inputs.hMarketInputs.cBarMidDrawSpecs.Label( + "C Hind Mid", + clrYellow, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + iDescriptor.x121Inputs.hMarketInputs.pBarMidDrawSpecs.clr = clrYellow; + iDescriptor.x121Inputs.hMarketInputs.pBarMidDrawSpecs.Label( + "P Hind Mid", + clrYellow, + fontName, + fontSize, + fontAnchor, + fontAngel // + ); + + // + // Validate Inputs ... + bool isX5InputsValid = iDescriptor.x5Inputs.IsValid(); + if (!isX5InputsValid) + { + break; + } + + // + // Init X121 Inputs ... + bool isX121InputsInit = iDescriptor.x121Inputs.Init(); + if (!isX121InputsInit) + { + break; + } + + // + // Initialize ... + + // + bool isDescriptorInitialized = iDescriptor.Init(); + if (!isDescriptorInitialized) + { + break; + } + + // + AddRef( + iDescriptor, + x5121EAProviders // + ); + + // + } + + // + result = ArraySize(x5121EAProviders) == symbolsCount; + + // + return result; +} + +// +void HandleOnDraw() {} + +// +bool HandleStateManagement() +{ + return false; +} + +// +bool CheckForGuard(XGuard &guards[]) +{ + return false; +} + +// +int RequestForSignal( + XSignal &signals[] // Holds Signals ... +) +{ + // + int result = 0; + + // + Clean(signals); + + // + int descriptorsCount = ArraySize(x5121EAProviders); + if (descriptorsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < descriptorsCount; i++) + { + // + X5121ProviderDescriptor iDescriptor = x5121EAProviders[i]; + + // + iDescriptor.x5Provider.GetMarketConditions( + iDescriptor.x5Conditions // + ); + + // + iDescriptor.x121Provider.GetMarketConditions( + iDescriptor.x121Conditions // + ); + + // + X5MarketConditions x5Conditions = iDescriptor.x5Conditions; + X121MarketConditions x121Conditions = iDescriptor.x121Conditions; + + // + // Check For Long ... + bool hasLong = + // + (x121Conditions.hMarketConditions.isTrendSwitchedToBullish && + (x121Conditions.lMarketConditions.isTrendBullish && + x121Conditions.mMarketConditions.isTrendBullish && + x121Conditions.sMarketConditions.isTrendBullish && + x121Conditions.cMarketConditions.isTrendBullish)) + // + || + // + (x121Conditions.lMarketConditions.isTrendSwitchedToBullish && + (x121Conditions.hMarketConditions.isTrendBullish && + x121Conditions.mMarketConditions.isTrendBullish && + x121Conditions.sMarketConditions.isTrendBullish && + x121Conditions.cMarketConditions.isTrendBullish)) + // + || + // + (x121Conditions.mMarketConditions.isTrendSwitchedToBullish && + (x121Conditions.hMarketConditions.isTrendBullish && + x121Conditions.lMarketConditions.isTrendBullish && + x121Conditions.sMarketConditions.isTrendBullish && + x121Conditions.cMarketConditions.isTrendBullish)) + // + || + // + (x121Conditions.sMarketConditions.isTrendSwitchedToBullish && + (x121Conditions.hMarketConditions.isTrendBullish && + x121Conditions.lMarketConditions.isTrendBullish && + x121Conditions.mMarketConditions.isTrendBullish && + x121Conditions.cMarketConditions.isTrendBullish)) + // + || + // + (x121Conditions.cMarketConditions.isTrendSwitchedToBullish && + (x121Conditions.hMarketConditions.isTrendBullish && + x121Conditions.lMarketConditions.isTrendBullish && + x121Conditions.mMarketConditions.isTrendBullish && + x121Conditions.sMarketConditions.isTrendBullish)) + // + ; + + // + // Check For Short ... + bool hasShort = + // + false + // + ; + + if (hasLong) + { + Print(""); + } + + // + // bool iHasSignal = iDescriptor.HasSignal(0); + // if (iHasSignal) + // { + // // + // AddRef( + // iDescriptor.signal, + // signals // + // ); + + // // // + // // string conditionsStr = iDescriptor.GenerateSummary(); + // // Print(conditionsStr); + + // // + // double bullScore = 0; + // double bearScore = 0; + // iDescriptor.GenerateScore( + // bullScore, + // bearScore // + // ); + + // // + // Print(" "); + // Print((IsLong(iDescriptor.signal.type) ? "Long" : "Short")); + // Print(iDescriptor.signal.symbol, ",", ToString(iDescriptor.signal.period), ",", iDescriptor.signal.provider); + // Print("========================"); + // Print("bullScore: ", bullScore); + // Print("bearScore: ", bearScore); + + // // + // Print(""); + + // // + // Print(iDescriptor.GenerateX121Summary()); + // } + } + + // + result = ArraySize(signals); + + // + return result; +} + +// +void HandleSignalsExecution(XSignal &signals[]) +{ + // + int signalsCount = ArraySize(signals); + if (signalsCount <= 0) + { + return; + } + + // + // Filter Signals Based on their Types ... + XSignal filteredSignals[]; + + // + // Try to Filter Signals ... + for (int i = 0; i < signalsCount; i++) + { + // + XSignal iSignal = signals[i]; + + // + bool isLong = IsLong(iSignal.type); + + // + if ((isLong && !x5121EAAllowLong) || (!isLong && !x5121EAAllowShort)) + { + continue; + } + + // + AddRef( + iSignal, + filteredSignals // + ); + } + + // + int filteredSignalsCount = ArraySize(filteredSignals); + if (filteredSignalsCount <= 0) + { + return; + } + + // + // Try to Execute Signals ... + ENUM_X_SIGNAL_EXECUTION_RESULT reasons[]; + int executedSignalsCount = x5121EATrader.ExecuteSignals( + filteredSignals, + reasons + // + ); + + // + string message = NULL; + if (executedSignalsCount == 0) + { + // + message = "(" + ToString(filteredSignalsCount) + ") Signals Execution Failed ..."; + + // + for (int j = 0; j < ArraySize(reasons); j++) + { + // + string iReason = ToString(reasons[j]); + + // + // ToString(GetSpread(filteredSignals[j].symbol)) + "," + message += "\n" + ToString(j) + ": " + iReason; + } + } + else if (executedSignalsCount < filteredSignalsCount) + { + // + int diff = filteredSignalsCount - executedSignalsCount; + + // + message = "Failed to Execute (" + ToString(diff) + ") Signals ..."; + } + else if (executedSignalsCount == filteredSignalsCount) + { + message = "(" + ToString(executedSignalsCount) + ") Signals Executed Successfully ..."; + } + + // + if (IsValid(message)) + { + x5121EAAlert.Alert(message); + } +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5ea.mq5 b/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5ea.mq5 new file mode 100644 index 0000000..cae3ad7 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Experts/x-test.x5ea.mq5 @@ -0,0 +1,252 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center X5EA MQL5 Expert Advisor +// ------------------------------------------------- +// Name: X5EA +// Description: an Exper Advisor which used RSI and MA +// to Analyse Market ... +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +//////////////////////////////////////////////////////x +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X5EA" +#property strict + +// +#define ShortName "X5EA" + +// +#include "../Classes/x-saherelm.x5.xea.class.mq5" + +// +// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb" + +// +// Inputs ... +long x5EAMagicNumber = 78692110; // Magic Number +int x5EASlippage = 10; // Slippgae +string x5EASymbols = "EURUSDb,USDCHFb,USDJPYb,XAUUSDb"; // Symbols +// +bool x5EAAllowLong = true; // Allow Long Trades +bool x5EAAllowShort = true; // Allow Short Trades +int x5EAManageInterval = 5; // Manager Check Intervals Seconds +int x5EAMaxAllowedPositions = 15; // Max Allowed Positions +double x5EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades +double x5EAMinProfitPerTrade = 0; // Min Profit Per Trade based On Volume Factor (Hedge) +double x5EAMinProfitPerVolumeFactor = 0; // Min Volume Factor for Calculating Profit (Hedge) +double x5EAMaxAllowedDrawdownFactor = 0; // Max Allowed Drawdown Factor +// +double x5EAVolume = 0.01; + +// +// Vars ... +string x5EASymbol; +ENUM_TIMEFRAMES x5EAPeriod; + +// +MqlTick x5EATick; + +// +// X5EA ... +XSCX5EA *mX5EA; + +// +// Event Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + if (x5EASymbol == NULL || StringLen(x5EASymbol) <= 0) + { + x5EASymbol = _Symbol; + } + + // + if (x5EAPeriod == NULL) + { + x5EAPeriod = _Period; + } + + // + // Validate Inputs ... + if (!X5EAValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Initial EA ... + if (!InitialEA()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + TesterHideIndicators(true); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // De Initialize X5EA Providers ... +} + +// +// On Tick Handler ... +void OnTick() +{ + // + // Reading Tick ... + if (!SymbolInfoTick(x5EASymbol, x5EATick)) + { + return; + } + + // + mX5EA.OnTick(); +} + +// +// Custom Functions ... + +// +// Validate Variables nd Inputs ... +bool X5EAValidateInputs() +{ + // + bool result = false; + + // + result = + // + x5EASlippage > 0 && + x5EAMagicNumber > 0 + // + ; + + // + return result; +} + +// +// Initialize Specific Providers ... +bool InitialEA() +{ + // + bool result = false; + + // + // Here We Have to Initial 4 instance of X5Provider ... + // - EURUSD/M5; + // - USDCHF/M5; + // - USDJPY/M5; + // - XAUUSD/M5; + + // + result = IsValid(x5EASymbols); + if (!result) + { + return result; + } + + // + string symbols[]; + int symbolsCount = SplitContent( + symbols, + x5EASymbols); + result = symbolsCount > 0; + if (!result) + { + return result; + } + + // + // Define Signallers ... + ENUM_X5_SIGNAL_PROVIDERS signallers[]; + GetAllX5SignalProviders(signallers); + + // + // Instantiate X5EA Class ... + mX5EA = new XSCX5EA( + x5EASlippage, // Slippgae + x5EAMagicNumber, // Magic Number + x5EAManageInterval, // Manager Check Intervals Seconds + x5EAMaxAllowedSpread, // Max Allowed Spred for Opening Trades + x5EAMaxAllowedPositions, // Max Allowed Positions + x5EAMaxAllowedDrawdownFactor, // Max Allowed Drawdown Factor + x5EAAllowLong, // Allow Long Trades + x5EAAllowShort, // Allow Short Trades + x5EAMinProfitPerTrade, // Min Profit Per Trade based On Volume Factor (Hedge) + x5EAMinProfitPerVolumeFactor // Min Volume Factor for Calculating Profit (Hedge) + ); + + // + // Prepare Providers and Add them into mX5EA class ... + for (int i = 0; i < symbolsCount; i++) + { + // + // Define Structure ... + X5ProviderDescriptor iDescriptor; + + // + iDescriptor.symbol = symbols[i]; + iDescriptor.period = PERIOD_M5; + iDescriptor.staticVolume = x5EAVolume; + iDescriptor.allowLong = x5EAAllowLong; + iDescriptor.allowShort = x5EAAllowShort; + Copy( + signallers, + iDescriptor.signallers); + + // + // Set Inputs to Default ... + iDescriptor.inputs.Default(); + + // + // Validate Inputs ... + bool isInputsValid = iDescriptor.inputs.IsValid(); + if (!isInputsValid) + { + continue; + } + + // + result = mX5EA.AddProvider(iDescriptor); + if (!result) + { + break; + } + } + + // + return result; +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xama.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xama.helper.mq5 new file mode 100644 index 0000000..227800b --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xama.helper.mq5 @@ -0,0 +1,317 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXAMAHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XAMA_BUFFERS +{ + XAMA_MAIN_LINE = 0 +}; + +// +// Input Models ... +struct XAMAInputs +{ + // + // Props ... + // + // Market ... + int length; // Period + int fastEMA; // Fast EMA Period + int slowEMA; // Slow EMA Period + int maShift; // Shift + ENUM_APPLIED_PRICE appliedTo; // Applied To + // + // Presentation ... + bool showLine; // Show Line + + // + // Constructor(s) ... + XAMAInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + fastEMA = 0; + slowEMA = 0; + maShift = 0; + showLine = false; + appliedTo = PRICE_CLOSE; + } + + // + // Default ... + void Default() + { + // + length = 18; + fastEMA = 2; + slowEMA = 30; + maShift = 0; + showLine = true; + appliedTo = PRICE_CLOSE; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length > 0 && + fastEMA > 0 && + slowEMA > 0 && + slowEMA > fastEMA + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(length, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXAMAHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXAMAHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXAMAHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XAMAInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(mainBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xama", + // + // Inputs ... + // + // Market ... + "", + mInputs.length, // Period + mInputs.fastEMA, // Fast EMA Period + mInputs.slowEMA, // Slow EMA Period + mInputs.maShift, // Shift + mInputs.appliedTo, // Applied To + // + // Presentation ... + "", + mInputs.showLine // Show Line + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XAMAInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XAMAInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetMain( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mainBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mainBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMain( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mainBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XAMAInputs mInputs; // Inputs ... + + // + // Buffers ... + double mainBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Main Buffer ... + CopyBuffer( + mHandler, + XAMA_MAIN_LINE, + 0, + totalBars, + mainBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xcc.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xcc.helper.mq5 new file mode 100644 index 0000000..98bec86 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xcc.helper.mq5 @@ -0,0 +1,245 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXCCHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +// Input Models ... +struct XCCInputs +{ + // + // Props ... + + // + // Chart Style ... + ENUM_CHART_MODE mode; // Mode + color upColor; // Up Color + color downColor; // Down Color + color lineColor; // Line mode and Doji candlestick Color + color bearishColor; // Bullish Color + color bullishColor; // Bearish Color + color volumesColor; // Volumes Color + + // + // Presentation ... + bool showCandles; // Show Candles + + // + // Constructor(s) ... + XCCInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + mode = CHART_CANDLES; + + // + upColor = CLR_NONE; + downColor = CLR_NONE; + lineColor = CLR_NONE; + bearishColor = CLR_NONE; + bullishColor = CLR_NONE; + volumesColor = CLR_NONE; + + // + showCandles = false; + } + + // + // Default ... + void Default() + { + // + mode = CHART_CANDLES; + + // + upColor = clrLime; + downColor = clrRed; + lineColor = clrLime; + bearishColor = clrRed; + bullishColor = clrLime; + volumesColor = clrGreen; + // + showCandles = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + true + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(0, 0); + + // + return result; + } +}; + +// +// Class ... +class XSCXCCHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXCCHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXCCHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XCCInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xcc", + // + // Inputs ... + // + // Chart Style ... + "", + mInputs.mode, // Mode + mInputs.upColor, // Up Color + mInputs.downColor, // Down Color + mInputs.lineColor, // Line mode and Doji candlestick Color + mInputs.bearishColor, // Bullish Color + mInputs.bullishColor, // Bearish Color + mInputs.volumesColor, // Volumes Color + // + // Presentation ... + "", + mInputs.showCandles // Show Candles + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XCCInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XCCInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XCCInputs mInputs; // Inputs ... +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xche.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xche.helper.mq5 new file mode 100644 index 0000000..268fc29 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xche.helper.mq5 @@ -0,0 +1,514 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXCHEHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XCHE_BUFFERS +{ + X_CHE_LONG_EXIT_1_LINE = 0, + X_CHE_SHORT_EXIT_1_LINE = 1, + X_CHE_LONG_EXIT_2_LINE = 2, + X_CHE_SHORT_EXIT_2_LINE = 3, +}; + +// +// Input Models ... +struct XCHEInputs +{ + // + // Props ... + + // + // Market ... + int length; // Length + int loopback; // Loopback + double multiplier1; // 1st Multiplier + double multiplier2; // 2nd Multiplier + + // + // Calculation ... + ENUM_APPLIED_PRICE upAppliedTo; // Up Zone Applied To + ENUM_APPLIED_PRICE downAppliedTo; // Down Zone Applied To + + // + // Presentation ... + bool showLongExit1Line; // Show 1st Long Exit + bool showShortExit1Line; // Show 1st Short Exit + bool showLongExit2Line; // Show 2st Long Exit + bool showShortExit2Line; // Show 2st Short Exit + + // + // Constructor(s) ... + XCHEInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + loopback = 0; + multiplier1 = 0; + multiplier2 = 0; + + // + upAppliedTo = PRICE_HIGH; + downAppliedTo = PRICE_LOW; + + // + showLongExit1Line = false; + showShortExit1Line = false; + showLongExit2Line = false; + showShortExit2Line = false; + } + + // + // Default ... + void Default() + { + // + length = 35; + loopback = 26; + multiplier1 = 3.0; + multiplier2 = 3.5; + + // + upAppliedTo = PRICE_HIGH; + downAppliedTo = PRICE_LOW; + + // + showLongExit1Line = true; + showShortExit1Line = true; + showLongExit2Line = true; + showShortExit2Line = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length > 0 && + loopback < length && + multiplier1 > 0 && + multiplier2 > multiplier1 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(length, loopback); + + // + return result; + } +}; + +// +// Class ... +class XSCXCHEHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXCHEHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXCHEHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XCHEInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(longExit1Buffer, true); + ArraySetAsSeries(longExit2Buffer, true); + ArraySetAsSeries(shortExit1Buffer, true); + ArraySetAsSeries(shortExit2Buffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xche", + // + // Inputs ... + // + // Market ... + "", + mInputs.length, + mInputs.loopback, + mInputs.multiplier1, + mInputs.multiplier2, + // + // Calculations ... + "", + mInputs.upAppliedTo, + mInputs.downAppliedTo, + // + // Presentation ... + "", + mInputs.showLongExit1Line, // Show 1st Long Exit, + mInputs.showShortExit1Line, // Show 1st Short Exit, + mInputs.showLongExit2Line, // Show 2st Long Exit, + mInputs.showShortExit2Line // Show 2st Short Exit + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XCHEInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XCHEInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs); + } + + // + // Buffers ... + + // + double GetLongExit1( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return longExit1Buffer[barIndex]; + } + + // + // Copy Required Long Exits 1 ... + int CopyLongExit1( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + longExit1Buffer, + buffer, + forceClean + // + ); + } + + // + double GetLongExit2( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return longExit2Buffer[barIndex]; + } + + // + // Copy Required Long Exits 2 ... + int CopyLongExit2( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + longExit2Buffer, + buffer, + forceClean + // + ); + } + + // + double GetShortExit1( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return shortExit1Buffer[barIndex]; + } + + // + // Copy Required Short Exits 1 ... + int CopyShortExit1( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + shortExit1Buffer, + buffer, + forceClean + // + ); + } + + // + double GetShortExit2( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return shortExit2Buffer[barIndex]; + } + + // + // Copy Required Short Exits 2 ... + int CopyShortExit2( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + shortExit2Buffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XCHEInputs mInputs; // Inputs ... + + // + // Buffers ... + // + double longExit1Buffer[]; + double longExit2Buffer[]; + double shortExit1Buffer[]; + double shortExit2Buffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + int calculatedBars = CountCalculatedBars(); + + // + // Long Exit 1 ... + CopyBuffer( + mHandler, + X_CHE_LONG_EXIT_1_LINE, + 0, + totalBars, + longExit1Buffer + // + ); + + // + // Long Exit 2 ... + CopyBuffer( + mHandler, + X_CHE_LONG_EXIT_2_LINE, + 0, + totalBars, + longExit2Buffer + // + ); + + // + // Short Exit 1 ... + CopyBuffer( + mHandler, + X_CHE_SHORT_EXIT_1_LINE, + 0, + totalBars, + shortExit1Buffer + // + ); + + // + // Short Exit 2 ... + CopyBuffer( + mHandler, + X_CHE_SHORT_EXIT_2_LINE, + 0, + totalBars, + shortExit2Buffer + // + ); + } +}; + +// +// Tools ... diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchlh.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchlh.helper.mq5 new file mode 100644 index 0000000..f67f902 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchlh.helper.mq5 @@ -0,0 +1,967 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXCHLHHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XCHLH_BUFFERS +{ + // + // LC ... + XCHLH_LC_HH_LINE = 0, + XCHLH_LC_LL_LINE = 1, + // + // MC ... + XCHLH_MC_HH_LINE = 2, + XCHLH_MC_LL_LINE = 3, + // + // SC ... + XCHLH_SC_HH_LINE = 4, + XCHLH_SC_LL_LINE = 5, + // + // Hot State ... + XCHLH_HOT_STATE_LINE = 6 +}; + +// +// Input Models ... +struct XCHLHInputs +{ + // + // Props ... + + // + // Hot Areas ... + bool drawHotAreas; // Draw Hot Areas Symbol + uchar hotHHArrowCode; // Hot HH Arrow Code + color hotHHArrowColor; // Hot HH Arrow Color + uchar hotLLArrowCode; // Hot LL Arrow Code + color hotLLArrowColor; // Hot LL Arrow Color + + // + // Long Cycle ... + // LC Market ... + int lcLength; // Length + double lcThresholdInPips; // Threshold In Pips + ENUM_SERIESMODE lcHHMode; // Highest High Calculation Method + ENUM_SERIESMODE lcLLMode; // Lowest Low Calculation Method + // + // LC Style ... + int lcDrawWidth; // Draw Width + ENUM_DRAW_TYPE lcDrawType; // Draw Type + ENUM_LINE_STYLE lcDrawStyle; // Draw Style + color lcHHColor; // Highest High Color + color lcLLColor; // Lowest Low Color + // LC Drawings ... + bool lcDrawHH; // Draw Highest High + bool lcDrawLL; // Draw Lowest Low + + // + // Medium Cycle ... + // MC Market ... + int mcLength; // Length + double mcThresholdInPips; // Threshold In Pips + ENUM_SERIESMODE mcHHMode; // Highest High Calculation Method + ENUM_SERIESMODE mcLLMode; // Lowest Low Calculation Method + // MC Style ... + int mcDrawWidth; // Draw Width + ENUM_DRAW_TYPE mcDrawType; // Draw Type + ENUM_LINE_STYLE mcDrawStyle; // Draw Style + color mcHHColor; // Highest High Color + color mcLLColor; // Lowest Low Color + // MC Drawings ... + bool mcDrawHH; // Draw Highest High + bool mcDrawLL; // Draw Lowest Low + + // + // Short Cycle ... + // SC Market ... + int scLength; // Length + double scThresholdInPips; // Threshold In Pips + ENUM_SERIESMODE scHHMode; // Highest High Calculation Method + ENUM_SERIESMODE scLLMode; // Lowest Low Calculation Method + // SC Style ... + int scDrawWidth; // Draw Width + ENUM_DRAW_TYPE scDrawType; // Draw Type + ENUM_LINE_STYLE scDrawStyle; // Draw Style + color scHHColor; // Highest High Color + color scLLColor; // Lowest Low Color + // SC Drawings ... + bool scDrawHH; // Draw Highest High + bool scDrawLL; // Draw Lowest Low + + // + // Constructor(s) ... + XCHLHInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Hot Areas ... + drawHotAreas = false; + hotHHArrowCode = 234; + hotHHArrowColor = CLR_NONE; + hotLLArrowCode = 233; + hotLLArrowColor = CLR_NONE; + + // + // Long Cycle ... + // LC Market ... + lcLength = 0; + lcThresholdInPips = 0; + lcHHMode = MODE_HIGH; + lcLLMode = MODE_LOW; + // + // LC Style ... + lcDrawWidth = 1; + lcDrawType = DRAW_NONE; + lcDrawStyle = STYLE_DOT; + lcHHColor = CLR_NONE; + lcLLColor = CLR_NONE; + // LC Drawings ... + lcDrawHH = false; + lcDrawLL = false; + + // + // Medium Cycle ... + // MC Market ... + mcLength = 0; + mcThresholdInPips = 0; + mcHHMode = MODE_HIGH; + mcLLMode = MODE_LOW; + // MC Style ... + mcDrawWidth = 1; + mcDrawType = DRAW_NONE; + mcDrawStyle = STYLE_DOT; + mcHHColor = CLR_NONE; + mcLLColor = CLR_NONE; + // MC Drawings ... + mcDrawHH = false; + mcDrawLL = false; + + // + // Short Cycle ... + // SC Market ... + scLength = 0; + scThresholdInPips = 0; + scHHMode = MODE_HIGH; + scLLMode = MODE_LOW; + // SC Style ... + scDrawWidth = 1; + scDrawType = DRAW_NONE; + scDrawStyle = STYLE_DOT; + scHHColor = CLR_NONE; + scLLColor = CLR_NONE; + // SC Drawings ... + scDrawHH = false; + scDrawLL = false; + } + + // + // Default ... + void Default() + { + // + // Hot Areas ... + drawHotAreas = false; + hotHHArrowCode = 234; + hotHHArrowColor = CLR_NONE; + hotLLArrowCode = 233; + hotLLArrowColor = CLR_NONE; + + // + // Long Cycle ... + // LC Market ... + lcLength = 28; + lcThresholdInPips = 0.3; + lcHHMode = MODE_HIGH; + lcLLMode = MODE_LOW; + // + // LC Style ... + lcDrawWidth = 1; + lcDrawType = DRAW_LINE; + lcDrawStyle = STYLE_DOT; + lcHHColor = clrAqua; + lcLLColor = clrFuchsia; + // LC Drawings ... + lcDrawHH = false; + lcDrawLL = false; + + // + // Medium Cycle ... + // MC Market ... + mcLength = 14; + mcThresholdInPips = 0.3; + mcHHMode = MODE_HIGH; + mcLLMode = MODE_LOW; + // MC Style ... + mcDrawWidth = 1; + mcDrawType = DRAW_LINE; + mcDrawStyle = STYLE_DOT; + mcHHColor = clrLime; + mcLLColor = clrRed; + // MC Drawings ... + mcDrawHH = false; + mcDrawLL = false; + + // + // Short Cycle ... + // SC Market ... + scLength = 7; + scThresholdInPips = 0.3; + scHHMode = MODE_HIGH; + scLLMode = MODE_LOW; + // SC Style ... + scDrawWidth = 1; + scDrawType = DRAW_LINE; + scDrawStyle = STYLE_DOT; + scHHColor = clrLightBlue; + scLLColor = clrLightSalmon; + // SC Drawings ... + scDrawHH = false; + scDrawLL = false; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + // LC ... + (lcLength >= 4 && + lcLength > mcLength && + lcLength > scLength) + // + && + // + // MC ... + (mcLength >= 4 && + mcLength > scLength && + mcLength < lcLength) + // + && + // + // SC ... + (scLength >= 4 && + scLength < mcLength && + scLength < lcLength) + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(lcLength, mcLength); + result = MathMax(result, scLength); + + // + return result; + } +}; + +// +// Class ... +class XSCXCHLHHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXCHLHHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXCHLHHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XCHLHInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(scHHBuffer, true); + ArraySetAsSeries(scLLBuffer, true); + ArraySetAsSeries(mcHHBuffer, true); + ArraySetAsSeries(mcLLBuffer, true); + ArraySetAsSeries(lcHHBuffer, true); + ArraySetAsSeries(lcLLBuffer, true); + ArraySetAsSeries(hotStateBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xchlh", + // + // Inputs ... + // + // Hot Areas ... + "", + // + mInputs.drawHotAreas, // Draw Hot Areas Symbol + mInputs.hotHHArrowCode, // Hot HH Arrow Code + mInputs.hotHHArrowColor, // Hot HH Arrow Color + mInputs.hotLLArrowCode, // Hot LL Arrow Code + mInputs.hotLLArrowColor, // Hot LL Arrow Color + // + // Long Cycle ... + "", + // LC Market ... + "", + // + mInputs.lcLength, // Length + mInputs.lcThresholdInPips, // Threshold In Pips + mInputs.lcHHMode, // Highest High Calculation Method + mInputs.lcLLMode, // Lowest Low Calculation Method + // + // LC Style ... + "", + // + mInputs.lcDrawWidth, // Draw Width + mInputs.lcDrawType, // Draw Type + mInputs.lcDrawStyle, // Draw Style + mInputs.lcHHColor, // Highest High Color + mInputs.lcLLColor, // Lowest Low Color + // + // LC Drawings ... + "", + mInputs.lcDrawHH, // Draw Highest High + mInputs.lcDrawLL, // Draw Lowest Low + // + // Medium Cycle ... + "", + // MC Market ... + "", + // + mInputs.mcLength, // Length + mInputs.mcThresholdInPips, // Threshold In Pips + mInputs.mcHHMode, // Highest High Calculation Method + mInputs.mcLLMode, // Lowest Low Calculation Method + // + // MC Style ... + "", + // + mInputs.mcDrawWidth, // Draw Width + mInputs.mcDrawType, // Draw Type + mInputs.mcDrawStyle, // Draw Style + mInputs.mcHHColor, // Highest High Color + mInputs.mcLLColor, // Lowest Low Color + // + // MC Drawings ... + "", + mInputs.mcDrawHH, // Draw Highest High + mInputs.mcDrawLL, // Draw Lowest Low + // + // Short Cycle ... + "", + // SC Market ... + "", + // + mInputs.scLength, // Length + mInputs.scThresholdInPips, // Threshold In Pips + mInputs.scHHMode, // Highest High Calculation Method + mInputs.scLLMode, // Lowest Low Calculation Method + // + // SC Style ... + "", + // + mInputs.scDrawWidth, // Draw Width + mInputs.scDrawType, // Draw Type + mInputs.scDrawStyle, // Draw Style + mInputs.scHHColor, // Highest High Color + mInputs.scLLColor, // Lowest Low Color + // + // SC Drawings ... + "", + mInputs.scDrawHH, // Draw Highest High + mInputs.scDrawLL // Draw Lowest Low + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XCHLHInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XCHLHInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + // Short ... + + // + double GetSCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(scHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return scHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + scHHBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(scLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return scLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + scLLBuffer, + buffer, + forceClean + // + ); + } + + // + // Medium ... + + // + double GetMCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mcHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mcHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mcHHBuffer, + buffer, + forceClean + // + ); + } + + // + double GetMCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mcLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mcLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mcLLBuffer, + buffer, + forceClean + // + ); + } + + // + // Long ... + + // + double GetLCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lcHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lcHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lcHHBuffer, + buffer, + forceClean + // + ); + } + + // + double GetLCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lcLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lcLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lcLLBuffer, + buffer, + forceClean + // + ); + } + + // + double GetHotState( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(hotStateBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return hotStateBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHotState( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + hotStateBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XCHLHInputs mInputs; // Inputs ... + + // + // Buffers ... + double scHHBuffer[]; + double scLLBuffer[]; + double mcHHBuffer[]; + double mcLLBuffer[]; + double lcHHBuffer[]; + double lcLLBuffer[]; + double hotStateBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Short Cycle ... + + // + // HH ... + CopyBuffer( + mHandler, + XCHLH_SC_HH_LINE, + 0, + totalBars, + scHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XCHLH_SC_LL_LINE, + 0, + totalBars, + scLLBuffer + // + ); + + // + // Medium Cycle ... + + // + // HH ... + CopyBuffer( + mHandler, + XCHLH_MC_HH_LINE, + 0, + totalBars, + mcHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XCHLH_MC_LL_LINE, + 0, + totalBars, + mcLLBuffer + // + ); + + // + // Long Cycle ... + + // + // HH ... + CopyBuffer( + mHandler, + XCHLH_LC_HH_LINE, + 0, + totalBars, + lcHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XCHLH_LC_LL_LINE, + 0, + totalBars, + lcLLBuffer + // + ); + + // + // Hot State ... + CopyBuffer( + mHandler, + XCHLH_HOT_STATE_LINE, + 0, + totalBars, + hotStateBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchma.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchma.helper.mq5 new file mode 100644 index 0000000..b18120a --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xchma.helper.mq5 @@ -0,0 +1,960 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXCHMAHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XCHMA_BUFFERS +{ + // + // LC ... + XCHMA_LC_FAST_LINE = 0, + XCHMA_LC_SLOW_LINE = 1, + // + // MC ... + XCHMA_MC_FAST_LINE = 2, + XCHMA_MC_SLOW_LINE = 3, + // + // SC ... + XCHMA_SC_FAST_LINE = 4, + XCHMA_SC_SLOW_LINE = 5, + // + XCHMA_HOT_STATE_LINE = 6, +}; + +// +// Input Models ... +struct XCHMAInputs +{ + // + // Props ... + // + // Hot Areas ... + bool drawHotAreas; // Draw Hot Areas Symbol + uchar hotBullishArrowCode; // Hot Bullish Arrow Code + color hotBullishArrowColor; // Hot Bullish Arrow Color + uchar hotBearishArrowCode; // Hot Bearish Arrow Code + color hotBearishArrowColor; // Hot Bearish Arrow Color + + // + // Long Cycle ... + // LC Market ... + int lcFastLength; // Fast Length + int lcSlowLength; // Slow Length + ENUM_MA_METHOD lcMethod; // Calculation Method + ENUM_APPLIED_PRICE lcAppliedTo; // Applied To + // LC Style ... + int lcDrawWidth; // Draw Width + ENUM_DRAW_TYPE lcDrawType; // Draw Type + ENUM_LINE_STYLE lcDrawStyle; // Draw Style + color lcFastColor; // Fast Color + color lcSlowColor; // Slow Color + // LC Drawings ... + bool lcDrawFast; // Draw Fast + bool lcDrawSlow; // Draw Slow + bool lcDrawCrosses; // Draw Cross Lines + + // + // Medium Cycle ... + // MC Market ... + int mcFastLength; // Fast Length + int mcSlowLength; // Slow Length + ENUM_MA_METHOD mcMethod; // Calculation Method + ENUM_APPLIED_PRICE mcAppliedTo; // Applied To + // MC Style ... + int mcDrawWidth; // Draw Width + ENUM_DRAW_TYPE mcDrawType; // Draw Type + ENUM_LINE_STYLE mcDrawStyle; // Draw Style + color mcFastColor; // Fast Color + color mcSlowColor; // Slow Color + // MC Drawings ... + bool mcDrawFast; // Draw Fast + bool mcDrawSlow; // Draw Slow + bool mcDrawCrosses; // Draw Cross Lines + + // + // Short Cycle ... + // SC Market ... + int scFastLength; // Fast Length + int scSlowLength; // Slow Length + ENUM_MA_METHOD scMethod; // Calculation Method + ENUM_APPLIED_PRICE scAppliedTo; // Applied To + // SC Style ... + int scDrawWidth; // Draw Width + ENUM_DRAW_TYPE scDrawType; // Draw Type + ENUM_LINE_STYLE scDrawStyle; // Draw Style + color scFastColor; // Fast Color + color scSlowColor; // Slow Color + // SC Drawings ... + bool scDrawFast; // Draw Fast + bool scDrawSlow; // Draw Slow + bool scDrawCrosses; // Draw Cross Lines + + // + // Constructor(s) ... + XCHMAInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Hot Areas ... + drawHotAreas = false; + hotBullishArrowCode = 228; + hotBullishArrowColor = CLR_NONE; + hotBearishArrowCode = 230; + hotBearishArrowColor = CLR_NONE; + + // + // Long Cycle ... + // LC Market ... + lcFastLength = 20; + lcSlowLength = 50; + lcMethod = MODE_EMA; + lcAppliedTo = PRICE_CLOSE; + // LC Style ... + lcDrawWidth = 1; + lcDrawType = DRAW_NONE; + lcDrawStyle = STYLE_DOT; + lcFastColor = CLR_NONE; + lcSlowColor = CLR_NONE; + // LC Drawings ... + lcDrawFast = false; + lcDrawSlow = false; + lcDrawCrosses = false; + + // + // Medium Cycle ... + // MC Market ... + mcFastLength = 10; + mcSlowLength = 30; + mcMethod = MODE_EMA; + mcAppliedTo = PRICE_CLOSE; + // MC Style ... + mcDrawWidth = 1; + mcDrawType = DRAW_NONE; + mcDrawStyle = STYLE_DOT; + mcFastColor = CLR_NONE; + mcSlowColor = CLR_NONE; + // MC Drawings ... + mcDrawFast = false; + mcDrawSlow = false; + mcDrawCrosses = false; + + // + // Short Cycle ... + // SC Market ... + scFastLength = 7; + scSlowLength = 14; + scMethod = MODE_EMA; + scAppliedTo = PRICE_CLOSE; + // SC Style ... + scDrawWidth = 1; + scDrawType = DRAW_NONE; + scDrawStyle = STYLE_SOLID; + scFastColor = CLR_NONE; + scSlowColor = CLR_NONE; + // SC Drawings ... + scDrawFast = false; + scDrawSlow = false; + scDrawCrosses = false; + } + + // + // Default ... + void Default() + { + // + // Hot Areas ... + drawHotAreas = false; + hotBullishArrowCode = 228; + hotBullishArrowColor = CLR_NONE; + hotBearishArrowCode = 230; + hotBearishArrowColor = CLR_NONE; + + // + // Long Cycle ... + // LC Market ... + lcFastLength = 20; + lcSlowLength = 50; + lcMethod = MODE_EMA; + lcAppliedTo = PRICE_CLOSE; + // LC Style ... + lcDrawWidth = 1; + lcDrawType = DRAW_LINE; + lcDrawStyle = STYLE_DOT; + lcFastColor = clrAqua; + lcSlowColor = clrFuchsia; + // LC Drawings ... + lcDrawFast = false; + lcDrawSlow = false; + lcDrawCrosses = false; + + // + // Medium Cycle ... + // MC Market ... + mcFastLength = 10; + mcSlowLength = 30; + mcMethod = MODE_EMA; + mcAppliedTo = PRICE_CLOSE; + // MC Style ... + mcDrawWidth = 1; + mcDrawType = DRAW_LINE; + mcDrawStyle = STYLE_DOT; + mcFastColor = clrLime; + mcSlowColor = clrRed; + // MC Drawings ... + mcDrawFast = false; + mcDrawSlow = false; + mcDrawCrosses = false; + + // + // Short Cycle ... + // SC Market ... + scFastLength = 7; + scSlowLength = 14; + scMethod = MODE_EMA; + scAppliedTo = PRICE_CLOSE; + // SC Style ... + scDrawWidth = 1; + scDrawType = DRAW_LINE; + scDrawStyle = STYLE_SOLID; + scFastColor = clrLightBlue; + scSlowColor = clrLightSalmon; + // SC Drawings ... + scDrawFast = false; + scDrawSlow = false; + scDrawCrosses = false; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + (lcFastLength >= 4 && lcSlowLength > lcFastLength) && + (mcFastLength >= 4 && mcSlowLength > mcFastLength) && + (scFastLength >= 4 && scSlowLength > scFastLength) && + (lcFastLength > mcFastLength && + mcFastLength > scFastLength) + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(scFastLength, scSlowLength); + result = MathMax(result, lcFastLength); + result = MathMax(result, lcSlowLength); + result = MathMax(result, mcFastLength); + result = MathMax(result, mcSlowLength); + + // + return result; + } +}; + +// +// Class ... +class XSCXCHMAHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXCHMAHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXCHMAHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XCHMAInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(scFastBuffer, true); + ArraySetAsSeries(scSlowBuffer, true); + ArraySetAsSeries(mcFastBuffer, true); + ArraySetAsSeries(mcSlowBuffer, true); + ArraySetAsSeries(lcFastBuffer, true); + ArraySetAsSeries(lcSlowBuffer, true); + ArraySetAsSeries(hotStateBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xchma", + // + // Inputs ... + // + // Hot Areas ... + "", + mInputs.drawHotAreas, // Draw Hot Areas Symbol + mInputs.hotBullishArrowCode, // Hot Bullish Arrow Code + mInputs.hotBullishArrowColor, // Hot Bullish Arrow Color + mInputs.hotBearishArrowCode, // Hot Bearish Arrow Code + mInputs.hotBearishArrowColor, // Hot Bearish Arrow Color + // + // Long Cycle ... + "", + // + // LC Market ... + "", + mInputs.lcFastLength, // Fast Length + mInputs.lcSlowLength, // Slow Length + mInputs.lcMethod, // Calculation Method + mInputs.lcAppliedTo, // Applied To + // + // LC Style ... + "", + mInputs.lcDrawWidth, // Draw Width + mInputs.lcDrawType, // Draw Type + mInputs.lcDrawStyle, // Draw Style + mInputs.lcFastColor, // Fast Color + mInputs.lcSlowColor, // Slow Color + // + // LC Drawings ... + "", + mInputs.lcDrawFast, // Draw Fast + mInputs.lcDrawSlow, // Draw Slow + mInputs.lcDrawCrosses, // Draw Cross Lines + // + // Medium Cycle ... + "", + // + // MC Market ... + "", + mInputs.mcFastLength, // Fast Length + mInputs.mcSlowLength, // Slow Length + mInputs.mcMethod, // Calculation Method + mInputs.mcAppliedTo, // Applied To + // + // MC Style ... + "", + mInputs.mcDrawWidth, // Draw Width + mInputs.mcDrawType, // Draw Type + mInputs.mcDrawStyle, // Draw Style + mInputs.mcFastColor, // Fast Color + mInputs.mcSlowColor, // Slow Color + // + // MC Drawings ... + "", + mInputs.mcDrawFast, // Draw Fast + mInputs.mcDrawSlow, // Draw Slow + mInputs.mcDrawCrosses, // Draw Cross Lines + // + // Short Cycle ... + "", + // + // SC Market ... + "", + mInputs.scFastLength, // Fast Length + mInputs.scSlowLength, // Slow Length + mInputs.scMethod, // Calculation Method + mInputs.scAppliedTo, // Applied To + // + // SC Style ... + "", + mInputs.scDrawWidth, // Draw Width + mInputs.scDrawType, // Draw Type + mInputs.scDrawStyle, // Draw Style + mInputs.scFastColor, // Fast Color + mInputs.scSlowColor, // Slow Color + // + // SC Drawings ... + "", + mInputs.scDrawFast, // Draw Fast + mInputs.scDrawSlow, // Draw Slow + mInputs.scDrawCrosses // Draw Cross Lines + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XCHMAInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XCHMAInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + // Short ... + + // + double GetSCFast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(scFastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return scFastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySCFast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + scFastBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSCSlow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(scSlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return scSlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySCSlow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + scSlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Medium ... + + // + double GetMCFast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mcFastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mcFastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMCFast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mcFastBuffer, + buffer, + forceClean + // + ); + } + + // + double GetMCSlow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mcSlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mcSlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMCSlow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mcSlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Long ... + + // + double GetLCFast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lcFastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lcFastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLCFast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lcFastBuffer, + buffer, + forceClean + // + ); + } + + // + double GetLCSlow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lcSlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lcSlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLCSlow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lcSlowBuffer, + buffer, + forceClean + // + ); + } + + // + double GetHotState( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(hotStateBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return hotStateBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHotState( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + hotStateBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XCHMAInputs mInputs; // Inputs ... + + // + // Buffers ... + double scFastBuffer[]; + double scSlowBuffer[]; + double mcFastBuffer[]; + double mcSlowBuffer[]; + double lcFastBuffer[]; + double lcSlowBuffer[]; + double hotStateBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Short Cycle ... + + // + // Fast ... + CopyBuffer( + mHandler, + XCHMA_SC_FAST_LINE, + 0, + totalBars, + scFastBuffer + // + ); + + // + // Slow ... + CopyBuffer( + mHandler, + XCHMA_SC_SLOW_LINE, + 0, + totalBars, + scSlowBuffer + // + ); + + // + // Medium Cycle ... + + // + // Fast ... + CopyBuffer( + mHandler, + XCHMA_MC_FAST_LINE, + 0, + totalBars, + mcFastBuffer + // + ); + + // + // Slow ... + CopyBuffer( + mHandler, + XCHMA_MC_SLOW_LINE, + 0, + totalBars, + mcSlowBuffer + // + ); + + // + // Long Cycle ... + + // + // Fast ... + CopyBuffer( + mHandler, + XCHMA_LC_FAST_LINE, + 0, + totalBars, + lcFastBuffer + // + ); + + // + // Slow ... + CopyBuffer( + mHandler, + XCHMA_LC_SLOW_LINE, + 0, + totalBars, + lcSlowBuffer + // + ); + + // + // Hot State ... + CopyBuffer( + mHandler, + XCHMA_HOT_STATE_LINE, + 0, + totalBars, + hotStateBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xct.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xct.helper.mq5 new file mode 100644 index 0000000..a7e8769 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xct.helper.mq5 @@ -0,0 +1,220 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXCTHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +// Input Models ... +struct XCTInputs +{ + // + // Props ... + + // + color clr; // Text Color + ENUM_BASE_CORNER corner; // Text Position + + // + // Presentation ... + bool showCandleTime; // Show Candle Time + + // + // Constructor(s) ... + XCTInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + clr = CLR_NONE; + corner = CORNER_RIGHT_LOWER; + + // + // Presentation ... + showCandleTime = false; + } + + // + // Default ... + void Default() + { + // + clr = clrYellow; + corner = CORNER_RIGHT_LOWER; + + // + // Presentation ... + showCandleTime = false; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + true + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(0, 0); + + // + return result; + } +}; + +// +// Class ... +class XSCXCTHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXCTHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXCTHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XCTInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xct", + // + // Inputs ... + mInputs.clr, // Text Color + mInputs.corner, // Text Position + // + // Presentation ... + "", + mInputs.showCandleTime // Show Candle Time + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XCTInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XCTInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XCTInputs mInputs; // Inputs ... +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xdon.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xdon.helper.mq5 new file mode 100644 index 0000000..3e7355d --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xdon.helper.mq5 @@ -0,0 +1,1075 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXDONHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XDON_BUFFERS +{ + // + // Open ... + XDON_UPPER_O_LINE = 0, + XDON_LOWER_O_LINE = 1, + // + // Close ... + XDON_UPPER_C_LINE = 2, + XDON_LOWER_C_LINE = 3, + // + // High ... + XDON_UPPER_H_LINE = 4, + XDON_LOWER_H_LINE = 5, + // + // Low ... + XDON_UPPER_L_LINE = 6, + XDON_LOWER_L_LINE = 7, +}; + +// +// Input Models ... +struct XDONInputs +{ + // + // Props ... + + // + // Market ... + int length; // Market Length + double offset; // Offset + + // + // Presentation ... + bool showOpen; // Show Open + bool showHigh; // Show High + bool showClose; // Show Close + bool showLow; // Show Low + + // + // Constructor(s) ... + XDONInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Market ... + length = 0; + offset = 0; + + // + // Presentation ... + showOpen = false; + showHigh = false; + showClose = false; + showLow = false; + } + + // + // Default ... + void Default() + { + // + // Market ... + length = 52; + offset = 0; + + // + // Presentation ... + showOpen = true; + showHigh = true; + showClose = true; + showLow = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 5 && + offset >= 0 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(0, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXDONHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXDONHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXDONHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XDONInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(upperOBuffer, true); + ArraySetAsSeries(lowerOBuffer, true); + ArraySetAsSeries(upperCBuffer, true); + ArraySetAsSeries(lowerCBuffer, true); + ArraySetAsSeries(upperHBuffer, true); + ArraySetAsSeries(lowerHBuffer, true); + ArraySetAsSeries(upperLBuffer, true); + ArraySetAsSeries(lowerLBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xdon", + // + // Inputs ... + // + // Market ... + "", + mInputs.length, // Market Length + mInputs.offset, // Offset + // + // Presentation ... + "", + mInputs.showOpen, // Show Open + mInputs.showHigh, // Show High + mInputs.showClose, // Show Close + mInputs.showLow // Show Low + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XDONInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XDONInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + // Open ... + + // + // Upper ... + + // + double GetUpperO( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(upperOBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return upperOBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyUpperO( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + upperOBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameUpperO( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + upperOBuffer, + verifier, + barIndex // + ); + } + + // + // Lower ... + + // + double GetLowerO( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lowerOBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lowerOBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLowerO( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lowerOBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameLowerO( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + lowerOBuffer, + verifier, + barIndex // + ); + } + + // + // Close ... + + // + // Upper ... + + // + double GetUpperC( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(upperCBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return upperCBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyUpperC( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + upperCBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameUpperC( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + upperCBuffer, + verifier, + barIndex // + ); + } + + // + // Lower ... + + // + double GetLowerC( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lowerCBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lowerCBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLowerC( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lowerCBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameLowerC( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + lowerCBuffer, + verifier, + barIndex // + ); + } + + // + // High ... + + // + // Upper ... + + // + double GetUpperH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(upperHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return upperHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyUpperH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + upperHBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameUpperH( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + upperHBuffer, + verifier, + barIndex // + ); + } + + // + // Lower ... + + // + double GetLowerH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lowerHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lowerHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLowerH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lowerHBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameLowerH( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + lowerHBuffer, + verifier, + barIndex // + ); + } + + // + // Low ... + + // + // Upper ... + + // + double GetUpperL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(upperLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return upperLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyUpperL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + upperLBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameUpperL( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + upperLBuffer, + verifier, + barIndex // + ); + } + + // + // Lower ... + + // + double GetLowerL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lowerLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lowerLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLowerL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lowerLBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameLowerL( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + lowerLBuffer, + verifier, + barIndex // + ); + } + + // + void GetUppers( + double &result[], + int barIndex = 0 // + ) + { + // + Clean(result); + + // + double uo = GetUpperO(barIndex); + double uc = GetUpperC(barIndex); + double uh = GetUpperH(barIndex); + double ul = GetUpperL(barIndex); + + // + Add(uo, result); + Add(uc, result); + Add(uh, result); + Add(ul, result); + } + double GetMinUpper( + int barIndex = 0 // + ) + { + // + double values[]; + GetUppers(values); + + // + double result = GetMin(values); + + // + return result; + } + double GetMaxUpper( + int barIndex = 0 // + ) + { + // + double values[]; + GetUppers(values); + + // + double result = GetMax(values); + + // + return result; + } + + // + void GetLowers( + double &result[], + int barIndex = 0 // + ) + { + // + Clean(result); + + // + double lo = GetLowerO(barIndex); + double lc = GetLowerC(barIndex); + double lh = GetLowerH(barIndex); + double ll = GetLowerL(barIndex); + + // + Add(lo, result); + Add(lc, result); + Add(lh, result); + Add(ll, result); + } + double GetMinLower( + int barIndex = 0 // + ) + { + // + double values[]; + GetLowers(values); + + // + double result = GetMin(values); + + // + return result; + } + double GetMaxLower( + int barIndex = 0 // + ) + { + // + double values[]; + GetLowers(values); + + // + double result = GetMin(values); + + // + return result; + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XDONInputs mInputs; // Inputs ... + + // + // Buffers ... + double upperOBuffer[]; + double lowerOBuffer[]; + double upperCBuffer[]; + double lowerCBuffer[]; + double upperHBuffer[]; + double lowerHBuffer[]; + double upperLBuffer[]; + double lowerLBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Open ... + + // + // Upper Buffer ... + CopyBuffer( + mHandler, + XDON_UPPER_O_LINE, + 0, + totalBars, + upperOBuffer + // + ); + + // + // Lower Buffer ... + CopyBuffer( + mHandler, + XDON_LOWER_O_LINE, + 0, + totalBars, + lowerOBuffer + // + ); + + // + // Close ... + + // + // Upper Buffer ... + CopyBuffer( + mHandler, + XDON_UPPER_C_LINE, + 0, + totalBars, + upperCBuffer + // + ); + + // + // Lower Buffer ... + CopyBuffer( + mHandler, + XDON_LOWER_C_LINE, + 0, + totalBars, + lowerCBuffer + // + ); + + // + // High ... + + // + // Upper Buffer ... + CopyBuffer( + mHandler, + XDON_UPPER_H_LINE, + 0, + totalBars, + upperHBuffer + // + ); + + // + // Lower Buffer ... + CopyBuffer( + mHandler, + XDON_LOWER_H_LINE, + 0, + totalBars, + lowerHBuffer + // + ); + + // + // Low ... + + // + // Upper Buffer ... + CopyBuffer( + mHandler, + XDON_UPPER_L_LINE, + 0, + totalBars, + upperLBuffer + // + ); + + // + // Lower Buffer ... + CopyBuffer( + mHandler, + XDON_LOWER_L_LINE, + 0, + totalBars, + lowerLBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xfi.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xfi.helper.mq5 new file mode 100644 index 0000000..c636da6 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xfi.helper.mq5 @@ -0,0 +1,292 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXFIHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XFI_BUFFERS +{ + XFI_MAIN_LINE = 0 +}; + +// +// Input Models ... +struct XFIInputs +{ + // + // Props ... + int length; // Length + ENUM_MA_METHOD method; // MA Method + ENUM_APPLIED_VOLUME appliedTo; // Applied To + + // + // Constructor(s) ... + XFIInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + method = MODE_SMA; + appliedTo = VOLUME_TICK; + } + + // + // Default ... + void Default() + { + // + length = 18; + method = MODE_SMA; + appliedTo = VOLUME_TICK; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 2 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXFIHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXFIHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXFIHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XFIInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(mainBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xfi", + // + // Inputs ... + mInputs.length, // Length + mInputs.method, // MA Method + mInputs.appliedTo // Applied To + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XFIInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XFIInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetMain( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mainBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mainBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMain( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mainBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XFIInputs mInputs; // Inputs ... + + // + // Buffers ... + double mainBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Short Exit 2 ... + CopyBuffer( + mHandler, + XFI_MAIN_LINE, + 0, + totalBars, + mainBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhk.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhk.helper.mq5 new file mode 100644 index 0000000..c9b2698 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhk.helper.mq5 @@ -0,0 +1,1014 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXHKHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XHK_BUFFERS +{ + // + // Hiken Ashi ... + XHK_OPEN_LINE = 0, + XHK_HIGHLINE = 1, + XHK_LOW_LINE = 2, + XHK_CLOSE_LINE = 3, + // + // Smoothed Hiken Ashi ... + XHK_SM_OPEN_LINE = 5, + XHK_SM_HIGHLINE = 6, + XHK_SM_LOW_LINE = 7, + XHK_SM_CLOSE_LINE = 8, +}; + +// +// Input Models ... +struct XHKInputs +{ + // + // Props ... + + // + // Market ... + int smoothingLength; // Smoothing Length + // + // Presentation ... + bool drawHikenAshi; // Draw Hiken Ashi + bool drawSmoothedHikenAshi; // Draw Smoothed Hiken Ashi + + // + // Constructor(s) ... + XHKInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Market ... + smoothingLength = 0; + // + // Presentation ... + drawHikenAshi = false; + drawSmoothedHikenAshi = false; + } + + // + // Default ... + void Default() + { + // + // Market ... + smoothingLength = 17; + // + // Presentation ... + drawHikenAshi = true; + drawSmoothedHikenAshi = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + smoothingLength > 2 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(0, smoothingLength); + + // + return result; + } +}; + +// +// Class ... +class XSCXHKHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXHKHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXHKHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XHKInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(openBuffer, true); + ArraySetAsSeries(highBuffer, true); + ArraySetAsSeries(lowBuffer, true); + ArraySetAsSeries(closeBuffer, true); + ArraySetAsSeries(smOpenBuffer, true); + ArraySetAsSeries(smHighBuffer, true); + ArraySetAsSeries(smLowBuffer, true); + ArraySetAsSeries(smCloseBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xhk", + // + // Inputs ... + // + // Market ... + "", + mInputs.smoothingLength, // Smoothing Length + // + // Presentation ... + "", + mInputs.drawHikenAshi, // Draw Hiken Ashi + mInputs.drawSmoothedHikenAshi // Draw Smoothed Hiken Ashi + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XHKInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XHKInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetOpen( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(openBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return openBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyOpen( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + openBuffer, + buffer, + forceClean + // + ); + } + + // + double GetHigh( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(highBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return highBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHigh( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + highBuffer, + buffer, + forceClean + // + ); + } + + // + double GetLow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lowBuffer, + buffer, + forceClean + // + ); + } + + // + double GetClose( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(closeBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return closeBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyClose( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + closeBuffer, + buffer, + forceClean + // + ); + } + + // + // Smoothed ... + + // + double GetSMOpen( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(smOpenBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return smOpenBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySMOpen( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + smOpenBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSMHigh( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(smHighBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return smHighBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySMHigh( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + smHighBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSMLow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(smLowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return smLowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySMLow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + smLowBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSMClose( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(smCloseBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return smCloseBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySMClose( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + smCloseBuffer, + buffer, + forceClean + // + ); + } + + // + // XOHCL ... + + // + // Retrieve Hiken Ashi Info as XOHCL model ... + bool AsOHCL( + XOHCL &bar, // Holds Result + int barIndex // Bar Index + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(openBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + double open = GetOpen(barIndex); + double high = GetHigh(barIndex); + double close = GetClose(barIndex); + double low = GetLow(barIndex); + + // + result = bar.Init( + mSymbol, + mPeriod, + open, + high, + close, + low, + barIndex + // + ); + + // + return result; + } + + // + // Copy Required Items ... + int CopyAsOHCL( + int start, // Start + int count, // Number of Items for read + XOHCL &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + int result = 0; + + // + // Update Calculations ... + Calculate(); + + // + if (forceClean) + { + Clean(buffer); + } + + // + int before = ArraySize(buffer); + + // + if (start < 0) + { + start = 0; + } + + // + if (start >= ArraySize(openBuffer)) + { + start = ArraySize(openBuffer) - 1; + } + + // + bool asSeriesBuffer = ArrayGetAsSeries(buffer); + ArraySetAsSeries(buffer, true); + + // + for (int i = start; i < start + count; i++) + { + // + XOHCL iBar; + bool isInit = AsOHCL(iBar, i); + + // + if (isInit) + { + // + AddRef( + iBar, + buffer + // + ); + } + } + + // + ArraySetAsSeries(buffer, asSeriesBuffer); + + // + int after = ArraySize(buffer); + + // + result = after - before; + + // + return result; + } + + // + // Retrieve Smoothed Hiken Ashi Info as XOHCL model ... + bool SMAsOHCL( + XOHCL &bar, // Holds Result + int barIndex // Bar Index + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(openBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + double open = GetSMOpen(barIndex); + double high = GetSMHigh(barIndex); + double close = GetSMClose(barIndex); + double low = GetSMLow(barIndex); + + // + result = bar.Init( + mSymbol, + mPeriod, + open, + high, + close, + low, + barIndex + // + ); + + // + return result; + } + + // + // Copy Required Items ... + int CopySMAsOHCL( + int start, // Start + int count, // Number of Items for read + XOHCL &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + int result = 0; + + // + // Update Calculations ... + Calculate(); + + // + if (forceClean) + { + Clean(buffer); + } + + // + int before = ArraySize(buffer); + + // + if (start < 0) + { + start = 0; + } + + // + if (start >= ArraySize(openBuffer)) + { + start = ArraySize(openBuffer) - 1; + } + + // + bool asSeriesBuffer = ArrayGetAsSeries(buffer); + ArraySetAsSeries(buffer, true); + + // + for (int i = start; i < start + count; i++) + { + // + XOHCL iBar; + bool isInit = SMAsOHCL(iBar, i); + + // + if (isInit) + { + // + AddRef( + iBar, + buffer + // + ); + } + } + + // + ArraySetAsSeries(buffer, asSeriesBuffer); + + // + int after = ArraySize(buffer); + + // + result = after - before; + + // + return result; + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XHKInputs mInputs; // Inputs ... + + // + // Buffers ... + double openBuffer[]; + double highBuffer[]; + double lowBuffer[]; + double closeBuffer[]; + double smOpenBuffer[]; + double smHighBuffer[]; + double smLowBuffer[]; + double smCloseBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Open Buffer ... + CopyBuffer( + mHandler, + XHK_OPEN_LINE, + 0, + totalBars, + openBuffer + // + ); + + // + // High Buffer ... + CopyBuffer( + mHandler, + XHK_HIGHLINE, + 0, + totalBars, + highBuffer + // + ); + + // + // Low Buffer ... + CopyBuffer( + mHandler, + XHK_LOW_LINE, + 0, + totalBars, + lowBuffer + // + ); + + // + // Close Buffer ... + CopyBuffer( + mHandler, + XHK_CLOSE_LINE, + 0, + totalBars, + closeBuffer + // + ); + + // + // Smoothed ... + + // + // Open Buffer ... + CopyBuffer( + mHandler, + XHK_SM_OPEN_LINE, + 0, + totalBars, + smOpenBuffer + // + ); + + // + // High Buffer ... + CopyBuffer( + mHandler, + XHK_SM_HIGHLINE, + 0, + totalBars, + smHighBuffer + // + ); + + // + // Low Buffer ... + CopyBuffer( + mHandler, + XHK_SM_LOW_LINE, + 0, + totalBars, + smLowBuffer + // + ); + + // + // Close Buffer ... + CopyBuffer( + mHandler, + XHK_SM_CLOSE_LINE, + 0, + totalBars, + smCloseBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhull.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhull.helper.mq5 new file mode 100644 index 0000000..900f629 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xhull.helper.mq5 @@ -0,0 +1,399 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXHULLHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XHULLC_BUFFERS +{ + XHULLC_UP_LINE = 0, + XHULLC_DOWN_LINE = 2, +}; + +// +// Input Models ... +struct XHULLInputs +{ + // + // Props ... + // + // Market ... + int length; // Length + double divisor; // Divisor (Speed) + + // + // Calculation ... + ENUM_APPLIED_PRICE upAppliedTo; // Up Zone Applied to + ENUM_APPLIED_PRICE downAppliedTo; // Down Zone Applied to + + // + // Presentation ... + bool showUpZone; // Show Up Zone + bool showDownZone; // Show Down Zone + + // + // Constructor(s) ... + XHULLInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Market ... + length = 0; + divisor = 0; + + // + // Calculation ... + upAppliedTo = PRICE_HIGH; + downAppliedTo = PRICE_LOW; + + // + // Presentation ... + showUpZone = false; + showDownZone = false; + } + + // + // Default ... + void Default() + { + // + // Market ... + length = 72; + divisor = 2.0; + + // + // Calculation ... + upAppliedTo = PRICE_HIGH; + downAppliedTo = PRICE_LOW; + + // + // Presentation ... + showUpZone = true; + showDownZone = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 9 && + divisor >= 0.5 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(0, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXHULLHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXHULLHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXHULLHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XHULLInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + // ArraySetAsSeries(mainBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xhull", + // + // Inputs ... + // + // Market ... + "", + mInputs.length, // Length + mInputs.divisor, // Divisor (Speed) + // + // Calculation ... + "", + mInputs.upAppliedTo, // Up Zone Applied to + mInputs.downAppliedTo, // Down Zone Applied to + // + // Presentation ... + "", + mInputs.showUpZone, // Show Up Zone + mInputs.showDownZone // Show Down Zone + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XHULLInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XHULLInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetUp( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(upBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return upBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyUp( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + upBuffer, + buffer, + forceClean + // + ); + } + + // + double GetDown( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(downBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return downBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyDown( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + downBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XHULLInputs mInputs; // Inputs ... + + // + // Buffers ... + double upBuffer[]; + double downBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Up Buffer ... + CopyBuffer( + mHandler, + XHULLC_UP_LINE, + 0, + totalBars, + upBuffer + // + ); + + // + // Down Buffer ... + CopyBuffer( + mHandler, + XHULLC_DOWN_LINE, + 0, + totalBars, + downBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xich.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xich.helper.mq5 new file mode 100644 index 0000000..3a1dcf9 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xich.helper.mq5 @@ -0,0 +1,827 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXICHHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... +// +// Ichimoku Lines Calculator Mode ... +enum ENUM_XICH_CALCULATION_MODE +{ + // + X_XICH_HH_LL_MODE = 1, // Highest High and Lowest Low + X_XICH_HO_LC_MODE = 2, // Highest Open and Lowest Close +}; + +// +enum ENUM_XICH_BUFFERS +{ + X_ICH_TEANKANSEN_LINE = 0, + X_ICH_KIJUNSEN_LINE = 1, + X_ICH_CHIKOUSPAN_LINE = 4, + X_ICH_SENKOUSPANA_LINE = 5, + X_ICH_SENKOUSPANB_LINE = 6, +}; + +// +// Input Models ... +struct XICHInputs +{ + // + // Props ... + + // + // Market ... + // + // Tenkan Sen ... + int tenkanSenLength; // Length + ENUM_XICH_CALCULATION_MODE tenkanSenMode; // Calculation Mode + + // + // Kijun Sen ... + int kijunSenLength; // Length + ENUM_XICH_CALCULATION_MODE kijunSenMode; // Calculation Mode + + // + // Senkou Span B ... + int senkouSpanBLength; // Length + ENUM_XICH_CALCULATION_MODE senkouSpanBMode; // Calculation Mode + + // + // Chikou Span ... + ENUM_APPLIED_PRICE chikuoSpanAppliedTo; // Price Type + + // + // Presentation ... + bool showTenkanSen; // Show Tenkan Sen + bool showKijunSen; // Show Kijun Sen + bool showKijunSenPlus; // Show Kijun Sen + + bool showKijunSenNegative; // Show Kijun Sen - + bool showChikouSpan; // Show Chikou Span + bool showSenkouSpanA; // Show Senkou Span A + bool showSenkouSpanB; // Show Senkou Span B + bool showKumo; // Show Kumo + bool shiftKumo; // Shift Kumo to Future + + // + // Constructor(s) ... + XICHInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + kijunSenLength = 0; + tenkanSenLength = 0; + senkouSpanBLength = 0; + + // + kijunSenMode = X_XICH_HH_LL_MODE; + tenkanSenMode = X_XICH_HH_LL_MODE; + senkouSpanBMode = X_XICH_HH_LL_MODE; + + // + chikuoSpanAppliedTo = PRICE_CLOSE; + + // + showTenkanSen = false; + showKijunSen = false; + showKijunSenPlus = false; + showKijunSenNegative = false; + showChikouSpan = false; + showSenkouSpanA = false; + showSenkouSpanB = false; + showKumo = false; + shiftKumo = true; + } + + // + // Default ... + void Default() + { + // + kijunSenLength = 26; + tenkanSenLength = 9; + senkouSpanBLength = 52; + + // + kijunSenMode = X_XICH_HH_LL_MODE; + tenkanSenMode = X_XICH_HH_LL_MODE; + senkouSpanBMode = X_XICH_HH_LL_MODE; + + // + chikuoSpanAppliedTo = PRICE_CLOSE; + + // + showTenkanSen = true; + showKijunSen = true; + showKijunSenPlus = false; + showKijunSenNegative = false; + showChikouSpan = true; + showSenkouSpanA = true; + showSenkouSpanB = true; + showKumo = true; + shiftKumo = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + tenkanSenLength > 2 && + kijunSenLength > tenkanSenLength && + senkouSpanBLength > kijunSenLength + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, tenkanSenLength); + result = MathMax(result, kijunSenLength); + result = MathMax(result, senkouSpanBLength); + + // + return result; + } +}; + +// +// Class ... +class XSCXICHHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXICHHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXICHHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XICHInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(tenkanSenBuffer, true); + ArraySetAsSeries(kijunSenBuffer, true); + ArraySetAsSeries(chikouSpanBuffer, true); + ArraySetAsSeries(senkouSpanABuffer, true); + ArraySetAsSeries(senkouSpanBBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xich", + // + // Inputs ... + // + // TenkanSen ... + "", + mInputs.tenkanSenLength, + mInputs.tenkanSenMode, + // + // KijunSen ... + "", + mInputs.kijunSenLength, + mInputs.kijunSenMode, + // + // SenkouSpan B ... + "", + mInputs.senkouSpanBLength, + mInputs.senkouSpanBMode, + // + // ChikouSpan ... + "", + mInputs.chikuoSpanAppliedTo, + // + // Presentation ... + "", + mInputs.showTenkanSen, // Show Tenkan Sen + mInputs.showKijunSen, // Show Kijun Sen + mInputs.showKijunSenPlus, // Show Kijun Sen + + mInputs.showKijunSenNegative, // Show Kijun Sen - + mInputs.showChikouSpan, // Show Chikou Span + mInputs.showSenkouSpanA, // Show Senkou Span A + mInputs.showSenkouSpanB, // Show Senkou Span B + mInputs.showKumo, // Show Kumo + mInputs.shiftKumo // Shift Kumo to Future + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XICHInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XICHInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs); + } + + // + // Buffers ... + + // + // TenkanSen ... + + // + double GetTenkanSen( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return tenkanSenBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyTenkanSen( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + tenkanSenBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameTenkanSen( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + tenkanSenBuffer, + verifier, + barIndex // + ); + } + + // + // KijunSen ... + + // + double GetKijunSen( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return kijunSenBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyKijunSen( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + kijunSenBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameKijunSen( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + kijunSenBuffer, + verifier, + barIndex // + ); + } + + // + // ChikouSpan ... + + // + double GetChikouSpan( + int barIndex // Bar Index + ) + { + // + barIndex -= mInputs.kijunSenLength; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex > ArraySize(chikouSpanBuffer)) + { + barIndex = ArraySize(chikouSpanBuffer) - 1; + } + + // + Calculate(); + + // + return chikouSpanBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyChikouSpan( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start - mInputs.kijunSenLength, + count, + chikouSpanBuffer, + buffer, + forceClean + // + ); + } + + // + // SenkouSpanA ... + + // + double GetSenkouSpanA( + int barIndex // Bar Index + ) + { + // + barIndex += mInputs.kijunSenLength; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex > ArraySize(senkouSpanABuffer)) + { + barIndex = ArraySize(senkouSpanABuffer) - 1; + } + + // + Calculate(); + + // + return senkouSpanABuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySenkouSpanA( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start + mInputs.kijunSenLength, + count, + senkouSpanABuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameSenkouSpanA( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + senkouSpanABuffer, + verifier, + barIndex // + ); + } + + // + // SenkouSpanB ... + + // + double GetSenkouSpanB( + int barIndex // Bar Index + ) + { + // + barIndex += mInputs.kijunSenLength; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex > ArraySize(senkouSpanBBuffer)) + { + barIndex = ArraySize(senkouSpanBBuffer) - 1; + } + + // + Calculate(); + + // + return senkouSpanBBuffer[barIndex + mInputs.kijunSenLength]; + } + + // + // Copy Required Items ... + int CopySenkouSpanB( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start + mInputs.kijunSenLength, + count, + senkouSpanBBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameSenkouSpanB( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + senkouSpanBBuffer, + verifier, + barIndex // + ); + } + + // + // Future SenkouSpanA ... + + // + double GetFutureSenkouSpanA( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return senkouSpanABuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFutureSenkouSpanA( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + senkouSpanABuffer, + buffer, + forceClean + // + ); + } + + // + // SenkouSpanB ... + + // + double GetFutureSenkouSpanB( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return senkouSpanBBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFutureSenkouSpanB( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + senkouSpanBBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XICHInputs mInputs; // Inputs ... + + // + // Buffers ... + double tenkanSenBuffer[]; + double kijunSenBuffer[]; + double chikouSpanBuffer[]; + double senkouSpanABuffer[]; + double senkouSpanBBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + int calculatedBars = CountCalculatedBars(); + + // + // TenkanSen ... + CopyBuffer( + mHandler, + X_ICH_TEANKANSEN_LINE, + 0, + totalBars, + tenkanSenBuffer + // + ); + + // + // KijunSen ... + CopyBuffer( + mHandler, + X_ICH_KIJUNSEN_LINE, + 0, + totalBars, + kijunSenBuffer + // + ); + + // + // ChikouSpan ... + CopyBuffer( + mHandler, + X_ICH_CHIKOUSPAN_LINE, + 0, + totalBars, + chikouSpanBuffer + // + ); + + // + // SenkouSpan A ... + CopyBuffer( + mHandler, + X_ICH_SENKOUSPANA_LINE, + 0, + totalBars, + senkouSpanABuffer + // + ); + + // + // SenkouSpan B ... + CopyBuffer( + mHandler, + X_ICH_SENKOUSPANB_LINE, + 0, + totalBars, + senkouSpanBBuffer + // + ); + } +}; + +// +// Tools ... diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xlh.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xlh.helper.mq5 new file mode 100644 index 0000000..400407a --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xlh.helper.mq5 @@ -0,0 +1,422 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXLHHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XLH_BUFFERS +{ + XLH_HH_LINE = 0, + XLH_LL_LINE = 1, + XLH_SIGNAL_LINE = 2, +}; + +// +// Input Models ... +struct XLHInputs +{ + // + // Props ... + int length; // Length + ENUM_SERIESMODE hhMode; // Highest High Calculation Method + ENUM_SERIESMODE llMode; // Lowest Low Calculation Method + + // + // Constructor(s) ... + XLHInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + hhMode = MODE_HIGH; + llMode = MODE_LOW; + } + + // + // Default ... + void Default() + { + // + length = 14; + hhMode = MODE_HIGH; + llMode = MODE_LOW; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 2 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXLHHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXLHHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXLHHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XLHInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(hhBuffer, true); + ArraySetAsSeries(llBuffer, true); + ArraySetAsSeries(signalBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xlh", + // + // Inputs ... + mInputs.length, // Length + mInputs.hhMode, // Highest High Calculation Method + mInputs.llMode // Lowest Low Calculation Method + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XLHInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XLHInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(hhBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return hhBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + hhBuffer, + buffer, + forceClean + // + ); + } + + // + double GetLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(llBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return llBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + llBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSignal( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(signalBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return signalBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySignal( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + signalBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XLHInputs mInputs; // Inputs ... + + // + // Buffers ... + double hhBuffer[]; + double llBuffer[]; + double signalBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // HH ... + CopyBuffer( + mHandler, + XLH_HH_LINE, + 0, + totalBars, + hhBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XLH_LL_LINE, + 0, + totalBars, + llBuffer + // + ); + + // + // Signal ... + CopyBuffer( + mHandler, + XLH_SIGNAL_LINE, + 0, + totalBars, + signalBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmc.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmc.helper.mq5 new file mode 100644 index 0000000..0ec6a85 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmc.helper.mq5 @@ -0,0 +1,497 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXMCHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XMC_BUFFERS +{ + X_MC_FAST_LINE = 0, + X_MC_SLOW_LINE = 1, + X_MC_VERIFIER_LINE = 2, +}; + +// +// Input Models ... +struct XMCInputs +{ + // + // Props ... + + // + // Market ... + + // + // Fast ... + int fastLength; // Length + int fastShift; // Shift + ENUM_MA_METHOD fastMethod; // Method + ENUM_APPLIED_PRICE fastAppliedTo; // Applied To + + // + // Slow ... + int slowLength; // Length + int slowShift; // Shift + ENUM_MA_METHOD slowMethod; // Method + ENUM_APPLIED_PRICE slowAppliedTo; // Applied To + + // + // Verifier ... + int verifierLength; // Length + int verifierShift; // Shift + ENUM_MA_METHOD verifierMethod; // Method + ENUM_APPLIED_PRICE verifierAppliedTo; // Applied To + + // + // Presentation ... + bool showFastMa; // Show Fast + bool showSlowMa; // Show Slow + bool showVerifierMa; // Show Verifier + + // + // Constructor(s) ... + XMCInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + fastLength = 0; + fastShift = 0; + fastMethod = 0; + fastAppliedTo = PRICE_CLOSE; + + // + slowLength = 0; + slowShift = 0; + slowMethod = 0; + slowAppliedTo = PRICE_CLOSE; + + // + verifierLength = 0; + verifierShift = 0; + verifierMethod = 0; + verifierAppliedTo = PRICE_CLOSE; + + // + showFastMa = false; + showSlowMa = false; + showVerifierMa = false; + } + + // + // Default ... + void Default() + { + // + fastLength = 9; + fastShift = 0; + fastMethod = MODE_EMA; + fastAppliedTo = PRICE_CLOSE; + + // + slowLength = 18; + slowShift = 0; + slowMethod = MODE_EMA; + slowAppliedTo = PRICE_CLOSE; + + // + verifierLength = 200; + verifierShift = 0; + verifierMethod = MODE_EMA; + verifierAppliedTo = PRICE_CLOSE; + + // + showFastMa = true; + showSlowMa = true; + showVerifierMa = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + fastLength > 1 && + slowLength > fastLength && + verifierLength > slowLength + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(fastLength, slowLength); + result = MathMax(result, verifierLength); + + // + return result; + } +}; + +// +// Class ... +class XSCXMCHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXMCHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXMCHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XMCInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(fastBuffer, true); + ArraySetAsSeries(slowBuffer, true); + ArraySetAsSeries(verifierBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xmc", + // + // Inputs ... + // + // Fast ... + "", + mInputs.fastLength, + mInputs.fastShift, + mInputs.fastMethod, + mInputs.fastAppliedTo, + // + // Slow ... + "", + mInputs.slowLength, + mInputs.slowShift, + mInputs.slowMethod, + mInputs.slowAppliedTo, + // + // Verifier ... + "", + mInputs.verifierLength, + mInputs.verifierShift, + mInputs.verifierMethod, + mInputs.verifierAppliedTo, + // + // Presentation ... + "", + mInputs.showFastMa, // Show Fast, + mInputs.showSlowMa, // Show Slow, + mInputs.showVerifierMa // Show Verifier + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XMCInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XMCInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs); + } + + // + // Buffers ... + + // + // Fast ... + + // + double GetFast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return fastBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyFast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetSlow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return slowBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopySlow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + slowBuffer, + buffer, + forceClean + // + ); + } + + // + // Verifier ... + + // + double GetVerifier( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return verifierBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyVerifier( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + verifierBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XMCInputs mInputs; // Inputs ... + + // + // Buffers ... + // + double fastBuffer[]; + double slowBuffer[]; + double verifierBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + int calculatedBars = CountCalculatedBars(); + + // + // Fast ... + CopyBuffer( + mHandler, + X_MC_FAST_LINE, + 0, + totalBars, + fastBuffer + // + ); + + // + // Slow ... + CopyBuffer( + mHandler, + X_MC_SLOW_LINE, + 0, + totalBars, + slowBuffer + // + ); + + // + // Verifier ... + CopyBuffer( + mHandler, + X_MC_VERIFIER_LINE, + 0, + totalBars, + verifierBuffer + // + ); + } +}; + +// +// Tools ... diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmrb.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmrb.helper.mq5 new file mode 100644 index 0000000..78addb8 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xmrb.helper.mq5 @@ -0,0 +1,1411 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXMRBHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XMRB_BUFFERS +{ + // + // Ribbon ... + XMRB_FAST_LINE = 0, + XMRB_SLOW_LINE = 1, + // + // Ribbon 1 ... + XMRB_R1_FAST_LINE = 2, + XMRB_R1_SLOW_LINE = 3, + // + // Ribbon 2 ... + XMRB_R2_FAST_LINE = 4, + XMRB_R2_SLOW_LINE = 5, + // + // Ribbon 3 ... + XMRB_R3_FAST_LINE = 6, + XMRB_R3_SLOW_LINE = 7, + // + // Ribbon 4 ... + XMRB_R4_FAST_LINE = 8, + XMRB_R4_SLOW_LINE = 9, + // + // Ribbon 5 ... + XMRB_R5_FAST_LINE = 10, + XMRB_R5_SLOW_LINE = 11, + // + // Ribbon 5 ... + XMRB_R6_FAST_LINE = 12, + XMRB_R6_SLOW_LINE = 13, +}; + +// +// Input Models ... +struct XMRBInputs +{ + // + // Props ... + + // + // Ribbon 1 ... + int fast1Length; // Fast + int slow1Length; // Slow + ENUM_APPLIED_PRICE r1AppliedTo; // AppliedTo + + // + // Ribbon 2 ... + int fast2Length; // Fast + int slow2Length; // Slow + ENUM_APPLIED_PRICE r2AppliedTo; // AppliedTo + + // + // Ribbon 3 ... + int fast3Length; // Fast + int slow3Length; // Slow + ENUM_APPLIED_PRICE r3AppliedTo; // AppliedTo + + // + // Ribbon 4 ... + int fast4Length; // Fast + int slow4Length; // Slow + ENUM_APPLIED_PRICE r4AppliedTo; // AppliedTo + + // + // Ribbon 5 ... + int fast5Length; // Fast + int slow5Length; // Slow + ENUM_APPLIED_PRICE r5AppliedTo; // AppliedTo + + // + // Ribbon 6 ... + int fast6Length; // Fast + int slow6Length; // Slow + ENUM_APPLIED_PRICE r6AppliedTo; // AppliedTo + + // + // Calculation ... + ENUM_MA_METHOD ribbonMode; // Mode + + // + // Presentation ... + bool showFastMa; // Show Fast + bool showSlowMa; // Show Slow + bool showRibbon; // Show Ribbon + + // + // Constructor(s) ... + XMRBInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Ribbon 1 ... + fast1Length = 0; // Fast + slow1Length = 0; // Slow + r1AppliedTo = PRICE_HIGH; // AppliedTo + + // + // Ribbon 2 ... + fast2Length = 0; // Fast + slow2Length = 0; // Slow + r2AppliedTo = PRICE_OPEN; // AppliedTo + + // + // Ribbon 3 ... + fast3Length = 0; // Fast + slow3Length = 0; // Slow + r3AppliedTo = PRICE_CLOSE; // AppliedTo + + // + // Ribbon 4 ... + fast4Length = 0; // Fast + slow4Length = 0; // Slow + r4AppliedTo = PRICE_MEDIAN; // AppliedTo + + // + // Ribbon 5 ... + fast5Length = 0; // Fast + slow5Length = 0; // Slow + r5AppliedTo = PRICE_TYPICAL; // AppliedTo + + // + // Ribbon 6 ... + fast6Length = 0; // Fast + slow6Length = 0; // Slow + r6AppliedTo = PRICE_LOW; // AppliedTo + + // + // Calculation ... + ribbonMode = MODE_EMA; // Mode + + // + // Presentation ... + showFastMa = false; // Show Fast + showSlowMa = false; // Show Slow + showRibbon = false; // Show Ribbon + } + + // + // Default ... + void Default() + { + // + // Ribbon 1 ... + fast1Length = 20; // Fast + slow1Length = 50; // Slow + r1AppliedTo = PRICE_HIGH; // AppliedTo + + // + // Ribbon 2 ... + fast2Length = 20; // Fast + slow2Length = 50; // Slow + r2AppliedTo = PRICE_OPEN; // AppliedTo + + // + // Ribbon 3 ... + fast3Length = 20; // Fast + slow3Length = 50; // Slow + r3AppliedTo = PRICE_CLOSE; // AppliedTo + + // + // Ribbon 4 ... + fast4Length = 20; // Fast + slow4Length = 50; // Slow + r4AppliedTo = PRICE_MEDIAN; // AppliedTo + + // + // Ribbon 5 ... + fast5Length = 20; // Fast + slow5Length = 50; // Slow + r5AppliedTo = PRICE_TYPICAL; // AppliedTo + + // + // Ribbon 6 ... + fast6Length = 20; // Fast + slow6Length = 50; // Slow + r6AppliedTo = PRICE_LOW; // AppliedTo + + // + // Calculation ... + ribbonMode = MODE_EMA; // Mode + + // + // Presentation ... + showFastMa = true; // Show Fast + showSlowMa = true; // Show Slow + showRibbon = false; // Show Ribbon + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + (fast1Length > 2 && + fast2Length > 2 && + fast3Length > 2 && + fast4Length > 2 && + fast5Length > 2 && + fast6Length > 2 && + slow1Length > fast1Length && + slow2Length > fast2Length && + slow3Length > fast3Length && + slow4Length > fast4Length && + slow5Length > fast5Length && + slow6Length > fast6Length + // + ) + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(fast1Length, fast2Length); + result = MathMax(result, fast3Length); + result = MathMax(result, fast4Length); + result = MathMax(result, fast5Length); + result = MathMax(result, fast6Length); + + // + result = MathMax(result, slow1Length); + result = MathMax(result, slow2Length); + result = MathMax(result, slow3Length); + result = MathMax(result, slow4Length); + result = MathMax(result, slow5Length); + result = MathMax(result, slow6Length); + + // + return result; + } +}; + +// +// Class ... +class XSCXMRBHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXMRBHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXMRBHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XMRBInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(fastBuffer, true); + ArraySetAsSeries(slowBuffer, true); + ArraySetAsSeries(r1FastBuffer, true); + ArraySetAsSeries(r1SlowBuffer, true); + ArraySetAsSeries(r2FastBuffer, true); + ArraySetAsSeries(r2SlowBuffer, true); + ArraySetAsSeries(r3FastBuffer, true); + ArraySetAsSeries(r3SlowBuffer, true); + ArraySetAsSeries(r4FastBuffer, true); + ArraySetAsSeries(r4SlowBuffer, true); + ArraySetAsSeries(r5FastBuffer, true); + ArraySetAsSeries(r5SlowBuffer, true); + ArraySetAsSeries(r6FastBuffer, true); + ArraySetAsSeries(r6SlowBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xmrb", + // + // Inputs ... + // + // Ribbon 1 ... + "", + mInputs.fast1Length, // Fast + mInputs.slow1Length, // Slow + mInputs.r1AppliedTo, // AppliedTo + // + // Ribbon 2 ... + "", + mInputs.fast2Length, // Fast + mInputs.slow2Length, // Slow + mInputs.r2AppliedTo, // AppliedTo + // + // Ribbon 3 ... + "", + mInputs.fast3Length, // Fast + mInputs.slow3Length, // Slow + mInputs.r3AppliedTo, // AppliedTo + // + // Ribbon 4 ... + "", + mInputs.fast4Length, // Fast + mInputs.slow4Length, // Slow + mInputs.r4AppliedTo, // AppliedTo + // + // Ribbon 5 ... + "", + mInputs.fast5Length, // Fast + mInputs.slow5Length, // Slow + mInputs.r5AppliedTo, // AppliedTo + // + // Ribbon 6 ... + "", + mInputs.fast6Length, // Fast + mInputs.slow6Length, // Slow + mInputs.r6AppliedTo, // AppliedTo + // + // Calculation ... + "", + mInputs.ribbonMode, // Mode + // + // Presentation ... + "", + mInputs.showFastMa, // Show Fast + mInputs.showSlowMa, // Show Slow + mInputs.showRibbon // Show Ribbon + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XMRBInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XMRBInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + // Fast ... + + // + double GetFast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(fastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return fastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetSlow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(slowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return slowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySlow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + slowBuffer, + buffer, + forceClean + // + ); + } + + // + // Ribbon 1 ... + + // + // Fast ... + + // + double GetR1Fast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r1FastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r1FastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR1Fast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r1FastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetR1Slow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r1SlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r1SlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR1Slow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r1SlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Ribbon 2 ... + + // + // Fast ... + + // + double GetR2Fast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r2FastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r2FastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR2Fast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r2FastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetR2Slow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r2SlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r2SlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR2Slow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r2SlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Ribbon 3 ... + + // + // Fast ... + + // + double GetR3Fast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r3FastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r3FastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR3Fast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r3FastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetR3Slow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r3SlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r3SlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR3Slow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r3SlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Ribbon 4 ... + + // + // Fast ... + + // + double GetR4Fast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r4FastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r4FastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR4Fast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r4FastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetR4Slow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r4SlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r4SlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR4Slow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r4SlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Ribbon 5 ... + + // + // Fast ... + + // + double GetR5Fast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r5FastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r5FastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR5Fast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r5FastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetR5Slow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r5SlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r5SlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR5Slow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r5SlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Ribbon 6 ... + + // + // Fast ... + + // + double GetR6Fast( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r6FastBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r6FastBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR6Fast( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r6FastBuffer, + buffer, + forceClean + // + ); + } + + // + // Slow ... + + // + double GetR6Slow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(r6SlowBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return r6SlowBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyR6Slow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + r6SlowBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XMRBInputs mInputs; // Inputs ... + + // + // Buffers ... + double fastBuffer[]; + double slowBuffer[]; + double r1FastBuffer[]; + double r1SlowBuffer[]; + double r2FastBuffer[]; + double r2SlowBuffer[]; + double r3FastBuffer[]; + double r3SlowBuffer[]; + double r4FastBuffer[]; + double r4SlowBuffer[]; + double r5FastBuffer[]; + double r5SlowBuffer[]; + double r6FastBuffer[]; + double r6SlowBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_FAST_LINE, + 0, + totalBars, + fastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_SLOW_LINE, + 0, + totalBars, + slowBuffer + // + ); + + // + // Ribbon 1 ... + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_R1_FAST_LINE, + 0, + totalBars, + r1FastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_R1_SLOW_LINE, + 0, + totalBars, + r1SlowBuffer + // + ); + + // + // Ribbon 2 ... + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_R2_FAST_LINE, + 0, + totalBars, + r2FastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_R2_SLOW_LINE, + 0, + totalBars, + r2SlowBuffer + // + ); + + // + // Ribbon 3 ... + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_R3_FAST_LINE, + 0, + totalBars, + r3FastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_R3_SLOW_LINE, + 0, + totalBars, + r3SlowBuffer + // + ); + + // + // Ribbon 4 ... + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_R4_FAST_LINE, + 0, + totalBars, + r4FastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_R4_SLOW_LINE, + 0, + totalBars, + r4SlowBuffer + // + ); + + // + // Ribbon 5 ... + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_R5_FAST_LINE, + 0, + totalBars, + r5FastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_R5_SLOW_LINE, + 0, + totalBars, + r5SlowBuffer + // + ); + + // + // Ribbon 6 ... + + // + // Fast Buffer ... + CopyBuffer( + mHandler, + XMRB_R6_FAST_LINE, + 0, + totalBars, + r6FastBuffer + // + ); + + // + // Slow Buffer ... + CopyBuffer( + mHandler, + XMRB_R6_SLOW_LINE, + 0, + totalBars, + r6SlowBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xobd.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xobd.helper.mq5 new file mode 100644 index 0000000..03957cb --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xobd.helper.mq5 @@ -0,0 +1,306 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXOBDHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XOBD_BUFFERS +{ + XOBD_MAIN_LINE = 0 +}; + +// +// Input Models ... +struct XOBDInputs +{ + // + // Props ... + + // + int length; // Swing Length + + // + uchar swingHighArrowCode; // Swing High Arrow Code + color swingHighArrowColor; // Swing High Arrow Color + + // + uchar swingLowArrowCode; // Swing Low Arrow Code + color swingLowArrowColor; // Swing Low Arrow Color + + // + // Constructor(s) ... + XOBDInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + swingHighArrowCode = 0; + swingHighArrowColor = CLR_NONE; + swingLowArrowCode = 0; + swingLowArrowColor = CLR_NONE; + } + + // + // Default ... + void Default() + { + // + length = 5; + swingHighArrowCode = 0; + swingHighArrowColor = CLR_NONE; + swingLowArrowCode = 0; + swingLowArrowColor = CLR_NONE; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 3 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXOBDHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXOBDHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXOBDHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XOBDInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(mainBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xobd", + // + // Inputs ... + mInputs.length, // Swing Length + mInputs.swingHighArrowCode, // Swing High Arrow Code + mInputs.swingHighArrowColor, // Swing High Arrow Color + mInputs.swingLowArrowCode, // Swing Low Arrow Code + mInputs.swingLowArrowColor // Swing Low Arrow Color + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XOBDInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XOBDInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetMain( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mainBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mainBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMain( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mainBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XOBDInputs mInputs; // Inputs ... + + // + // Buffers ... + double mainBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Main ... + CopyBuffer( + mHandler, + XOBD_MAIN_LINE, + 0, + totalBars, + mainBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xosc.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xosc.helper.mq5 new file mode 100644 index 0000000..20f738e --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xosc.helper.mq5 @@ -0,0 +1,1321 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXOSCHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XOSC_BUFFERS +{ + X_OSC_ATR_LINE = 0, + X_OSC_RVI_MAIN_LINE = 1, + X_OSC_RVI_SIGNAL_LINE = 2, + X_OSC_BULL_POWER_LINE = 3, + X_OSC_BEAR_POWER_LINE = 4, + X_OSC_VOLUME_LINE = 5, + X_OSC_RSI_LINE = 6, + X_OSC_CCI_LINE = 7, + X_OSC_MOMENTUM_LINE = 8, + X_OSC_SAR_LINE = 9, + X_OSC_MACD_MAIN_LINE = 10, + X_OSC_MACD_SIGNAL_LINE = 11, + X_OSC_STOCH_MAIN_LINE = 12, + X_OSC_STOCH_SIGNAL_LINE = 13, + X_OSC_STDDEV_LINE = 14, +}; + +// +// Input Models ... +struct XOSCInputs +{ + // + // Props ... + + // + // ATR ... + int atrLength; // Length + + // + // RVI ... + int rviLength; // Length + + // + // BULLPOWER ... + int bullpLength; // Length + + // + // BEARPOWER ... + int bearpLength; // Length + + // + // VOLUME ... + ENUM_APPLIED_VOLUME volumeAppliedTo; // Applied To + + // + // RSI ... + int rsiLength; // Length + ENUM_APPLIED_PRICE rsiAppliedTo; // Applied To + + // + // CCI ... + int cciLength; // Length + ENUM_APPLIED_PRICE cciAppliedTo; // Applied To + + // + // STDDEV ... + int stddevLength; // Length + int stddevShift; // Shift + ENUM_MA_METHOD stddevMethod; // Mode + ENUM_APPLIED_PRICE stddevAppliedTo; // AppliedTo + + // + // MOMENTUM ... + int momentumLength; // Length + ENUM_APPLIED_PRICE momentumAppliedTo; // Applied To + + // + // SAR ... + double sarStep; // Step + double sarMaximum; // Maximum + + // + // MACD ... + int macdFastLength; // Fast Length + int macdSlowLength; // Slow Length + int macdSignaLength; // Signal Length + ENUM_APPLIED_PRICE macdAppliedTo; // Applied To + + // + // STOCHASTIC ... + // The buffer numbers: 0 - MAIN_LINE, 1 - SIGNAL_LINE. + int stochKLength; // K Length + int stochDLength; // D Length + int stochSlowing; // Slowing + ENUM_MA_METHOD stochMaMethod; // Ma Method + ENUM_STO_PRICE stochMode; // Calculation Mode + + // + // Constructor(s) ... + XOSCInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + atrLength = 0; // Length + rviLength = 0; // Length + bullpLength = 0; // Length + bearpLength = 0; // Length + volumeAppliedTo = VOLUME_TICK; // Applied To + rsiLength = 0; // Length + rsiAppliedTo = PRICE_CLOSE; // Applied To + cciLength = 0; // Length + cciAppliedTo = PRICE_TYPICAL; // Applied To + stddevLength = 0; // Length + stddevShift = 0; // Shift + stddevMethod = MODE_SMA; // Mode + stddevAppliedTo = PRICE_CLOSE; // AppliedTo + momentumLength = 0; // Length + momentumAppliedTo = PRICE_CLOSE; // Applied To + sarStep = 0; // Step + sarMaximum = 0; // Maximum + macdFastLength = 0; // Fast Length + macdSlowLength = 0; // Slow Length + macdSignaLength = 0; // Signal Length + macdAppliedTo = PRICE_CLOSE; // Applied To + stochKLength = 0; // K Length + stochDLength = 0; // D Length + stochSlowing = 0; // Slowing + stochMaMethod = MODE_SMA; // Ma Method + stochMode = STO_LOWHIGH; // Calculation Mode + } + + // + // Default ... + void Default() + { + // + atrLength = 14; // Length + rviLength = 10; // Length + bullpLength = 13; // Length + bearpLength = 13; // Length + volumeAppliedTo = VOLUME_TICK; // Applied To + rsiLength = 14; // Length + rsiAppliedTo = PRICE_CLOSE; // Applied To + cciLength = 14; // Length + cciAppliedTo = PRICE_TYPICAL; // Applied To + stddevLength = 20; // Length + stddevShift = 0; // Shift + stddevMethod = MODE_SMA; // Mode + stddevAppliedTo = PRICE_CLOSE; // AppliedTo + momentumLength = 14; // Length + momentumAppliedTo = PRICE_CLOSE; // Applied To + sarStep = 0.02; // Step + sarMaximum = 0.2; // Maximum + macdFastLength = 12; // Fast Length + macdSlowLength = 26; // Slow Length + macdSignaLength = 9; // Signal Length + macdAppliedTo = PRICE_CLOSE; // Applied To + stochKLength = 5; // K Length + stochDLength = 3; // D Length + stochSlowing = 3; // Slowing + stochMaMethod = MODE_SMA; // Ma Method + stochMode = STO_LOWHIGH; // Calculation Mode + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + atrLength >= 2 && + rviLength >= 2 && + bullpLength >= 2 && + bearpLength >= 2 && + rsiLength >= 2 && + cciLength >= 2 && + momentumLength >= 2 && + sarStep > 0 && + sarStep < sarMaximum && + macdFastLength >= 2 && + macdSlowLength > macdFastLength && + macdSignaLength >= 2 && + stochKLength >= 2 && + stochDLength >= 2 && + stochSlowing >= 2 && + stddevLength >= 2 && + stddevShift >= 0 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(atrLength, rviLength); + result = MathMax(result, bullpLength); + result = MathMax(result, bearpLength); + result = MathMax(result, rsiLength); + result = MathMax(result, cciLength); + result = MathMax(result, momentumLength); + result = MathMax(result, macdFastLength); + result = MathMax(result, macdSlowLength); + result = MathMax(result, macdSignaLength); + result = MathMax(result, stochKLength); + result = MathMax(result, stochDLength); + result = MathMax(result, stochSlowing); + result = MathMax(result, stddevLength); + + // + return result; + } +}; + +// +// Class ... +class XSCXOSCHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXOSCHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXOSCHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XOSCInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(atrBuffer, true); + ArraySetAsSeries(rviMainBuffer, true); + ArraySetAsSeries(rviSignalBuffer, true); + ArraySetAsSeries(bullPBuffer, true); + ArraySetAsSeries(bearPBuffer, true); + ArraySetAsSeries(volumeBuffer, true); + ArraySetAsSeries(rsiBuffer, true); + ArraySetAsSeries(cciBuffer, true); + ArraySetAsSeries(momentumBuffer, true); + ArraySetAsSeries(sarBuffer, true); + ArraySetAsSeries(macdMainBuffer, true); + ArraySetAsSeries(macdSignalBuffer, true); + ArraySetAsSeries(stochMainBuffer, true); + ArraySetAsSeries(stochSignalBuffer, true); + ArraySetAsSeries(stddevBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xosc", + // + // Inputs ... + // + // ATR ... + "", + mInputs.atrLength, + // + // RVI ... + "", + mInputs.rviLength, + // + // Bulls Power ... + "", + mInputs.bullpLength, + // + // Bears Power ... + "", + mInputs.bearpLength, + // + // Voluem ... + "", + mInputs.volumeAppliedTo, + // + // RSI ... + "", + mInputs.rsiLength, + mInputs.rsiAppliedTo, + // + // CCI ... + "", + mInputs.cciLength, + mInputs.cciAppliedTo, + // + // STDDev ... + "", + mInputs.stddevLength, + mInputs.stddevShift, + mInputs.stddevMethod, + mInputs.stddevAppliedTo, + // + // Momentum ... + "", + mInputs.momentumLength, + mInputs.momentumAppliedTo, + // + // SAR ... + "", + mInputs.sarStep, + mInputs.sarMaximum, + // + // MACD ... + "", + mInputs.macdFastLength, + mInputs.macdSlowLength, + mInputs.macdSignaLength, + mInputs.macdAppliedTo, + // + // Stochastic ... + "", + mInputs.stochKLength, + mInputs.stochDLength, + mInputs.stochSlowing, + mInputs.stochMaMethod, + mInputs.stochMode + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XOSCInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XOSCInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs); + } + + // + // Buffers ... + + // + // ATR ... + + // + double GetATR( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return atrBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyATR( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + atrBuffer, + buffer, + forceClean + // + ); + } + + // + // RVI ... + + // + double GetRVI( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return rviMainBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyRVI( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + rviMainBuffer, + buffer, + forceClean + // + ); + } + + // + double GetRVISignal( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return rviSignalBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyRVISignal( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + rviSignalBuffer, + buffer, + forceClean + // + ); + } + + // + // BULLP ... + + // + double GetBullPower( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return bullPBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyBullPower( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + bullPBuffer, + buffer, + forceClean + // + ); + } + + // + // BEARP ... + + // + double GetBearPower( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return bearPBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyBearPower( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + bearPBuffer, + buffer, + forceClean + // + ); + } + + // + // VOLUME ... + + // + double GetVolume( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return volumeBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyVolume( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + volumeBuffer, + buffer, + forceClean + // + ); + } + + // + // RSI ... + + // + double GetRSI( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return rsiBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyRSI( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + rsiBuffer, + buffer, + forceClean + // + ); + } + + // + // CCI ... + + // + double GetCCI( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return cciBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyCCI( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + cciBuffer, + buffer, + forceClean + // + ); + } + + // + // MOMENTUM ... + + // + double GetMomentum( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return momentumBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyMomentum( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + momentumBuffer, + buffer, + forceClean + // + ); + } + + // + // SAR ... + + // + double GetSAR( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return sarBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopySAR( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + sarBuffer, + buffer, + forceClean + // + ); + } + + // + // STDDEV ... + + // + double GetSTDDEV( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return stddevBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopySTDDEV( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + stddevBuffer, + buffer, + forceClean + // + ); + } + + // + // MACD ... + + // + double GetMACD( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return macdMainBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyMACD( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + macdMainBuffer, + buffer, + forceClean + // + ); + } + + // + double GetMACDSignal( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return macdSignalBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyMACDSignal( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + macdSignalBuffer, + buffer, + forceClean + // + ); + } + + // + // STOCH ... + + // + double GetSTOCH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return stochMainBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopySTOCH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + stochMainBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSTOCHSignal( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return stochSignalBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopySTOCHSignal( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + stochSignalBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XOSCInputs mInputs; // Inputs ... + + // + // Buffers ... + double atrBuffer[]; + double rviMainBuffer[]; + double rviSignalBuffer[]; + double bullPBuffer[]; + double bearPBuffer[]; + double volumeBuffer[]; + double rsiBuffer[]; + double cciBuffer[]; + double momentumBuffer[]; + double sarBuffer[]; + double macdMainBuffer[]; + double macdSignalBuffer[]; + double stochMainBuffer[]; + double stochSignalBuffer[]; + double stddevBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + int calculatedBars = CountCalculatedBars(); + + // + // ATR ... + CopyBuffer( + mHandler, + X_OSC_ATR_LINE, + 0, + totalBars, + atrBuffer + // + ); + + // + // BULLP ... + CopyBuffer( + mHandler, + X_OSC_BULL_POWER_LINE, + 0, + totalBars, + bullPBuffer + // + ); + + // + // BEARP ... + CopyBuffer( + mHandler, + X_OSC_BEAR_POWER_LINE, + 0, + totalBars, + bearPBuffer + // + ); + + // + // VOLUME ... + CopyBuffer( + mHandler, + X_OSC_VOLUME_LINE, + 0, + totalBars, + volumeBuffer + // + ); + + // + // RSI ... + CopyBuffer( + mHandler, + X_OSC_RSI_LINE, + 0, + totalBars, + rsiBuffer + // + ); + + // + // CCI ... + CopyBuffer( + mHandler, + X_OSC_CCI_LINE, + 0, + totalBars, + cciBuffer + // + ); + + // + // MOMENTUM ... + CopyBuffer( + mHandler, + X_OSC_MOMENTUM_LINE, + 0, + totalBars, + momentumBuffer + // + ); + + // + // SAR ... + CopyBuffer( + mHandler, + X_OSC_SAR_LINE, + 0, + totalBars, + sarBuffer + // + ); + + // + // STDDEV ... + CopyBuffer( + mHandler, + X_OSC_STDDEV_LINE, + 0, + totalBars, + stddevBuffer + // + ); + + // + // RVI ... + + // + // RVI Main ... + CopyBuffer( + mHandler, + X_OSC_RVI_MAIN_LINE, + 0, + totalBars, + rviMainBuffer + // + ); + + // + // RVI Signal ... + CopyBuffer( + mHandler, + X_OSC_RVI_SIGNAL_LINE, + 0, + totalBars, + rviSignalBuffer + // + ); + + // + // MACD ... + + // + // MACD Main ... + CopyBuffer( + mHandler, + X_OSC_MACD_MAIN_LINE, + 0, + totalBars, + macdMainBuffer + // + ); + + // + // MACD Signal ... + CopyBuffer( + mHandler, + X_OSC_MACD_SIGNAL_LINE, + 0, + totalBars, + macdSignalBuffer + // + ); + + // + // STOCH ... + + // + // STOCH Main ... + CopyBuffer( + mHandler, + X_OSC_STOCH_MAIN_LINE, + 0, + totalBars, + stochMainBuffer + // + ); + + // + // STOCH Signal ... + CopyBuffer( + mHandler, + X_OSC_STOCH_SIGNAL_LINE, + 0, + totalBars, + stochSignalBuffer + // + ); + } +}; + +// +// Tools ... diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xpv.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xpv.helper.mq5 new file mode 100644 index 0000000..b78b183 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xpv.helper.mq5 @@ -0,0 +1,1870 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXPVHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XPV_BUFFERS +{ + // + // Peaks and Vales ... + XPV_PEAKS_LINE = 0, + XPV_VALES_LINE = 1, + // + // Support and Resistances ... + XPV_RESISTANCE_LINE = 2, + XPV_SUPPORT_LINE = 4, + // + // Fibonacci ... + XPV_FIB_1_LINE = 6, + XPV_FIB_2_LINE = 8, + XPV_FIB_3_LINE = 10, + XPV_FIB_4_LINE = 12, + XPV_FIB_5_LINE = 14, + // + // Short ... + XPV_SC_HH_LINE = 16, + XPV_SC_LL_LINE = 18, + // + // Medium ... + XPV_MC_HH_LINE = 20, + XPV_MC_LL_LINE = 22, + // + // Long ... + XPV_LC_HH_LINE = 24, + XPV_LC_LL_LINE = 26, + // + // Hind ... + XPV_HC_HH_LINE = 28, + XPV_HC_LL_LINE = 30, +}; + +// +// Input Models ... +struct XPVInputs +{ + // + // Props ... + + // + // Makret Cycles ... + + // + // Short ... + ENUM_X_PERIOD_METHOD scMethod; // How to Find Period + ENUM_TIMEFRAMES scPeriod; // Time Period + + // + // Medium ... + ENUM_X_PERIOD_METHOD mcMethod; // How to Find Period + ENUM_TIMEFRAMES mcPeriod; // Time Period + + // + // Long ... + ENUM_X_PERIOD_METHOD lcMethod; // How to Find Period + ENUM_TIMEFRAMES lcPeriod; // Time Period + + // + // Hind ... + ENUM_X_PERIOD_METHOD hcMethod; // How to Find Period + ENUM_TIMEFRAMES hcPeriod; // Time Period + + // + // Fibonacci ... + double fiboLevel1; // Fibio 1st Level + double fiboLevel2; // Fibio 2st Level + double fiboLevel3; // Fibio 3rd Level + double fiboLevel4; // Fibio 4th Level + double fiboLevel5; // Fibio 5th Level + + // + // Boundary Detection Modes ... + ENUM_SERIESMODE hhMode; // Highest High Calculation Method + ENUM_SERIESMODE llMode; // Lowest Low Calculation Method + + // + // Presentation ... + bool showPeaksAndVales; // Show Peaks and Vales + bool showLevels; // Show Levels + bool showConsolidations; // Show Consolidations + bool showFibo1Levels; // Show Fibo 1st Level + bool showFibo2Levels; // Show Fibo 2nd Level + bool showFibo3Levels; // Show Fibo 3rd Level + bool showFibo4Levels; // Show Fibo 4th Level + bool showFibo5Levels; // Show Fibo 5th Level + + // + // Constructor(s) ... + XPVInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Makret Cycles ... + + // + // Short ... + scMethod = X_PERIOD_NOTHING; + scPeriod = NULL; + + // + // Medium ... + mcMethod = X_PERIOD_NOTHING; + mcPeriod = NULL; + + // + // Long ... + lcMethod = X_PERIOD_NOTHING; + lcPeriod = NULL; + + // + // Hind ... + hcMethod = X_PERIOD_NOTHING; + hcPeriod = NULL; + + // + // Fibonacci ... + fiboLevel1 = 0; + fiboLevel2 = 0; + fiboLevel3 = 0; + fiboLevel4 = 0; + fiboLevel5 = 0; + + // + // Boundary Detection Modes ... + hhMode = MODE_HIGH; + llMode = MODE_LOW; + + // + // Presentation ... + showPeaksAndVales = false; + showLevels = false; + showConsolidations = false; + showFibo1Levels = false; + showFibo2Levels = false; + showFibo3Levels = false; + showFibo4Levels = false; + showFibo5Levels = false; + } + + // + // Default ... + void Default() + { + // + // Makret Cycles ... + + // + // Short ... + scMethod = X_PERIOD_AUTO; + scPeriod = NULL; + + // + // Medium ... + mcMethod = X_PERIOD_AUTO; + mcPeriod = NULL; + + // + // Long ... + lcMethod = X_PERIOD_AUTO; + lcPeriod = NULL; + + // + // Hind ... + hcMethod = X_PERIOD_AUTO; + hcPeriod = NULL; + + // + // Fibonacci ... + fiboLevel1 = 0.236; + fiboLevel2 = 0.382; + fiboLevel3 = 0.5; + fiboLevel4 = 0.618; + fiboLevel5 = 0.764; + + // + // Boundary Detection Modes ... + hhMode = MODE_HIGH; + llMode = MODE_LOW; + + // + // Presentation ... + showPeaksAndVales = true; + showLevels = false; + showConsolidations = false; + showFibo1Levels = true; + showFibo2Levels = true; + showFibo3Levels = true; + showFibo4Levels = true; + showFibo5Levels = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(scMethod, scPeriod) && + IsValid(mcMethod, mcPeriod) && + IsValid(lcMethod, lcPeriod) && + IsValid(hcMethod, hcPeriod) + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, 0); + + // + return result; + } +}; + +// +// Class ... +class XSCXPVHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXPVHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXPVHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XPVInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(peaksBuffer, true); + ArraySetAsSeries(valesBuffer, true); + ArraySetAsSeries(resistanceBuffer, true); + ArraySetAsSeries(supportBuffer, true); + ArraySetAsSeries(fib1Buffer, true); + ArraySetAsSeries(fib2Buffer, true); + ArraySetAsSeries(fib3Buffer, true); + ArraySetAsSeries(fib4Buffer, true); + ArraySetAsSeries(fib5Buffer, true); + ArraySetAsSeries(scHHBuffer, true); + ArraySetAsSeries(scLLBuffer, true); + ArraySetAsSeries(mcHHBuffer, true); + ArraySetAsSeries(mcLLBuffer, true); + ArraySetAsSeries(lcHHBuffer, true); + ArraySetAsSeries(lcLLBuffer, true); + ArraySetAsSeries(hcHHBuffer, true); + ArraySetAsSeries(hcLLBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xpv", + // + // Inputs ... + // + // Makret Cycles ... + "", + // + // Short ... + "", + mInputs.scMethod, // How to Find Period + mInputs.scPeriod, // Time Period + // + // Medium ... + "", + mInputs.mcMethod, // How to Find Period + mInputs.mcPeriod, // Time Period + // + // Long ... + "", + mInputs.lcMethod, // How to Find Period + mInputs.lcPeriod, // Time Period + // + // Hind ... + "", + mInputs.hcMethod, // How to Find Period + mInputs.hcPeriod, // Time Period + // + // Fibonacci ... + "", + mInputs.fiboLevel1, // Fibio 1st Level + mInputs.fiboLevel2, // Fibio 2st Level + mInputs.fiboLevel3, // Fibio 3rd Level + mInputs.fiboLevel4, // Fibio 4th Level + mInputs.fiboLevel5, // Fibio 5th Level + // + // Boundary Detection Modes ... + "", + mInputs.hhMode, // Highest High Calculation Method + mInputs.llMode, // Lowest Low Calculation Method + // + // Presentation ... + "", + mInputs.showPeaksAndVales, // Show Peaks and Vales + mInputs.showLevels, // Show Levels + mInputs.showConsolidations, // Show Consolidations + mInputs.showFibo1Levels, // Show Fibo 1st Level + mInputs.showFibo2Levels, // Show Fibo 2nd Level + mInputs.showFibo3Levels, // Show Fibo 3rd Level + mInputs.showFibo4Levels, // Show Fibo 4th Level + mInputs.showFibo5Levels // Show Fibo 5th Level + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XPVInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XPVInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + // Peaks ... + + // + double GetPeak( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(peaksBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return peaksBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyPeak( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + peaksBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSamePeak( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + peaksBuffer, + verifier, + barIndex // + ); + } + + // + // Vales ... + + // + double GetVale( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(valesBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return valesBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyVale( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + valesBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameVale( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + valesBuffer, + verifier, + barIndex // + ); + } + + // + // Resistance ... + + // + double GetResistance( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(resistanceBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return resistanceBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyResistance( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + resistanceBuffer, + buffer, + forceClean + // + ); + } + + // + // Support ... + + // + double GetSupport( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(supportBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return supportBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySupport( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + supportBuffer, + buffer, + forceClean + // + ); + } + + // + // Fibonacci ... + + // + // Level 1 ... + + // + double GetFib1( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(fib1Buffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return fib1Buffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFib1( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fib1Buffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameFib1( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + fib1Buffer, + verifier, + barIndex // + ); + } + + // + // Level 2 ... + + // + double GetFib2( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(fib2Buffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return fib2Buffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFib2( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fib2Buffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameFib2( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + fib2Buffer, + verifier, + barIndex // + ); + } + + // + // Level 3 ... + + // + double GetFib3( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(fib3Buffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return fib3Buffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFib3( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fib3Buffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameFib3( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + fib3Buffer, + verifier, + barIndex // + ); + } + + // + // Level 4 ... + + // + double GetFib4( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(fib4Buffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return fib4Buffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFib4( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fib4Buffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameFib4( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + fib4Buffer, + verifier, + barIndex // + ); + } + + // + // Level 5 ... + + // + double GetFib5( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(fib5Buffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return fib5Buffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFib5( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + fib5Buffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameFib5( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + fib5Buffer, + verifier, + barIndex // + ); + } + + // + // Cycles ... + + // + // Short ... + + // + // HH ... + + // + double GetSCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(scHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return scHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + scHHBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameSCHH( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + scHHBuffer, + verifier, + barIndex // + ); + } + + // + // LL ... + + // + double GetSCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(scLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return scLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + scLLBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameSCLL( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + scLLBuffer, + verifier, + barIndex // + ); + } + + // + // Medium ... + + // + // HH ... + + // + double GetMCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mcHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mcHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mcHHBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameMCHH( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + mcHHBuffer, + verifier, + barIndex // + ); + } + + // + // LL ... + + // + double GetMCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mcLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mcLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mcLLBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameMCLL( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + mcLLBuffer, + verifier, + barIndex // + ); + } + + // + // Long ... + + // + // HH ... + + // + double GetLCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lcHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lcHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lcHHBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameLCHH( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + lcHHBuffer, + verifier, + barIndex // + ); + } + + // + // LL ... + + // + double GetLCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lcLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lcLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lcLLBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameLCLL( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + lcLLBuffer, + verifier, + barIndex // + ); + } + + // + // Hind ... + + // + // HH ... + + // + double GetHCHH( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(hcHHBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return hcHHBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHCHH( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + hcHHBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameHCHH( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + hcHHBuffer, + verifier, + barIndex // + ); + } + + // + // LL ... + + // + double GetHCLL( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(hcLLBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return hcLLBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHCLL( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + hcLLBuffer, + buffer, + forceClean + // + ); + } + + // + bool IsSameHCLL( + int barIndex, // Start Bar Index + int verifier = 71 // Number of Verifiers + ) + { + // + // Update Calculations ... + Calculate(); + + // + return IsSame( + hcLLBuffer, + verifier, + barIndex // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XPVInputs mInputs; // Inputs ... + + // + // Buffers ... + double peaksBuffer[]; + double valesBuffer[]; + double resistanceBuffer[]; + double supportBuffer[]; + double fib1Buffer[]; + double fib2Buffer[]; + double fib3Buffer[]; + double fib4Buffer[]; + double fib5Buffer[]; + double scHHBuffer[]; + double scLLBuffer[]; + double mcHHBuffer[]; + double mcLLBuffer[]; + double lcHHBuffer[]; + double lcLLBuffer[]; + double hcHHBuffer[]; + double hcLLBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Peaks and Vales ... + + // + // Peaks Buffer ... + CopyBuffer( + mHandler, + XPV_PEAKS_LINE, + 0, + totalBars, + peaksBuffer + // + ); + + // + // Vales Buffer ... + CopyBuffer( + mHandler, + XPV_VALES_LINE, + 0, + totalBars, + valesBuffer + // + ); + + // + // Support and Resistances ... + + // + // Resistances Buffer ... + CopyBuffer( + mHandler, + XPV_RESISTANCE_LINE, + 0, + totalBars, + resistanceBuffer + // + ); + + // + // Supports Buffer ... + CopyBuffer( + mHandler, + XPV_SUPPORT_LINE, + 0, + totalBars, + supportBuffer + // + ); + + // + // Fibonacci ... + + // + // Level 1 Buffer ... + CopyBuffer( + mHandler, + XPV_FIB_1_LINE, + 0, + totalBars, + fib1Buffer + // + ); + + // + // Level 2 Buffer ... + CopyBuffer( + mHandler, + XPV_FIB_2_LINE, + 0, + totalBars, + fib2Buffer + // + ); + + // + // Level 3 Buffer ... + CopyBuffer( + mHandler, + XPV_FIB_3_LINE, + 0, + totalBars, + fib3Buffer + // + ); + + // + // Level 4 Buffer ... + CopyBuffer( + mHandler, + XPV_FIB_4_LINE, + 0, + totalBars, + fib4Buffer + // + ); + + // + // Level 5 Buffer ... + CopyBuffer( + mHandler, + XPV_FIB_5_LINE, + 0, + totalBars, + fib5Buffer + // + ); + + // + // Cycles ... + + // + // Short ... + + // + // HH ... + CopyBuffer( + mHandler, + XPV_SC_HH_LINE, + 0, + totalBars, + scHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XPV_SC_LL_LINE, + 0, + totalBars, + scLLBuffer + // + ); + + // + // Medium ... + + // + // HH ... + CopyBuffer( + mHandler, + XPV_MC_HH_LINE, + 0, + totalBars, + mcHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XPV_MC_LL_LINE, + 0, + totalBars, + mcLLBuffer + // + ); + + // + // Long ... + + // + // HH ... + CopyBuffer( + mHandler, + XPV_LC_HH_LINE, + 0, + totalBars, + lcHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XPV_LC_LL_LINE, + 0, + totalBars, + lcLLBuffer + // + ); + + // + // Hind ... + + // + // HH ... + CopyBuffer( + mHandler, + XPV_HC_HH_LINE, + 0, + totalBars, + hcHHBuffer + // + ); + + // + // LL ... + CopyBuffer( + mHandler, + XPV_HC_LL_LINE, + 0, + totalBars, + hcLLBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xrsi.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xrsi.helper.mq5 new file mode 100644 index 0000000..804cf35 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xrsi.helper.mq5 @@ -0,0 +1,392 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXRSIHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XRSI_BUFFERS +{ + XRSI_MAIN_LINE = 0 +}; + +// +// Input Models ... +struct XRSIInputs +{ + // + // Props ... + + // + // Market ... + int length; // Market Length + ENUM_APPLIED_PRICE appliedTo; // Applied To + + // + // Short Entry ... + double shortEntryValue; // Short Entry Level + color shortEntryColor; // Short Entry Level Color + ENUM_LINE_STYLE shortEntryLineStyle; // Short Entry Style + + // + // Short Exit ... + double shortExitValue; // Short Exit Level + color shortExitColor; // Short Exit Level Color + ENUM_LINE_STYLE shortExitLineStyle; // Short Exit Style + + // + // Long Entry ... + double longEntryValue; // Long Entry Level + color longEntryColor; // Long Entry Level Color + ENUM_LINE_STYLE longEntryLineStyle; // Long Entry Style + + // + // Long Exit ... + double longExitValue; // Long Exit Level + color longExitColor; // Long Exit Level Color + ENUM_LINE_STYLE longExitLineStyle; // Long Exit Style + + // + // Constructor(s) ... + XRSIInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Market ... + length = 0; + appliedTo = PRICE_CLOSE; + + // + // Short Entry ... + shortEntryValue = 0; + shortEntryColor = CLR_NONE; + shortEntryLineStyle = STYLE_DOT; + + // + // Short Exit ... + shortExitValue = 0; + shortExitColor = CLR_NONE; + shortExitLineStyle = STYLE_DOT; + + // + // Long Entry ... + longEntryValue = 0; + longEntryColor = CLR_NONE; + longEntryLineStyle = STYLE_DOT; + + // + // Long Exit ... + longExitValue = 0; + longExitColor = CLR_NONE; + longExitLineStyle = STYLE_DOT; + } + + // + // Default ... + void Default() + { + // + // Market ... + length = 14; + appliedTo = PRICE_CLOSE; + + // + // Short Entry ... + shortEntryValue = 70; + shortEntryColor = CLR_NONE; + shortEntryLineStyle = STYLE_DOT; + + // + // Short Exit ... + shortExitValue = 40; + shortExitColor = CLR_NONE; + shortExitLineStyle = STYLE_DOT; + + // + // Long Entry ... + longEntryValue = 30; + longEntryColor = CLR_NONE; + longEntryLineStyle = STYLE_DOT; + + // + // Long Exit ... + longExitValue = 60; + longExitColor = CLR_NONE; + longExitLineStyle = STYLE_DOT; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 2 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXRSIHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXRSIHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXRSIHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XRSIInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(mainBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xrsi", + // + // Inputs ... + // + // Market ... + "", + mInputs.length, // Market Length + mInputs.appliedTo, // Applied To + // + // Short Entry ... + "", + mInputs.shortEntryValue, // Short Entry Level + mInputs.shortEntryColor, // Short Entry Level Color + mInputs.shortEntryLineStyle, // Short Entry Style + // + // Short Exit ... + "", + mInputs.shortExitValue, // Short Exit Level + mInputs.shortExitColor, // Short Exit Level Color + mInputs.shortExitLineStyle, // Short Exit Style + // + // Long Entry ... + "", + mInputs.longEntryValue, // Long Entry Level + mInputs.longEntryColor, // Long Entry Level Color + mInputs.longEntryLineStyle, // Long Entry Style + // + // Long Exit ... + "", + mInputs.longExitValue, // Long Exit Level + mInputs.longExitColor, // Long Exit Level Color + mInputs.longExitLineStyle // Long Exit Style + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XRSIInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XRSIInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetMain( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mainBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mainBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMain( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mainBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XRSIInputs mInputs; // Inputs ... + + // + // Buffers ... + double mainBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Main ... + CopyBuffer( + mHandler, + XRSI_MAIN_LINE, + 0, + totalBars, + mainBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xsslc.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xsslc.helper.mq5 new file mode 100644 index 0000000..6198876 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xsslc.helper.mq5 @@ -0,0 +1,408 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXSSLCHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XSSLC_BUFFERS +{ + XSSLC_UP_LINE = 0, + XSSLC_DOWN_LINE = 1, +}; + +// +// Input Models ... +struct XSSLCInputs +{ + // + // Props ... + + // + // Market ... + int length; // Length + + // + // Calculation ... + ENUM_MA_METHOD method; // Method + ENUM_APPLIED_PRICE upAppliedTo; // Up Applied To + ENUM_APPLIED_PRICE downAppliedTo; // Down Applied To + + // + // Presentation ... + bool showUp; // Show Up + bool showDown; // Show Down + + // + // Constructor(s) ... + XSSLCInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Market ... + length = 0; + + // + // Calculation ... + method = MODE_SMA; + upAppliedTo = PRICE_HIGH; + downAppliedTo = PRICE_LOW; + + // + // Presentation ... + showUp = false; + showDown = false; + } + + // + // Default ... + void Default() + { + // + // Market ... + length = 36; + + // + // Calculation ... + method = MODE_SMA; + upAppliedTo = PRICE_HIGH; + downAppliedTo = PRICE_LOW; + + // + // Presentation ... + showUp = true; + showDown = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + false + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(0, 0); + + // + return result; + } +}; + +// +// Class ... +class XSCXSSLCHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXSSLCHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXSSLCHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XSSLCInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(upBuffer, true); + ArraySetAsSeries(downBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xsslc", + // + // Inputs ... + // + // Market ... + "", + mInputs.length, // Length + // + // Calculation ... + "", + mInputs.method, // Method + mInputs.upAppliedTo, // Up Applied To + mInputs.downAppliedTo, // Down Applied To + // + // Presentation ... + "", + mInputs.showUp, // Show Up + mInputs.showDown // Show Down + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XSSLCInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XSSLCInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + // Up ... + + // + double GetUp( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(upBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return upBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyUp( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + upBuffer, + buffer, + forceClean + // + ); + } + + // + // Down ... + + // + double GetDown( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(downBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return downBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyDown( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + downBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XSSLCInputs mInputs; // Inputs ... + + // + // Buffers ... + double upBuffer[]; + double downBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Up ... + CopyBuffer( + mHandler, + XSSLC_UP_LINE, + 0, + totalBars, + upBuffer + // + ); + + // + // Down ... + CopyBuffer( + mHandler, + XSSLC_DOWN_LINE, + 0, + totalBars, + downBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xstr.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xstr.helper.mq5 new file mode 100644 index 0000000..009f3ba --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xstr.helper.mq5 @@ -0,0 +1,421 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXSTRHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XSTR_BUFFERS +{ + X_STR_TREND_LINE = 0, + X_STR_STATE_LINE = 5, +}; + +// +enum ENUM_XSTR_TREND_STATES +{ + X_STR_BULLISH = 1, // Bullish + X_STR_BEARISH = -1, // Bearish +}; + +// +// Input Models ... +struct XSTRInputs +{ + // + // Props ... + + // + // Market ... + int length; // Length + double multiplier; // Multiplier + ENUM_APPLIED_PRICE appliedTo; // Applied To + + // + // Presentation ... + bool showTrends; // Show Trends + bool fillTrends; // Fill Trends + + // + // Constructor(s) ... + XSTRInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + multiplier = 0; + appliedTo = PRICE_CLOSE; + // + showTrends = false; + fillTrends = false; + } + + // + // Default ... + void Default() + { + // + length = 14; + multiplier = 3.5; + appliedTo = PRICE_MEDIAN; + // + showTrends = true; + fillTrends = false; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length > 0 && + multiplier > 0 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = length; + + // + return result; + } +}; + +// +// Class ... +class XSCXSTRHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXSTRHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXSTRHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XSTRInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(trendBuffer, true); + ArraySetAsSeries(stateBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xstr", + // + // Inputs ... + // + // ATR ... + "", + mInputs.length, // Length + mInputs.multiplier, // Multiplier + mInputs.appliedTo, // Applied To + // + // Presentation ... + "", + mInputs.showTrends, // Show Trends + mInputs.fillTrends // Fill Trends + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XSTRInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XSTRInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs); + } + + // + // Buffers ... + + // + // Trend ... + + // + double GetTrend( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return trendBuffer[barIndex]; + } + + // + // Copy Required Buffer ... + int CopyTrend( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + trendBuffer, + buffer, + forceClean + // + ); + } + + // + // State ... + + // + ENUM_XSTR_TREND_STATES GetState( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + return (ENUM_XSTR_TREND_STATES)((int)stateBuffer[barIndex]); + } + + // + // Copy Required Buffer ... + int CopyState( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + stateBuffer, + buffer, + forceClean + // + ); + } + + // + // Tools ... + + // + ENUM_XSTR_TREND_STATES ToState(double state) + { + return (ENUM_XSTR_TREND_STATES)((int)state); + } + + // + bool IsBullish(double state) + { + // + bool result = false; + + // + result = + // + ToState(state) == X_STR_BULLISH; + // + ; + + // + return result; + } + + // + bool IsBearish(double state) + { + // + bool result = false; + + // + result = + // + ToState(state) == X_STR_BEARISH; + // + ; + + // + return result; + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XSTRInputs mInputs; // Inputs ... + + // + // Buffers ... + double trendBuffer[]; + double stateBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + int calculatedBars = CountCalculatedBars(); + + // + // Trend ... + CopyBuffer( + mHandler, + X_STR_TREND_LINE, + 0, + totalBars, + trendBuffer + // + ); + + // + // State ... + CopyBuffer( + mHandler, + X_STR_STATE_LINE, + 0, + totalBars, + stateBuffer + // + ); + } +}; + +// +// Tools ... diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtd.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtd.helper.mq5 new file mode 100644 index 0000000..488e7d6 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtd.helper.mq5 @@ -0,0 +1,458 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXTDHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XTD_BUFFERS +{ + XTD_BULLISH_LINE = 0, + XTD_BEARISH_LINE = 1, + XTD_SIGNAL_LINE = 2, +}; + +// +// Input Models ... +struct XTDInputs +{ + // + // Props ... + // + int length; // Market Length + bool drawCrosses; // Draw Cross Arrows + + // + // Bullish ... + uchar bullishArrowCode; // Cross Over Arrow Code + color bullishArrowColor; // Cross Over Arrow Color + + // + // Bearish ... + uchar bearishArrowCode; // Cross Under Arrow Code + color bearishArrowColor; // Cross Under Arrow Color + + // + // Constructor(s) ... + XTDInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + length = 0; + drawCrosses = false; + + // + // Bullish ... + bullishArrowCode = 228; + bullishArrowColor = CLR_NONE; + + // + // Bearish ... + bearishArrowCode = 230; + bearishArrowColor = CLR_NONE; + } + + // + // Default ... + void Default() + { + // + length = 14; + drawCrosses = false; + + // + // Bullish ... + bullishArrowCode = 228; + bullishArrowColor = CLR_NONE; + + // + // Bearish ... + bearishArrowCode = 230; + bearishArrowColor = CLR_NONE; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + length >= 2 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, length); + + // + return result; + } +}; + +// +// Class ... +class XSCXTDHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXTDHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXTDHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XTDInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(bullishBuffer, true); + ArraySetAsSeries(bearishBuffer, true); + ArraySetAsSeries(signalBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xtd", + // + // Inputs ... + // + mInputs.length, // Market Length + mInputs.drawCrosses, // Draw Cross Arrows + // + // Bullish ... + mInputs.bullishArrowCode, // Cross Over Arrow Code + mInputs.bullishArrowColor, // Cross Over Arrow Color + // + // Bearish ... + mInputs.bearishArrowCode, // Cross Under Arrow Code + mInputs.bearishArrowColor // Cross Under Arrow Color + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XTDInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XTDInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetBullish( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(bullishBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return bullishBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyBullish( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + bullishBuffer, + buffer, + forceClean + // + ); + } + + // + double GetBearish( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(bearishBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return bearishBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyBearish( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + bearishBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSignal( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(signalBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return signalBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopySignal( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + signalBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XTDInputs mInputs; // Inputs ... + + // + // Buffers ... + double bullishBuffer[]; + double bearishBuffer[]; + double signalBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Bullish ... + CopyBuffer( + mHandler, + XTD_BULLISH_LINE, + 0, + totalBars, + bullishBuffer + // + ); + + // + // Bearish ... + CopyBuffer( + mHandler, + XTD_BEARISH_LINE, + 0, + totalBars, + bearishBuffer + // + ); + + // + // Signal ... + CopyBuffer( + mHandler, + XTD_SIGNAL_LINE, + 0, + totalBars, + signalBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtm.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtm.helper.mq5 new file mode 100644 index 0000000..a55a04b --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xtm.helper.mq5 @@ -0,0 +1,310 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXTMHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XTM_BUFFERS +{ + XTM_MAIN_LINE = 0 +}; + +// +// Input Models ... +struct XTMInputs +{ + // + // Props ... + // + // Market ... + int maPeriod; // Period + int maShift; // Shift + ENUM_MA_METHOD maMethod; // Method + ENUM_APPLIED_PRICE maAppliedTo; // Applied To + // + // Presentation ... + bool showLine; // Show Line + + // + // Constructor(s) ... + XTMInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + maShift = 0; + maPeriod = 0; + showLine = false; + maMethod = MODE_SMA; + maAppliedTo = PRICE_CLOSE; + } + + // + // Default ... + void Default() + { + // + maShift = 0; + maPeriod = 14; + showLine = true; + maMethod = MODE_SMA; + maAppliedTo = PRICE_CLOSE; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + maPeriod >= 2 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, maPeriod); + + // + return result; + } +}; + +// +// Class ... +class XSCXTMHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXTMHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXTMHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XTMInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(mainBuffer, true); + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xtm", + // + // Inputs ... + // + // Market ... + "", + mInputs.maPeriod, // Period + mInputs.maShift, // Shift + mInputs.maMethod, // Method + mInputs.maAppliedTo, // Applied To + // + // Presentation ... + "", + mInputs.showLine // Show Line + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XTMInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XTMInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetMain( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mainBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mainBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMain( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mainBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XTMInputs mInputs; // Inputs ... + + // + // Buffers ... + double mainBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Main Buffer ... + CopyBuffer( + mHandler, + XTM_MAIN_LINE, + 0, + totalBars, + mainBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xts.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xts.helper.mq5 new file mode 100644 index 0000000..72eb425 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xts.helper.mq5 @@ -0,0 +1,550 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXTSHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XTS_BUFFERS +{ + XTS_CURRENT_LINE = 0, + XTS_NEAREST_LINE = 1, + XTS_MEDIEST_LINE = 2, + XTS_FAREST_LINE = 3, +}; + +// +// Input Models ... +struct XTSInputs +{ + // + // Props ... + // + // Current Period ... + ENUM_APPLIED_PRICE currentAppliedTo; // Current Applied To + // + // Nearest Period ... + ENUM_X_PERIOD_METHOD nearestMethod; // How to Find Nearest Period + ENUM_TIMEFRAMES nearestPeriod; // Nearest Time Frame + ENUM_APPLIED_PRICE nearestAppliedTo; // Nearest Applied To + // + // Mediest Period ... + ENUM_X_PERIOD_METHOD mediestMethod; // How to Find Mediest Period + ENUM_TIMEFRAMES mediestPeriod; // Mediest Time Frame + ENUM_APPLIED_PRICE mediestAppliedTo; // Mediest Applied To + // + // Farest Period ... + ENUM_X_PERIOD_METHOD farestMethod; // How to Find Farest Period + ENUM_TIMEFRAMES farestPeriod; // Farest Time Frame + ENUM_APPLIED_PRICE farestAppliedTo; // Farest Applied To + + // + // Constructor(s) ... + XTSInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Current Period ... + currentAppliedTo = PRICE_CLOSE; + // + // Nearest Period ... + nearestMethod = X_PERIOD_NOTHING; + nearestPeriod = NULL; + nearestAppliedTo = PRICE_CLOSE; + // + // Mediest Period ... + mediestMethod = X_PERIOD_NOTHING; + mediestPeriod = NULL; + mediestAppliedTo = PRICE_CLOSE; + // + // Farest Period ... + farestMethod = X_PERIOD_NOTHING; + farestPeriod = NULL; + farestAppliedTo = PRICE_CLOSE; + } + + // + // Default ... + void Default() + { + // + // Current Period ... + currentAppliedTo = PRICE_CLOSE; + // + // Nearest Period ... + nearestMethod = X_PERIOD_AUTO; + nearestPeriod = NULL; + nearestAppliedTo = PRICE_CLOSE; + // + // Mediest Period ... + mediestMethod = X_PERIOD_AUTO; + mediestPeriod = NULL; + mediestAppliedTo = PRICE_CLOSE; + // + // Farest Period ... + farestMethod = X_PERIOD_AUTO; + farestPeriod = NULL; + farestAppliedTo = PRICE_CLOSE; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(nearestMethod, nearestPeriod) && + IsValid(mediestMethod, mediestPeriod) && + IsValid(farestMethod, farestPeriod) + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(result, 0); + + // + return result; + } +}; + +// +// Class ... +class XSCXTSHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXTSHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXTSHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XTSInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(currentBuffer, true); + ArraySetAsSeries(nearestBuffer, true); + ArraySetAsSeries(mediestBuffer, true); + ArraySetAsSeries(farestBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xts", + // + // Inputs ... + // + // Current Period ... + "", + mInputs.currentAppliedTo, // Current Applied To + // + // Nearest Period ... + "", + mInputs.nearestMethod, // How to Find Nearest Period + mInputs.nearestPeriod, // Nearest Time Frame + mInputs.nearestAppliedTo, // Nearest Applied To + // + // Mediest Period ... + "", + mInputs.mediestMethod, // How to Find Mediest Period + mInputs.mediestPeriod, // Mediest Time Frame + mInputs.mediestAppliedTo, // Mediest Applied To + // + // Farest Period ... + "", + mInputs.farestMethod, // How to Find Farest Period + mInputs.farestPeriod, // Farest Time Frame + mInputs.farestAppliedTo // Farest Applied To + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XTSInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XTSInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetCurrent( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(currentBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return currentBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyCurrent( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + currentBuffer, + buffer, + forceClean + // + ); + } + + // + double GetNearest( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(nearestBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return nearestBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyNearest( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + nearestBuffer, + buffer, + forceClean + // + ); + } + + // + double GetMediest( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mediestBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mediestBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMediest( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mediestBuffer, + buffer, + forceClean + // + ); + } + + // + double GetFarest( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(farestBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return farestBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyFarest( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + farestBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XTSInputs mInputs; // Inputs ... + + // + // Buffers ... + double currentBuffer[]; + double nearestBuffer[]; + double mediestBuffer[]; + double farestBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Current ... + CopyBuffer( + mHandler, + XTS_CURRENT_LINE, + 0, + totalBars, + currentBuffer + // + ); + + // + // Nearest ... + CopyBuffer( + mHandler, + XTS_NEAREST_LINE, + 0, + totalBars, + nearestBuffer + // + ); + + // + // Mediest ... + CopyBuffer( + mHandler, + XTS_MEDIEST_LINE, + 0, + totalBars, + mediestBuffer + // + ); + + // + // Farest ... + CopyBuffer( + mHandler, + XTS_FAREST_LINE, + 0, + totalBars, + farestBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xzg.helper.mq5 b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xzg.helper.mq5 new file mode 100644 index 0000000..a51158d --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Helpers/x-saherelm.xzg.helper.mq5 @@ -0,0 +1,527 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XSCXZGHelper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xhelper.class.mq5" + +// +// Definitions ... + +// +// How to Calculate Up and Down Price ... +enum ENUM_X_ZG_PRICE_MODE +{ + // + X_ZG_PRICE_HIGH_LOW_MODE = 1, + X_ZG_PRICE_OPEN_CLOSE_MODE = 2, +}; + +// +enum ENUM_XZG_BUFFERS +{ + // + XZG_MAIN_LINE = 0, + XZG_PEAKSANDVALES_LINE = 2, + XZG_HIGHS_LINE = 4, + XZG_LOWS_LINE = 5, +}; + +// +// Input Models ... +struct XZGInputs +{ + // + // Props ... + + // + // Market ... + int depth; // Depth + int deviation; // Deviation + int backStep; // Back Step + ENUM_X_ZG_PRICE_MODE mode; // Mode + // + // Presentation ... + bool showZigZag; // Show ZigZag + bool showPeaksAndVales; // Show Peaks and Vales + + // + // Constructor(s) ... + XZGInputs() + { + // + Clean(); + } + + // + // Tools ... + + // + // Clean ... + void Clean() + { + // + // Market ... + depth = 0; + deviation = 0; + backStep = 0; + mode = X_ZG_PRICE_HIGH_LOW_MODE; + // + // Presentation ... + showZigZag = false; + showPeaksAndVales = false; + } + + // + // Default ... + void Default() + { + // + // Market ... + depth = 12; + deviation = 5; + backStep = 3; + mode = X_ZG_PRICE_HIGH_LOW_MODE; + // + // Presentation ... + showZigZag = true; + showPeaksAndVales = true; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + depth > 0 && + deviation > 0 && + backStep > 0 + // + ; + + // + return result; + } + + // + // Retrieve MAx Length ... + int Max() + { + // + int result = 0; + + // + result = MathMax(backStep, depth); + + // + return result; + } +}; + +// +// Class ... +class XSCXZGHelper : public XSCBaseHelper +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructors ... + XSCXZGHelper() : XSCBaseHelper(_Symbol, _Period) + { + } + + // + // Deconstructor ... + ~XSCXZGHelper() {} + + // + // Tools ... + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + XZGInputs &inputs // Inputs + ) + { + // + bool result = false; + + // + mSymbol = symbol; + mPeriod = period; + + // + result = inputs.IsValid(); + if (!result) + { + return result; + } + + // + mInputs = inputs; + + // + ArraySetAsSeries(mainBuffer, true); + ArraySetAsSeries(PeaksAndValesBuffer, true); + ArraySetAsSeries(highsBuffer, true); + ArraySetAsSeries(lowsBuffer, true); + + // + mHandler = iCustom( + mSymbol, + mPeriod, + "x-saherelm.xzg", + // + // Inputs ... + // + // Market ... + "", + mInputs.depth, // Depth + mInputs.deviation, // Deviation + mInputs.backStep, // Back Step + mInputs.mode, // Mode + // + // Presentation ... + "", + mInputs.showZigZag, // Show ZigZag + mInputs.showPeaksAndVales // Show Peaks and Vales + // + ); + result = mHandler != INVALID_HANDLE; + if (!result) + { + return result; + } + + // + return result; + } + + // + // Inputs ... + + // + XZGInputs GetInputs() + { + return mInputs; + } + + // + bool SetInputs( + XZGInputs &inputs // Configs + ) + { + // + return Init( + mSymbol, + mPeriod, + inputs + // + ); + } + + // + // Buffers ... + + // + double GetMain( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(mainBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return mainBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyMain( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + mainBuffer, + buffer, + forceClean + // + ); + } + + // + double GetPeaksAndVales( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(PeaksAndValesBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return PeaksAndValesBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyPeaksAndVales( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + PeaksAndValesBuffer, + buffer, + forceClean + // + ); + } + + // + double GetHigh( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(highsBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return highsBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyHigh( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + highsBuffer, + buffer, + forceClean + // + ); + } + + // + double GetLow( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(lowsBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return lowsBuffer[barIndex]; + } + + // + // Copy Required Items ... + int CopyLow( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + lowsBuffer, + buffer, + forceClean + // + ); + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + // Props ... + XZGInputs mInputs; // Inputs ... + + // + // Buffers ... + double mainBuffer[]; + double PeaksAndValesBuffer[]; + double highsBuffer[]; + double lowsBuffer[]; + + // + // Tools ... + + // + // Calculate Values Until Now ... + void Calculate() + { + // + int totalBars = CountBars(); + + // + // Main Buffer ... + CopyBuffer( + mHandler, + XZG_MAIN_LINE, + 0, + totalBars, + mainBuffer + // + ); + + // + // Peaks and Vales Buffer ... + CopyBuffer( + mHandler, + XZG_PEAKSANDVALES_LINE, + 0, + totalBars, + PeaksAndValesBuffer + // + ); + + // + // Highs Buffer ... + CopyBuffer( + mHandler, + XZG_HIGHS_LINE, + 0, + totalBars, + highsBuffer + // + ); + + // + // Lows Buffer ... + CopyBuffer( + mHandler, + XZG_LOWS_LINE, + 0, + totalBars, + lowsBuffer + // + ); + } +}; + +// +// Tools ... \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xama.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xama.mq5 new file mode 100644 index 0000000..714a25d --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xama.mq5 @@ -0,0 +1,348 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XAMA Indicator +// --------------------------------------------- +// Name: XAMA +// Description: Trend Magic Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XAMA Indicator" +#property strict + +// +// Constants ... + +#define ShortName "XAMA" + +// +// Indicator States ... +enum ENUM_X_XAMA_STATES +{ + X_XAMA_BULLISH = 1, + X_XAMA_BEARISH = -1, + X_XAMA_NEUTURAL = 0, +}; + +// +// Inputs ... + +// +// Market ... +input group "Market"; +input int length = 18; // Period +input int fastEMA = 2; // Fast EMA Period +input int slowEMA = 30; // Slow EMA Period +input int maShift = 0; // Shift +input ENUM_APPLIED_PRICE appliedTo = PRICE_CLOSE; // Applied To + +// +// Presentation ... +input group "Presentation"; +input bool showLine = true; // Show Line + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 3 +#property indicator_plots 1 + +// +// maBuffer ... +#define maBufferIndex 0 +#define maColorBufferIndex 1 +#define stateBufferIndex 2 + +double maBuffer[]; +double maColorBuffer[]; +double stateBuffer[]; + +#property indicator_label1 "XAMA" +#property indicator_type1 DRAW_COLOR_LINE +#property indicator_color1 clrLime, clrGray, clrRed, CLR_NONE +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +int maHandler = INVALID_HANDLE; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Initializing MA Handler ... + maHandler = iAMA( + _Symbol, + _Period, + length, + fastEMA, + slowEMA, + maShift, + appliedTo); + if (maHandler == INVALID_HANDLE) + { + // + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(maHandler); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(fastEMA, slowEMA); + maxLength = MathMax(maxLength, length); + + // + // Check Calculated Bars ... + int maCalculatedBars = BarsCalculated(maHandler); + if (maCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedMas = CopyBuffer(maHandler, 0, 0, limit, maBuffer); + if (copiedMas <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + // + // Do Buffers Calculation ... + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (length >= 2) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + string maBufferLabel = "XAMA " + "(" + (string)length + ")"; + + // + // Ma Buffer ... + ArraySetAsSeries(maBuffer, true); + SetIndexBuffer(maBufferIndex, maBuffer, INDICATOR_DATA); + PlotIndexSetString(maBufferIndex, PLOT_LABEL, maBufferLabel); + + // + // Ma Color Buffer ... + ArraySetAsSeries(maColorBuffer, true); + SetIndexBuffer(maColorBufferIndex, maColorBuffer, INDICATOR_COLOR_INDEX); + + // + // State Buffer ... + ArraySetAsSeries(stateBuffer, true); + SetIndexBuffer(stateBufferIndex, stateBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "(", length, ")"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ + // + // Requirements ... + XOHCL candle; + candle.Init( + _Symbol, + _Period, + bar_index); + + // + double maValue = maBuffer[bar_index]; + + // + double lineColorIndex = + maValue < candle.low ? 0 : maValue > candle.high ? 2 + : 1; + + // + // Define State Value ... + // lineColorIndex == 0 => Bullish => 1; + // lineColorIndex == 1 => Neutural => 0; + // lineColorIndex == 2 => Bearish => -1; + double stateValue = + lineColorIndex == 0 ? X_XAMA_BULLISH : lineColorIndex == 2 ? X_XAMA_BEARISH + : X_XAMA_NEUTURAL; + + // + // Set Ma Buffer Color Index ... + maColorBuffer[bar_index] = showLine ? lineColorIndex : 3; + + // + // Set State Buffer Value ... + stateBuffer[bar_index] = stateValue; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xcc.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xcc.mq5 new file mode 100644 index 0000000..2e11f1c --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xcc.mq5 @@ -0,0 +1,458 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Candle Styles +// --------------------------------------------------- +// Name: XCC +// Description: Candle Styles ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XCC Indicator" +#property strict + +// +// START Constants ... +// + +// +// Indicator Short Name ... +#define ShortName "XCC" + +// +// Holds an SnapShot of Charts Configuration ... +struct XChartStyle +{ + // + // chart's ID ... + long chartId; + // + // chart's mode ... + ENUM_CHART_MODE mode; + // + // show bid line ... + bool showBidLine; + // + // show ask line ... + bool showAskLine; + // + // show grids on chart ... + bool showGrid; + // + // show volumes ... + bool showVolumes; + // + // Displaying trade levels in the chart (levels of open positions, Stop Loss, Take Profit and pending orders) ... + bool showTradeLevels; + // + // chart autoscroll ... + bool autoScroll; + // + // chart quick navigation state ... + bool quickNavigation; + // + // chart's foreground color ... + color foreGroundColor; + // + // chart's background color ... + color backGroundColor; + // + // Up Color ... + color upColor; + // + // Down Color ... + color downColor; + // + // Bullish color ... + color bullishColor; + // + // Bearish color ... + color bearishColor; + // + // grid color ... + color gridColor; + // + // bid line color ... + color bidLineColor; + // + // ask line color ... + color askLineColor; + // + // line mode and doji candlestick color ... + color lineColor; + // + // Color of stop order levels (Stop Loss and Take Profit) ... + color stopColor; + // + // volumes color ... + color volumesColor; +}; + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Chart Style"; +input ENUM_CHART_MODE mode = CHART_CANDLES; // Mode +input color upColor = clrLime; // Up Color +input color downColor = clrRed; // Down Color +input color lineColor = clrLime; // Line mode and Doji candlestick Color +input color bearishColor = clrRed; // Bullish Color +input color bullishColor = clrLime; // Bearish Color +input color volumesColor = clrGreen; // Volumes Color + +// +input group "Presentation"; +input bool showCandles = true; // Show Candles + +// +// END Inputs ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Draw Library ... +#include "../Libraries/x-saherelm.draw.lib.mq5" + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START Buffers ... +// + +// +#property indicator_chart_window + +// +#property indicator_buffers 0 +#property indicator_plots 0 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +XChartStyle chartStyle; +XChartStyle clearStyle; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + drawPrefix = ShortName; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Apply Chart Style ... + ApplyCustomChartStyle(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[] + // +) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i); + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = true; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ +} + +// +// Apply Custom Chart Style ... +void ApplyCustomChartStyle() +{ + // + // Read Current Chart Config and Store it ... + ReadChartStyle(); + + // + // After Reading Current Chart Style ... + // we have to Save Configs and Change Styles ... + clearStyle = chartStyle; + + // + clearStyle.upColor = CLR_NONE; + clearStyle.downColor = CLR_NONE; + clearStyle.lineColor = CLR_NONE; + clearStyle.bullishColor = CLR_NONE; + clearStyle.bearishColor = CLR_NONE; + + // + // Decide to Show or not Candles based on User Input ... + if (showCandles) + { + SetChartStyle(chartStyle); + } + else + { + SetChartStyle(clearStyle); + } +} + +// +// Read Previous Chart Style ... +void ReadChartStyle() +{ + // + // Retrieve Current Chart ID ... + long chartId = ChartID(); + chartStyle.chartId = chartId; + + // + // Retrieve Chart Mode ... + chartStyle.mode = (ENUM_CHART_MODE)ChartGetInteger(chartId, CHART_MODE); + + // + chartStyle.showBidLine = (bool)ChartGetInteger(chartId, CHART_SHOW_BID_LINE); + chartStyle.showAskLine = (bool)ChartGetInteger(chartId, CHART_SHOW_ASK_LINE); + chartStyle.showGrid = (bool)ChartGetInteger(chartId, CHART_SHOW_GRID); + chartStyle.showVolumes = (bool)ChartGetInteger(chartId, CHART_SHOW_VOLUMES); + chartStyle.showTradeLevels = (bool)ChartGetInteger(chartId, CHART_SHOW_TRADE_LEVELS); + chartStyle.autoScroll = (bool)ChartGetInteger(chartId, CHART_AUTOSCROLL); + chartStyle.quickNavigation = (bool)ChartGetInteger(chartId, CHART_QUICK_NAVIGATION); + + // + chartStyle.foreGroundColor = (color)ChartGetInteger(chartId, CHART_COLOR_FOREGROUND); + chartStyle.backGroundColor = (color)ChartGetInteger(chartId, CHART_COLOR_BACKGROUND); + chartStyle.upColor = (color)ChartGetInteger(chartId, CHART_COLOR_CHART_UP); + chartStyle.downColor = (color)ChartGetInteger(chartId, CHART_COLOR_CHART_DOWN); + chartStyle.bullishColor = (color)ChartGetInteger(chartId, CHART_COLOR_CANDLE_BULL); + chartStyle.bearishColor = (color)ChartGetInteger(chartId, CHART_COLOR_CANDLE_BEAR); + chartStyle.gridColor = (color)ChartGetInteger(chartId, CHART_COLOR_GRID); + chartStyle.bidLineColor = (color)ChartGetInteger(chartId, CHART_COLOR_BID); + chartStyle.askLineColor = (color)ChartGetInteger(chartId, CHART_COLOR_ASK); + chartStyle.stopColor = (color)ChartGetInteger(chartId, CHART_COLOR_STOP_LEVEL); + chartStyle.lineColor = (color)ChartGetInteger(chartId, CHART_COLOR_CHART_LINE); + chartStyle.volumesColor = (color)ChartGetInteger(chartId, CHART_COLOR_VOLUME); + + // + chartStyle.mode = mode; + chartStyle.upColor = upColor; + chartStyle.downColor = downColor; + chartStyle.lineColor = lineColor; + chartStyle.bearishColor = bearishColor; + chartStyle.bullishColor = bullishColor; + chartStyle.volumesColor = volumesColor; +} + +// +// Set Chart Style ... +void SetChartStyle( + XChartStyle &mChartStyle // Chart Style to Apply +) +{ + // + ApplyChartStyle( + mChartStyle.chartId, + mChartStyle.mode, + mChartStyle.showBidLine, + mChartStyle.showAskLine, + mChartStyle.showGrid, + mChartStyle.showVolumes, + mChartStyle.showTradeLevels, + mChartStyle.autoScroll, + mChartStyle.quickNavigation, + mChartStyle.foreGroundColor, + mChartStyle.backGroundColor, + mChartStyle.upColor, + mChartStyle.downColor, + mChartStyle.bullishColor, + mChartStyle.bearishColor, + mChartStyle.gridColor, + mChartStyle.bidLineColor, + mChartStyle.askLineColor, + mChartStyle.lineColor, + mChartStyle.stopColor, + mChartStyle.volumesColor); +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xche.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xche.mq5 new file mode 100644 index 0000000..f47d363 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xche.mq5 @@ -0,0 +1,631 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// --------------------------------------------- +// Name: XCHE +// Description: Chandelier Exit Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XCHE Indicator" +#property strict + +// +// START Constants ... +// + +// +#define ShortName "XCHE" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Market"; +input int length = 35; // Length +input int loopback = 26; // Loopback +input double multiplier1 = 3.0; // 1st Multiplier +input double multiplier2 = 3.5; // 2nd Multiplier + +// +input group "Calculation"; +input ENUM_APPLIED_PRICE upAppliedTo = PRICE_HIGH; // Up Zone Applied to +input ENUM_APPLIED_PRICE downAppliedTo = PRICE_LOW; // Down Zone Applied to + +// +input group "Presentation"; +input bool showLongExit1Line = true; // Show 1st Long Exit +input bool showShortExit1Line = true; // Show 1st Short Exit +input bool showLongExit2Line = true; // Show 2st Long Exit +input bool showShortExit2Line = true; // Show 2st Short Exit + +// +// END Inputs ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START Buffers ... +// + +// +#property indicator_chart_window + +// +#property indicator_buffers 8 +#property indicator_plots 8 + +// +// Long Exit 1 ... +#define longExit1BufferIndex 0 +double longExit1Buffer[]; + +// +#property indicator_label1 "XCHE LE 1" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrLime +#property indicator_style1 STYLE_DOT + +// +// Short Exit 1 ... +#define shortExit1BufferIndex 1 +double shortExit1Buffer[]; + +// +#property indicator_label2 "XCHE SE 1" +#property indicator_type2 DRAW_LINE +#property indicator_style2 STYLE_DOT +#property indicator_color2 clrRed + +// +// Long Exit 2 ... +#define longExit2BufferIndex 2 +double longExit2Buffer[]; + +// +#property indicator_label3 "XCHE LE 2" +#property indicator_type3 DRAW_LINE +#property indicator_style2 STYLE_DOT +#property indicator_color3 clrAqua + +// +// Short Exit 2 ... +#define shortExit2BufferIndex 3 +double shortExit2Buffer[]; + +// +#property indicator_label4 "XCHE SE 2" +#property indicator_type4 DRAW_LINE +#property indicator_style2 STYLE_DOT +#property indicator_color4 clrMagenta + +// +// START Arrows ... + +// +// Long Exit 1 Start ... +#define longExit1StartBufferIndex 4 +double longExit1StartBuffer[]; + +// +#property indicator_label5 "XCHE LES 1" +#property indicator_type5 DRAW_ARROW +#property indicator_color5 clrLime + +// +// Short Exit 1 Start ... +#define shortExit1StartBufferIndex 5 +double shortExit1StartBuffer[]; + +// +#property indicator_label6 "XCHE SES 1" +#property indicator_type6 DRAW_ARROW +#property indicator_color6 clrRed + +// +// Long Exit 2 Start ... +#define longExit2StartBufferIndex 6 +double longExit2StartBuffer[]; + +// +#property indicator_label7 "XCHE LES 2" +#property indicator_type7 DRAW_ARROW +#property indicator_color7 clrAqua + +// +// Short Exit 2 Start ... +#define shortExit2StartBufferIndex 7 +double shortExit2StartBuffer[]; + +// +#property indicator_label8 "XCHE SES 2" +#property indicator_type8 DRAW_ARROW +#property indicator_color8 clrMagenta + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +// Working Array ... +double work[][6]; +#define hi1Idx 0 +#define lo1Idx 1 +#define hi2Idx 2 +#define lo2Idx 3 +#define trend1Idx 4 +#define trend2Idx 5 + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart mPeriod is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + if (Bars(_Symbol, _Period) < rates_total) + { + return (prev_calculated); + } + + // + if (ArrayRange(work, 0) != rates_total) + { + ArrayResize(work, rates_total); + } + + // + // this counts Available Bars ... + int limit; + + // + limit = prev_calculated - 1; + if (limit < 0) + { + limit = 0; + } + + // + // Main Loop ... + for (int i = limit; i < rates_total && !IsStopped(); i++) + { + CalculateBuffers( + i, + prev_calculated, + rates_total, + // + open, + high, + low, + close); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = true; + + // + result = + length >= 9 && + loopback >= 0; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + result = MathMax(length, loopback); + + // + return result; +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + uint arrowCode = 159; + + // + // LEVEL 1 ... + + // + // Long Exit 1 ... + + // + // Draw Type ... + ENUM_DRAW_TYPE longExit1DrawType = showLongExit1Line ? DRAW_LINE : DRAW_NONE; + ENUM_DRAW_TYPE longExit1StartDrawType = showLongExit1Line ? DRAW_ARROW : DRAW_NONE; + + // + // Buffer ... + SetIndexBuffer(longExit1BufferIndex, longExit1Buffer, INDICATOR_DATA); + PlotIndexSetInteger(longExit1BufferIndex, PLOT_SHOW_DATA, showLongExit1Line); + PlotIndexSetInteger(longExit1BufferIndex, PLOT_DRAW_TYPE, longExit1DrawType); + + // + // Start Buffer ... + SetIndexBuffer(longExit1StartBufferIndex, longExit1StartBuffer, INDICATOR_DATA); + PlotIndexSetInteger(longExit1StartBufferIndex, PLOT_ARROW, arrowCode); + PlotIndexSetInteger(longExit1StartBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(longExit1StartBufferIndex, PLOT_DRAW_TYPE, longExit1StartDrawType); + + // + // Short Exit 1 ... + + // + // Draw Type ... + ENUM_DRAW_TYPE shortExit1DrawType = showShortExit1Line ? DRAW_LINE : DRAW_NONE; + ENUM_DRAW_TYPE shortExit1StartDrawType = showShortExit1Line ? DRAW_ARROW : DRAW_NONE; + + // + // Buffer ... + SetIndexBuffer(shortExit1BufferIndex, shortExit1Buffer, INDICATOR_DATA); + PlotIndexSetInteger(shortExit1BufferIndex, PLOT_SHOW_DATA, showShortExit1Line); + PlotIndexSetInteger(shortExit1BufferIndex, PLOT_DRAW_TYPE, shortExit1DrawType); + + // + // Start Buffer ... + SetIndexBuffer(shortExit1StartBufferIndex, shortExit1StartBuffer, INDICATOR_DATA); + PlotIndexSetInteger(shortExit1StartBufferIndex, PLOT_ARROW, arrowCode); + PlotIndexSetInteger(shortExit1StartBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(shortExit1StartBufferIndex, PLOT_DRAW_TYPE, shortExit1StartDrawType); + + // + // LEVEL 2 ... + + // + // Long Exit 2 ... + + // + // Draw Type ... + ENUM_DRAW_TYPE longExit2DrawType = showLongExit2Line ? DRAW_LINE : DRAW_NONE; + ENUM_DRAW_TYPE longExit2StartDrawType = showLongExit2Line ? DRAW_ARROW : DRAW_NONE; + + // + // Buffer ... + SetIndexBuffer(longExit2BufferIndex, longExit2Buffer, INDICATOR_DATA); + PlotIndexSetInteger(longExit2BufferIndex, PLOT_SHOW_DATA, showLongExit2Line); + PlotIndexSetInteger(longExit2BufferIndex, PLOT_DRAW_TYPE, longExit2DrawType); + + // + // Start Buffer ... + SetIndexBuffer(longExit2StartBufferIndex, longExit2StartBuffer, INDICATOR_DATA); + PlotIndexSetInteger(longExit2StartBufferIndex, PLOT_ARROW, arrowCode); + PlotIndexSetInteger(longExit2StartBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(longExit2StartBufferIndex, PLOT_DRAW_TYPE, longExit2StartDrawType); + + // + // Short Exit 2 ... + + // + // Draw Type ... + ENUM_DRAW_TYPE shortExit2DrawType = showShortExit2Line ? DRAW_LINE : DRAW_NONE; + ENUM_DRAW_TYPE shortExit2StartDrawType = showShortExit2Line ? DRAW_ARROW : DRAW_NONE; + + // + // Buffer ... + SetIndexBuffer(shortExit2BufferIndex, shortExit2Buffer, INDICATOR_DATA); + PlotIndexSetInteger(shortExit2BufferIndex, PLOT_SHOW_DATA, showShortExit2Line); + PlotIndexSetInteger(shortExit2BufferIndex, PLOT_DRAW_TYPE, shortExit2DrawType); + + // + // Start Buffer ... + SetIndexBuffer(shortExit2StartBufferIndex, shortExit2StartBuffer, INDICATOR_DATA); + PlotIndexSetInteger(shortExit2StartBufferIndex, PLOT_ARROW, arrowCode); + PlotIndexSetInteger(shortExit2StartBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(shortExit2StartBufferIndex, PLOT_DRAW_TYPE, shortExit2StartDrawType); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index, // Selected Bar Index + int prevCalculated, // Previous Calculated + int ratesTotal, // Total Rates + const double &open[], // Rates Open ... + const double &high[], // Rates High ... + const double &low[], // Rates Low ... + const double &close[] // Rates Close ... +) +{ + // + // Cleanup Buffers ... + longExit1Buffer[bar_index] = longExit1StartBuffer[bar_index] = shortExit1Buffer[bar_index] = shortExit1StartBuffer[bar_index] = EMPTY_VALUE; + longExit2Buffer[bar_index] = longExit2StartBuffer[bar_index] = shortExit2Buffer[bar_index] = shortExit2StartBuffer[bar_index] = EMPTY_VALUE; + + // + int start = MathMax(bar_index - loopback, 0); + + // + // Calculate ATR Value ... + double atrValue = 0; + for (int k = 1; k <= length && (bar_index - k - 1) >= 0; k++) + { + // + atrValue += MathMax(high[bar_index - k], close[MathMax(bar_index - k - 1, 0)]) - + MathMin(low[bar_index - k], close[MathMax(bar_index - k - 1, 0)]); + } + atrValue /= (double)length; + + // + // Retrieve Highest High and Lowest Lows ... + double loopbackMax = high[ArrayMaximum(high, start, loopback)]; + double loopbackMin = low[ArrayMinimum(low, start, loopback)]; + + // + // Fill Multi Dimesional Working Array ... + work[bar_index][hi1Idx] = loopbackMax - multiplier1 * atrValue; + work[bar_index][lo1Idx] = loopbackMin + multiplier1 * atrValue; + work[bar_index][hi2Idx] = loopbackMax - multiplier2 * atrValue; + work[bar_index][lo2Idx] = loopbackMin + multiplier2 * atrValue; + work[bar_index][trend1Idx] = (bar_index > 0) ? work[bar_index - 1][trend1Idx] : 0; + work[bar_index][trend2Idx] = (bar_index > 0) ? work[bar_index - 1][trend2Idx] : 0; + + // + if (bar_index > 0) + { + // + // Calculate Trends ... + if (close[bar_index] > work[bar_index - 1][lo1Idx]) + { + work[bar_index][trend1Idx] = 1; + } + + // + if (close[bar_index] < work[bar_index - 1][hi1Idx]) + { + work[bar_index][trend1Idx] = -1; + } + + // + if (close[bar_index] > work[bar_index - 1][lo2Idx]) + { + work[bar_index][trend2Idx] = 1; + } + + // + if (close[bar_index] < work[bar_index - 1][hi2Idx]) + { + work[bar_index][trend2Idx] = -1; + } + + // + // Calculate Exit Values ... + + // + // Exit 1 ... + + // + // Long ... + if (multiplier1 > 0 && work[bar_index][trend1Idx] == 1) + { + // + if (work[bar_index][hi1Idx] < work[bar_index - 1][hi1Idx]) + { + work[bar_index][hi1Idx] = work[bar_index - 1][hi1Idx]; + } + + // + longExit1Buffer[bar_index] = work[bar_index][hi1Idx]; + + // + if (longExit1Buffer[bar_index - 1] == EMPTY_VALUE) + { + longExit1StartBuffer[bar_index] = longExit1Buffer[bar_index]; + } + } + + // + // Short ... + if (multiplier1 > 0 && work[bar_index][trend1Idx] == -1) + { + // + if (work[bar_index][lo1Idx] > work[bar_index - 1][lo1Idx]) + { + work[bar_index][lo1Idx] = work[bar_index - 1][lo1Idx]; + } + + // + shortExit1Buffer[bar_index] = work[bar_index][lo1Idx]; + + // + if (shortExit1Buffer[bar_index - 1] == EMPTY_VALUE) + { + shortExit1StartBuffer[bar_index] = shortExit1Buffer[bar_index]; + } + } + + // + // Exit 2 ... + + // + // Long ... + if (multiplier2 > 0 && work[bar_index][trend2Idx] == 1) + { + if (work[bar_index][hi2Idx] < work[bar_index - 1][hi2Idx]) + { + work[bar_index][hi2Idx] = work[bar_index - 1][hi2Idx]; + } + + // + longExit2Buffer[bar_index] = work[bar_index][hi2Idx]; + + // + if (longExit2Buffer[bar_index - 1] == EMPTY_VALUE) + { + longExit2StartBuffer[bar_index] = longExit2Buffer[bar_index]; + } + } + + // + // Short ... + if (multiplier2 > 0 && work[bar_index][trend2Idx] == -1) + { + // + if (work[bar_index][lo2Idx] > work[bar_index - 1][lo2Idx]) + { + work[bar_index][lo2Idx] = work[bar_index - 1][lo2Idx]; + } + + // + shortExit2Buffer[bar_index] = work[bar_index][lo2Idx]; + + // + if (shortExit2Buffer[bar_index - 1] == EMPTY_VALUE) + { + shortExit2StartBuffer[bar_index] = shortExit2Buffer[bar_index]; + } + } + } +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchlh.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchlh.mq5 new file mode 100644 index 0000000..3df87f0 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchlh.mq5 @@ -0,0 +1,816 @@ +////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Cycle Channel LH Oscillator +// --------------------------------------------------- +// Name: XCHLH +// Description: detecting HH and LL based on cycles ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XCHLH Oscillator" +#property strict + +// +// START Constants ... +// +#define ShortName "XCHLH" + +// +// XCHLH Hot States ... +enum ENUM_X_XCHLH_HOT_STATES +{ + X_XCHLH_HOT_HH = 1, + X_XCHLH_NEUTURAL = 0, + X_XCHLH_HOT_LL = -1, +}; + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +// Common ... +input group "Hot Areas"; +input bool drawHotAreas = true; // Draw Hot Areas Symbol +input uchar hotHHArrowCode = 234; // Hot HH Arrow Code +input color hotHHArrowColor = clrAqua; // Hot HH Arrow Color +input uchar hotLLArrowCode = 233; // Hot LL Arrow Code +input color hotLLArrowColor = clrFuchsia; // Hot LL Arrow Color + +// +// LC Inputs ... +input group "Long Cycle"; +input group "LC Market"; +input int lcLength = 28; // Length +input double lcThresholdInPips = 0.3; // Threshold In Pips +input ENUM_SERIESMODE lcHHMode = MODE_HIGH; // Highest High Calculation Method +input ENUM_SERIESMODE lcLLMode = MODE_LOW; // Lowest Low Calculation Method +input group "LC Style"; +input int lcDrawWidth = 1; // Draw Width +input ENUM_DRAW_TYPE lcDrawType = DRAW_LINE; // Draw Type +input ENUM_LINE_STYLE lcDrawStyle = STYLE_DOT; // Draw Style +input color lcHHColor = clrAqua; // Highest High Color +input color lcLLColor = clrFuchsia; // Lowest Low Color +input group "LC Drawings"; +input bool lcDrawHH = true; // Draw Highest High +input bool lcDrawLL = true; // Draw Lowest Low + +// +// MC Inputs ... +input group "Medium Cycle"; +input group "MC Market"; +input int mcLength = 14; // Length +input double mcThresholdInPips = 0.3; // Threshold In Pips +input ENUM_SERIESMODE mcHHMode = MODE_HIGH; // Highest High Calculation Method +input ENUM_SERIESMODE mcLLMode = MODE_LOW; // Lowest Low Calculation Method +input group "MC Style"; +input int mcDrawWidth = 1; // Draw Width +input ENUM_DRAW_TYPE mcDrawType = DRAW_LINE; // Draw Type +input ENUM_LINE_STYLE mcDrawStyle = STYLE_DOT; // Draw Style +input color mcHHColor = clrLime; // Highest High Color +input color mcLLColor = clrRed; // Lowest Low Color +input group "MC Drawings"; +input bool mcDrawHH = true; // Draw Highest High +input bool mcDrawLL = true; // Draw Lowest Low + +// +// SC Inputs ... +input group "Short Cycle"; +input group "SC Market"; +input int scLength = 7; // Length +input double scThresholdInPips = 0.3; // Threshold In Pips +input ENUM_SERIESMODE scHHMode = MODE_HIGH; // Highest High Calculation Method +input ENUM_SERIESMODE scLLMode = MODE_LOW; // Lowest Low Calculation Method +input group "SC Style"; +input int scDrawWidth = 1; // Draw Width +input ENUM_DRAW_TYPE scDrawType = DRAW_LINE; // Draw Type +input ENUM_LINE_STYLE scDrawStyle = STYLE_DOT; // Draw Style +input color scHHColor = clrLightBlue; // Highest High Color +input color scLLColor = clrLightSalmon; // Lowest Low Color +input group "SC Drawings"; +input bool scDrawHH = true; // Draw Highest High +input bool scDrawLL = true; // Draw Lowest Low +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5"; + +// +// Includes Draw Library ... +#include "../Libraries/x-saherelm.draw.lib.mq5"; + +// +// START Buffers ... +// +// #property indicator_separate_window +#property indicator_chart_window + +// +#property indicator_buffers 7 +// #property indicator_plots 6 +#property indicator_plots 0 + +// +// LC ... +#define lcHHBufferIndex 0 +#define lcLLBufferIndex 1 + +// +double lcHHBuffer[]; +double lcLLBuffer[]; + +// +// MC ... +#define mcHHBufferIndex 2 +#define mcLLBufferIndex 3 + +// +double mcHHBuffer[]; +double mcLLBuffer[]; + +// +// SC ... +#define scHHBufferIndex 4 +#define scLLBufferIndex 5 + +// +double scHHBuffer[]; +double scLLBuffer[]; + +// +// Hot State ... +// +#define hotStateBufferIndex 6 + +// +double hotStateBuffer[]; +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + drawPrefix = ShortName; + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + + // + // ReDraw Chart ... + ChartRedraw(); + + // + Comment(""); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(lcLength, mcLength); + maxLength = MathMax(maxLength, scLength); + + // + limit = prev_calculated < maxLength ? rates_total - (maxLength + 1) : rates_total - prev_calculated; + + // + // Main Loop ... + for (int i = limit; i >= 0 && !IsStopped(); i--) + { + // + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + bool isLCInputsValid = + lcLength >= 4 && + lcLength > mcLength && + lcLength > scLength; + bool isMCInputsValid = + mcLength >= 4 && + mcLength > scLength && + mcLength < lcLength; + bool isSCInputsValid = + scLength >= 4 && + scLength < mcLength && + scLength < lcLength; + if ( + isLCInputsValid && + isMCInputsValid && + isSCInputsValid) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // LC ... + LCDefineBuffers(); + + // + // MC ... + MCDefineBuffers(); + + // + // SC ... + SCDefineBuffers(); + + // + // Hot State Buffer ... + HotStateDefineBuffers(); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, ""); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // LC ... + LCCalculateBuffers(bar_index); + + // + // MC ... + MCCalculateBuffers(bar_index); + + // + // SC ... + SCCalculateBuffers(bar_index); + + // + // SIGNAL ... + SignalCalculateBuffers(bar_index); + + // + // HOT State Buffer ... + HotStateCalculateBuffers(bar_index); + + // + // After all Calculations we are ready to Draw what we want ... + DrawBuffers(bar_index); +} + +// +// LC Buffers Definitions ... +void LCDefineBuffers() +{ + // + // LC HH Buffer ... + string lcHHBufferLabel = ShortName + " LC HH (" + (string)lcLength + ")"; + ENUM_DRAW_TYPE lcHHDrawType = lcDrawHH ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(lcHHBuffer, true); + SetIndexBuffer(lcHHBufferIndex, lcHHBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(lcHHBufferIndex, lcHHBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(lcHHBufferIndex, PLOT_DRAW_BEGIN, lcLength); + // PlotIndexSetString(lcHHBufferIndex, PLOT_LABEL, lcHHBufferLabel); + // PlotIndexSetInteger(lcHHBufferIndex, PLOT_LINE_COLOR, lcHHColor); + // PlotIndexSetInteger(lcHHBufferIndex, PLOT_LINE_STYLE, lcDrawStyle); + // PlotIndexSetInteger(lcHHBufferIndex, PLOT_LINE_WIDTH, lcDrawWidth); + // PlotIndexSetInteger(lcHHBufferIndex, PLOT_DRAW_TYPE, lcHHDrawType); + + // + // LC LL Buffer ... + string lcLLBufferLabel = ShortName + " LC LL (" + (string)lcLength + ")"; + ENUM_DRAW_TYPE lcLLDrawType = lcDrawLL ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(lcLLBuffer, true); + SetIndexBuffer(lcLLBufferIndex, lcLLBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(lcLLBufferIndex, lcLLBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(lcLLBufferIndex, PLOT_DRAW_BEGIN, lcLength); + // PlotIndexSetString(lcLLBufferIndex, PLOT_LABEL, lcLLBufferLabel); + // PlotIndexSetInteger(lcLLBufferIndex, PLOT_LINE_COLOR, lcLLColor); + // PlotIndexSetInteger(lcLLBufferIndex, PLOT_LINE_STYLE, lcDrawStyle); + // PlotIndexSetInteger(lcLLBufferIndex, PLOT_LINE_WIDTH, lcDrawWidth); + // PlotIndexSetInteger(lcLLBufferIndex, PLOT_DRAW_TYPE, lcLLDrawType); +} + +// +// MC Buffers Definitions ... +void MCDefineBuffers() +{ + // + // MC HH Buffer ... + string mcHHBufferLabel = ShortName + " MC HH (" + (string)mcLength + ")"; + ENUM_DRAW_TYPE mcHHDrawType = mcDrawHH ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(mcHHBuffer, true); + SetIndexBuffer(mcHHBufferIndex, mcHHBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(mcHHBufferIndex, mcHHBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(mcHHBufferIndex, PLOT_DRAW_BEGIN, mcLength); + // PlotIndexSetString(mcHHBufferIndex, PLOT_LABEL, mcHHBufferLabel); + // PlotIndexSetInteger(mcHHBufferIndex, PLOT_LINE_COLOR, mcHHColor); + // PlotIndexSetInteger(mcHHBufferIndex, PLOT_LINE_STYLE, mcDrawStyle); + // PlotIndexSetInteger(mcHHBufferIndex, PLOT_LINE_WIDTH, mcDrawWidth); + // PlotIndexSetInteger(mcHHBufferIndex, PLOT_DRAW_TYPE, mcHHDrawType); + + // + // MC LL Buffer ... + string mcLLBufferLabel = ShortName + " MC LL (" + (string)mcLength + ")"; + ENUM_DRAW_TYPE mcLLDrawType = mcDrawLL ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(mcLLBuffer, true); + SetIndexBuffer(mcLLBufferIndex, mcLLBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(mcLLBufferIndex, mcLLBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(mcLLBufferIndex, PLOT_DRAW_BEGIN, mcLength); + // PlotIndexSetString(mcLLBufferIndex, PLOT_LABEL, mcLLBufferLabel); + // PlotIndexSetInteger(mcLLBufferIndex, PLOT_LINE_COLOR, mcLLColor); + // PlotIndexSetInteger(mcLLBufferIndex, PLOT_LINE_STYLE, mcDrawStyle); + // PlotIndexSetInteger(mcLLBufferIndex, PLOT_LINE_WIDTH, mcDrawWidth); + // PlotIndexSetInteger(mcLLBufferIndex, PLOT_DRAW_TYPE, mcLLDrawType); +} + +// +// SC Buffers Definitions ... +void SCDefineBuffers() +{ + // + // SC HH Buffer ... + string scHHBufferLabel = ShortName + " SC HH (" + (string)scLength + ")"; + ENUM_DRAW_TYPE scHHDrawType = scDrawHH ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(scHHBuffer, true); + SetIndexBuffer(scHHBufferIndex, scHHBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(scHHBufferIndex, scHHBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(scHHBufferIndex, PLOT_DRAW_BEGIN, scLength); + // PlotIndexSetString(scHHBufferIndex, PLOT_LABEL, scHHBufferLabel); + // PlotIndexSetInteger(scHHBufferIndex, PLOT_LINE_COLOR, scHHColor); + // PlotIndexSetInteger(scHHBufferIndex, PLOT_LINE_STYLE, scDrawStyle); + // PlotIndexSetInteger(scHHBufferIndex, PLOT_LINE_WIDTH, scDrawWidth); + // PlotIndexSetInteger(scHHBufferIndex, PLOT_DRAW_TYPE, scHHDrawType); + + // + // SC LL Buffer ... + string scLLBufferLabel = ShortName + " SC LL (" + (string)scLength + ")"; + ENUM_DRAW_TYPE scLLDrawType = scDrawLL ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(scLLBuffer, true); + SetIndexBuffer(scLLBufferIndex, scLLBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(scLLBufferIndex, scLLBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(scLLBufferIndex, PLOT_DRAW_BEGIN, scLength); + // PlotIndexSetString(scLLBufferIndex, PLOT_LABEL, scLLBufferLabel); + // PlotIndexSetInteger(scLLBufferIndex, PLOT_LINE_COLOR, scLLColor); + // PlotIndexSetInteger(scLLBufferIndex, PLOT_LINE_STYLE, scDrawStyle); + // PlotIndexSetInteger(scLLBufferIndex, PLOT_LINE_WIDTH, scDrawWidth); + // PlotIndexSetInteger(scLLBufferIndex, PLOT_DRAW_TYPE, scLLDrawType); +} + +// +// Hot State Buffer ... +void HotStateDefineBuffers() +{ + // + // Hot State Buffer ... + ArraySetAsSeries(hotStateBuffer, true); + SetIndexBuffer(hotStateBufferIndex, hotStateBuffer, INDICATOR_CALCULATIONS); +} + +// +// LC Calculations ... +void LCCalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // Detect Cycle HH and LL ... + int length = lcLength; + ENUM_SERIESMODE hhMode = lcHHMode; + ENUM_SERIESMODE llMode = lcLLMode; + double threshold = PipsToPrice(lcThresholdInPips); + + // + int hhIdx = iHighest( + _Symbol, + _Period, + hhMode, + length, + bar_index + // + ); + double hh = iHigh( + _Symbol, + _Period, + hhIdx); + double hhValue = hh + threshold; + + // + int llIdx = iLowest( + _Symbol, + _Period, + llMode, + length, + bar_index + // + ); + double ll = iLow( + _Symbol, + _Period, + llIdx); + double llValue = ll - threshold; + + // + lcHHBuffer[bar_index] = hhValue; + lcLLBuffer[bar_index] = llValue; +} + +// +// MC Calculations ... +void MCCalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // Detect Cycle HH and LL ... + int length = mcLength; + ENUM_SERIESMODE hhMode = mcHHMode; + ENUM_SERIESMODE llMode = mcLLMode; + double threshold = PipsToPrice(mcThresholdInPips); + + // + int hhIdx = iHighest( + _Symbol, + _Period, + hhMode, + length, + bar_index + // + ); + double hh = iHigh( + _Symbol, + _Period, + hhIdx); + double hhValue = hh + threshold; + + // + int llIdx = iLowest( + _Symbol, + _Period, + llMode, + length, + bar_index + // + ); + double ll = iLow( + _Symbol, + _Period, + llIdx); + double llValue = ll - threshold; + + // + mcHHBuffer[bar_index] = hhValue; + mcLLBuffer[bar_index] = llValue; +} + +// +// SC Calculations ... +void SCCalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // Detect Cycle HH and LL ... + int length = scLength; + ENUM_SERIESMODE hhMode = scHHMode; + ENUM_SERIESMODE llMode = scLLMode; + double threshold = PipsToPrice(scThresholdInPips); + + // + int hhIdx = iHighest( + _Symbol, + _Period, + hhMode, + length, + bar_index + // + ); + double hh = iHigh( + _Symbol, + _Period, + hhIdx); + double hhValue = hh + threshold; + + // + int llIdx = iLowest( + _Symbol, + _Period, + llMode, + length, + bar_index + // + ); + double ll = iLow( + _Symbol, + _Period, + llIdx); + double llValue = ll - threshold; + + // + scHHBuffer[bar_index] = hhValue; + scLLBuffer[bar_index] = llValue; +} + +// +// SIGNAL Calculations ... +void SignalCalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // LC Values ... + double lcHH = lcHHBuffer[bar_index]; + double lcLL = lcLLBuffer[bar_index]; + double lcDelta = lcHH - lcLL; + double lcAvg = lcDelta / 2; + + // + // MC Values ... + double mcHH = mcHHBuffer[bar_index]; + double mcLL = mcLLBuffer[bar_index]; + double mcDelta = mcHH - mcLL; + double mcAvg = mcDelta / 2; + + // + // SC Values ... + double scHH = scHHBuffer[bar_index]; + double scLL = scLLBuffer[bar_index]; + double scDelta = scHH - scLL; + double scAvg = scDelta / 2; + + // + // Min Value ... + double minValue = MathMin( + scLL, mcLL); + minValue = MathMin( + lcLL, minValue); + + // + // Max Value ... + double maxValue = MathMin( + scHH, mcHH); + maxValue = MathMin( + lcHH, maxValue); +} + +// +// HOT State Calculate Buffers ... +void HotStateCalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // LC ... + double lcHH = lcHHBuffer[bar_index]; + double lcLL = lcLLBuffer[bar_index]; + // + double lcHH1 = lcHHBuffer[bar_index + 1]; + double lcLL1 = lcLLBuffer[bar_index + 1]; + + // + // MC ... + double mcHH = mcHHBuffer[bar_index]; + double mcLL = mcLLBuffer[bar_index]; + // + double mcHH1 = mcHHBuffer[bar_index + 1]; + double mcLL1 = mcLLBuffer[bar_index + 1]; + + // + // SC ... + double scHH = scHHBuffer[bar_index]; + double scLL = scLLBuffer[bar_index]; + // + double scHH1 = scHHBuffer[bar_index + 1]; + double scLL1 = scLLBuffer[bar_index + 1]; + + // + bool isHotLLState = scLL == mcLL && mcLL == lcLL; + bool isHotLLState1 = scLL1 == mcLL1 && mcLL1 == lcLL1; + // + bool isHotHHState = scHH == mcHH && mcHH == lcHH; + bool isHotHHState1 = scHH1 == mcHH1 && mcHH1 == lcHH1; + + // + bool isHotLL = isHotLLState && !isHotLLState1; + bool isHotHH = isHotHHState && !isHotHHState1; + + // + double hotStateValue = X_XCHLH_NEUTURAL; + if (isHotHH) + { + hotStateValue = X_XCHLH_HOT_HH; + } + else if (isHotLL) + { + hotStateValue = X_XCHLH_HOT_LL; + } + + // + hotStateBuffer[bar_index] = hotStateValue; +} + +// +// Draw Buffers ... +void DrawBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // General Requirements ... + + // + // Retrieve Candle Model ... + XOHCL candle; + candle.Init( + _Symbol, + _Period, + bar_index + // + ); + datetime time = iTime(_Symbol, _Period, bar_index); + + // + // Draw Arrow on Hot Areas ... + if (drawHotAreas) + { + // + double hotStateValue = hotStateBuffer[bar_index]; + bool isHotHHArea = hotStateValue == 1; + bool isHotLLArea = hotStateValue == -1; + if (isHotHHArea || isHotLLArea) + { + // + bool isHH = isHotHHArea; + + // + double price = isHH ? candle.high : candle.low; + ENUM_ARROW_ANCHOR anchor = isHH ? ANCHOR_BOTTOM : ANCHOR_TOP; + color clr = isHH ? hotHHArrowColor : hotLLArrowColor; + uchar arrowCode = isHH ? hotHHArrowCode : hotLLArrowCode; + string name = "HOT " + (isHH ? "HH" : "LL") + "_" + (string)price + "_" + (string)time; + + // + DrawArrow( + 0, + name, + 0, + time, + price, + arrowCode, + anchor, + clr, + STYLE_SOLID, + 1); + } + } +} +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchma.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchma.mq5 new file mode 100644 index 0000000..e59bc43 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xchma.mq5 @@ -0,0 +1,1134 @@ +/////////////////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Cycle Channel Moving Averages Oscillator +// ---------------------------------------------------------------- +// Name: XCHMA +// Description: trend detecting based on cycles ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XCHMA Oscillator" +#property strict + +// +// START Constants ... +// +#define ShortName "XCHMA" + +// +// XCHMA Oscillator Cycles State Presentation ... +enum ENUM_XCHMA_CYCLE_STATES +{ + X_XCHMA_FAST_CROSSED_OVER_SLOW = 2, + X_XCHMA_FAST_OVER_SLOW = 1, + X_XCHMA_NEUTURAL = 0, + X_XCHMA_FAST_UNDER_SLOW = -1, + X_XCHMA_FAST_CROSSED_UNDER_SLOW = -2, +}; +// +// END Constants ... +// + +// +// START Inputs ... +// +// +// Common ... +input group "Hot Areas"; +input bool drawHotAreas = true; // Draw Hot Areas Symbol +input uchar hotBullishArrowCode = 228; // Hot Bullish Arrow Code +input color hotBullishArrowColor = clrAqua; // Hot Bullish Arrow Color +input uchar hotBearishArrowCode = 230; // Hot Bearish Arrow Code +input color hotBearishArrowColor = clrFuchsia; // Hot Bearish Arrow Color + +// +// LC Inputs ... +input group "Long Cycle"; +input group "LC Market"; +input int lcFastLength = 20; // Fast Length +input int lcSlowLength = 50; // Slow Length +input ENUM_MA_METHOD lcMethod = MODE_EMA; // Calculation Method +input ENUM_APPLIED_PRICE lcAppliedTo = PRICE_CLOSE; // Applied To +input group "LC Style"; +input int lcDrawWidth = 1; // Draw Width +input ENUM_DRAW_TYPE lcDrawType = DRAW_LINE; // Draw Type +input ENUM_LINE_STYLE lcDrawStyle = STYLE_DOT; // Draw Style +input color lcFastColor = clrAqua; // Fast Color +input color lcSlowColor = clrFuchsia; // Slow Color +input group "LC Drawings"; +input bool lcDrawFast = true; // Draw Fast +input bool lcDrawSlow = true; // Draw Slow +input bool lcDrawCrosses = true; // Draw Cross Lines + +// +// MC Inputs ... +input group "Medium Cycle"; +input group "MC Market"; +input int mcFastLength = 10; // Fast Length +input int mcSlowLength = 30; // Slow Length +input ENUM_MA_METHOD mcMethod = MODE_EMA; // Calculation Method +input ENUM_APPLIED_PRICE mcAppliedTo = PRICE_CLOSE; // Applied To +input group "MC Style"; +input int mcDrawWidth = 1; // Draw Width +input ENUM_DRAW_TYPE mcDrawType = DRAW_LINE; // Draw Type +input ENUM_LINE_STYLE mcDrawStyle = STYLE_DOT; // Draw Style +input color mcFastColor = clrLime; // Fast Color +input color mcSlowColor = clrRed; // Slow Color +input group "MC Drawings"; +input bool mcDrawFast = true; // Draw Fast +input bool mcDrawSlow = true; // Draw Slow +input bool mcDrawCrosses = false; // Draw Cross Lines + +// +// SC Inputs ... +input group "Short Cycle"; +input group "SC Market"; +input int scFastLength = 7; // Fast Length +input int scSlowLength = 14; // Slow Length +input ENUM_MA_METHOD scMethod = MODE_EMA; // Calculation Method +input ENUM_APPLIED_PRICE scAppliedTo = PRICE_CLOSE; // Applied To +input group "SC Style"; +input int scDrawWidth = 1; // Draw Width +input ENUM_DRAW_TYPE scDrawType = DRAW_LINE; // Draw Type +input ENUM_LINE_STYLE scDrawStyle = STYLE_SOLID; // Draw Style +input color scFastColor = clrLightBlue; // Fast Color +input color scSlowColor = clrLightSalmon; // Slow Color +input group "SC Drawings"; +input bool scDrawFast = true; // Draw Fast +input bool scDrawSlow = true; // Draw Slow +input bool scDrawCrosses = false; // Draw Cross Lines +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// Includes Draw Library ... +#include "../Libraries/x-saherelm.draw.lib.mq5" + +// +// START Buffers ... +// +// #property indicator_separate_window +#property indicator_chart_window + +// +#property indicator_buffers 7 +// #property indicator_plots 6 +#property indicator_plots 0 + +// +// LC ... +#define lcFastBufferIndex 0 +#define lcSlowBufferIndex 1 + +// +double lcFastBuffer[]; +double lcSlowBuffer[]; + +// +// MC ... +#define mcFastBufferIndex 2 +#define mcSlowBufferIndex 3 + +// +double mcFastBuffer[]; +double mcSlowBuffer[]; + +// +// SC ... +#define scFastBufferIndex 4 +#define scSlowBufferIndex 5 + +// +double scFastBuffer[]; +double scSlowBuffer[]; + +// +// Hot State ... +// +#define hotStateBufferIndex 6 + +// +double hotStateBuffer[]; +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +// +// LC ... +int lcFastHandler = INVALID_HANDLE; +int lcSlowHandler = INVALID_HANDLE; + +// +// MC ... +int mcFastHandler = INVALID_HANDLE; +int mcSlowHandler = INVALID_HANDLE; + +// +// SC ... +int scFastHandler = INVALID_HANDLE; +int scSlowHandler = INVALID_HANDLE; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + drawPrefix = ShortName; + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init All Required Handlers ... + if (!InitHandlers()) + { + return INIT_FAILED; + } + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + + // + // ReDraw Chart ... + ChartRedraw(); + + // + Comment(""); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(lcFastLength, lcSlowLength); + + // + // Get Retrieved Values from indicators ... + // + // LC ... + int lcFastCalculatedBars = BarsCalculated(lcFastHandler); + int lcSlowCalculatedBars = BarsCalculated(lcSlowHandler); + + // + // MC ... + int mcFastCalculatedBars = BarsCalculated(mcFastHandler); + int mcSlowCalculatedBars = BarsCalculated(mcSlowHandler); + + // + // SC ... + int scFastCalculatedBars = BarsCalculated(scFastHandler); + int scSlowCalculatedBars = BarsCalculated(scSlowHandler); + + // + // Check Calculated Bars ... + if ( + // + // LC ... + lcFastCalculatedBars < maxLength || + lcSlowCalculatedBars < maxLength || + // + // MC ... + mcFastCalculatedBars < maxLength || + mcSlowCalculatedBars < maxLength || + // + // SC ... + scFastCalculatedBars < maxLength || + scSlowCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = prev_calculated < maxLength ? rates_total - (maxLength + 1) : rates_total - prev_calculated; + + // + // Copy Buffers from indicators ... + // + // LC ... + int lcFastCopiedItems = CopyBuffer(lcFastHandler, 0, 0, limit + 1, lcFastBuffer); + int lcSlowCopiedItems = CopyBuffer(lcSlowHandler, 0, 0, limit + 1, lcSlowBuffer); + + // + // MC ... + int mcFastCopiedItems = CopyBuffer(mcFastHandler, 0, 0, limit + 1, mcFastBuffer); + int mcSlowCopiedItems = CopyBuffer(mcSlowHandler, 0, 0, limit + 1, mcSlowBuffer); + + // + // SC ... + int scFastCopiedItems = CopyBuffer(scFastHandler, 0, 0, limit + 1, scFastBuffer); + int scSlowCopiedItems = CopyBuffer(scSlowHandler, 0, 0, limit + 1, scSlowBuffer); + + // + // Check Copied Items Number ... + if ( + // + // LC ... + lcFastCopiedItems <= 0 || + lcSlowCopiedItems <= 0 || + // + // MC ... + mcFastCopiedItems <= 0 || + mcSlowCopiedItems <= 0 || + // + // MC ... + mcFastCopiedItems <= 0 || + mcSlowCopiedItems <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit; i >= 0 && !IsStopped(); i--) + { + // + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + bool isLCInputsValid = lcFastLength >= 4 && lcSlowLength > lcFastLength; + bool isMCInputsValid = mcFastLength >= 4 && mcSlowLength > mcFastLength; + bool isSCInputsValid = scFastLength >= 4 && scSlowLength > scFastLength; + if ( + isLCInputsValid && + isMCInputsValid && + isSCInputsValid && + lcFastLength > mcFastLength && + mcFastLength > scFastLength) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // LC ... + LCDefineBuffers(); + + // + // MC ... + MCDefineBuffers(); + + // + // SC ... + SCDefineBuffers(); + + // + // Hot State Buffer ... + HotStateDefineBuffers(); +} + +// +// Init Handlers ... +bool InitHandlers() +{ + // + bool result = false; + + // + // LC ... + result = LCInitHandlers(); + if (!result) + { + return result; + } + + // + // MC ... + result = MCInitHandlers(); + if (!result) + { + return result; + } + + // + // SC ... + result = SCInitHandlers(); + if (!result) + { + return result; + } + + // + return result; +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, ""); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // HOT State Buffer ... + HotStateCalculateBuffers(bar_index); + + // + // After all Calculations we are ready to Draw what we want ... + DrawBuffers(bar_index); +} + +// +// LC Buffers Definitions ... +void LCDefineBuffers() +{ + // + // LC Fast Buffer ... + string lcFastBufferLabel = ShortName + " LC Fast (" + (string)lcFastLength + ")"; + ENUM_DRAW_TYPE lcFastDrawType = lcDrawFast ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(lcFastBuffer, true); + SetIndexBuffer(lcFastBufferIndex, lcFastBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(lcFastBufferIndex, lcFastBuffer, INDICATOR_DATA); + // PlotIndexSetString(lcFastBufferIndex, PLOT_LABEL, lcFastBufferLabel); + // PlotIndexSetInteger(lcFastBufferIndex, PLOT_LINE_COLOR, lcFastColor); + // PlotIndexSetInteger(lcFastBufferIndex, PLOT_LINE_STYLE, lcDrawStyle); + // PlotIndexSetInteger(lcFastBufferIndex, PLOT_LINE_WIDTH, lcDrawWidth); + // PlotIndexSetInteger(lcFastBufferIndex, PLOT_DRAW_BEGIN, lcFastLength); + // PlotIndexSetInteger(lcFastBufferIndex, PLOT_DRAW_TYPE, lcFastDrawType); + + // + // LC Slow Buffer ... + string lcSlowBufferLabel = ShortName + " LC Slow (" + (string)lcSlowLength + ")"; + ENUM_DRAW_TYPE lcSlowDrawType = lcDrawSlow ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(lcSlowBuffer, true); + SetIndexBuffer(lcSlowBufferIndex, lcSlowBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(lcSlowBufferIndex, lcSlowBuffer, INDICATOR_DATA); + // PlotIndexSetString(lcSlowBufferIndex, PLOT_LABEL, lcSlowBufferLabel); + // PlotIndexSetInteger(lcSlowBufferIndex, PLOT_LINE_COLOR, lcSlowColor); + // PlotIndexSetInteger(lcSlowBufferIndex, PLOT_LINE_STYLE, lcDrawStyle); + // PlotIndexSetInteger(lcSlowBufferIndex, PLOT_LINE_WIDTH, lcDrawWidth); + // PlotIndexSetInteger(lcSlowBufferIndex, PLOT_DRAW_BEGIN, lcSlowLength); + // PlotIndexSetInteger(lcSlowBufferIndex, PLOT_DRAW_TYPE, lcSlowDrawType); +} + +// +// MC Buffers Definitions ... +void MCDefineBuffers() +{ + // + // MC Fast Buffer ... + string mcFastBufferLabel = ShortName + " MC Fast (" + (string)mcFastLength + ")"; + ENUM_DRAW_TYPE mcFastDrawType = mcDrawFast ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(mcFastBuffer, true); + SetIndexBuffer(mcFastBufferIndex, mcFastBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(mcFastBufferIndex, mcFastBuffer, INDICATOR_DATA); + // PlotIndexSetString(mcFastBufferIndex, PLOT_LABEL, mcFastBufferLabel); + // PlotIndexSetInteger(mcFastBufferIndex, PLOT_LINE_COLOR, mcFastColor); + // PlotIndexSetInteger(mcFastBufferIndex, PLOT_LINE_STYLE, mcDrawStyle); + // PlotIndexSetInteger(mcFastBufferIndex, PLOT_LINE_WIDTH, mcDrawWidth); + // PlotIndexSetInteger(mcFastBufferIndex, PLOT_DRAW_BEGIN, mcFastLength); + // PlotIndexSetInteger(mcFastBufferIndex, PLOT_DRAW_TYPE, mcFastDrawType); + + // + // MC Slow Buffer ... + string mcSlowBufferLabel = ShortName + " MC Slow (" + (string)mcSlowLength + ")"; + ENUM_DRAW_TYPE mcSlowDrawType = mcDrawSlow ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(mcSlowBuffer, true); + SetIndexBuffer(mcSlowBufferIndex, mcSlowBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(mcSlowBufferIndex, mcSlowBuffer, INDICATOR_DATA); + // PlotIndexSetString(mcSlowBufferIndex, PLOT_LABEL, mcSlowBufferLabel); + // PlotIndexSetInteger(mcSlowBufferIndex, PLOT_LINE_COLOR, mcSlowColor); + // PlotIndexSetInteger(mcSlowBufferIndex, PLOT_LINE_STYLE, mcDrawStyle); + // PlotIndexSetInteger(mcSlowBufferIndex, PLOT_LINE_WIDTH, mcDrawWidth); + // PlotIndexSetInteger(mcSlowBufferIndex, PLOT_DRAW_BEGIN, mcSlowLength); + // PlotIndexSetInteger(mcSlowBufferIndex, PLOT_DRAW_TYPE, mcSlowDrawType); +} + +// +// SC Buffers Definitions ... +void SCDefineBuffers() +{ + // + // SC Fast Buffer ... + string scFastBufferLabel = ShortName + " SC Fast (" + (string)scFastLength + ")"; + ENUM_DRAW_TYPE scFastDrawType = scDrawFast ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(scFastBuffer, true); + SetIndexBuffer(scFastBufferIndex, scFastBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(scFastBufferIndex, scFastBuffer, INDICATOR_DATA); + // PlotIndexSetString(scFastBufferIndex, PLOT_LABEL, scFastBufferLabel); + // PlotIndexSetInteger(scFastBufferIndex, PLOT_LINE_COLOR, scFastColor); + // PlotIndexSetInteger(scFastBufferIndex, PLOT_LINE_STYLE, scDrawStyle); + // PlotIndexSetInteger(scFastBufferIndex, PLOT_LINE_WIDTH, scDrawWidth); + // PlotIndexSetInteger(scFastBufferIndex, PLOT_DRAW_BEGIN, scFastLength); + // PlotIndexSetInteger(scFastBufferIndex, PLOT_DRAW_TYPE, scFastDrawType); + + // + // SC Slow Buffer ... + string scSlowBufferLabel = ShortName + " SC Slow (" + (string)scSlowLength + ")"; + ENUM_DRAW_TYPE scSlowDrawType = scDrawSlow ? lcDrawType : DRAW_NONE; + ArraySetAsSeries(scSlowBuffer, true); + SetIndexBuffer(scSlowBufferIndex, scSlowBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(scSlowBufferIndex, scSlowBuffer, INDICATOR_DATA); + // PlotIndexSetString(scSlowBufferIndex, PLOT_LABEL, scSlowBufferLabel); + // PlotIndexSetInteger(scSlowBufferIndex, PLOT_LINE_COLOR, scSlowColor); + // PlotIndexSetInteger(scSlowBufferIndex, PLOT_LINE_STYLE, scDrawStyle); + // PlotIndexSetInteger(scSlowBufferIndex, PLOT_LINE_WIDTH, scDrawWidth); + // PlotIndexSetInteger(scSlowBufferIndex, PLOT_DRAW_BEGIN, scSlowLength); + // PlotIndexSetInteger(scSlowBufferIndex, PLOT_DRAW_TYPE, scSlowDrawType); +} + +// +// Hot State Buffer ... +void HotStateDefineBuffers() +{ + // + // Hot State Buffer ... + ArraySetAsSeries(hotStateBuffer, true); + SetIndexBuffer(hotStateBufferIndex, hotStateBuffer, INDICATOR_CALCULATIONS); +} + +// +// LC Init Handlers ... +bool LCInitHandlers() +{ + // + ResetLastError(); + + // + // LC Fast Handler ... + lcFastHandler = iMA( + _Symbol, + _Period, + lcFastLength, + 0, + lcMethod, + lcAppliedTo); + if (lcFastHandler == INVALID_HANDLE) + { + return false; + } + + // + // LC Slow Handler ... + lcSlowHandler = iMA( + _Symbol, + _Period, + lcSlowLength, + 0, + lcMethod, + lcAppliedTo); + if (lcSlowHandler == INVALID_HANDLE) + { + return false; + } + + // + return true; +} + +// +// MC Init Handlers ... +bool MCInitHandlers() +{ + // + ResetLastError(); + + // + // MC Fast Handler ... + mcFastHandler = iMA( + _Symbol, + _Period, + mcFastLength, + 0, + mcMethod, + mcAppliedTo); + if (mcFastHandler == INVALID_HANDLE) + { + return false; + } + + // + // MC Slow Handler ... + mcSlowHandler = iMA( + _Symbol, + _Period, + mcSlowLength, + 0, + mcMethod, + mcAppliedTo); + if (mcSlowHandler == INVALID_HANDLE) + { + return false; + } + + // + return true; +} + +// +// SC Init Handlers ... +bool SCInitHandlers() +{ + // + ResetLastError(); + + // + // SC Fast Handler ... + scFastHandler = iMA( + _Symbol, + _Period, + scFastLength, + 0, + scMethod, + scAppliedTo); + if (scFastHandler == INVALID_HANDLE) + { + return false; + } + + // + // SC Slow Handler ... + scSlowHandler = iMA( + _Symbol, + _Period, + scSlowLength, + 0, + scMethod, + scAppliedTo); + if (scSlowHandler == INVALID_HANDLE) + { + return false; + } + + // + return true; +} + +// +// LC State ... +double GetLCState( + int bar_index // Current Candle Index ... +) +{ + // + // Fast Cross Over Slow Detection ... + bool isFastCrossedOverSlow = IsCrossedOver( + lcFastBuffer, + lcSlowBuffer, + bar_index); + + // + // Fast Over Slow Detection ... + bool isFastOverSlow = IsOver( + lcFastBuffer, + lcSlowBuffer, + bar_index); + + // + // Fast Cross Under Slow Detection ... + bool isFastCrossedUnderSlow = IsCrossedUnder( + lcFastBuffer, + lcSlowBuffer, + bar_index); + + // + // Fast Under Slow Detection ... + bool isFastUnderSlow = IsUnder( + lcFastBuffer, + lcSlowBuffer, + bar_index); + + // + // Generate state value which represent curren bar index + // state between fast and slow lines ... + double result = X_XCHMA_NEUTURAL; + + // + // Filling state value based on Market Conditions ... + if (isFastCrossedOverSlow) + { + result = X_XCHMA_FAST_CROSSED_OVER_SLOW; + } + else if (isFastCrossedUnderSlow) + { + result = X_XCHMA_FAST_CROSSED_UNDER_SLOW; + } + else if (isFastOverSlow) + { + result = X_XCHMA_FAST_OVER_SLOW; + } + else if (isFastUnderSlow) + { + result = X_XCHMA_FAST_UNDER_SLOW; + } + + // + return result; +} + +// +// MC State ... +double GetMCState( + int bar_index // Current Candle Index ... +) +{ + // + // Fast Cross Over Slow Detection ... + bool isFastCrossedOverSlow = IsCrossedOver( + mcFastBuffer, + mcSlowBuffer, + bar_index); + + // + // Fast Over Slow Detection ... + bool isFastOverSlow = IsOver( + mcFastBuffer, + mcSlowBuffer, + bar_index); + + // + // Fast Cross Under Slow Detection ... + bool isFastCrossedUnderSlow = IsCrossedUnder( + mcFastBuffer, + mcSlowBuffer, + bar_index); + + // + // Fast Under Slow Detection ... + bool isFastUnderSlow = IsUnder( + mcFastBuffer, + mcSlowBuffer, + bar_index); + + // + // Generate state value which represent curren bar index + // state between fast and slow lines ... + double result = X_XCHMA_NEUTURAL; + + // + // Filling state value based on Market Conditions ... + if (isFastCrossedOverSlow) + { + result = X_XCHMA_FAST_CROSSED_OVER_SLOW; + } + else if (isFastCrossedUnderSlow) + { + result = X_XCHMA_FAST_CROSSED_UNDER_SLOW; + } + else if (isFastOverSlow) + { + result = X_XCHMA_FAST_OVER_SLOW; + } + else if (isFastUnderSlow) + { + result = X_XCHMA_FAST_UNDER_SLOW; + } + + // + return result; +} + +// +// SC State ... +double GetSCState( + int bar_index // Current Candle Index ... +) +{ + // + // Fast Cross Over Slow Detection ... + bool isFastCrossedOverSlow = IsCrossedOver( + scFastBuffer, + scSlowBuffer, + bar_index); + + // + // Fast Over Slow Detection ... + bool isFastOverSlow = IsOver( + scFastBuffer, + scSlowBuffer, + bar_index); + + // + // Fast Cross Under Slow Detection ... + bool isFastCrossedUnderSlow = IsCrossedUnder( + scFastBuffer, + scSlowBuffer, + bar_index); + + // + // Fast Under Slow Detection ... + bool isFastUnderSlow = IsUnder( + scFastBuffer, + scSlowBuffer, + bar_index); + + // + // Generate state value which represent curren bar index + // state between fast and slow lines ... + double result = X_XCHMA_NEUTURAL; + + // + // Filling state value based on Market Conditions ... + if (isFastCrossedOverSlow) + { + result = X_XCHMA_FAST_CROSSED_OVER_SLOW; + } + else if (isFastCrossedUnderSlow) + { + result = X_XCHMA_FAST_CROSSED_UNDER_SLOW; + } + else if (isFastOverSlow) + { + result = X_XCHMA_FAST_OVER_SLOW; + } + else if (isFastUnderSlow) + { + result = X_XCHMA_FAST_UNDER_SLOW; + } + + // + return result; +} + +// +// HOT State Calculate Buffers ... +void HotStateCalculateBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // LC ... + double lcFast = lcFastBuffer[bar_index]; + double lcSlow = lcSlowBuffer[bar_index]; + // + double lcFastPrev = lcFastBuffer[bar_index + 1]; + double lcSlowPrev = lcSlowBuffer[bar_index + 1]; + // + double lcState = GetLCState(bar_index); + + // + // MC ... + double mcFast = mcFastBuffer[bar_index]; + double mcSlow = mcSlowBuffer[bar_index]; + // + double mcFastPrev = mcFastBuffer[bar_index + 1]; + double mcSlowPrev = mcSlowBuffer[bar_index + 1]; + // + double mcState = GetMCState(bar_index); + + // + // SC ... + double scFast = scFastBuffer[bar_index]; + double scSlow = scSlowBuffer[bar_index]; + // + double scFastPrev = scFastBuffer[bar_index + 1]; + double scSlowPrev = scSlowBuffer[bar_index + 1]; + // + double scState = GetSCState(bar_index); + + // + // Detect HOT Bearish Area ... + bool isHotBearishArea = + lcFast < lcSlow && + mcFast < mcSlow && + scFast < scSlow; + // + bool isPrevHotBearishArea = + lcFastPrev < lcSlowPrev && + mcFastPrev < mcSlowPrev && + scFastPrev < scSlowPrev; + + // + // Detect HOT Bearish Area ... + bool isHotBullishArea = + lcFast > lcSlow && + mcFast > mcSlow && + scFast > scSlow; + // + bool isPrevHotBullishArea = + lcFastPrev > lcSlowPrev && + mcFastPrev > mcSlowPrev && + scFastPrev > scSlowPrev; + + // + // Generate HotState Value ... + double hotStateValue = + isHotBullishArea && !isPrevHotBullishArea + ? 1 + : isHotBearishArea && !isPrevHotBearishArea + ? -1 + : 0; + hotStateBuffer[bar_index] = hotStateValue; +} + +// +// Draw Buffers ... +void DrawBuffers( + int bar_index // Current Candle Index ... +) +{ + // + // General Requirements ... + + // + // Retrieve Candle Model ... + XOHCL candle; + candle.Init( + _Symbol, + _Period, + bar_index + // + ); + datetime time = iTime(_Symbol, _Period, bar_index); + + // + // Draw Arrow on Hot Areas ... + if (drawHotAreas) + { + // + double hotStateValue = hotStateBuffer[bar_index]; + bool isHotBullishArea = hotStateValue == 1; + bool isHotBearishArea = hotStateValue == -1; + if (isHotBullishArea || isHotBearishArea) + { + // + bool isBull = isHotBullishArea; + + // + double price = isBull ? candle.low : candle.high; + ENUM_ARROW_ANCHOR anchor = isBull ? ANCHOR_TOP : ANCHOR_BOTTOM; + color clr = isBull ? hotBullishArrowColor : hotBearishArrowColor; + uchar arrowCode = isBull ? hotBullishArrowCode : hotBearishArrowCode; + string name = "HOT " + (isBull ? "Bullish" : "Bearish") + "_" + (string)price + "_" + (string)time; + + // + DrawArrow( + 0, + name, + 0, + time, + price, + arrowCode, + anchor, + clr); + } + } + + // + // Draw LC Crosses ... + if (lcDrawCrosses) + { + // + double lcStateValue = GetLCState(bar_index); + bool isLcFastCrossedOverSlow = lcStateValue == X_XCHMA_FAST_CROSSED_OVER_SLOW; + bool isLcFastCrossedUnderSlow = lcStateValue == X_XCHMA_FAST_CROSSED_UNDER_SLOW; + if (isLcFastCrossedOverSlow || isLcFastCrossedUnderSlow) + { + // + bool isBull = isLcFastCrossedOverSlow; + + // + color clr = isBull ? lcFastColor : lcSlowColor; + string name = "LC Fast Cross " + (isBull ? "Over" : "Under") + "_" + (string)time; + + // + DrawVerticalLine( + 0, + name, + 0, + time, + clr); + } + } + + // + // Draw MC Crosses ... + if (mcDrawCrosses) + { + // + double mcStateValue = GetMCState(bar_index); + bool isMcFastCrossedOverSlow = mcStateValue == X_XCHMA_FAST_CROSSED_OVER_SLOW; + bool isMcFastCrossedUnderSlow = mcStateValue == X_XCHMA_FAST_CROSSED_UNDER_SLOW; + if (isMcFastCrossedOverSlow || isMcFastCrossedUnderSlow) + { + // + bool isBull = isMcFastCrossedOverSlow; + + // + color clr = isBull ? mcFastColor : mcSlowColor; + string name = "MC Fast Cross " + (isBull ? "Over" : "Under") + "_" + (string)time; + + // + DrawVerticalLine( + 0, + name, + 0, + time, + clr); + } + } + + // + // Draw SC Crosses ... + if (scDrawCrosses) + { + // + double scStateValue = GetSCState(bar_index); + bool isScFastCrossedOverSlow = scStateValue == X_XCHMA_FAST_CROSSED_OVER_SLOW; + bool isScFastCrossedUnderSlow = scStateValue == X_XCHMA_FAST_CROSSED_UNDER_SLOW; + if (isScFastCrossedOverSlow || isScFastCrossedUnderSlow) + { + // + bool isBull = isScFastCrossedOverSlow; + + // + color clr = isBull ? scFastColor : scSlowColor; + string name = "SC Fast Cross " + (isBull ? "Over" : "Under") + "_" + (string)time; + + // + DrawVerticalLine( + 0, + name, + 0, + time, + clr); + } + } +} +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xct.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xct.mq5 new file mode 100644 index 0000000..25b3b07 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xct.mq5 @@ -0,0 +1,261 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// --------------------------------------------- +// Name: XCT +// Description: Trend Magic Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XCT Indicator" +#property strict + +// +// START Constants ... +// + +// +#define ShortName "XCT" +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input color clr = clrYellow; // Text Color +input ENUM_BASE_CORNER corner = CORNER_RIGHT_LOWER; // Text Position + +// +input group "Presentation"; +input bool showCandleTime = true; // Show Candle Time + +// +// END Inputs ... +// + +// +// START Buffers ... +// + +// +#property indicator_chart_window + +// +#property indicator_buffers 0 +#property indicator_plots 0 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (showCandleTime) + { + CreateIndicatorObject(); + } + else + { + ObjectDelete(0, ShortName); + } + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + ulong chID = FindChartID( + _Symbol, + _Period + // + ); + + // + // Delete Object ... + ObjectDelete(chID, ShortName); + + // + Comment(""); +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... +) +{ + // + ArraySetAsSeries(time, true); + + // + if (!showCandleTime) + { + return rates_total; + } + + // + ulong chID = FindChartID( + _Symbol, + _Period + // + ); + + // + XBarRemainsTime barRemains; + barRemains.Init( + _Symbol, + _Period + // + ); + + // + string msg = barRemains + .ToString( + "", + "", + "", + "", + "", + ":", + true + // + ); + + // + long mSpread = SymbolInfoInteger(Symbol(), SYMBOL_SPREAD); + + // + string _sp = ""; + if (mSpread < 10) + _sp = ".."; + else if (mSpread < 100) + _sp = "."; + + // + string objText = "Spread: " + IntegerToString(mSpread) + _sp + " Next Bar in: " + msg; + + // + ObjectSetInteger(chID, ShortName, OBJPROP_COLOR, clr); + ObjectSetString(chID, ShortName, OBJPROP_TEXT, objText); + ObjectSetInteger(chID, ShortName, OBJPROP_FONTSIZE, 10); + ObjectSetString(chID, ShortName, OBJPROP_FONT, "Courier"); + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +void CreateIndicatorObject() +{ + // + if (!showCandleTime) + { + return; + } + + // + ObjectCreate(0, ShortName, OBJ_LABEL, 0, 0, 0); + ObjectSetInteger(0, ShortName, OBJPROP_CORNER, corner); + ObjectSetInteger(0, ShortName, OBJPROP_XDISTANCE, 10); + ObjectSetInteger(0, ShortName, OBJPROP_YDISTANCE, 2); + + // + ENUM_ANCHOR_POINT Anchor = ANCHOR_LEFT_UPPER; + switch (corner) + { + case CORNER_LEFT_UPPER: + Anchor = ANCHOR_LEFT_UPPER; + break; + case CORNER_RIGHT_UPPER: + Anchor = ANCHOR_RIGHT_UPPER; + break; + case CORNER_LEFT_LOWER: + Anchor = ANCHOR_LEFT_LOWER; + break; + case CORNER_RIGHT_LOWER: + Anchor = ANCHOR_RIGHT_LOWER; + break; + } + + // + ObjectSetInteger(0, ShortName, OBJPROP_ANCHOR, Anchor); +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xdon.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xdon.mq5 new file mode 100644 index 0000000..c96e2bf --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xdon.mq5 @@ -0,0 +1,366 @@ +/////////////////////////////////////////////////////// +// SaherElm IT Center MQL5 Indicator +// ------------------------------------------- +// Name: XDON +// Description: DONCHAIN Channel ... +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XDON Indicator" +#property strict + +// +#define ShortName "XDON" + +// +// INPUT ... + +// +input group "Market"; +input int length = 52; // Market Length +input double offset = 0; // Offset + +// +input group "Presentation"; +input bool showOpen = true; // Show Open +input bool showHigh = true; // Show High +input bool showClose = true; // Show Close +input bool showLow = true; // Show Low + +// +// BUFFERS ... + +// +#property indicator_chart_window + +// +#property indicator_buffers 8 +#property indicator_plots 8 + +// +#define upperOBufferIndex 0 +double upperOBuffer[]; + +// +#property indicator_label1 "XDON OU" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrCornflowerBlue +#property indicator_width1 2 + +// +#define lowerOBufferIndex 1 +double lowerOBuffer[]; + +// +#property indicator_label2 "XDON OL" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrCornflowerBlue +#property indicator_width2 2 + +// +#define upperCBufferIndex 2 +double upperCBuffer[]; + +// +#property indicator_label3 "XDON CU" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrCoral +#property indicator_width3 2 + +// +#define lowerCBufferIndex 3 +double lowerCBuffer[]; + +// +#property indicator_label4 "XDON CL" +#property indicator_type4 DRAW_LINE +#property indicator_color4 clrCoral +#property indicator_width4 2 + +// +#define upperHBufferIndex 4 +double upperHBuffer[]; + +// +#property indicator_label5 "XDON HU" +#property indicator_type5 DRAW_LINE +#property indicator_color5 clrAquamarine +#property indicator_width5 2 + +// +#define lowerHBufferIndex 5 +double lowerHBuffer[]; + +// +#property indicator_label6 "XDON HL" +#property indicator_type6 DRAW_LINE +#property indicator_color6 clrAquamarine +#property indicator_width6 2 + +// +#define upperLBufferIndex 6 +double upperLBuffer[]; + +// +#property indicator_label7 "XDON LU" +#property indicator_type7 DRAW_LINE +#property indicator_color7 clrDarkOrchid +#property indicator_width7 2 + +// +#define lowerLBufferIndex 7 +double lowerLBuffer[]; + +// +#property indicator_label8 "XDON LL" +#property indicator_type8 DRAW_LINE +#property indicator_color8 clrDarkOrchid +#property indicator_width8 2 + +// +// EVENT Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... +) +{ + // + if (rates_total < length - 1) + { + return prev_calculated; + } + + // + int start = prev_calculated == 0 + ? length + : prev_calculated - 1; + + // + // Main Loop ... + for (int barIndex = start; barIndex < rates_total; barIndex++) + { + // + // OPEN ... + + // + double upperOValue = open[ArrayMaximum(open, barIndex - length + 1, length)]; + double lowerOValue = open[ArrayMinimum(open, barIndex - length + 1, length)]; + + // + double oDelta = MathAbs(upperOValue - lowerOValue); + double oOffsetValue = oDelta * (offset) * 0.01; + + // + upperOBuffer[barIndex] = upperOValue - oOffsetValue; + lowerOBuffer[barIndex] = lowerOValue + oOffsetValue; + + // + // CLOSE ... + + // + double upperCValue = close[ArrayMaximum(close, barIndex - length + 1, length)]; + double lowerCValue = close[ArrayMinimum(close, barIndex - length + 1, length)]; + + // + double cDelta = MathAbs(upperCValue - lowerCValue); + double cOffsetValue = cDelta * (offset) * 0.01; + + // + upperCBuffer[barIndex] = upperCValue - cOffsetValue; + lowerCBuffer[barIndex] = lowerCValue + cOffsetValue; + + // + // HIGH ... + + // + double upperHValue = high[ArrayMaximum(high, barIndex - length + 1, length)]; + double lowerHValue = high[ArrayMinimum(high, barIndex - length + 1, length)]; + + // + double hDelta = MathAbs(upperHValue - lowerHValue); + double hOffsetValue = hDelta * (offset) * 0.01; + + // + upperHBuffer[barIndex] = upperHValue - hOffsetValue; + lowerHBuffer[barIndex] = lowerHValue + hOffsetValue; + + // + // LOW ... + + // + double upperLValue = low[ArrayMaximum(low, barIndex - length + 1, length)]; + double lowerLValue = low[ArrayMinimum(low, barIndex - length + 1, length)]; + + // + double lDelta = MathAbs(upperLValue - lowerLValue); + double lOffsetValue = lDelta * (offset) * 0.01; + + // + upperLBuffer[barIndex] = upperLValue - lOffsetValue; + lowerLBuffer[barIndex] = lowerLValue + lOffsetValue; + } + + // + return rates_total; +} + +// +// CUSTOM Functions ... + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + result = length >= 7; + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // Open ... + ENUM_DRAW_TYPE openDrawType = showOpen ? DRAW_LINE : DRAW_NONE; + + // + // UPPER ... + SetIndexBuffer(upperOBufferIndex, upperOBuffer, INDICATOR_DATA); + PlotIndexSetInteger(upperOBufferIndex, PLOT_SHOW_DATA, showOpen); + PlotIndexSetDouble(upperOBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(upperOBufferIndex, PLOT_DRAW_TYPE, openDrawType); + + // + // LOWER ... + SetIndexBuffer(lowerOBufferIndex, lowerOBuffer, INDICATOR_DATA); + PlotIndexSetInteger(lowerOBufferIndex, PLOT_SHOW_DATA, showOpen); + PlotIndexSetDouble(lowerOBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(lowerOBufferIndex, PLOT_DRAW_TYPE, openDrawType); + + // + // Close ... + ENUM_DRAW_TYPE closeDrawType = showClose ? DRAW_LINE : DRAW_NONE; + + // + // UPPER ... + SetIndexBuffer(upperCBufferIndex, upperCBuffer, INDICATOR_DATA); + PlotIndexSetInteger(upperCBufferIndex, PLOT_SHOW_DATA, showClose); + PlotIndexSetDouble(upperCBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(upperCBufferIndex, PLOT_DRAW_TYPE, closeDrawType); + + // + // LOWER ... + SetIndexBuffer(lowerCBufferIndex, lowerCBuffer, INDICATOR_DATA); + PlotIndexSetInteger(lowerCBufferIndex, PLOT_SHOW_DATA, showClose); + PlotIndexSetDouble(lowerCBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(lowerCBufferIndex, PLOT_DRAW_TYPE, closeDrawType); + + // + // High ... + ENUM_DRAW_TYPE highDrawType = showHigh ? DRAW_LINE : DRAW_NONE; + + // + // UPPER ... + SetIndexBuffer(upperHBufferIndex, upperHBuffer, INDICATOR_DATA); + PlotIndexSetInteger(upperHBufferIndex, PLOT_SHOW_DATA, showHigh); + PlotIndexSetDouble(upperHBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(upperHBufferIndex, PLOT_DRAW_TYPE, highDrawType); + + // + // LOWER ... + SetIndexBuffer(lowerHBufferIndex, lowerHBuffer, INDICATOR_DATA); + PlotIndexSetInteger(lowerHBufferIndex, PLOT_SHOW_DATA, showHigh); + PlotIndexSetDouble(lowerHBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(lowerHBufferIndex, PLOT_DRAW_TYPE, highDrawType); + + // + // Low ... + ENUM_DRAW_TYPE lowDrawType = showLow ? DRAW_LINE : DRAW_NONE; + + // + // UPPER ... + SetIndexBuffer(upperLBufferIndex, upperLBuffer, INDICATOR_DATA); + PlotIndexSetInteger(upperLBufferIndex, PLOT_SHOW_DATA, showLow); + PlotIndexSetDouble(upperLBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(upperLBufferIndex, PLOT_DRAW_TYPE, lowDrawType); + + // + // LOWER ... + SetIndexBuffer(lowerLBufferIndex, lowerLBuffer, INDICATOR_DATA); + PlotIndexSetInteger(lowerLBufferIndex, PLOT_SHOW_DATA, showLow); + PlotIndexSetDouble(lowerLBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE); + PlotIndexSetInteger(lowerLBufferIndex, PLOT_DRAW_TYPE, lowDrawType); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xfi.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xfi.mq5 new file mode 100644 index 0000000..44f2c4d --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xfi.mq5 @@ -0,0 +1,309 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XFI Oscillator +// --------------------------------------------- +// Name: XFI +// Description: Price Momentum Power Detection +// Market Analysor ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XFI Oscillator" +#property strict + +// +// START Constants ... +// +#define ShortName "XFI" +// +// END Constants ... +// + +// +// START Inputs ... +// +input int length = 18; // Length +input ENUM_MA_METHOD method = MODE_SMA; // MA Method +input ENUM_APPLIED_VOLUME appliedTo = VOLUME_TICK; // Applied To +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// +// #property indicator_separate_window +#property indicator_chart_window + +// +#property indicator_buffers 2 +// #property indicator_plots 1 +#property indicator_plots 0 + +// +// FI Buffer ... +#define fiBufferIndex 0 +#define fiColorBufferIndex 1 + +// +double fiBuffer[]; +double fiColorBuffer[]; + +// +// #property indicator_label1 "XFI" +// #property indicator_type1 DRAW_COLOR_LINE +// #property indicator_color1 clrAqua, clrGray, clrFuchsia +// #property indicator_style1 STYLE_DOT +// #property indicator_width1 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +int fiHandler = INVALID_HANDLE; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + fiHandler = iForce( + _Symbol, + _Period, + length, + method, + appliedTo); + if (fiHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(fiHandler); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(0, length); + + // + // Check Calculated Bars ... + int fiCalculatedBars = BarsCalculated(fiHandler); + if (fiCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedFis = CopyBuffer(fiHandler, 0, 0, limit, fiBuffer); + if (copiedFis <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = 0; i < limit && !IsStopped(); i++) + { + // + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (length >= 2) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + string fiBufferLabel = "XFI " + "(" + (string)length + ")"; + + // + // FI Buffer ... + ArraySetAsSeries(fiBuffer, true); + SetIndexBuffer(fiBufferIndex, fiBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(fiBufferIndex, fiBuffer, INDICATOR_DATA); + // PlotIndexSetString(fiBufferIndex, PLOT_LABEL, fiBufferLabel); + + // // + // // FI Color Buffer ... + ArraySetAsSeries(fiColorBuffer, true); + // SetIndexBuffer(fiColorBufferIndex, fiColorBuffer, INDICATOR_COLOR_INDEX); + SetIndexBuffer(fiColorBufferIndex, fiColorBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, ""); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ + // + double iValue = fiBuffer[bar_index]; + + // + double iColorIndex = + iValue > 0 ? 0 : iValue < 0 ? 2 + : 1; + + // + // Set Buffer Color Index ... + fiColorBuffer[bar_index] = iColorIndex; +} +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhk.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhk.mq5 new file mode 100644 index 0000000..37cf4b5 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhk.mq5 @@ -0,0 +1,479 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// -------------------------------------------- +// Name: XHK +// Description: Hiken Ashi ... +// Market Analysor ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XHK Indicator" +#property strict + +// +// Constants ... + +// +// Indicator Short Name ... +#define ShortName "XHK" + +// +// Imports ... +#include +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// Inputs ... + +// +input group "Market"; +input int smoothingLength = 17; // Smoothing Length +// +input group "Presentation"; +input bool drawHikenAshi = true; // Draw Hiken Ashi +input bool drawSmoothedHikenAshi = true; // Draw Smoothed Hiken Ashi + +// +// Buffers ... + +// +#property indicator_chart_window + +// +#property indicator_buffers 10 +#property indicator_plots 10 + +// +// Buffers ... + +// +// Open ... +#define openBufferIndex 0 +double openBuffer[]; + +// +// High ... +#define highBufferIndex 1 +double highBuffer[]; + +// +// Low ... +#define lowBufferIndex 2 +double lowBuffer[]; + +// +// Close ... +#define closeBufferIndex 3 +double closeBuffer[]; + +// +// Candle Color ... +#define candleColorBufferIndex 4 +double candleColorBuffer[]; + +// +#define candlesBufferIndex 0 + +// +#property indicator_label1 "XHK Open;XHK High;XHK Low;XHK Close" +#property indicator_type1 DRAW_COLOR_CANDLES +#property indicator_color1 CLR_NONE, clrAqua, clrMagenta + +// +// SM Open ... +#define openSMBufferIndex 5 +double openSMBuffer[]; + +// +// SM High ... +#define highSMBufferIndex 6 +double highSMBuffer[]; + +// +// SM Low ... +#define lowSMBufferIndex 7 +double lowSMBuffer[]; + +// +// SM Close ... +#define closeSMBufferIndex 8 +double closeSMBuffer[]; + +// +// SM Candle Color ... +#define candleColorSMBufferIndex 9 +double candleColorSMBuffer[]; + +// +#define candlesSMBufferIndex 1 + +// +#property indicator_label2 "XSMHK Open;XSMHK High;XSMHK Low;XSMHK Close" +#property indicator_type2 DRAW_COLOR_CANDLES +#property indicator_color2 CLR_NONE, clrDarkGreen, clrDarkRed + +// +// Variables, Properties and etc ... + +// +int maxLength; + +// +double mHideColorIDX = 0; + +// +// Event Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... +) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i, prev_calculated, rates_total, open, high, close, low); + } + + // + CalculateSM(rates_total, prev_calculated); + + // + return rates_total; +} + +// +// Functions ... + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = true; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // Candles Color ... + ArraySetAsSeries(candleColorBuffer, true); + SetIndexBuffer(candleColorBufferIndex, candleColorBuffer, INDICATOR_COLOR_INDEX); + + // + // Set EMPTY_VALUE on Candles Buffer ... + PlotIndexSetDouble(candlesBufferIndex, PLOT_EMPTY_VALUE, 0.0); + + // + PlotIndexSetInteger(candlesBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(candleColorBufferIndex, PLOT_SHOW_DATA, false); + + // + // Open ... + ArraySetAsSeries(openBuffer, true); + PlotIndexSetInteger(openBufferIndex, PLOT_SHOW_DATA, false); + SetIndexBuffer(openBufferIndex, openBuffer, INDICATOR_DATA); + + // + // High ... + ArraySetAsSeries(highBuffer, true); + SetIndexBuffer(highBufferIndex, highBuffer, INDICATOR_DATA); + PlotIndexSetInteger(highBufferIndex, PLOT_SHOW_DATA, false); + + // + // Close ... + ArraySetAsSeries(closeBuffer, true); + SetIndexBuffer(closeBufferIndex, closeBuffer, INDICATOR_DATA); + PlotIndexSetInteger(closeBufferIndex, PLOT_SHOW_DATA, false); + + // + // Low ... + ArraySetAsSeries(lowBuffer, true); + SetIndexBuffer(lowBufferIndex, lowBuffer, INDICATOR_DATA); + PlotIndexSetInteger(lowBufferIndex, PLOT_SHOW_DATA, false); + + // + // Candles Color ... + ArraySetAsSeries(candleColorSMBuffer, true); + SetIndexBuffer(candleColorSMBufferIndex, candleColorSMBuffer, INDICATOR_COLOR_INDEX); + + // + // Set EMPTY_VALUE on Candles Buffer ... + PlotIndexSetDouble(candlesSMBufferIndex, PLOT_EMPTY_VALUE, 0.0); + + // + PlotIndexSetInteger(candlesSMBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(candleColorSMBufferIndex, PLOT_SHOW_DATA, false); + + // + // Open ... + ArraySetAsSeries(openSMBuffer, true); + PlotIndexSetInteger(openSMBufferIndex, PLOT_SHOW_DATA, false); + SetIndexBuffer(openSMBufferIndex, openSMBuffer, INDICATOR_DATA); + + // + // High ... + ArraySetAsSeries(highSMBuffer, true); + SetIndexBuffer(highSMBufferIndex, highSMBuffer, INDICATOR_DATA); + PlotIndexSetInteger(highSMBufferIndex, PLOT_SHOW_DATA, false); + + // + // Close ... + ArraySetAsSeries(closeSMBuffer, true); + SetIndexBuffer(closeSMBufferIndex, closeSMBuffer, INDICATOR_DATA); + PlotIndexSetInteger(closeSMBufferIndex, PLOT_SHOW_DATA, false); + + // + // Low ... + ArraySetAsSeries(lowSMBuffer, true); + SetIndexBuffer(lowSMBufferIndex, lowSMBuffer, INDICATOR_DATA); + PlotIndexSetInteger(lowSMBufferIndex, PLOT_SHOW_DATA, false); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index, // Selected Bar Index + const int prevCalculated, + const int ratesTotal, + const double &open[], + const double &high[], + const double &close[], + const double &low[] // +) +{ + // + double mPrevHKOpenValue; + double mPrevHKCloseValue; + + // + if (ArraySize(open) <= bar_index + 1) + { + // + mPrevHKOpenValue = 0; + mPrevHKCloseValue = 0; + } + else + { + // + mPrevHKOpenValue = openBuffer[bar_index + 1]; + mPrevHKCloseValue = closeBuffer[bar_index + 1]; + } + + // + double mHKOpenValue = (mPrevHKOpenValue + mPrevHKCloseValue) / 2; + double mHKCloseValue = (open[bar_index] + high[bar_index] + close[bar_index] + low[bar_index]) / 4; + double mHKHighValue = MathMax(high[bar_index], MathMax(mHKOpenValue, mHKCloseValue)); + double mHKLowValue = MathMin(low[bar_index], MathMin(mHKOpenValue, mHKCloseValue)); + + // + openBuffer[bar_index] = mHKOpenValue; + highBuffer[bar_index] = mHKHighValue; + lowBuffer[bar_index] = mHKLowValue; + closeBuffer[bar_index] = mHKCloseValue; + + // + bool isBearish = + // + openBuffer[bar_index] > closeBuffer[bar_index] + // + ; + + // + candleColorBuffer[bar_index] = !drawHikenAshi + ? mHideColorIDX + : isBearish + ? 2 + : 1; +} + +// +// Calculate Smoothed HikenAshi ... +void CalculateSM( + int ratesTotal, // Total Bars + int prevCalculated // Calculated Bars +) +{ + // + // Open ... + int calculatedSMHKOpens = ExponentialMAOnBuffer( + ratesTotal, + prevCalculated, + 0, + smoothingLength, + openBuffer, + openSMBuffer); + + // + // High ... + int calculatedSMHKHighs = ExponentialMAOnBuffer( + ratesTotal, + prevCalculated, + 0, + smoothingLength, + highBuffer, + highSMBuffer); + + // + // Low ... + int calculatedSMHKLows = ExponentialMAOnBuffer( + ratesTotal, + prevCalculated, + 0, + smoothingLength, + lowBuffer, + lowSMBuffer); + + // + // Close ... + int calculatedSMHKCloses = ExponentialMAOnBuffer( + ratesTotal, + prevCalculated, + 0, + smoothingLength, + closeBuffer, + closeSMBuffer); + + // + // Find Calculated Items for Colors ... + int mNumberOfItems = MathMin(calculatedSMHKOpens, calculatedSMHKHighs); + mNumberOfItems = MathMin(mNumberOfItems, calculatedSMHKLows); + mNumberOfItems = MathMin(mNumberOfItems, calculatedSMHKCloses); + + // + // Create a Loop for Color of Candles ... + for (int i = 0; i < mNumberOfItems; i++) + { + // + bool isBearish = + // + openSMBuffer[i] > closeSMBuffer[i] + // + ; + + // + if (drawSmoothedHikenAshi) + { + // + candleColorSMBuffer[i] = isBearish + ? 2 + : 1; + } + else + { + // + candleColorSMBuffer[i] = mHideColorIDX; + } + } +} diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhull.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhull.mq5 new file mode 100644 index 0000000..ffc1792 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xhull.mq5 @@ -0,0 +1,583 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// --------------------------------------------- +// Name: XHULL +// Description: Hull Trend Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XHULL Indicator" +#property strict + +// +// START Constants ... +// + +// +#define ShortName "XHULL" + +// +struct XHullData +{ + // + double value; + double value3; + + // + double wsum1; + double wsum2; + double wsum3; + + // + double lsum1; + double lsum2; + double lsum3; +}; + +// +// END Constants ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START XSCHULL Class Definition ... +// + +// +// a Class For Hull Calculations ... +class XSCHull +{ + // +public: + // + // Constructor ... + XSCHull() : mFullPeriod(1), mHalfPeriod(1), mSqrtPeriod(1), mArraySize(-1) + { + // + // These are a way above to assign Private variables at Construct time ... + } + + // + // Deconstructor ... + ~XSCHull() + { + ArrayFree(mData); + } + + // + // Initial Hull ... + bool Init( + int mPeriod, + double mDivisor) + { + // + bool result = false; + + // + mFullPeriod = (int)(mPeriod > 1 ? mPeriod : 1); + mHalfPeriod = (int)(mFullPeriod > 1 ? mFullPeriod / (mDivisor > 1 ? mDivisor : 1) : 1); + mSqrtPeriod = (int)MathSqrt(mFullPeriod); + + // + mArraySize = -1; + mWeight1 = mWeight2 = mWeight3 = 1; + + // + result = true; + + // + return result; + } + + // + // CalCulate Specific Value ... + double Calculate( + double value, + int i, + int bars) + { + // + double result = 0; + + // + if (mArraySize < bars) + { + // + mArraySize = ArrayResize(mData, bars + 500); + if (mArraySize < bars) + return result; + } + + // + mData[i].value = value; + if (i > mFullPeriod) + { + // + mData[i].wsum1 = mData[i - 1].wsum1 + value * mHalfPeriod - mData[i - 1].lsum1; + mData[i].lsum1 = mData[i - 1].lsum1 + value - mData[i - mHalfPeriod].value; + mData[i].wsum2 = mData[i - 1].wsum2 + value * mFullPeriod - mData[i - 1].lsum2; + mData[i].lsum2 = mData[i - 1].lsum2 + value - mData[i - mFullPeriod].value; + } + else + { + // + mData[i].wsum1 = mData[i].wsum2 = + mData[i].lsum1 = mData[i].lsum2 = mWeight1 = mWeight2 = 0; + for (int k = 0, w1 = mHalfPeriod, w2 = mFullPeriod; w2 > 0 && i >= k; k++, w1--, w2--) + { + // + if (w1 > 0) + { + // + mData[i].wsum1 += mData[i - k].value * w1; + mData[i].lsum1 += mData[i - k].value; + mWeight1 += w1; + } + + // + mData[i].wsum2 += mData[i - k].value * w2; + mData[i].lsum2 += mData[i - k].value; + mWeight2 += w2; + } + } + + // + mData[i].value3 = 2.0 * mData[i].wsum1 / mWeight1 - mData[i].wsum2 / mWeight2; + + // + if (i > mSqrtPeriod) + { + // + mData[i].wsum3 = mData[i - 1].wsum3 + mData[i].value3 * mSqrtPeriod - mData[i - 1].lsum3; + mData[i].lsum3 = mData[i - 1].lsum3 + mData[i].value3 - mData[i - mSqrtPeriod].value3; + } + else + { + // + mData[i].wsum3 = + mData[i].lsum3 = mWeight3 = 0; + + // + for (int k = 0, w3 = mSqrtPeriod; w3 > 0 && i >= k; k++, w3--) + { + // + mData[i].wsum3 += mData[i - k].value3 * w3; + mData[i].lsum3 += mData[i - k].value3; + mWeight3 += w3; + } + } + + // + result = mData[i].wsum3 / mWeight3; + + // + return result; + } + + // + // Protected ... +protected: + // + // Private ... +private: + // + int mFullPeriod; + int mHalfPeriod; + int mSqrtPeriod; + int mArraySize; + double mWeight1; + double mWeight2; + double mWeight3; + + // + XHullData mData[]; +}; + +// +// END XSCHULL Class Definition ... +// + +// +// START Inputs ... +// + +// +input group "Market"; +input int length = 72; // Length +input double divisor = 2.0; // Divisor (Speed) + +// +input group "Calculation"; +input ENUM_APPLIED_PRICE upAppliedTo = PRICE_HIGH; // Up Zone Applied to +input ENUM_APPLIED_PRICE downAppliedTo = PRICE_LOW; // Down Zone Applied to + +// +input group "Presentation"; +input bool showUpZone = true; // Show Up Zone +input bool showDownZone = true; // Show Down Zone + +// +// END Inputs ... +// + +// +// START Buffers ... +// + +// +#property indicator_chart_window + +// +#property indicator_buffers 4 +#property indicator_plots 4 + +// +// UP Zone ... + +// +#define upZoneBufferIndex 0 +#define upZoneColorBufferIndex 1 + +// +double upZoneBuffer[]; +double upZoneColorBuffer[]; + +// +#property indicator_label1 "XHULL Up" +#property indicator_type1 DRAW_COLOR_LINE +#property indicator_color1 clrLightGray, clrAqua, clrMagenta +#property indicator_width1 1 + +// +// DOWN Zone ... + +// +#define downZoneBufferIndex 2 +#define downZoneColorBufferIndex 3 + +// +double downZoneBuffer[]; +double downZoneColorBuffer[]; + +// +#property indicator_label2 "XHULL Down" +#property indicator_type2 DRAW_COLOR_LINE +#property indicator_color2 clrLightGray, clrAqua, clrMagenta +#property indicator_width2 1 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +XSCHull *mUpZHull; +XSCHull *mDownZHull; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Make an Instance of Hull Class ... + + // + mUpZHull = new XSCHull(); + mUpZHull.Init( + length, + divisor); + + // + mDownZHull = new XSCHull(); + mDownZHull.Init( + length, + divisor); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart mPeriod is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + delete mUpZHull; + delete mDownZHull; +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... +) +{ + // + // this counts Available Bars ... + int limit; + + // + limit = prev_calculated - 1; + if (limit < 0) + { + limit = 0; + } + + // + // Main Loop ... + for (int i = limit; i < rates_total && !IsStopped(); i++) + { + // + double upPrice = getPrice( + upAppliedTo, + open, high, low, close, i); + + // + double downPrice = getPrice( + downAppliedTo, + open, high, low, close, i); + + // + CalculateBuffers( + i, + rates_total, + upPrice, + downPrice); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = true; + + // + result = + length >= 9 && + divisor >= 0.5; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + result = length; + + // + return result; +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // UP Zone ... + + // + // Draw Type ... + ENUM_DRAW_TYPE upZoneDrawType = showUpZone ? DRAW_COLOR_LINE : DRAW_NONE; + + // + // Buffer ... + SetIndexBuffer(upZoneBufferIndex, upZoneBuffer, INDICATOR_DATA); + PlotIndexSetInteger(upZoneBufferIndex, PLOT_SHOW_DATA, showUpZone); + PlotIndexSetInteger(upZoneBufferIndex, PLOT_DRAW_TYPE, upZoneDrawType); + + // + // Color Buffer ... + SetIndexBuffer(upZoneColorBufferIndex, upZoneColorBuffer, INDICATOR_COLOR_INDEX); + + // + // DOWN Zone ... + + // + // Draw Type ... + ENUM_DRAW_TYPE downZoneDrawType = showDownZone ? DRAW_COLOR_LINE : DRAW_NONE; + + // + // Buffer ... + SetIndexBuffer(downZoneBufferIndex, downZoneBuffer, INDICATOR_DATA); + PlotIndexSetInteger(downZoneBufferIndex - 1, PLOT_SHOW_DATA, showDownZone); + PlotIndexSetInteger(downZoneBufferIndex - 1, PLOT_DRAW_TYPE, downZoneDrawType); + + // + // Color Buffer ... + SetIndexBuffer(downZoneColorBufferIndex, downZoneColorBuffer, INDICATOR_COLOR_INDEX); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index, // Selected Bar Index + int ratesTotal, // Total Rates + double upPrice, // Up Price ... + double downPrice // Down Price ... +) +{ + // + double upValue = mUpZHull.Calculate( + upPrice, + bar_index, + ratesTotal); + upZoneBuffer[bar_index] = upValue; + double upColorIDX = (bar_index > 0) + ? (upZoneBuffer[bar_index] > upZoneBuffer[bar_index - 1]) + ? 1 + : (upZoneBuffer[bar_index] < upZoneBuffer[bar_index - 1]) + ? 2 + : upZoneColorBuffer[bar_index - 1] + : 0; + upZoneColorBuffer[bar_index] = upColorIDX; + + // + double downValue = mDownZHull.Calculate( + downPrice, + bar_index, + ratesTotal); + downZoneBuffer[bar_index] = downValue; + double downColorIDX = (bar_index > 0) + ? (downZoneBuffer[bar_index] > downZoneBuffer[bar_index - 1]) + ? 1 + : (downZoneBuffer[bar_index] < downZoneBuffer[bar_index - 1]) + ? 2 + : downZoneColorBuffer[bar_index - 1] + : 0; + downZoneColorBuffer[bar_index] = downColorIDX; +} + +// +// END Functions ... +// + +// +// TEMPLATE Function ... + +template +double getPrice(ENUM_APPLIED_PRICE tprice, T &open[], T &high[], T &low[], T &close[], int i) +{ + switch (tprice) + { + case PRICE_CLOSE: + return (close[i]); + case PRICE_OPEN: + return (open[i]); + case PRICE_HIGH: + return (high[i]); + case PRICE_LOW: + return (low[i]); + case PRICE_MEDIAN: + return ((high[i] + low[i]) / 2.0); + case PRICE_TYPICAL: + return ((high[i] + low[i] + close[i]) / 3.0); + case PRICE_WEIGHTED: + return ((high[i] + low[i] + close[i] + close[i]) / 4.0); + } + return (0); +} diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xich.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xich.mq5 new file mode 100644 index 0000000..00bf6fb --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xich.mq5 @@ -0,0 +1,846 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// ------------------------------------------------- +// Name: XICH +// Description: Ichimoku Kinko Hyo ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XICH Indicator" +#property strict + +// +// START Constants ... +// + +// +// Indicator Short Name ... +#define ShortName "XICH" + +// +// Ichimoku Golden Numbers ... +enum ENUM_X_ICHIMOKU_GOLDEN_NUMBERS +{ + X_ICH_BASE = 9, + X_ICH_GOLDEN = 17, + X_ICH_CYCLE = 26, + X_ICH_PERIOD = 35, + X_ICH_STAR = 45, + X_ICH_MED = 52, + X_ICH_LONG = 63, + X_ICH_FULL = 72 +}; + +// +// Ichimoku Lines Calculator Mode ... +enum ENUM_X_ICHIMOKU_CALCULATION_MODE +{ + // + X_XICH_HH_LL_MODE = 1, // Highest High and Lowest Low + X_XICH_HO_LC_MODE = 2, // Highest Open and Lowest Close +}; + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +// ICHIMOKU Kinko Hyo ... + +// +// TENKANSEN ... +input group "Tenkan Sen"; +input int tenkanSenLength = 9; // Length +input ENUM_X_ICHIMOKU_CALCULATION_MODE tenkanSenMode = X_XICH_HH_LL_MODE; // Calculation Mode + +// +// KIJUNSEN ... +input group "Kijun Sen"; +input int kijunSenLength = 26; // Length +input ENUM_X_ICHIMOKU_CALCULATION_MODE kijunSenMode = X_XICH_HH_LL_MODE; // Calculation Mode + +// +// SENKOUSPANB ... +input group "Senkou Span B"; +input int senkouSpanBLength = 52; // Length +input ENUM_X_ICHIMOKU_CALCULATION_MODE senkouSpanBMode = X_XICH_HH_LL_MODE; // Calculation Mode + +// +// CHIKOUSPAN ... +input group "Chikou Span"; +input ENUM_APPLIED_PRICE chikuoSpanAppliedTo = PRICE_CLOSE; // Price Type + +// +input group "Presentation"; +input bool showTenkanSen = true; // Show Tenkan Sen +input bool showKijunSen = true; // Show Kijun Sen +input bool showKijunSenPlus = false; // Show Kijun Sen + +input bool showKijunSenNegative = false; // 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 + +// +// END Inputs ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 15 +#property indicator_plots 8 + +// +// PLOTTED Buffers ... + +// +// ICHIMOKU ... + +// +// TENKANSEN ... + +// +#define tenkanSenBufferIndex 0 +double tenkanSenBuffer[]; + +// +#property indicator_label1 "XICH TK" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrBrown +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 + +// +// KIJUNSEN ... + +// +#define kijunSenBufferIndex 1 +double kijunSenBuffer[]; + +// +#property indicator_label2 "XICH KJ" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrDodgerBlue +#property indicator_style2 STYLE_SOLID +#property indicator_width2 1 + +// +#define kijunSenPlusBufferIndex 2 +double kijunSenPlusBuffer[]; + +// +#property indicator_label3 "XICH KJ+" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrMediumTurquoise +#property indicator_style3 STYLE_DOT +#property indicator_width3 1 + +// +#define kijunSenNegativeBufferIndex 3 +double kijunSenNegativeBuffer[]; + +// +#property indicator_label4 "XICH KJ-" +#property indicator_type4 DRAW_LINE +#property indicator_color4 clrDarkSeaGreen +#property indicator_style4 STYLE_DOT +#property indicator_width4 1 + +// +// CHIKOUSPAN ... + +// +#define chikouSpanBufferIndex 4 +double chikouSpanBuffer[]; + +// +#property indicator_label5 "XICH CS" +#property indicator_type5 DRAW_LINE +#property indicator_color5 clrDarkGreen +#property indicator_style5 STYLE_SOLID +#property indicator_width5 1 + +// +#define senkouABufferIndex 5 +double senkouABuffer[]; + +// +#property indicator_label6 "XICH SSA" +#property indicator_type6 DRAW_LINE +#property indicator_color6 clrLightGray +#property indicator_style6 STYLE_DASHDOTDOT +#property indicator_width6 1 + +// +#define senkouBBufferIndex 6 +double senkouBBuffer[]; + +// +#property indicator_label7 "XICH SSB" +#property indicator_type7 DRAW_LINE +#property indicator_color7 clrLightGray +#property indicator_style7 STYLE_DASHDOTDOT +#property indicator_width7 1 + +// +// KUMO ... + +// +// SENKOUSPANA ... + +// +#define senkouSpanABufferIndex 7 +double senkouSpanABuffer[]; + +// +// SENKOUSPANB ... + +// +#define senkouSpanBBufferIndex 8 +double senkouSpanBBuffer[]; + +// +// KUMOCLOUD ... + +// +#define kumoBufferIndex 7 + +// +#property indicator_label8 "XICH Kumo" +#property indicator_type8 DRAW_FILLING +#property indicator_color8 clrAqua, clrMagenta +#property indicator_style8 STYLE_SOLID +#property indicator_width8 1 + +// +// DATA Buffers ... + +// +#define dTenkanBufferIndex 9 +double dTenkanBuffer[]; + +// +#define dKijunBufferIndex 10 +double dKijunBuffer[]; + +// +#define dChikouBufferIndex 11 +double dChikouBuffer[]; + +// +#define dSSABufferIndex 12 +double dSSABuffer[]; + +// +#define dSSBBufferIndex 13 +double dSSBBuffer[]; + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; +int mHandler; + +// +ENUM_SERIESMODE mTenkanSenTopMode = NULL; +ENUM_SERIESMODE mTenkanSenBottomMode = NULL; + +// +ENUM_SERIESMODE mKijunSenTopMode = NULL; +ENUM_SERIESMODE mKijunSenBottomMode = NULL; + +// +ENUM_SERIESMODE mSenkouSpanBTopMode = NULL; +ENUM_SERIESMODE mSenkouSpanBBottomMode = NULL; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Init Handler ... + mHandler = iIchimoku( + _Symbol, + _Period, + tenkanSenLength, + kijunSenLength, + senkouSpanBLength); + if (mHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + IndicatorRelease(mHandler); +} + +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // Check Calculated Bars ... + int ichCalculatedBars = BarsCalculated(mHandler); + if (ichCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedTenkans = CopyBuffer(mHandler, TENKANSEN_LINE, 0, limit, dTenkanBuffer); + int copiedKijuns = CopyBuffer(mHandler, KIJUNSEN_LINE, 0, limit, dKijunBuffer); + int copiedChikous = CopyBuffer(mHandler, CHIKOUSPAN_LINE, 0, limit, dChikouBuffer); + int copiedSSAs = CopyBuffer(mHandler, SENKOUSPANA_LINE, 0, limit, dSSABuffer); + int copiedSSBs = CopyBuffer(mHandler, SENKOUSPANB_LINE, 0, limit, dSSBBuffer); + if ( + copiedSSAs < 0 || + copiedSSBs < 0 || + copiedKijuns < 0 || + copiedTenkans < 0 || + copiedChikous < 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i); + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = + // + (tenkanSenLength > 2 && + kijunSenLength > tenkanSenLength && + senkouSpanBLength > kijunSenLength) + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + // Ichimoku ... + result = MathMax(result, tenkanSenLength); + result = MathMax(result, kijunSenLength); + result = MathMax(result, senkouSpanBLength); + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // ICHIMOKU ... + + // + // TENKANSEN ... + + // + ENUM_DRAW_TYPE tenkanSenDrawType = showTenkanSen ? DRAW_LINE : DRAW_NONE; + + // + ArraySetAsSeries(tenkanSenBuffer, true); + SetIndexBuffer(tenkanSenBufferIndex, tenkanSenBuffer, INDICATOR_DATA); + PlotIndexSetInteger(tenkanSenBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(tenkanSenBufferIndex, PLOT_SHOW_DATA, showTenkanSen); + PlotIndexSetInteger(tenkanSenBufferIndex, PLOT_DRAW_TYPE, tenkanSenDrawType); + + // + // KIJUNSEN ... + + // + ENUM_DRAW_TYPE kijunSenDrawType = showKijunSen ? DRAW_LINE : DRAW_NONE; + + // + ArraySetAsSeries(kijunSenBuffer, true); + SetIndexBuffer(kijunSenBufferIndex, kijunSenBuffer, INDICATOR_DATA); + PlotIndexSetInteger(kijunSenBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(kijunSenBufferIndex, PLOT_SHOW_DATA, showKijunSen); + PlotIndexSetInteger(kijunSenBufferIndex, PLOT_DRAW_TYPE, kijunSenDrawType); + + // + // KIJUNSEN Plus ... + + // + ENUM_DRAW_TYPE kijunSenPlusDrawType = showKijunSenPlus ? DRAW_LINE : DRAW_NONE; + + // + ArraySetAsSeries(kijunSenPlusBuffer, true); + SetIndexBuffer(kijunSenPlusBufferIndex, kijunSenPlusBuffer, INDICATOR_DATA); + PlotIndexSetInteger(kijunSenPlusBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(kijunSenPlusBufferIndex, PLOT_SHIFT, kijunSenLength); + PlotIndexSetInteger(kijunSenPlusBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(kijunSenPlusBufferIndex, PLOT_DRAW_TYPE, kijunSenPlusDrawType); + + // + // KIJUNSEN Negative ... + + // + ENUM_DRAW_TYPE kijunSenNegativeDrawType = showKijunSenNegative ? DRAW_LINE : DRAW_NONE; + + // + ArraySetAsSeries(kijunSenNegativeBuffer, true); + SetIndexBuffer(kijunSenNegativeBufferIndex, kijunSenNegativeBuffer, INDICATOR_DATA); + PlotIndexSetInteger(kijunSenNegativeBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(kijunSenNegativeBufferIndex, PLOT_SHIFT, -kijunSenLength); + PlotIndexSetInteger(kijunSenNegativeBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(kijunSenNegativeBufferIndex, PLOT_DRAW_TYPE, kijunSenNegativeDrawType); + + // + // CHIKOUSPAN ... + + // + ENUM_DRAW_TYPE chikouSpanDrawType = showChikouSpan ? DRAW_LINE : DRAW_NONE; + + // + ArraySetAsSeries(chikouSpanBuffer, true); + SetIndexBuffer(chikouSpanBufferIndex, chikouSpanBuffer, INDICATOR_DATA); + PlotIndexSetInteger(chikouSpanBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(chikouSpanBufferIndex, PLOT_SHIFT, -kijunSenLength); + PlotIndexSetInteger(chikouSpanBufferIndex, PLOT_SHOW_DATA, showChikouSpan); + PlotIndexSetInteger(chikouSpanBufferIndex, PLOT_DRAW_TYPE, chikouSpanDrawType); + + // + // SENKOUSPAN A and B ... + int shiftSize = shiftKumo ? kijunSenLength : 0; + + // + // SENKOUSPANA ... + ENUM_DRAW_TYPE senkouSpanADrawType = showSenkouSpanA ? DRAW_LINE : DRAW_NONE; + ArraySetAsSeries(senkouABuffer, true); + SetIndexBuffer(senkouABufferIndex, senkouABuffer, INDICATOR_DATA); + PlotIndexSetInteger(senkouABufferIndex, PLOT_SHIFT, shiftSize); + PlotIndexSetInteger(senkouABufferIndex, PLOT_SHOW_DATA, showSenkouSpanA); + PlotIndexSetInteger(senkouABufferIndex, PLOT_DRAW_TYPE, senkouSpanADrawType); + + // + // SENKOUSPANB ... + ENUM_DRAW_TYPE senkouSpanBDrawType = showSenkouSpanB ? DRAW_LINE : DRAW_NONE; + ArraySetAsSeries(senkouBBuffer, true); + SetIndexBuffer(senkouBBufferIndex, senkouBBuffer, INDICATOR_DATA); + PlotIndexSetInteger(senkouBBufferIndex, PLOT_SHIFT, shiftSize); + PlotIndexSetInteger(senkouBBufferIndex, PLOT_SHOW_DATA, showSenkouSpanB); + PlotIndexSetInteger(senkouBBufferIndex, PLOT_DRAW_TYPE, senkouSpanBDrawType); + + // + // KUMO ... + + // + // SENKOUSPANA ... + ArraySetAsSeries(senkouSpanABuffer, true); + SetIndexBuffer(senkouSpanABufferIndex, senkouSpanABuffer, INDICATOR_DATA); + PlotIndexSetInteger(senkouSpanABufferIndex, PLOT_DRAW_BEGIN, maxLength); + + // + // SENKOUSPANB ... + ArraySetAsSeries(senkouSpanBBuffer, true); + SetIndexBuffer(senkouSpanBBufferIndex, senkouSpanBBuffer, INDICATOR_DATA); + PlotIndexSetInteger(senkouSpanBBufferIndex, PLOT_DRAW_BEGIN, maxLength); + + // + // KUMO ... + + // + ENUM_DRAW_TYPE kumoDrawType = showKumo ? DRAW_FILLING : DRAW_NONE; + + // + PlotIndexSetInteger(kumoBufferIndex, PLOT_SHIFT, shiftSize); + PlotIndexSetInteger(kumoBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(kumoBufferIndex, PLOT_DRAW_TYPE, kumoDrawType); + + // + // DATA Buffers ... + + // + // D Tenkan ... + ArraySetAsSeries(dTenkanBuffer, true); + SetIndexBuffer(dTenkanBufferIndex, dTenkanBuffer, INDICATOR_CALCULATIONS); + + // + // D Kijun ... + ArraySetAsSeries(dKijunBuffer, true); + SetIndexBuffer(dKijunBufferIndex, dKijunBuffer, INDICATOR_CALCULATIONS); + + // + // D Chikou ... + ArraySetAsSeries(dChikouBuffer, true); + SetIndexBuffer(dChikouBufferIndex, dChikouBuffer, INDICATOR_CALCULATIONS); + + // + // D SSA ... + ArraySetAsSeries(dSSABuffer, true); + SetIndexBuffer(dSSABufferIndex, dSSABuffer, INDICATOR_CALCULATIONS); + + // + // D SSB ... + ArraySetAsSeries(dSSBBuffer, true); + SetIndexBuffer(dSSBBufferIndex, dSSBBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ + // + // ICHIMOKU ... + + // + double topValue; + double bottomValue; + + // + // TENKANSEN ... + + // + // Extract Tenkan Sen Top/Bottom Calculation Mode based on User Input ... + if (mTenkanSenTopMode == NULL || mTenkanSenBottomMode == NULL) + { + // + switch (tenkanSenMode) + { + // + case X_XICH_HH_LL_MODE: + // + mTenkanSenTopMode = MODE_HIGH; + mTenkanSenBottomMode = MODE_LOW; + break; + + // + case X_XICH_HO_LC_MODE: + // + mTenkanSenTopMode = MODE_OPEN; + mTenkanSenBottomMode = MODE_CLOSE; + break; + } + } + + // + XOHCL bar; + bar.Init( + _Symbol, + _Period, + bar_index + // + ); + + // + // Calculate Top ... + topValue = bar + .FindHighest( + tenkanSenLength, + mTenkanSenTopMode + // + ); + + // + // Calculate Bottom ... + bottomValue = bar + .FindLowest( + tenkanSenLength, + mTenkanSenBottomMode + // + ); + + // + double tenkanSenValue = (topValue + bottomValue) / 2; + tenkanSenBuffer[bar_index] = tenkanSenValue; + + // + // KIJUNSEN ... + + // + // Extract Kijun Sen Top/Bottom Calculation Mode based on User Input ... + if (mKijunSenTopMode == NULL || mKijunSenBottomMode == NULL) + { + // + switch (kijunSenMode) + { + // + case X_XICH_HH_LL_MODE: + // + mKijunSenTopMode = MODE_HIGH; + mKijunSenBottomMode = MODE_LOW; + break; + + // + case X_XICH_HO_LC_MODE: + // + mKijunSenTopMode = MODE_OPEN; + mKijunSenBottomMode = MODE_CLOSE; + break; + } + } + + // + // Calculate Top ... + topValue = bar + .FindHighest( + kijunSenLength, + mKijunSenTopMode + // + ); + + // + // Calculate Bottom ... + bottomValue = bar + .FindLowest( + kijunSenLength, + mKijunSenBottomMode + // + ); + + // + double kijunSenValue = (topValue + bottomValue) / 2; + kijunSenBuffer[bar_index] = kijunSenValue; + + // + kijunSenPlusBuffer[bar_index] = kijunSenValue; + kijunSenNegativeBuffer[bar_index] = kijunSenValue; + + // + // CHIKOUSPAN ... + double chikouSpanValue = bar + .GetPrice(chikuoSpanAppliedTo); + + // + chikouSpanBuffer[bar_index] = chikouSpanValue; + + // + // KUMO ... + + // + // SENKOUSPANA ... + double senkouSpanAValue = (tenkanSenValue + kijunSenValue) / 2; + senkouABuffer[bar_index] = senkouSpanAValue; + senkouSpanABuffer[bar_index] = senkouSpanAValue; + + // + // SENKOUSPANB ... + + // + // Extract Senkou Span B Top/Bottom Calculation Mode based on User Input ... + if (mSenkouSpanBTopMode == NULL || mSenkouSpanBBottomMode == NULL) + { + // + switch (senkouSpanBMode) + { + // + case X_XICH_HH_LL_MODE: + // + mSenkouSpanBTopMode = MODE_HIGH; + mSenkouSpanBBottomMode = MODE_LOW; + break; + + // + case X_XICH_HO_LC_MODE: + // + mSenkouSpanBTopMode = MODE_OPEN; + mSenkouSpanBBottomMode = MODE_CLOSE; + break; + } + } + + // + // Calculate Top ... + topValue = bar + .FindHighest( + senkouSpanBLength, + mSenkouSpanBTopMode + // + ); + + // + // Calculate Bottom ... + bottomValue = bar + .FindLowest( + senkouSpanBLength, + mSenkouSpanBBottomMode + // + ); + + // + double senkouSpanBValue = (topValue + bottomValue) / 2; + senkouBBuffer[bar_index] = senkouSpanBValue; + senkouSpanBBuffer[bar_index] = senkouSpanBValue; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xlh.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xlh.mq5 new file mode 100644 index 0000000..16858c2 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xlh.mq5 @@ -0,0 +1,352 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XLH Indicator +// --------------------------------------------- +// Name: XLH +// Description: Moving Average Indicator +// Market Analysor ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XLH Indicator" +#property strict + +// +// START Constants ... +// +#define ShortName "XLH" +// +// END Constants ... +// + +// +// START Inputs ... +// +input int length = 14; // Length +input ENUM_SERIESMODE hhMode = MODE_HIGH; // Highest High Calculation Method +input ENUM_SERIESMODE llMode = MODE_LOW; // Lowest Low Calculation Method +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 3 +#property indicator_plots 3 + +// +// HH Buffer ... +#define hhBufferIndex 0 + +// +double hhBuffer[]; + +// +#property indicator_label1 "XLH HH" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrAqua +#property indicator_style1 STYLE_DOT +#property indicator_width1 1 + +// +// LL Buffer ... +#define llBufferIndex 1 + +// +double llBuffer[]; + +// +#property indicator_label2 "XLH LL" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrFuchsia +#property indicator_style2 STYLE_DOT +#property indicator_width2 1 + +// +// Signal Buffer ... +#define signalBufferIndex 2 + +// +double signalBuffer[]; + +// +#property indicator_label3 "XLH S" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrGold +#property indicator_style3 STYLE_DOT +#property indicator_width3 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(0, length); + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + // + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (length >= 2) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // HH Buffer ... + string hhBufferLabel = ShortName + " HH " + "(" + (string)length + ")"; + ArraySetAsSeries(hhBuffer, true); + SetIndexBuffer(hhBufferIndex, hhBuffer, INDICATOR_DATA); + PlotIndexSetInteger(hhBufferIndex, PLOT_DRAW_BEGIN, length); + PlotIndexSetString(hhBufferIndex, PLOT_LABEL, hhBufferLabel); + + // + // LL Buffer ... + string llBufferLabel = ShortName + " LL " + "(" + (string)length + ")"; + ArraySetAsSeries(llBuffer, true); + SetIndexBuffer(llBufferIndex, llBuffer, INDICATOR_DATA); + PlotIndexSetInteger(llBufferIndex, PLOT_DRAW_BEGIN, length); + PlotIndexSetString(llBufferIndex, PLOT_LABEL, llBufferLabel); + + // + // Signal Buffer ... + string signalBufferLabel = ShortName + " S " + "(" + (string)length + ")"; + ArraySetAsSeries(signalBuffer, true); + SetIndexBuffer(signalBufferIndex, signalBuffer, INDICATOR_DATA); + PlotIndexSetInteger(signalBufferIndex, PLOT_DRAW_BEGIN, length); + PlotIndexSetString(signalBufferIndex, PLOT_LABEL, signalBufferLabel); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, ""); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ + // + // Calculate Threshold ... + // + // HH Buffer ... + int hhIndex = iHighest( + _Symbol, + _Period, + hhMode, + length, + bar_index + // + ); + XOHCL hhBar; + hhBar.Init( + _Symbol, + _Period, + hhIndex + // + ); + double hhValue = hhBar.GetPrice(hhMode); + + // + hhBuffer[bar_index] = hhValue; + + // + // LL Buffer ... + int llIndex = iLowest( + _Symbol, + _Period, + llMode, + length, + bar_index + // + ); + XOHCL llBar; + llBar.Init( + _Symbol, + _Period, + llIndex + // + ); + double llValue = llBar.GetPrice(llMode); + + // + llBuffer[bar_index] = llValue; + + // + double lhDiff = hhValue - llValue; + double signalValue = (lhDiff / 2); + + // + signalBuffer[bar_index] = (hhValue - signalValue); +} +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmc.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmc.mq5 new file mode 100644 index 0000000..f7fe43b --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmc.mq5 @@ -0,0 +1,446 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XMC MA Cross Indicator +// --------------------------------------------------- +// Name: XMC +// Description: Moving Average Crosses +// Market Analysor ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XMC Indicator" +#property strict + +// +// START Constants ... +// + +// +// Indicator Short Name ... +#define ShortName "XMC" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Fast"; +input int fastMaLength = 9; // Length +input int fastMaShift = 0; // Shift +input ENUM_MA_METHOD fastMaMethod = MODE_EMA; // Method +input ENUM_APPLIED_PRICE fastMaAppliedTo = PRICE_CLOSE; // Applied To + +// +input group "Slow"; +input int slowMaLength = 18; // Length +input int slowMaShift = 0; // Shift +input ENUM_MA_METHOD slowMaMethod = MODE_EMA; // Method +input ENUM_APPLIED_PRICE slowMaAppliedTo = PRICE_CLOSE; // Applied To + +// +input group "Verifier"; +input int verifierMaLength = 50; // Length +input int verifierMaShift = 0; // Shift +input ENUM_MA_METHOD verifierMaMethod = MODE_EMA; // Method +input ENUM_APPLIED_PRICE verifierMaAppliedTo = PRICE_CLOSE; // Applied To + +// +input group "Presentation"; +input bool showFastMa = true; // Show Fast +input bool showSlowMa = true; // Show Slow +input bool showVerifierMa = true; // Show Verifier + +// +// END Inputs ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 3 +#property indicator_plots 3 + +// +// PLOTTED Buffers ... + +// +// MA ... + +// +// FAST ... +#define fastMaBufferIndex 0 +double fastMaBuffer[]; + +// +#property indicator_label1 "XMC MA F" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrYellow +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 + +// +// SLOW ... +#define slowMaBufferIndex 1 +double slowMaBuffer[]; + +// +#property indicator_label2 "XMC MA S" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrDarkOrange +#property indicator_style2 STYLE_SOLID +#property indicator_width2 1 + +// +// VERIFIER ... +#define verifierMaBufferIndex 2 +double verifierMaBuffer[]; + +// +#property indicator_label3 "XMC MA V" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrDarkBlue +#property indicator_style3 STYLE_SOLID +#property indicator_width3 2 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +int fastMaHandler = INVALID_HANDLE; +int slowMaHandler = INVALID_HANDLE; +int verifierMaHandler = INVALID_HANDLE; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // MA Initialization ... + + // + // FAST ... + fastMaHandler = iMA( + _Symbol, + _Period, + fastMaLength, + fastMaShift, + fastMaMethod, + fastMaAppliedTo); + if (fastMaHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // SLOW ... + slowMaHandler = iMA( + _Symbol, + _Period, + slowMaLength, + slowMaShift, + slowMaMethod, + slowMaAppliedTo); + if (slowMaHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // VERIFIER ... + verifierMaHandler = iMA( + _Symbol, + _Period, + verifierMaLength, + verifierMaShift, + verifierMaMethod, + verifierMaAppliedTo); + if (verifierMaHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(fastMaHandler); + IndicatorRelease(slowMaHandler); + IndicatorRelease(verifierMaHandler); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // Check Calculated Bars ... + int fastMaCalculatedBars = BarsCalculated(fastMaHandler); + int slowMaCalculatedBars = BarsCalculated(slowMaHandler); + int verifierMaCalculatedBars = BarsCalculated(verifierMaHandler); + if (fastMaCalculatedBars < maxLength || + slowMaCalculatedBars < maxLength || + verifierMaCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedFastMas = CopyBuffer(fastMaHandler, 0, 0, limit, fastMaBuffer); + int copiedSlowMas = CopyBuffer(slowMaHandler, 0, 0, limit, slowMaBuffer); + int copiedVerifierMas = CopyBuffer(verifierMaHandler, 0, 0, limit, verifierMaBuffer); + if (copiedFastMas <= 0 || + copiedSlowMas <= 0 || + copiedVerifierMas <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i); + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = + // + // Validate Ma ... + (fastMaLength > 2 && + slowMaLength > fastMaLength && + verifierMaLength > slowMaLength) + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + // Ma ... + result = MathMax(result, fastMaLength); + result = MathMax(result, slowMaLength); + result = MathMax(result, verifierMaLength); + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // MA ... + + // + // FAST ... + ENUM_DRAW_TYPE fastMaDrawType = showFastMa ? DRAW_LINE : DRAW_NONE; + ArraySetAsSeries(fastMaBuffer, true); + SetIndexBuffer(fastMaBufferIndex, fastMaBuffer, INDICATOR_DATA); + PlotIndexSetInteger(fastMaBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fastMaBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(fastMaBufferIndex, PLOT_DRAW_TYPE, fastMaDrawType); + + // + // SLOW ... + ENUM_DRAW_TYPE slowMaDrawType = showSlowMa ? DRAW_LINE : DRAW_NONE; + ArraySetAsSeries(slowMaBuffer, true); + SetIndexBuffer(slowMaBufferIndex, slowMaBuffer, INDICATOR_DATA); + PlotIndexSetInteger(slowMaBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slowMaBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(slowMaBufferIndex, PLOT_DRAW_TYPE, slowMaDrawType); + + // + // VERIFIER ... + ENUM_DRAW_TYPE verifierMaDrawType = showVerifierMa ? DRAW_LINE : DRAW_NONE; + ArraySetAsSeries(verifierMaBuffer, true); + SetIndexBuffer(verifierMaBufferIndex, verifierMaBuffer, INDICATOR_DATA); + PlotIndexSetInteger(verifierMaBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(verifierMaBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(verifierMaBufferIndex, PLOT_DRAW_TYPE, verifierMaDrawType); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, ""); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmrb.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmrb.mq5 new file mode 100644 index 0000000..5ff1d82 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xmrb.mq5 @@ -0,0 +1,855 @@ +////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// -------------------------------------- +// Name: XMRB +// Description: Moving Average Ribbon +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XMRB Indicator" +#property strict + +// +// START Constants ... +// + +// +// Indicator Short Name ... +#define ShortName "XMRB" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Ribbon 1"; +input int fast1Length = 20; // Fast +input int slow1Length = 50; // Slow +input ENUM_APPLIED_PRICE r1AppliedTo = PRICE_HIGH; // Applied To + +// +input group "Ribbon 2"; +input int fast2Length = 20; // Fast +input int slow2Length = 50; // Slow +input ENUM_APPLIED_PRICE r2AppliedTo = PRICE_OPEN; // Applied To + +// +input group "Ribbon 3"; +input int fast3Length = 20; // Fast +input int slow3Length = 50; // Slow +input ENUM_APPLIED_PRICE r3AppliedTo = PRICE_CLOSE; // Applied To + +// +input group "Ribbon 4"; +input int fast4Length = 20; // Fast +input int slow4Length = 50; // Slow +input ENUM_APPLIED_PRICE r4AppliedTo = PRICE_MEDIAN; // Applied To + +// +input group "Ribbon 5"; +input int fast5Length = 20; // Fast +input int slow5Length = 50; // Slow +input ENUM_APPLIED_PRICE r5AppliedTo = PRICE_TYPICAL; // Applied To + +// +input group "Ribbon 6"; +input int fast6Length = 20; // Fast +input int slow6Length = 50; // Slow +input ENUM_APPLIED_PRICE r6AppliedTo = PRICE_LOW; // Applied To + +// +input group "Calculation"; +input ENUM_MA_METHOD ribbonMode = MODE_EMA; // Mode + +// +input group "Presentation"; +input bool showFastMa = true; // Show Fast +input bool showSlowMa = true; // Show Slow +input bool showRibbon = false; // Show Ribbon + +// +// END Inputs ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 14 +#property indicator_plots 14 + +// +// PLOTTED Buffers ... + +// +// MA ... + +// +// FAST ... +#define fastMaBufferIndex 0 +double fastMaBuffer[]; + +// +#property indicator_label1 "XMRB F" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrLime +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 + +// +// SLOW ... +#define slowMaBufferIndex 1 +double slowMaBuffer[]; + +// +#property indicator_label2 "XMRB S" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrRed +#property indicator_style2 STYLE_SOLID +#property indicator_width2 1 + +// +// DATA Buffers ... + +// +// FAST ... + +// +#define fast1BufferIndex 2 +double fast1Buffer[]; + +// +#property indicator_label3 "XMRB 1 F" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrAquamarine +#property indicator_style3 STYLE_DOT +#property indicator_width3 1 + +// +#define fast2BufferIndex 3 +double fast2Buffer[]; + +// +#property indicator_label4 "XMRB 2 F" +#property indicator_type4 DRAW_LINE +#property indicator_color4 clrAquamarine +#property indicator_style4 STYLE_DOT +#property indicator_width4 1 + +// +#define fast3BufferIndex 4 +double fast3Buffer[]; + +// +#property indicator_label5 "XMRB 3 F" +#property indicator_type5 DRAW_LINE +#property indicator_color5 clrAquamarine +#property indicator_style5 STYLE_DOT +#property indicator_width5 1 + +// +#define fast4BufferIndex 5 +double fast4Buffer[]; + +// +#property indicator_label6 "XMRB 4 F" +#property indicator_type6 DRAW_LINE +#property indicator_color6 clrAquamarine +#property indicator_style6 STYLE_DOT +#property indicator_width6 1 + +// +#define fast5BufferIndex 6 +double fast5Buffer[]; + +// +#property indicator_label7 "XMRB 5 F" +#property indicator_type7 DRAW_LINE +#property indicator_color7 clrAquamarine +#property indicator_style7 STYLE_DOT +#property indicator_width7 1 + +// +#define fast6BufferIndex 7 +double fast6Buffer[]; + +// +#property indicator_label8 "XMRB 6 F" +#property indicator_type8 DRAW_LINE +#property indicator_color8 clrAquamarine +#property indicator_style8 STYLE_DOT +#property indicator_width8 1 + +// +// SLOW ... + +// +#define slow1BufferIndex 8 +double slow1Buffer[]; + +// +#property indicator_label9 "XMRB 1 S" +#property indicator_type9 DRAW_LINE +#property indicator_color9 clrPlum +#property indicator_style9 STYLE_DOT +#property indicator_width9 1 + +// +#define slow2BufferIndex 9 +double slow2Buffer[]; + +// +#property indicator_label10 "XMRB 2 S" +#property indicator_type10 DRAW_LINE +#property indicator_color10 clrPlum +#property indicator_style10 STYLE_DOT +#property indicator_width10 1 + +// +#define slow3BufferIndex 10 +double slow3Buffer[]; + +// +#property indicator_label11 "XMRB 3 S" +#property indicator_type11 DRAW_LINE +#property indicator_color11 clrPlum +#property indicator_style11 STYLE_DOT +#property indicator_width11 1 + +// +#define slow4BufferIndex 11 +double slow4Buffer[]; + +// +#property indicator_label12 "XMRB 4 S" +#property indicator_type12 DRAW_LINE +#property indicator_color12 clrPlum +#property indicator_style12 STYLE_DOT +#property indicator_width12 1 + +// +#define slow5BufferIndex 12 +double slow5Buffer[]; + +// +#property indicator_label13 "XMRB 5 S" +#property indicator_type13 DRAW_LINE +#property indicator_color13 clrPlum +#property indicator_style13 STYLE_DOT +#property indicator_width13 1 + +// +#define slow6BufferIndex 13 +double slow6Buffer[]; + +// +#property indicator_label14 "XMRB 6 S" +#property indicator_type14 DRAW_LINE +#property indicator_color14 clrPlum +#property indicator_style14 STYLE_DOT +#property indicator_width14 1 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +int fast1MaHandler = INVALID_HANDLE; +int fast2MaHandler = INVALID_HANDLE; +int fast3MaHandler = INVALID_HANDLE; +int fast4MaHandler = INVALID_HANDLE; +int fast5MaHandler = INVALID_HANDLE; +int fast6MaHandler = INVALID_HANDLE; + +// +int slow1MaHandler = INVALID_HANDLE; +int slow2MaHandler = INVALID_HANDLE; +int slow3MaHandler = INVALID_HANDLE; +int slow4MaHandler = INVALID_HANDLE; +int slow5MaHandler = INVALID_HANDLE; +int slow6MaHandler = INVALID_HANDLE; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Initialize MAs ... + if (!InitializeMas()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + + // + IndicatorRelease(fast1MaHandler); + IndicatorRelease(fast2MaHandler); + IndicatorRelease(fast3MaHandler); + IndicatorRelease(fast4MaHandler); + IndicatorRelease(fast5MaHandler); + IndicatorRelease(fast6MaHandler); + + // + IndicatorRelease(slow1MaHandler); + IndicatorRelease(slow2MaHandler); + IndicatorRelease(slow3MaHandler); + IndicatorRelease(slow4MaHandler); + IndicatorRelease(slow5MaHandler); + IndicatorRelease(slow6MaHandler); +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... +) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // Check Calculated Bars ... + // + int fast1MaCalculatedBars = BarsCalculated(fast1MaHandler); + int fast2MaCalculatedBars = BarsCalculated(fast2MaHandler); + int fast3MaCalculatedBars = BarsCalculated(fast3MaHandler); + int fast4MaCalculatedBars = BarsCalculated(fast4MaHandler); + int fast5MaCalculatedBars = BarsCalculated(fast5MaHandler); + int fast6MaCalculatedBars = BarsCalculated(fast6MaHandler); + // + int slow1MaCalculatedBars = BarsCalculated(slow1MaHandler); + int slow2MaCalculatedBars = BarsCalculated(slow2MaHandler); + int slow3MaCalculatedBars = BarsCalculated(slow3MaHandler); + int slow4MaCalculatedBars = BarsCalculated(slow4MaHandler); + int slow5MaCalculatedBars = BarsCalculated(slow5MaHandler); + int slow6MaCalculatedBars = BarsCalculated(slow6MaHandler); + if ( + fast1MaCalculatedBars < maxLength || + fast2MaCalculatedBars < maxLength || + fast3MaCalculatedBars < maxLength || + fast4MaCalculatedBars < maxLength || + fast5MaCalculatedBars < maxLength || + fast6MaCalculatedBars < maxLength || + slow1MaCalculatedBars < maxLength || + slow2MaCalculatedBars < maxLength || + slow3MaCalculatedBars < maxLength || + slow4MaCalculatedBars < maxLength || + slow5MaCalculatedBars < maxLength || + slow6MaCalculatedBars < maxLength // + ) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + // + int copiedFast1Mas = CopyBuffer(fast1MaHandler, 0, 0, limit, fast1Buffer); + int copiedFast2Mas = CopyBuffer(fast2MaHandler, 0, 0, limit, fast2Buffer); + int copiedFast3Mas = CopyBuffer(fast3MaHandler, 0, 0, limit, fast3Buffer); + int copiedFast4Mas = CopyBuffer(fast4MaHandler, 0, 0, limit, fast4Buffer); + int copiedFast5Mas = CopyBuffer(fast5MaHandler, 0, 0, limit, fast5Buffer); + int copiedFast6Mas = CopyBuffer(fast6MaHandler, 0, 0, limit, fast6Buffer); + // + int copiedSlow1Mas = CopyBuffer(slow1MaHandler, 0, 0, limit, slow1Buffer); + int copiedSlow2Mas = CopyBuffer(slow2MaHandler, 0, 0, limit, slow2Buffer); + int copiedSlow3Mas = CopyBuffer(slow3MaHandler, 0, 0, limit, slow3Buffer); + int copiedSlow4Mas = CopyBuffer(slow4MaHandler, 0, 0, limit, slow4Buffer); + int copiedSlow5Mas = CopyBuffer(slow5MaHandler, 0, 0, limit, slow5Buffer); + int copiedSlow6Mas = CopyBuffer(slow6MaHandler, 0, 0, limit, slow6Buffer); + if ( + copiedFast1Mas <= 0 || + copiedFast2Mas <= 0 || + copiedFast3Mas <= 0 || + copiedFast4Mas <= 0 || + copiedFast5Mas <= 0 || + copiedFast6Mas <= 0 || + copiedSlow1Mas <= 0 || + copiedSlow2Mas <= 0 || + copiedSlow3Mas <= 0 || + copiedSlow4Mas <= 0 || + copiedSlow5Mas <= 0 || + copiedSlow6Mas <= 0 // + ) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i); + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = + // + (fast1Length > 2 && + fast2Length > 2 && + fast3Length > 2 && + fast4Length > 2 && + fast5Length > 2 && + fast6Length > 2 && + slow1Length > fast1Length && + slow2Length > fast2Length && + slow3Length > fast3Length && + slow4Length > fast4Length && + slow5Length > fast5Length && + slow6Length > fast6Length + // + ) + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + // Ma ... + + // + result = MathMax(fast1Length, fast2Length); + result = MathMax(result, fast3Length); + result = MathMax(result, fast4Length); + result = MathMax(result, fast5Length); + result = MathMax(result, fast6Length); + + // + result = MathMax(result, slow1Length); + result = MathMax(result, slow2Length); + result = MathMax(result, slow3Length); + result = MathMax(result, slow4Length); + result = MathMax(result, slow5Length); + result = MathMax(result, slow6Length); + + // + return result; +} + +// +// Initialize Ma Handlers ... +bool InitializeMas() +{ + // + bool result = false; + + // + fast1MaHandler = iMA( + _Symbol, + _Period, + fast1Length, + 0, + ribbonMode, + r1AppliedTo); + fast2MaHandler = iMA( + _Symbol, + _Period, + fast2Length, + 0, + ribbonMode, + r2AppliedTo); + fast3MaHandler = iMA( + _Symbol, + _Period, + fast3Length, + 0, + ribbonMode, + r3AppliedTo); + fast4MaHandler = iMA( + _Symbol, + _Period, + fast4Length, + 0, + ribbonMode, + r4AppliedTo); + fast5MaHandler = iMA( + _Symbol, + _Period, + fast5Length, + 0, + ribbonMode, + r5AppliedTo); + fast6MaHandler = iMA( + _Symbol, + _Period, + fast6Length, + 0, + ribbonMode, + r6AppliedTo); + + // + slow1MaHandler = iMA( + _Symbol, + _Period, + slow1Length, + 0, + ribbonMode, + r1AppliedTo); + slow2MaHandler = iMA( + _Symbol, + _Period, + slow2Length, + 0, + ribbonMode, + r2AppliedTo); + slow3MaHandler = iMA( + _Symbol, + _Period, + slow3Length, + 0, + ribbonMode, + r3AppliedTo); + slow4MaHandler = iMA( + _Symbol, + _Period, + slow4Length, + 0, + ribbonMode, + r4AppliedTo); + slow5MaHandler = iMA( + _Symbol, + _Period, + slow5Length, + 0, + ribbonMode, + r5AppliedTo); + slow6MaHandler = iMA( + _Symbol, + _Period, + slow6Length, + 0, + ribbonMode, + r6AppliedTo); + + // + result = + fast1MaHandler != INVALID_HANDLE && + fast2MaHandler != INVALID_HANDLE && + fast3MaHandler != INVALID_HANDLE && + fast4MaHandler != INVALID_HANDLE && + fast5MaHandler != INVALID_HANDLE && + fast6MaHandler != INVALID_HANDLE && + slow1MaHandler != INVALID_HANDLE && + slow2MaHandler != INVALID_HANDLE && + slow3MaHandler != INVALID_HANDLE && + slow4MaHandler != INVALID_HANDLE && + slow5MaHandler != INVALID_HANDLE && + slow6MaHandler != INVALID_HANDLE; + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // FAST ... + ENUM_DRAW_TYPE fastDrawType = showFastMa ? DRAW_LINE : DRAW_NONE; + + ArraySetAsSeries(fastMaBuffer, true); + SetIndexBuffer(fastMaBufferIndex, fastMaBuffer, INDICATOR_DATA); + PlotIndexSetInteger(fastMaBufferIndex, PLOT_SHOW_DATA, showFastMa); + PlotIndexSetInteger(fastMaBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fastMaBufferIndex, PLOT_DRAW_TYPE, fastDrawType); + + // + // SLOW ... + ENUM_DRAW_TYPE slowDrawType = showSlowMa ? DRAW_LINE : DRAW_NONE; + + ArraySetAsSeries(slowMaBuffer, true); + SetIndexBuffer(slowMaBufferIndex, slowMaBuffer, INDICATOR_DATA); + PlotIndexSetInteger(slowMaBufferIndex, PLOT_SHOW_DATA, showSlowMa); + PlotIndexSetInteger(slowMaBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slowMaBufferIndex, PLOT_DRAW_TYPE, slowDrawType); + + // + // DATA ... + ENUM_DRAW_TYPE ribbonDrawType = showRibbon ? DRAW_LINE : DRAW_NONE; + + // + ArraySetAsSeries(fast1Buffer, true); + SetIndexBuffer(fast1BufferIndex, fast1Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fast1BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(fast1BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fast1BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(fast2Buffer, true); + SetIndexBuffer(fast2BufferIndex, fast2Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fast2BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(fast2BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fast2BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(fast3Buffer, true); + SetIndexBuffer(fast3BufferIndex, fast3Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fast3BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(fast3BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fast3BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(fast4Buffer, true); + SetIndexBuffer(fast4BufferIndex, fast4Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fast4BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(fast4BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fast4BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(fast5Buffer, true); + SetIndexBuffer(fast5BufferIndex, fast5Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fast5BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(fast5BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fast5BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(fast6Buffer, true); + SetIndexBuffer(fast6BufferIndex, fast6Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fast6BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(fast6BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fast6BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(slow1Buffer, true); + SetIndexBuffer(slow1BufferIndex, slow1Buffer, INDICATOR_DATA); + PlotIndexSetInteger(slow1BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(slow1BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slow1BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(slow2Buffer, true); + SetIndexBuffer(slow2BufferIndex, slow2Buffer, INDICATOR_DATA); + PlotIndexSetInteger(slow2BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(slow2BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slow2BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(slow3Buffer, true); + SetIndexBuffer(slow3BufferIndex, slow3Buffer, INDICATOR_DATA); + PlotIndexSetInteger(slow3BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(slow3BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slow3BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(slow4Buffer, true); + SetIndexBuffer(slow4BufferIndex, slow4Buffer, INDICATOR_DATA); + PlotIndexSetInteger(slow4BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(slow4BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slow4BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(slow5Buffer, true); + SetIndexBuffer(slow5BufferIndex, slow5Buffer, INDICATOR_DATA); + PlotIndexSetInteger(slow5BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(slow5BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slow5BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); + + // + ArraySetAsSeries(slow6Buffer, true); + SetIndexBuffer(slow6BufferIndex, slow6Buffer, INDICATOR_DATA); + PlotIndexSetInteger(slow6BufferIndex, PLOT_SHOW_DATA, showRibbon); + PlotIndexSetInteger(slow6BufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(slow6BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ + // + // Retireve Values ... + + // + double fast1Value = fast1Buffer[bar_index]; + double fast2Value = fast2Buffer[bar_index]; + double fast3Value = fast3Buffer[bar_index]; + double fast4Value = fast4Buffer[bar_index]; + double fast5Value = fast5Buffer[bar_index]; + double fast6Value = fast6Buffer[bar_index]; + + // + double fasts[] = { + fast1Value, + fast2Value, + fast3Value, + fast4Value, + fast5Value, + fast6Value}; + + // + double slow1Value = slow1Buffer[bar_index]; + double slow2Value = slow2Buffer[bar_index]; + double slow3Value = slow3Buffer[bar_index]; + double slow4Value = slow4Buffer[bar_index]; + double slow5Value = slow5Buffer[bar_index]; + double slow6Value = slow6Buffer[bar_index]; + + // + double slows[] = { + slow1Value, + slow2Value, + slow3Value, + slow4Value, + slow5Value, + slow6Value}; + + // + double fastValue = GetAverage(fasts); + fastMaBuffer[bar_index] = fastValue; + + // + double slowValue = GetAverage(slows); + slowMaBuffer[bar_index] = slowValue; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xobd.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xobd.mq5 new file mode 100644 index 0000000..2865679 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xobd.mq5 @@ -0,0 +1,392 @@ +///////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 OrderBlock Detector Indicator +// ----------------------------------------------------- +// Name: XOBD +// Description: detect Order Blocks based on Swings ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XOBD Indicator" +#property strict + +// +// START Constants ... +// +#define ShortName "XOBD" +// +// END Constants ... +// + +// +// START Inputs ... +// +// +input int length = 5; // Swing Length + +// +input uchar swingHighArrowCode = 108; // Swing High Arrow Code +input color swingHighArrowColor = clrMagenta; // Swing High Arrow Color + +// +input uchar swingLowArrowCode = 108; // Swing Low Arrow Code +input color swingLowArrowColor = clrAqua; // Swing Low Arrow Color +// +// END Inputs ... +// + +// +// Include Common and Models Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// Include Draw Library ... +#include "../Libraries/x-saherelm.draw.lib.mq5" + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 1 +#property indicator_plots 0 + +// +#define swingBufferIndex 0 +double swingBuffer[]; +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + drawPrefix = ShortName; + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(0, length * 3); + + // + limit = prev_calculated < maxLength ? rates_total - (maxLength + 1) : rates_total - prev_calculated; + + // + // Main Loop ... + for (int i = limit; i >= 0 && !IsStopped(); i--) + { + // + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (length >= 2) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + ArraySetAsSeries(swingBuffer, true); + SetIndexBuffer(swingBufferIndex, swingBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "( ", length, " )"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ + // + // GetCandleSwing(bar_index); + ENUM_X_SWING_TYPE type = X_NO_SWING; + + // + // Try To Detect Order Blocks ... + bool isSwingLow = false; + bool isSwingHigh = false; + + // + // Reading Candles Data ... + int start = bar_index; + int count = (length * 2) + 2; + int end = start + count; + XOHCL bars[]; + GetBars( + bars, + _Symbol, + _Period, + start, + count + // + ); + + // + // Swing Low ... + isSwingLow = + // + bars[1].close > bars[2].close && + bars[2].close > bars[3].close && + // + bars[3].close < bars[4].close && + // + bars[5].close > bars[4].close && + bars[6].close > bars[5].close + // + ; + + // + if (isSwingLow) + { + type = X_SWING_LOW; + } + + // + if (!isSwingLow) + { + // + // Swing High ... + isSwingHigh = + // + bars[1].close < bars[2].close && + bars[2].close < bars[3].close && + // + bars[3].close > bars[4].close && + // + bars[5].close < bars[4].close && + bars[6].close < bars[5].close + // + ; + + // + if (isSwingHigh) + { + type = X_SWING_HIGH; + } + } + + // + switch (type) + { + // + // Swing High ... + case X_SWING_HIGH: + // + swingBuffer[bar_index] = type; + DrawSwingArrow(1, bar_index); + break; + + // + // Swinmg Low ... + case X_SWING_LOW: + // + swingBuffer[bar_index] = type; + DrawSwingArrow(0, bar_index); + break; + + // + // No Swing ... + default: + case X_NO_SWING: + // + swingBuffer[bar_index] = 0; + break; + } +} + +// +// Draw a Swing Arrow Shape ... +void DrawSwingArrow( + int type, // Swing Type: 0 - Low / 1 - High ... + int bar_index // +) +{ + // + bool isSwingHigh = type == 1; + + // + if ((isSwingHigh && swingHighArrowCode == 0) || + (!isSwingHigh && swingLowArrowCode == 0)) + { + return; + } + + XOHCL candle; + candle.Init( + _Symbol, + _Period, + bar_index + 3); + double arrowDistanceInPoint = 0; + + // + // Define Required Object Properties fro Draw an Arrow ... + datetime time = iTime(_Symbol, _Period, bar_index + 3); + double purePrice = isSwingHigh ? candle.high : candle.low; + color clr = isSwingHigh ? swingHighArrowColor : swingLowArrowColor; + ENUM_ARROW_ANCHOR anchor = isSwingHigh ? ANCHOR_BOTTOM : ANCHOR_TOP; + uchar arrowCode = uchar(isSwingHigh ? swingHighArrowCode : swingLowArrowCode); + double price = isSwingHigh ? purePrice + arrowDistanceInPoint : purePrice - arrowDistanceInPoint; + string name = "Swing " + (isSwingHigh ? "High" : "Low") + "_" + (string)time + "_" + (string)purePrice; + + // + // Draw desired Arrow ... + DrawArrow( + 0, + name, + 0, + time, + price, + arrowCode, + anchor, + clr); +} +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xosc.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xosc.mq5 new file mode 100644 index 0000000..ecf3a27 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xosc.mq5 @@ -0,0 +1,721 @@ +////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// --------------------------------------------- +// Name: XOSC +// Description: provides some oscillator values +// as empty Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X121_XAMA Indicator" +#property strict + +// +// START Constants ... +// + +#define ShortName "XOSC" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +// ATR ... +input group "ATR"; +input int atrLength = 14; // Length + +// +// RVI ... +// The buffer numbers are the following: 0 - MAIN_LINE, 1 - SIGNAL_LINE. +input group "RVI"; +input int rviLength = 10; // Length + +// +// BULLPOWER ... +input group "Bulls Power"; +input int bullpLength = 13; // Length + +// +// BEARPOWER ... +input group "Bears Power"; +input int bearpLength = 13; // Length + +// +// VOLUME ... +input group "Volumes"; +input ENUM_APPLIED_VOLUME volumeAppliedTo = VOLUME_TICK; // Applied To + +// +// RSI ... +input group "RSI"; +input int rsiLength = 14; // Length +input ENUM_APPLIED_PRICE rsiAppliedTo = PRICE_CLOSE; // Applied To + +// +// CCI ... +input group "CCI"; +input int cciLength = 14; // Length +input ENUM_APPLIED_PRICE cciAppliedTo = PRICE_TYPICAL; // Applied To + +// +// STDDEV ... +input group "Standard Deviation"; +input int stddevLength = 20; // Length +input int stddevShift = 0; // Shift +input ENUM_MA_METHOD stddevMethod = MODE_SMA; // Mode +input ENUM_APPLIED_PRICE stddevAppliedTo = PRICE_CLOSE; // AppliedTo + +// +// MOMENTUM ... +input group "Momentum"; +input int momentumLength = 14; // Length +input ENUM_APPLIED_PRICE momentumAppliedTo = PRICE_CLOSE; // Applied To + +// +// SAR ... +input group "SAR"; +input double sarStep = 0.02; // Step +input double sarMaximum = 0.2; // Maximum + +// +// MACD ... +// The buffer numbers are the following: 0 - MAIN_LINE, 1 - SIGNAL_LINE. +input group "MACD"; +input int macdFastLength = 12; // Fast Length +input int macdSlowLength = 26; // Slow Length +input int macdSignaLength = 9; // Signal Length +input ENUM_APPLIED_PRICE macdAppliedTo = PRICE_CLOSE; // Applied To + +// +// STOCHASTIC ... +// The buffer numbers: 0 - MAIN_LINE, 1 - SIGNAL_LINE. +input group "Stochastic"; +input int stochKLength = 5; // K Length +input int stochDLength = 3; // D Length +input int stochSlowing = 3; // Slowing +input ENUM_MA_METHOD stochMaMethod = MODE_SMA; // Ma Method +input ENUM_STO_PRICE stochMode = STO_LOWHIGH; // Calculation Mode + +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// + +// +#property indicator_chart_window + +// +#property indicator_buffers 15 +#property indicator_plots 0 + +// +// ATR ... +#define atrBufferIndex 0 +double atrBuffer[]; + +// +// RVI ... +#define rviMainBufferIndex 1 +#define rviSignalBufferIndex 2 +double rviMainBuffer[]; +double rviSignalBuffer[]; + +// +// BULLPOWER ... +#define bullPBufferIndex 3 +double bullPBuffer[]; + +// +// BEARPOWER ... +#define bearPBufferIndex 4 +double bearPBuffer[]; + +// +// VOLUME ... +#define volumeBufferIndex 5 +double volumeBuffer[]; + +// +// RSI ... +#define rsiBufferIndex 6 +double rsiBuffer[]; + +// +// CCI ... +#define cciBufferIndex 7 +double cciBuffer[]; + +// +// MOMENTUM ... +#define momentumBufferIndex 8 +double momentumBuffer[]; + +// +// SAR ... +#define sarBufferIndex 9 +double sarBuffer[]; + +// +// MACD ... +#define macdMainBufferIndex 10 +#define macdSignalBufferIndex 11 +double macdMainBuffer[]; +double macdSignalBuffer[]; + +// +// STOCHASTIC ... +#define stochMainBufferIndex 12 +#define stochSignalBufferIndex 13 +double stochMainBuffer[]; +double stochSignalBuffer[]; + +// +// STANDARDDEVIATION ... +#define stddevBufferIndex 14 +double stddevBuffer[]; + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +int atrHandler = INVALID_HANDLE; +int rviHandler = INVALID_HANDLE; +int bullPHandler = INVALID_HANDLE; +int bearPHandler = INVALID_HANDLE; +int volumeHandler = INVALID_HANDLE; +int rsiHandler = INVALID_HANDLE; +int cciHandler = INVALID_HANDLE; +int momentumHandler = INVALID_HANDLE; +int sarHandler = INVALID_HANDLE; +int macdHandler = INVALID_HANDLE; +int stochHandler = INVALID_HANDLE; +int stddevHandler = INVALID_HANDLE; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Initializing Handlers ... + + // + // ATR ... + atrHandler = iATR( + _Symbol, + _Period, + atrLength); + + // + // RVI ... + rviHandler = iRVI( + _Symbol, + _Period, + rviLength); + + // + // BULLSPOWER ... + bullPHandler = iBullsPower( + _Symbol, + _Period, + bullpLength); + + // + // BEARSPOWER ... + bearPHandler = iBearsPower( + _Symbol, + _Period, + bullpLength); + + // + // VOLUMES ... + volumeHandler = iVolumes( + _Symbol, + _Period, + volumeAppliedTo); + + // + // RSI ... + rsiHandler = iRSI( + _Symbol, + _Period, + rsiLength, + rsiAppliedTo); + + // + // CCI ... + cciHandler = iCCI( + _Symbol, + _Period, + cciLength, + cciAppliedTo); + + // + // MOMENTUM ... + momentumHandler = iMomentum( + _Symbol, + _Period, + momentumLength, + momentumAppliedTo); + + // + // SAR ... + sarHandler = iSAR( + _Symbol, + _Period, + sarStep, + sarMaximum); + + // + // MACD ... + macdHandler = iMACD( + _Symbol, + _Period, + macdFastLength, + macdSlowLength, + macdSignaLength, + macdAppliedTo); + + // + // STOCHASTIC ... + stochHandler = iStochastic( + _Symbol, + _Period, + stochKLength, + stochDLength, + stochSlowing, + stochMaMethod, + stochMode); + + // + // STANDARDDEVIATION ... + stddevHandler = iStdDev( + _Symbol, + _Period, + stddevLength, + stddevShift, + stddevMethod, + stddevAppliedTo); + + // + bool isAllHandlersInit = + // + atrHandler != INVALID_HANDLE && + rviHandler != INVALID_HANDLE && + bullPHandler != INVALID_HANDLE && + bearPHandler != INVALID_HANDLE && + volumeHandler != INVALID_HANDLE && + rsiHandler != INVALID_HANDLE && + cciHandler != INVALID_HANDLE && + momentumHandler != INVALID_HANDLE && + sarHandler != INVALID_HANDLE && + macdHandler != INVALID_HANDLE && + stochHandler != INVALID_HANDLE && + stddevHandler != INVALID_HANDLE + // + ; + if (!isAllHandlersInit) + { + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(atrHandler); + IndicatorRelease(rviHandler); + IndicatorRelease(bullPHandler); + IndicatorRelease(bearPHandler); + IndicatorRelease(volumeHandler); + IndicatorRelease(rsiHandler); + IndicatorRelease(cciHandler); + IndicatorRelease(momentumHandler); + IndicatorRelease(sarHandler); + IndicatorRelease(macdHandler); + IndicatorRelease(stochHandler); + IndicatorRelease(stddevHandler); +} + +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // Check Calculated Bars ... + int atrCalculatedBars = BarsCalculated(atrHandler); + int rviCalculatedBars = BarsCalculated(rviHandler); + int bullPCalculatedBars = BarsCalculated(bullPHandler); + int bearPCalculatedBars = BarsCalculated(bearPHandler); + int volumeCalculatedBars = BarsCalculated(volumeHandler); + int rsiCalculatedBars = BarsCalculated(rsiHandler); + int cciCalculatedBars = BarsCalculated(cciHandler); + int momentumCalculatedBars = BarsCalculated(momentumHandler); + int sarCalculatedBars = BarsCalculated(sarHandler); + int macdCalculatedBars = BarsCalculated(macdHandler); + int stochCalculatedBars = BarsCalculated(stochHandler); + int stddevCalculatedBars = BarsCalculated(stddevHandler); + + // + bool isCalculatedBarsPassed = + // + atrCalculatedBars >= maxLength && + rviCalculatedBars >= maxLength && + bullPCalculatedBars >= maxLength && + bearPCalculatedBars >= maxLength && + volumeCalculatedBars >= maxLength && + rsiCalculatedBars >= maxLength && + cciCalculatedBars >= maxLength && + momentumCalculatedBars >= maxLength && + sarCalculatedBars >= maxLength && + macdCalculatedBars >= maxLength && + stochCalculatedBars >= maxLength && + stddevCalculatedBars >= maxLength + // + ; + if (!isCalculatedBarsPassed) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int atrCopiedItems = CopyBuffer(atrHandler, 0, 0, limit, atrBuffer); + int rviMainCopiedItems = CopyBuffer(rviHandler, MAIN_LINE, 0, limit, rviMainBuffer); + int rviSignalCopiedItems = CopyBuffer(rviHandler, SIGNAL_LINE, 0, limit, rviSignalBuffer); + int bullPCopiedItems = CopyBuffer(bullPHandler, 0, 0, limit, bullPBuffer); + int bearPCopiedItems = CopyBuffer(bearPHandler, 0, 0, limit, bearPBuffer); + int volumeCopiedItems = CopyBuffer(volumeHandler, 0, 0, limit, volumeBuffer); + int rsiCopiedItems = CopyBuffer(rsiHandler, 0, 0, limit, rsiBuffer); + int cciCopiedItems = CopyBuffer(cciHandler, 0, 0, limit, cciBuffer); + int momentumCopiedItems = CopyBuffer(momentumHandler, 0, 0, limit, momentumBuffer); + int sarCopiedItems = CopyBuffer(sarHandler, 0, 0, limit, sarBuffer); + int macdMainCopiedItems = CopyBuffer(macdHandler, MAIN_LINE, 0, limit, macdMainBuffer); + int macdSignalCopiedItems = CopyBuffer(macdHandler, SIGNAL_LINE, 0, limit, macdSignalBuffer); + int stochMainCopiedItems = CopyBuffer(stochHandler, MAIN_LINE, 0, limit, stochMainBuffer); + int stocSignalhCopiedItems = CopyBuffer(stochHandler, SIGNAL_LINE, 0, limit, stochSignalBuffer); + int stddevCopiedItems = CopyBuffer(stddevHandler, 0, 0, limit, stddevBuffer); + + // + bool isCopiedBarsPassed = + // + atrCopiedItems > 0 && + rviMainCopiedItems > 0 && + rviSignalCopiedItems > 0 && + bullPCopiedItems > 0 && + bearPCopiedItems > 0 && + volumeCopiedItems > 0 && + rsiCopiedItems > 0 && + cciCopiedItems > 0 && + momentumCopiedItems > 0 && + sarCopiedItems > 0 && + macdMainCopiedItems > 0 && + macdSignalCopiedItems > 0 && + stochMainCopiedItems > 0 && + stocSignalhCopiedItems > 0 && + stddevCopiedItems > 0 + // + ; + if (!isCopiedBarsPassed) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + // + // Do Buffers Calculation ... + // HERE We Do Not anything ... + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + result = + // + atrLength >= 2 && + rviLength >= 2 && + bullpLength >= 2 && + bearpLength >= 2 && + rsiLength >= 2 && + cciLength >= 2 && + momentumLength >= 2 && + sarStep > 0 && + sarStep < sarMaximum && + macdFastLength >= 2 && + macdSlowLength > macdFastLength && + macdSignaLength >= 2 && + stochKLength >= 2 && + stochDLength >= 2 && + stochSlowing >= 2 && + stddevLength >= 2 && + stddevShift >= 0 + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + result = MathMax(atrLength, rviLength); + result = MathMax(result, bullpLength); + result = MathMax(result, bearpLength); + result = MathMax(result, rsiLength); + result = MathMax(result, cciLength); + result = MathMax(result, momentumLength); + result = MathMax(result, macdFastLength); + result = MathMax(result, macdSlowLength); + result = MathMax(result, macdSignaLength); + result = MathMax(result, stochKLength); + result = MathMax(result, stochDLength); + result = MathMax(result, stochSlowing); + result = MathMax(result, stddevLength); + + // + return result; +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // DATA Buffers ... + + // + // ATR ... + ArraySetAsSeries(atrBuffer, true); + SetIndexBuffer(atrBufferIndex, atrBuffer, INDICATOR_CALCULATIONS); + + // + // RVI ... + + // + // Main ... + ArraySetAsSeries(rviMainBuffer, true); + SetIndexBuffer(rviMainBufferIndex, rviMainBuffer, INDICATOR_CALCULATIONS); + + // + // Signal ... + ArraySetAsSeries(rviSignalBuffer, true); + SetIndexBuffer(rviSignalBufferIndex, rviSignalBuffer, INDICATOR_CALCULATIONS); + + // + // BULLPOWER ... + ArraySetAsSeries(bullPBuffer, true); + SetIndexBuffer(bullPBufferIndex, bullPBuffer, INDICATOR_CALCULATIONS); + + // + // BEARPOWER ... + ArraySetAsSeries(bearPBuffer, true); + SetIndexBuffer(bearPBufferIndex, bearPBuffer, INDICATOR_CALCULATIONS); + + // + // VOLUME ... + ArraySetAsSeries(volumeBuffer, true); + SetIndexBuffer(volumeBufferIndex, volumeBuffer, INDICATOR_CALCULATIONS); + + // + // RSI ... + ArraySetAsSeries(rsiBuffer, true); + SetIndexBuffer(rsiBufferIndex, rsiBuffer, INDICATOR_CALCULATIONS); + + // + // CCI ... + ArraySetAsSeries(cciBuffer, true); + SetIndexBuffer(cciBufferIndex, cciBuffer, INDICATOR_CALCULATIONS); + + // + // MOMENTUM ... + ArraySetAsSeries(momentumBuffer, true); + SetIndexBuffer(momentumBufferIndex, momentumBuffer, INDICATOR_CALCULATIONS); + + // + // SAR ... + ArraySetAsSeries(sarBuffer, true); + SetIndexBuffer(sarBufferIndex, sarBuffer, INDICATOR_CALCULATIONS); + + // + // STANDARDDEVIATION ... + ArraySetAsSeries(stddevBuffer, true); + SetIndexBuffer(stddevBufferIndex, stddevBuffer, INDICATOR_CALCULATIONS); + + // + // MACD ... + + // + // Main ... + ArraySetAsSeries(macdMainBuffer, true); + SetIndexBuffer(macdMainBufferIndex, macdMainBuffer, INDICATOR_CALCULATIONS); + + // + // Signal ... + ArraySetAsSeries(macdSignalBuffer, true); + SetIndexBuffer(macdSignalBufferIndex, macdSignalBuffer, INDICATOR_CALCULATIONS); +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xpv.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xpv.mq5 new file mode 100644 index 0000000..d724dd2 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xpv.mq5 @@ -0,0 +1,1211 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// ------------------------------------------------- +// Name: XPV +// Description: Peaks and Vales ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XPV Indicator" +#property strict + +// +// Definitions ... + +// +#define ShortName "XPV" + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// Inputs ... + +// +input group "Makret Cycles"; + +// +input group "Short"; +input ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period +input ENUM_TIMEFRAMES scPeriod = NULL; // Time Period + +// +input group "Medium"; +input ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Period +input ENUM_TIMEFRAMES mcPeriod = NULL; // Time Period + +// +input group "Long"; +input ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Period +input ENUM_TIMEFRAMES lcPeriod = NULL; // Time Period + +// +input group "Hind"; +input ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period +input ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period + +// +input group "Fibonacci"; +input double fiboLevel1 = 0.236; // Fibio 1st Level +input double fiboLevel2 = 0.382; // Fibio 2st Level +input double fiboLevel3 = 0.5; // Fibio 3rd Level +input double fiboLevel4 = 0.618; // Fibio 4th Level +input double fiboLevel5 = 0.764; // Fibio 5th Level + +// +input group "Boundary Detection Modes"; +input ENUM_SERIESMODE hhMode = MODE_HIGH; // Highest High Calculation Method +input ENUM_SERIESMODE llMode = MODE_LOW; // Lowest Low Calculation Method + +// +input group "Presentation"; +input bool showPeaksAndVales = true; // Show Peaks and Vales +input bool showLevels = false; // Show Levels +input bool showConsolidations = false; // Show Consolidations +input bool showFibo1Levels = false; // Show Fibo 1st Level +input bool showFibo2Levels = false; // Show Fibo 2nd Level +input bool showFibo3Levels = false; // Show Fibo 3rd Level +input bool showFibo4Levels = false; // Show Fibo 4th Level +input bool showFibo5Levels = false; // Show Fibo 5th Level + +// +// Buffers ... + +// +#property indicator_chart_window + +// +#property indicator_buffers 32 +#property indicator_plots 32 + +// +// PEAKS ... + +// +#define peaksBufferIndex 0 +double peaksBuffer[]; + +// +#property indicator_label1 "XPV PEAKS" +#property indicator_type1 DRAW_ARROW +#property indicator_color1 clrAqua +#property indicator_width1 1 + +// +// VALES ... + +// +#define valesBufferIndex 1 +double valesBuffer[]; + +// +#property indicator_label2 "XPV VALES" +#property indicator_type2 DRAW_ARROW +#property indicator_color2 clrMagenta +#property indicator_width2 1 + +// +#define rBufferIndex 2 +double rBuffer[]; + +// +#define rColorBufferIndex 3 +double rColorBuffer[]; + +// +#property indicator_label3 "XPV R" +#property indicator_type3 DRAW_COLOR_LINE +#property indicator_color3 CLR_NONE, clrAqua +#property indicator_style3 STYLE_DOT +#property indicator_width3 1 + +// +#define sBufferIndex 4 +#define sBufferPlotIndex 3 +double sBuffer[]; + +// +#define sColorBufferIndex 5 +double sColorBuffer[]; + +// +#property indicator_label4 "XPV S" +#property indicator_type4 DRAW_COLOR_LINE +#property indicator_color4 CLR_NONE, clrMagenta +#property indicator_style4 STYLE_DOT +#property indicator_width4 1 + +// +// FIBBO Level 1 ... + +// +#define fl1BufferIndex 6 +#define fl1BufferPlotIndex 4 +double fl1Buffer[]; + +// +#define fl1ColorBufferIndex 7 +double fl1ColorBuffer[]; + +// +#property indicator_label5 "XPV FL1" +#property indicator_type5 DRAW_COLOR_LINE +#property indicator_color5 CLR_NONE, clrGold +#property indicator_style5 STYLE_DASHDOTDOT +#property indicator_width5 1 + +// +// FIBBO Level 2 ... + +// +#define fl2BufferIndex 8 +#define fl2BufferPlotIndex 5 +double fl2Buffer[]; + +// +#define fl2ColorBufferIndex 9 +double fl2ColorBuffer[]; + +// +#property indicator_label6 "XPV FL2" +#property indicator_type6 DRAW_COLOR_LINE +#property indicator_color6 CLR_NONE, clrGold +#property indicator_style6 STYLE_DASHDOTDOT +#property indicator_width6 1 + +// +// FIBBO Level 3 ... + +// +#define fl3BufferIndex 10 +#define fl3BufferPlotIndex 6 +double fl3Buffer[]; + +// +#define fl3ColorBufferIndex 11 +double fl3ColorBuffer[]; + +// +#property indicator_label7 "XPV FL3" +#property indicator_type7 DRAW_COLOR_LINE +#property indicator_color7 CLR_NONE, clrGold +#property indicator_style7 STYLE_DASHDOTDOT +#property indicator_width7 1 + +// +// FIBBO Level 4 ... + +// +#define fl4BufferIndex 12 +#define fl4BufferPlotIndex 7 +double fl4Buffer[]; + +// +#define fl4ColorBufferIndex 13 +double fl4ColorBuffer[]; + +// +#property indicator_label8 "XPV FL4" +#property indicator_type8 DRAW_COLOR_LINE +#property indicator_color8 CLR_NONE, clrGold +#property indicator_style8 STYLE_DASHDOTDOT +#property indicator_width8 1 + +// +// FIBBO Level 5 ... + +// +#define fl5BufferIndex 14 +#define fl5BufferPlotIndex 8 +double fl5Buffer[]; + +// +#define fl5ColorBufferIndex 15 +double fl5ColorBuffer[]; + +// +#property indicator_label9 "XPV FL5" +#property indicator_type9 DRAW_COLOR_LINE +#property indicator_color9 CLR_NONE, clrGold +#property indicator_style9 STYLE_DASHDOTDOT +#property indicator_width9 1 + +// +// LEVELS ... + +// +#define scHHBufferIndex 16 +#define scHHBufferPlotIndex 9 +double scHHBuffer[]; + +// +#define scHHColorBufferIndex 17 +double scHHColorBuffer[]; + +// +#property indicator_label10 "XPV SHH" +#property indicator_type10 DRAW_COLOR_LINE +#property indicator_color10 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style10 STYLE_DOT +#property indicator_width10 1 + +#define scLLBufferIndex 18 +#define scLLBufferPlotIndex 10 +double scLLBuffer[]; + +// +#define scLLColorBufferIndex 19 +double scLLColorBuffer[]; + +// +#property indicator_label11 "XPV SLL" +#property indicator_type11 DRAW_COLOR_LINE +#property indicator_color11 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style11 STYLE_DOT +#property indicator_width11 1 + +// +#define mcHHBufferIndex 20 +#define mcHHBufferPlotIndex 11 +double mcHHBuffer[]; + +// +#define mcHHColorBufferIndex 21 +double mcHHColorBuffer[]; + +// +#property indicator_label12 "XPV MHH" +#property indicator_type12 DRAW_COLOR_LINE +#property indicator_color12 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style12 STYLE_DOT +#property indicator_width12 1 + +// +#define mcLLBufferIndex 22 +#define mcLLBufferPlotIndex 12 +double mcLLBuffer[]; + +// +#define mcLLColorBufferIndex 23 +double mcLLColorBuffer[]; + +// +#property indicator_label13 "XPV MLL" +#property indicator_type13 DRAW_COLOR_LINE +#property indicator_color13 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style13 STYLE_DOT +#property indicator_width13 1 + +// +#define lcHHBufferIndex 24 +#define lcHHBufferPlotIndex 13 +double lcHHBuffer[]; + +// +#define lcHHColorBufferIndex 25 +double lcHHColorBuffer[]; + +// +#property indicator_label14 "XPV LHH" +#property indicator_type14 DRAW_COLOR_LINE +#property indicator_color14 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style14 STYLE_DOT +#property indicator_width14 1 + +// +#define lcLLBufferIndex 26 +#define lcLLBufferPlotIndex 14 +double lcLLBuffer[]; + +// +#define lcLLColorBufferIndex 27 +double lcLLColorBuffer[]; + +// +#property indicator_label15 "XPV LLL" +#property indicator_type15 DRAW_COLOR_LINE +#property indicator_color15 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style15 STYLE_DOT +#property indicator_width15 1 + +// +#define hcHHBufferIndex 28 +#define hcHHBufferPlotIndex 15 +double hcHHBuffer[]; + +// +#define hcHHColorBufferIndex 29 +double hcHHColorBuffer[]; + +// +#property indicator_label16 "XPV HHH" +#property indicator_type16 DRAW_COLOR_LINE +#property indicator_color16 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style16 STYLE_DOT +#property indicator_width16 1 + +// +#define hcLLBufferIndex 30 +#define hcLLBufferPlotIndex 16 +double hcLLBuffer[]; + +// +#define hcLLColorBufferIndex 31 +double hcLLColorBuffer[]; + +// +#property indicator_label17 "XPV HLL" +#property indicator_type17 DRAW_COLOR_LINE +#property indicator_color17 CLR_NONE, clrLightGray, clrAqua, clrMagenta +#property indicator_style17 STYLE_DOT +#property indicator_width17 1 + +// +// Variables, Properties and etc ... + +// +int maxLength; + +// +double mHideColorIDX = 0; + +// +XMarketCycle sc; +double mLastSCHH = 0; +double mLastSCLL = 0; + +// +XMarketCycle mc; +double mLastMCHH = 0; +double mLastMCLL = 0; + +// +XMarketCycle lc; +double mLastLCHH = 0; +double mLastLCLL = 0; + +// +XMarketCycle hc; +double mLastHCHH = 0; +double mLastHCLL = 0; + +// +double lastPeak = 0; +double lastVale = 0; + +// +// Event Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + if (!InitMarketCycles()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... + // +) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i); + } + + // + return rates_total; +} + +// +// Functions ... + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = + // + IsValid(scMethod, scPeriod) && + IsValid(mcMethod, mcPeriod) && + IsValid(lcMethod, lcPeriod) && + IsValid(hcMethod, hcPeriod) + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + result = MathMax(sc.length, mc.length); + result = MathMax(result, lc.length); + result = MathMax(result, hc.length); + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // PEAKS and VALES ... + ENUM_DRAW_TYPE pvDrawType = showPeaksAndVales ? DRAW_ARROW : DRAW_NONE; + + // + // PEAKS ... + ArraySetAsSeries(peaksBuffer, true); + SetIndexBuffer(peaksBufferIndex, peaksBuffer, INDICATOR_DATA); + PlotIndexSetInteger(peaksBufferIndex, PLOT_ARROW, 225); + PlotIndexSetDouble(peaksBufferIndex, PLOT_EMPTY_VALUE, 0); + + // + PlotIndexSetInteger(peaksBufferIndex, PLOT_SHOW_DATA, showPeaksAndVales); + PlotIndexSetInteger(peaksBufferIndex, PLOT_DRAW_TYPE, pvDrawType); + + // + // VALES ... + ArraySetAsSeries(valesBuffer, true); + SetIndexBuffer(valesBufferIndex, valesBuffer, INDICATOR_DATA); + PlotIndexSetInteger(valesBufferIndex, PLOT_ARROW, 225); + PlotIndexSetDouble(valesBufferIndex, PLOT_EMPTY_VALUE, 0); + + // + PlotIndexSetInteger(valesBufferIndex, PLOT_SHOW_DATA, showPeaksAndVales); + PlotIndexSetInteger(valesBufferIndex, PLOT_DRAW_TYPE, pvDrawType); + + // + // SUPPORT and RESISTANCE ... + // + + // + // RESISTANCE ... + ArraySetAsSeries(rBuffer, true); + SetIndexBuffer(rBufferIndex, rBuffer, INDICATOR_DATA); + PlotIndexSetInteger(rBufferIndex, PLOT_SHOW_DATA, false); + PlotIndexSetInteger(rBufferIndex, PLOT_DRAW_BEGIN, maxLength); + + // + // RESISTANCE Color ... + ArraySetAsSeries(rColorBuffer, true); + SetIndexBuffer(rColorBufferIndex, rColorBuffer, INDICATOR_COLOR_INDEX); + + // + // SUPPORT ... + ArraySetAsSeries(sBuffer, true); + SetIndexBuffer(sBufferIndex, sBuffer, INDICATOR_DATA); + PlotIndexSetInteger(sBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(sBufferPlotIndex, PLOT_SHOW_DATA, false); + + // + // SUPPORT Color ... + ArraySetAsSeries(sColorBuffer, true); + SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_COLOR_INDEX); + + // + // FIBBO Levels ... + + // + // LEVEL 1 ... + + // + // Buffer ... + ArraySetAsSeries(fl1Buffer, true); + SetIndexBuffer(fl1BufferIndex, fl1Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fl1BufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fl1BufferPlotIndex, PLOT_SHOW_DATA, showFibo1Levels); + + // + // Color ... + ArraySetAsSeries(fl1ColorBuffer, true); + SetIndexBuffer(fl1ColorBufferIndex, fl1ColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LEVEL 2 ... + + // + // Buffer ... + ArraySetAsSeries(fl2Buffer, true); + SetIndexBuffer(fl2BufferIndex, fl2Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fl2BufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fl2BufferPlotIndex, PLOT_SHOW_DATA, showFibo2Levels); + + // + // Color ... + ArraySetAsSeries(fl2ColorBuffer, true); + SetIndexBuffer(fl2ColorBufferIndex, fl2ColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LEVEL 3 ... + + // + // Buffer ... + ArraySetAsSeries(fl3Buffer, true); + SetIndexBuffer(fl3BufferIndex, fl3Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fl3BufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fl3BufferPlotIndex, PLOT_SHOW_DATA, showFibo3Levels); + + // + // Color ... + ArraySetAsSeries(fl3ColorBuffer, true); + SetIndexBuffer(fl3ColorBufferIndex, fl3ColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LEVEL 4 ... + + // + // Buffer ... + ArraySetAsSeries(fl4Buffer, true); + SetIndexBuffer(fl4BufferIndex, fl4Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fl4BufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fl4BufferPlotIndex, PLOT_SHOW_DATA, showFibo4Levels); + + // + // Color ... + ArraySetAsSeries(fl4ColorBuffer, true); + SetIndexBuffer(fl4ColorBufferIndex, fl4ColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LEVEL 5 ... + + // + // Buffer ... + ArraySetAsSeries(fl5Buffer, true); + SetIndexBuffer(fl5BufferIndex, fl5Buffer, INDICATOR_DATA); + PlotIndexSetInteger(fl5BufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(fl5BufferPlotIndex, PLOT_SHOW_DATA, showFibo5Levels); + + // + // Color ... + ArraySetAsSeries(fl5ColorBuffer, true); + SetIndexBuffer(fl5ColorBufferIndex, fl5ColorBuffer, INDICATOR_COLOR_INDEX); + + // + // SHORT Buffers ... + + // + // HIGH ... + ArraySetAsSeries(scHHBuffer, true); + SetIndexBuffer(scHHBufferIndex, scHHBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(scHHBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(scHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(scHHColorBuffer, true); + SetIndexBuffer(scHHColorBufferIndex, scHHColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LOW ... + ArraySetAsSeries(scLLBuffer, true); + SetIndexBuffer(scLLBufferIndex, scLLBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(scLLBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(scLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(scLLColorBuffer, true); + SetIndexBuffer(scLLColorBufferIndex, scLLColorBuffer, INDICATOR_COLOR_INDEX); + + // + // MEDIUM Buffer ... + + // + // HIGH ... + ArraySetAsSeries(mcHHBuffer, true); + SetIndexBuffer(mcHHBufferIndex, mcHHBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(mcHHBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(mcHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(mcHHColorBuffer, true); + SetIndexBuffer(mcHHColorBufferIndex, mcHHColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LOW ... + ArraySetAsSeries(mcLLBuffer, true); + SetIndexBuffer(mcLLBufferIndex, mcLLBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(mcLLBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(mcLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(mcLLColorBuffer, true); + SetIndexBuffer(mcLLColorBufferIndex, mcLLColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LONG Buffer ... + + // + // HIGH ... + ArraySetAsSeries(lcHHBuffer, true); + SetIndexBuffer(lcHHBufferIndex, lcHHBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(lcHHBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(lcHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(lcHHColorBuffer, true); + SetIndexBuffer(lcHHColorBufferIndex, lcHHColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LOW ... + ArraySetAsSeries(lcLLBuffer, true); + SetIndexBuffer(lcLLBufferIndex, lcLLBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(lcLLBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(lcLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(lcLLColorBuffer, true); + SetIndexBuffer(lcLLColorBufferIndex, lcLLColorBuffer, INDICATOR_COLOR_INDEX); + + // + // HIND Buffer ... + + // + // HIGH ... + ArraySetAsSeries(hcHHBuffer, true); + SetIndexBuffer(hcHHBufferIndex, hcHHBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(hcHHBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(hcHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(hcHHColorBuffer, true); + SetIndexBuffer(hcHHColorBufferIndex, hcHHColorBuffer, INDICATOR_COLOR_INDEX); + + // + // LOW ... + ArraySetAsSeries(hcLLBuffer, true); + SetIndexBuffer(hcLLBufferIndex, hcLLBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(hcLLBufferPlotIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(hcLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels); + + // + ArraySetAsSeries(hcLLColorBuffer, true); + SetIndexBuffer(hcLLColorBufferIndex, hcLLColorBuffer, INDICATOR_COLOR_INDEX); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index // Selected Bar Index +) +{ + // + // Calculate Cycles ... + CalculateCycles(bar_index); + + // + // Calculate Peaks and Vales ... + CalculatePeaksAndVales(bar_index); + + // + // Calculate Fibonnaci ... + CalculateFibonacci(bar_index); +} + +// +// Custom ... + +// +// Initial Market Cycles ... +bool InitMarketCycles() +{ + // + bool result = false; + + // + // Short ... + result = sc.Init( + _Symbol, + _Period, + X_MARKET_CYCLE_SHORT, + scMethod, + scPeriod + // + ); + if (!result) + { + return result; + } + + // + // Medium ... + result = mc.Init( + _Symbol, + _Period, + X_MARKET_CYCLE_MEDIUM, + mcMethod, + mcPeriod + // + ); + if (!result) + { + return result; + } + + // + // Long ... + result = lc.Init( + _Symbol, + _Period, + X_MARKET_CYCLE_LONG, + lcMethod, + lcPeriod + // + ); + if (!result) + { + return result; + } + + // + // Hind ... + result = hc.Init( + _Symbol, + _Period, + X_MARKET_CYCLE_HIND, + hcMethod, + hcPeriod + // + ); + + // + return result; +} + +// +// Calculate Specified Cycles HH and LL ... +void CalculateCycle( + int barIndex, + XMarketCycle &cycle, + double &lastHH, + double &hhBuffer[], + double &hhColorBuffer[], + double &lastLL, + double &llBuffer[], + double &llColorBuffer[] // +) +{ + // + cycle.Update(barIndex); + + // + XOHCL bar; + bar.Init( + _Symbol, + _Period, + barIndex + // + ); + + // + double hhValue = bar.FindHighest( + cycle.length, + hhMode + // + ); + hhBuffer[barIndex] = hhValue; + + // + double hhColorIDX = + !showLevels + ? mHideColorIDX + : (hhValue == lastHH) + ? !showConsolidations + ? mHideColorIDX + : 1 + : hhValue > lastHH + ? 2 + : hhValue < lastHH + ? 3 + : mHideColorIDX; + hhColorBuffer[barIndex] = hhColorIDX; + + // + lastHH = hhValue; + + // + double llValue = bar.FindLowest( + cycle.length, + llMode + // + ); + llBuffer[barIndex] = llValue; + + // + double llColorIDX = + !showLevels + ? mHideColorIDX + : (llValue == lastLL) + ? !showConsolidations + ? mHideColorIDX + : 1 + : llValue > lastLL + ? 2 + : llValue < lastLL + ? 3 + : mHideColorIDX; + llColorBuffer[barIndex] = llColorIDX; + + // + lastLL = llValue; +} + +// +// Calculate Cycles Up and Down Boundaries ... +void CalculateCycles( + int barIndex // Bar Index +) +{ + // + // Short ... + CalculateCycle( + barIndex, + sc, + // + mLastSCHH, + scHHBuffer, + scHHColorBuffer, + // + mLastSCLL, + scLLBuffer, + scLLColorBuffer + // + ); + + // + // Medium ... + CalculateCycle( + barIndex, + mc, + // + mLastMCHH, + mcHHBuffer, + mcHHColorBuffer, + // + mLastMCLL, + mcLLBuffer, + mcLLColorBuffer + // + ); + + // + // Long ... + CalculateCycle( + barIndex, + lc, + // + mLastLCHH, + lcHHBuffer, + lcHHColorBuffer, + // + mLastLCLL, + lcLLBuffer, + lcLLColorBuffer + // + ); + + // + // Hind ... + CalculateCycle( + barIndex, + hc, + // + mLastHCHH, + hcHHBuffer, + hcHHColorBuffer, + // + mLastHCLL, + hcLLBuffer, + hcLLColorBuffer + // + ); +} + +// +// Calculate Peaks and Values ... +void CalculatePeaksAndVales( + int barIndex // Bar Index +) +{ + // + // Retrieve Requirements ... + + // + // Short ... + double scHHValue = scHHBuffer[barIndex]; + double scLLValue = scLLBuffer[barIndex]; + + // + // Medium ... + double mcHHValue = mcHHBuffer[barIndex]; + double mcLLValue = mcLLBuffer[barIndex]; + + // + // Long ... + double lcHHValue = lcHHBuffer[barIndex]; + double lcLLValue = lcLLBuffer[barIndex]; + + // + // Hind ... + double hcHHValue = hcHHBuffer[barIndex]; + double hcLLValue = hcLLBuffer[barIndex]; + + // + double rColorIDX = mHideColorIDX; + double sColorIDX = mHideColorIDX; + + // + // RESISTANCE ... + double rValue = (scHHValue + mcHHValue + lcHHValue + hcHHValue) / 4; + + // + // PEAKS ... + bool isPeak = rValue == hcHHValue && + hcHHValue == lcHHValue && + lcHHValue == mcHHValue && + mcHHValue == scHHValue; + + // + if (isPeak && lastPeak != rValue) + { + // + rColorIDX = 1; + lastPeak = rValue; + } + + // + // SUPPORT ... + double sValue = (scLLValue + mcLLValue + lcLLValue + hcLLValue) / 4; + + // + // VALES ... + bool isVale = sValue == hcLLValue && + hcLLValue == lcLLValue && + lcLLValue == mcLLValue && + mcLLValue == scLLValue; + + // + if (isVale && lastVale != sValue) + { + // + sColorIDX = 1; + + // + lastVale = sValue; + } + + // + rBuffer[barIndex] = rValue; + sBuffer[barIndex] = sValue; + peaksBuffer[barIndex] = lastPeak; + valesBuffer[barIndex] = lastVale; + + // + if (showPeaksAndVales) + { + // + rColorBuffer[barIndex] = rColorIDX; + sColorBuffer[barIndex] = sColorIDX; + } + else + { + // + rColorBuffer[barIndex] = mHideColorIDX; + sColorBuffer[barIndex] = mHideColorIDX; + } +} + +// +// Calculate Fibonacci Level 1 ... +void CalculateFibonacci( + int barIndex // Bar Index +) +{ + // + // Select Requirements ... + double upPrice = peaksBuffer[barIndex]; + double downPrice = valesBuffer[barIndex]; + + // + // Level 1 ... + double fibLevel1Value = GetFibonacciLevel( + upPrice, + downPrice, + fiboLevel1, + 1); + // + // Level 2 ... + double fibLevel2Value = GetFibonacciLevel( + upPrice, + downPrice, + fiboLevel2, + 1); + + // + // Level 3 ... + double fibLevel3Value = GetFibonacciLevel( + upPrice, + downPrice, + fiboLevel3, + 1); + + // + // Level 4 ... + double fibLevel4Value = GetFibonacciLevel( + upPrice, + downPrice, + fiboLevel4, + 1); + + // + // Level 5 ... + double fibLevel5Value = GetFibonacciLevel( + upPrice, + downPrice, + fiboLevel5, + 1); + + // + fl1Buffer[barIndex] = fibLevel1Value; + fl2Buffer[barIndex] = fibLevel2Value; + fl3Buffer[barIndex] = fibLevel3Value; + fl4Buffer[barIndex] = fibLevel4Value; + fl5Buffer[barIndex] = fibLevel5Value; + + // + double fl1ColorIdx = showFibo1Levels ? 1 : mHideColorIDX; + double fl2ColorIdx = showFibo2Levels ? 1 : mHideColorIDX; + double fl3ColorIdx = showFibo3Levels ? 1 : mHideColorIDX; + double fl4ColorIdx = showFibo4Levels ? 1 : mHideColorIDX; + double fl5ColorIdx = showFibo5Levels ? 1 : mHideColorIDX; + + // + fl1ColorBuffer[barIndex] = fl1ColorIdx; + fl2ColorBuffer[barIndex] = fl2ColorIdx; + fl3ColorBuffer[barIndex] = fl3ColorIdx; + fl4ColorBuffer[barIndex] = fl4ColorIdx; + fl5ColorBuffer[barIndex] = fl5ColorIdx; +} + +// \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xrsi.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xrsi.mq5 new file mode 100644 index 0000000..f581113 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xrsi.mq5 @@ -0,0 +1,394 @@ +///////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 OrderBlock Detector Oscillator +// ------------------------------------------------------ +// Name: XRSI +// Description: detect market conditions based on RSI ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XRSI Oscillator" +#property strict + +// +// START Constants ... +// + +#define ShortName "XRSI" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Market"; +input int length = 14; // Market Length +input ENUM_APPLIED_PRICE appliedTo = PRICE_CLOSE; // Applied To + +// +input group "Short Entry"; +input double shortEntryValue = 70; // Short Entry Level +input color shortEntryColor = clrRed; // Short Entry Level Color +input ENUM_LINE_STYLE shortEntryLineStyle = STYLE_DOT; // Short Entry Style + +// +input group "Short Exit"; +input double shortExitValue = 40; // Short Exit Level +input color shortExitColor = clrRed; // Short Exit Level Color +input ENUM_LINE_STYLE shortExitLineStyle = STYLE_DOT; // Short Exit Style + +// +input group "Long Entry"; +input double longEntryValue = 30; // Long Entry Level +input color longEntryColor = clrRed; // Long Entry Level Color +input ENUM_LINE_STYLE longEntryLineStyle = STYLE_DOT; // Long Entry Style + +// +input group "Long Exit"; +input double longExitValue = 60; // Long Exit Level +input color longExitColor = clrRed; // Long Exit Level Color +input ENUM_LINE_STYLE longExitLineStyle = STYLE_DOT; // Long Exit Style + +// +// START Inputs ... +// + +// +// Include Common and Models Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// + +// +// #property indicator_separate_window +#property indicator_chart_window +#property indicator_buffers 2 +// #property indicator_plots 1 +#property indicator_plots 0 + +// +#define rsiBufferIndex 0 +#define rsiColorBufferIndex 1 + +// +double rsiBuffer[]; +double rsiColorBuffer[]; + +// +// #property indicator_label1 "XRSI" +// #property indicator_type1 DRAW_COLOR_LINE +// #property indicator_color1 clrAqua, clrGray, clrFuchsia +// #property indicator_style1 STYLE_DOT +// #property indicator_width1 1 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int rsiHandler = INVALID_HANDLE; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + rsiHandler = iRSI( + _Symbol, + _Period, + length, + appliedTo); + if (rsiHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + + // + IndicatorRelease(rsiHandler); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(0, length); + + // + int rsiCalculatedBars = BarsCalculated(rsiHandler); + if (rsiCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = prev_calculated < maxLength ? rates_total - (maxLength + 1) : rates_total - prev_calculated; + + // + int rsiCopiedItems = CopyBuffer(rsiHandler, 0, 0, limit, rsiBuffer); + if (rsiCopiedItems <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (length >= 2) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // RSI ... + string rsiBufferLabel = ShortName + " (" + (string)length + ")"; + ArraySetAsSeries(rsiBuffer, true); + SetIndexBuffer(rsiBufferIndex, rsiBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(rsiBufferIndex, rsiBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(rsiBufferIndex, PLOT_DRAW_BEGIN, length); + // PlotIndexSetString(rsiBufferIndex, PLOT_LABEL, rsiBufferLabel); + + // // + // // RSI Color Buffer ... + ArraySetAsSeries(rsiColorBuffer, true); + SetIndexBuffer(rsiColorBufferIndex, rsiColorBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(rsiColorBufferIndex, rsiColorBuffer, INDICATOR_COLOR_INDEX); + + // + // Set Indicator Levels here ... + // OB, ExitLong, ExitShort, OS ... + IndicatorSetInteger(INDICATOR_LEVELS, 4); + + // + // SHORTENTRY ... + IndicatorSetDouble(INDICATOR_LEVELVALUE, 0, shortEntryValue); + IndicatorSetInteger(INDICATOR_LEVELCOLOR, 0, shortEntryColor); + IndicatorSetInteger(INDICATOR_LEVELSTYLE, 0, shortEntryLineStyle); + IndicatorSetString(INDICATOR_LEVELTEXT, 0, "Short Entry"); + + // + // LONGEXIT ... + IndicatorSetDouble(INDICATOR_LEVELVALUE, 1, longExitValue); + IndicatorSetInteger(INDICATOR_LEVELCOLOR, 1, longExitColor); + IndicatorSetInteger(INDICATOR_LEVELSTYLE, 1, shortExitLineStyle); + IndicatorSetString(INDICATOR_LEVELTEXT, 1, "Long Exit"); + + // + // SHORTEXIT ... + IndicatorSetDouble(INDICATOR_LEVELVALUE, 2, shortExitValue); + IndicatorSetInteger(INDICATOR_LEVELCOLOR, 2, shortExitColor); + IndicatorSetInteger(INDICATOR_LEVELSTYLE, 2, longEntryLineStyle); + IndicatorSetString(INDICATOR_LEVELTEXT, 2, "Short Exit"); + + // + // LONGENTRY ... + IndicatorSetDouble(INDICATOR_LEVELVALUE, 3, longEntryValue); + IndicatorSetInteger(INDICATOR_LEVELCOLOR, 3, longEntryColor); + IndicatorSetInteger(INDICATOR_LEVELSTYLE, 3, longExitLineStyle); + IndicatorSetString(INDICATOR_LEVELTEXT, 3, "Long Entry"); + + // + // Set Maximum and Minimum for subwindow + IndicatorSetInteger(INDICATOR_DIGITS, 2); + IndicatorSetDouble(INDICATOR_MINIMUM, 0); + IndicatorSetDouble(INDICATOR_MAXIMUM, 100); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "( ", length, " )"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ + // + double iValue = rsiBuffer[bar_index]; + + // + double iColorIndex = 0; + + // + if ( + iValue >= shortEntryValue || + iValue <= longEntryValue || + (iValue < longExitValue && + iValue > shortExitValue)) + { + iColorIndex = 0; + } + else if ( + iValue <= shortEntryValue && + iValue >= longExitValue) + { + iColorIndex = 2; + } + else if ( + iValue < shortExitValue && + iValue > longEntryValue) + { + iColorIndex = 1; + } + + // + rsiColorBuffer[bar_index] = iColorIndex; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xsslc.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xsslc.mq5 new file mode 100644 index 0000000..620cb24 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xsslc.mq5 @@ -0,0 +1,440 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// ---------------------------------------------------- +// Name: XSSLC +// Description: SSL Channel Indicator +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XSSLC Indicator" +#property strict + +// +// START Constants ... +// + +// +// Indicator Short Name ... +#define ShortName "XSSLC" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Market"; +input int length = 36; // Length + +// +input group "Calculation"; +input ENUM_MA_METHOD method = MODE_SMA; // Method +input ENUM_APPLIED_PRICE upAppliedTo = PRICE_HIGH; // Up Applied To +input ENUM_APPLIED_PRICE downAppliedTo = PRICE_LOW; // Down Applied To + +// +input group "Presentation"; +input bool showUp = true; // Show Up +input bool showDown = true; // Show Down + +// +// END Inputs ... +// + +// +// START Includes and Imports ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Includes and Imports ... +// + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 5 +#property indicator_plots 2 + +// +// PLOTTED Buffers ... + +// +#define upBufferIndex 0 +double upBuffer[]; + +// +#property indicator_label1 "XSSLC Up" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrLime +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 + +// +#define downBufferIndex 1 +double downBuffer[]; + +// +#property indicator_label2 "XSSLC Down" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrRed +#property indicator_style2 STYLE_SOLID +#property indicator_width2 1 + +// +// DATA Buffers ... + +// +#define upMaBufferIndex 2 +double upMaBuffer[]; + +// +#define downMaBufferIndex 3 +double downMaBuffer[]; + +// +#define kpiBufferIndex 4 +double kpiBuffer[]; + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +int upHandler = INVALID_HANDLE; +int downHandler = INVALID_HANDLE; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Initialize Requierd Handlers ... + upHandler = iMA( + _Symbol, + _Period, + length, + 0, + method, + upAppliedTo); + downHandler = iMA( + _Symbol, + _Period, + length, + 0, + method, + downAppliedTo); + if (upHandler == INVALID_HANDLE || downHandler == INVALID_HANDLE) + { + // + string msg = "Error in Initilizing Indicator ..."; + Print(msg); + + // + return INIT_FAILED; + } + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Release Indicators ... + IndicatorRelease(upHandler); + IndicatorRelease(downHandler); +} + +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // Check Calculated Bars ... + int upCalculatedBars = BarsCalculated(upHandler); + int downCalculatedBars = BarsCalculated(downHandler); + if (upCalculatedBars < maxLength || + downCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedUps = CopyBuffer(upHandler, 0, 0, limit, upMaBuffer); + int copiedDowns = CopyBuffer(downHandler, 0, 0, limit, downMaBuffer); + if (copiedUps <= 0 || + copiedDowns <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + CalculateBuffers(i, limit, rates_total, prev_calculated, close); + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = + // + (length > 2) + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + result = MathMax(result, length); + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // UP ... + + // + ENUM_DRAW_TYPE upDrawType = showUp ? DRAW_LINE : DRAW_NONE; + + ArraySetAsSeries(upBuffer, true); + SetIndexBuffer(upBufferIndex, upBuffer, INDICATOR_DATA); + PlotIndexSetInteger(upBufferIndex, PLOT_SHOW_DATA, showUp); + PlotIndexSetInteger(upBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(upBufferIndex, PLOT_DRAW_TYPE, upDrawType); + + // + // DOWN ... + + // + ENUM_DRAW_TYPE downDrawType = showDown ? DRAW_LINE : DRAW_NONE; + + ArraySetAsSeries(downBuffer, true); + SetIndexBuffer(downBufferIndex, downBuffer, INDICATOR_DATA); + PlotIndexSetInteger(downBufferIndex, PLOT_SHOW_DATA, showDown); + PlotIndexSetInteger(downBufferIndex, PLOT_DRAW_BEGIN, maxLength); + PlotIndexSetInteger(downBufferIndex, PLOT_DRAW_TYPE, downDrawType); + + // + // DATA Buffers ... + + // + // UP MA ... + ArraySetAsSeries(upMaBuffer, true); + SetIndexBuffer(upMaBufferIndex, upMaBuffer, INDICATOR_CALCULATIONS); + + // + // DOWN MA ... + ArraySetAsSeries(downMaBuffer, true); + SetIndexBuffer(downMaBufferIndex, downMaBuffer, INDICATOR_CALCULATIONS); + + // + // KPI ... + ArraySetAsSeries(kpiBuffer, true); + SetIndexBuffer(kpiBufferIndex, kpiBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index, // Selected Bar Index + int limit, + int ratesTotal, + int prevCalculated, + const double &close[]) +{ + // + double upMaValue = upMaBuffer[bar_index]; + double downMaValue = downMaBuffer[bar_index]; + + // + double closeValue = close[bar_index]; + + // + double kpiValue; + if (closeValue > upMaValue) + { + kpiValue = 1; + } + else if (closeValue < downMaValue) + { + kpiValue = -1; + } + else + { + kpiValue = kpiBuffer[bar_index + 1]; + } + + // + kpiBuffer[bar_index] = kpiValue; + + // + double upValue = kpiValue < 0 ? downMaValue : upMaValue; + upBuffer[bar_index] = upValue; + + // + double downValue = kpiValue < 0 ? upMaValue : downMaValue; + downBuffer[bar_index] = downValue; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xstr.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xstr.mq5 new file mode 100644 index 0000000..90e6eeb --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xstr.mq5 @@ -0,0 +1,580 @@ +////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// --------------------------------------------- +// Name: XSTR +// Description: Super Trend Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X121_XAMA Indicator" +#property strict + +// +// START Constants ... +// + +#define ShortName "XSTR" + +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +// Market ... +input group "ATR"; +input int atrLength = 14; // Length +input double atrMultiplier = 3.0; // Multiplier +input ENUM_APPLIED_PRICE atrAppliedTo = PRICE_MEDIAN; // Applied To + +// +// Presentation ... +input group "Presentation"; +input bool showTrends = true; // Show Trends +input bool fillTrends = true; // Fill Trends + +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// + +// +#property indicator_chart_window + +// +#property indicator_buffers 9 +#property indicator_plots 2 + +// +#define fillUpBufferIndex 0 +double fillUpBuffer[]; + +#define fillDownBufferIndex 1 +double fillDownBuffer[]; + +// +#define fillingPlotBufferIndex 0 + +// +#property indicator_label1 "XSTR Filling" +#property indicator_type1 DRAW_FILLING +#property indicator_color1 clrBisque, clrPaleGreen + +// +#define mainBufferIndex 2 +#define mainPlotBufferIndex 1 +double mainBuffer[]; + +// +#define mainColorBufferIndex 3 +double mainColorBuffer[]; + +// +#property indicator_label2 "XSTR" +#property indicator_type2 DRAW_COLOR_LINE +#property indicator_color2 CLR_NONE, clrGreen, clrDarkRed +#property indicator_style2 STYLE_DOT + +// +// DATA Buffers ... + +// +#define atrBufferIndex 4 +double atrBuffer[]; + +// +#define trendBufferIndex 5 +double trendBuffer[]; + +// +#define upBufferIndex 6 +double upBuffer[]; + +// +#define downBufferIndex 7 +double downBuffer[]; + +// +#define priceBufferIndex 8 +double priceBuffer[]; + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +int maxLength; + +// +int atrHandler = INVALID_HANDLE; + +// +int changeOfTrend; +int startBearishTrend; +int startBullishTrend; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + maxLength = ExtractMaxLengthOfInputs(); + + // + atrHandler = iATR( + _Symbol, + _Period, + atrLength); + if (atrHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(atrHandler); +} + +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + int numOfRequiredAtrs; + if (prev_calculated > rates_total || prev_calculated < 0) + { + numOfRequiredAtrs = rates_total; + } + else + { + // + numOfRequiredAtrs = rates_total - prev_calculated; + if (prev_calculated > 0) + { + numOfRequiredAtrs++; + } + } + + // + // Checking for stop ... + if (IsStopped()) + { + return 0; + } + + // + // Check Number of items Copy or not ... + int copiedATRs = CopyBuffer(atrHandler, 0, 0, numOfRequiredAtrs, atrBuffer); + if (copiedATRs <= 0) + { + return 0; + } + + // + int limit; + + // + // checking for the limit start of calculation of an indicator ... + if (prev_calculated > rates_total || prev_calculated <= 0) + { + // + // starting index for calculation of all bars ... + limit = maxLength; + } + else + { + // + // starting number for calculation of new bars + limit = prev_calculated - 1; + } + + // + // Main Loop ... + for (int i = limit; i < rates_total && !IsStopped(); i++) + { + // + // Calculated Price ... + double price = getPrice( + atrAppliedTo, + open, + high, + low, + close, + i); + // price = (high[i] + low[i]) / 2; + priceBuffer[i] = price; + + // + double atr = atrBuffer[i]; + + // + // Up ... + upBuffer[i] = price + (atrMultiplier * atr); + + // + // Down ... + downBuffer[i] = price - (atrMultiplier * atr); + + // + if (close[i] > upBuffer[i - 1]) + { + // + trendBuffer[i] = 1; + if (trendBuffer[i - 1] == -1) + { + changeOfTrend = 1; + } + } + else if (close[i] < downBuffer[i - 1]) + { + // + trendBuffer[i] = -1; + if (trendBuffer[i - 1] == 1) + { + changeOfTrend = 1; + } + } + else if (trendBuffer[i - 1] == 1) + { + // + trendBuffer[i] = 1; + changeOfTrend = 0; + } + else if (trendBuffer[i - 1] == -1) + { + // + trendBuffer[i] = -1; + changeOfTrend = 0; + } + + // + // Down Trend Starting ... + if (trendBuffer[i] < 0 && trendBuffer[i - 1] > 0) + { + startBearishTrend = 1; + } + else + { + startBearishTrend = 0; + } + + // + // Up Trend Starting ... + if (trendBuffer[i] > 0 && trendBuffer[i - 1] < 0) + { + startBullishTrend = 1; + } + else + { + startBullishTrend = 0; + } + + // + if (trendBuffer[i] > 0 && downBuffer[i] < downBuffer[i - 1]) + { + downBuffer[i] = downBuffer[i - 1]; + } + + // + if (trendBuffer[i] < 0 && upBuffer[i] > upBuffer[i - 1]) + { + upBuffer[i] = upBuffer[i - 1]; + } + + // + if (startBearishTrend == 1) + { + upBuffer[i] = priceBuffer[i] + (atrMultiplier * atr); + } + + // + if (startBullishTrend == 1) + { + downBuffer[i] = priceBuffer[i] - (atrMultiplier * atr); + } + + // + // Draw the indicator ... + + // + double colorIDX = 0; + mainColorBuffer[i] = colorIDX; + + // + if (trendBuffer[i] == 1) + { + // + mainBuffer[i] = downBuffer[i]; + if (changeOfTrend == 1) + { + mainBuffer[i - 1] = mainBuffer[i - 2]; + changeOfTrend = 0; + } + + // + colorIDX = 1; + } + else if (trendBuffer[i] == -1) + { + // + mainBuffer[i] = upBuffer[i]; + if (changeOfTrend == 1) + { + // + mainBuffer[i - 1] = mainBuffer[i - 2]; + changeOfTrend = 0; + } + + // + colorIDX = 2; + } + + // + if (showTrends) + { + mainColorBuffer[i] = colorIDX; + } + + // + // Filling ... + if (fillTrends) + { + // + fillUpBuffer[i] = mainBuffer[i]; + fillDownBuffer[i] = close[i]; + } + else + { + // + fillUpBuffer[i] = EMPTY_VALUE; + fillDownBuffer[i] = EMPTY_VALUE; + } + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + result = + // + atrLength >= 2 + // + ; + + // + return result; +} + +// +// Retrieve all Exists Input Max Length ... +// use for Start Of Drawing ... +int ExtractMaxLengthOfInputs() +{ + // + int result = 0; + + // + result = atrLength; + + // + return result; +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // PLOT Buffers ... + + // + // FILLINGS ... + SetIndexBuffer(fillUpBufferIndex, fillUpBuffer, INDICATOR_DATA); + SetIndexBuffer(fillDownBufferIndex, fillDownBuffer, INDICATOR_DATA); + PlotIndexSetInteger(fillingPlotBufferIndex, PLOT_SHOW_DATA, false); + + // + // MAIN ... + SetIndexBuffer(mainBufferIndex, mainBuffer, INDICATOR_DATA); + PlotIndexSetInteger(mainPlotBufferIndex, PLOT_SHOW_DATA, showTrends); + SetIndexBuffer(mainColorBufferIndex, mainColorBuffer, INDICATOR_COLOR_INDEX); + + // + // DATA Buffers ... + + // + // ATR ... + SetIndexBuffer(atrBufferIndex, atrBuffer, INDICATOR_CALCULATIONS); + + // + // TREND ... + SetIndexBuffer(trendBufferIndex, trendBuffer, INDICATOR_CALCULATIONS); + + // + // UP ... + SetIndexBuffer(upBufferIndex, upBuffer, INDICATOR_CALCULATIONS); + + // + // DOWN ... + SetIndexBuffer(downBufferIndex, downBuffer, INDICATOR_CALCULATIONS); + + // + // PRICE ... + SetIndexBuffer(priceBufferIndex, priceBuffer, INDICATOR_CALCULATIONS); +} + +// +// END Functions ... +// + +// +// TEMPLATE Function ... + +template +double getPrice(ENUM_APPLIED_PRICE tprice, T &open[], T &high[], T &low[], T &close[], int i) +{ + switch (tprice) + { + case PRICE_CLOSE: + return (close[i]); + case PRICE_OPEN: + return (open[i]); + case PRICE_HIGH: + return (high[i]); + case PRICE_LOW: + return (low[i]); + case PRICE_MEDIAN: + return ((high[i] + low[i]) / 2.0); + case PRICE_TYPICAL: + return ((high[i] + low[i] + close[i]) / 3.0); + case PRICE_WEIGHTED: + return ((high[i] + low[i] + close[i] + close[i]) / 4.0); + } + return (0); +} diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtd.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtd.mq5 new file mode 100644 index 0000000..ca79695 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtd.mq5 @@ -0,0 +1,457 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Trend Detector Oscillator +// -------------------------------------------------- +// Name: XTD +// Description: trend detecting in both sides ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XTD Oscillator" +#property strict + +// +// START Constants ... +// +#define ShortName "XTD" + +// +// XTD Oscillator States ... +enum ENUM_X_XTD_STATES +{ + X_XTD_BULLISH_CROSSED_OVER_BEARISH = 2, + X_XTD_BULLISH_OVER_BEARISH = 1, + X_XTD_NEUTURAL = 0, + X_XTD_BULLISH_UNDER_BEARISH = -1, + X_XTD_BULLISH_CROSSED_UNDER_BEARISH = -2 +}; +// +// END Constants ... +// + +// +// START Inputs ... +// +input int length = 14; // Market Length +input bool drawCrosses = true; // Draw Cross Arrows + +// +// Bullish ... +input uchar bullishArrowCode = 228; // Cross Over Arrow Code +input color bullishArrowColor = clrAqua; // Cross Over Arrow Color + +// +// Bearish ... +input uchar bearishArrowCode = 230; // Cross Under Arrow Code +input color bearishArrowColor = clrMagenta; // Cross Under Arrow Color +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5"; + +// +// Includes Draw Library ... +#include "../Libraries/x-saherelm.draw.lib.mq5"; + +// +// START Buffers ... +// +// #property indicator_separate_window +#property indicator_chart_window + +// +#property indicator_buffers 3 +// #property indicator_plots 3 +#property indicator_plots 0 + +// +#define bullishBufferIndex 0 +#define bearishBufferIndex 1 +#define signalBufferIndex 2 + +// +double bullishBuffer[]; +double bearishBuffer[]; +double signalBuffer[]; + +// +// #property indicator_label1 "XBullPower" +// #property indicator_type1 DRAW_LINE +// #property indicator_color1 clrLime +// #property indicator_style1 STYLE_SOLID +// #property indicator_width1 1 + +// +// #property indicator_label2 "XBearPower" +// #property indicator_type2 DRAW_LINE +// #property indicator_color2 clrRed +// #property indicator_style2 STYLE_SOLID +// #property indicator_width2 1 + +// +// #property indicator_label3 "XSignal" +// #property indicator_type3 DRAW_LINE +// #property indicator_color3 clrGold +// #property indicator_style3 STYLE_DOT +// #property indicator_width3 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +// +int xtdBullishCandleCount = 0; +int xtdBearishCandleCount = 0; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + drawPrefix = ShortName; + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(0, length); + + // + limit = prev_calculated < maxLength ? rates_total - (maxLength + 1) : rates_total - prev_calculated; + + // + // Main Loop ... + for (int i = limit; i >= 0 && !IsStopped(); i--) + { + // + CalculateBuffers(i, close); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (length >= 5) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // Bullish Buffer ... + string bullishBufferLabel = ShortName + "BullPow " + "(" + (string)length + ")"; + ArraySetAsSeries(bullishBuffer, true); + SetIndexBuffer(bullishBufferIndex, bullishBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(bullishBufferIndex, bullishBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(bullishBufferIndex, PLOT_DRAW_BEGIN, length); + // PlotIndexSetString(bullishBufferIndex, PLOT_LABEL, bullishBufferLabel); + + // + // Bearish Buffer ... + string bearishBufferLabel = ShortName + "BearPow " + "(" + (string)length + ")"; + ArraySetAsSeries(bearishBuffer, true); + SetIndexBuffer(bearishBufferIndex, bearishBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(bearishBufferIndex, bearishBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(bearishBufferIndex, PLOT_DRAW_BEGIN, length); + // PlotIndexSetString(bearishBufferIndex, PLOT_LABEL, bearishBufferLabel); + + // + // Signal Buffer ... + string signalBufferLabel = ShortName + "Signal " + "(" + (string)length + ")"; + ArraySetAsSeries(signalBuffer, true); + SetIndexBuffer(signalBufferIndex, signalBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(signalBufferIndex, signalBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(signalBufferIndex, PLOT_DRAW_BEGIN, length); + // PlotIndexSetString(signalBufferIndex, PLOT_LABEL, signalBufferLabel); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "( ", length, " )"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers( + int bar_index, + const double &close[]) +{ + // + // Reset Global Counters ... + xtdBullishCandleCount = 0; + xtdBearishCandleCount = 0; + + // + // Loop through Closes ... + for (int i = bar_index; i <= bar_index + length; i++) + { + for (int j = i + 1; j <= bar_index + length; j++) + { + // + if (close[i] > close[j]) + { + xtdBullishCandleCount++; + } + + // + if (close[i] < close[j]) + { + xtdBearishCandleCount++; + } + } + } + + // + // Bullish Power Buffer ... + bullishBuffer[bar_index] = MathAbs(xtdBullishCandleCount); + + // + // Bearish Power Buffer ... + bearishBuffer[bar_index] = MathAbs(xtdBearishCandleCount); + + // + // Signal Buffer ... + signalBuffer[bar_index] = bullishBuffer[bar_index] - bearishBuffer[bar_index]; + + // + // Check and Draw Crosses if it's Specified ... + if (drawCrosses) + { + DrawCrosses(bar_index); + } +} + +// +// +double GetState( + int bar_index // Specified Bar Index +) +{ + // + // Check Cross Points ... + // bullishCrossedOverBearish = 2; + // bullishOverBearish = 1; + // bullishCrossedUnderBearish = -2; + // bullishUnderBearish = -1; + // OtherWise = 0; + bool isBullishCrossedOverBearish = IsCrossedOver( + bullishBuffer, + bearishBuffer, + bar_index); + bool isBullishCrossedUnderBearish = IsCrossedUnder( + bullishBuffer, + bearishBuffer, + bar_index); + bool isBullishOverBearish = IsOver( + bullishBuffer, + bearishBuffer, + bar_index); + bool isBullishUnderBearish = IsUnder( + bullishBuffer, + bearishBuffer, + bar_index); + + // + double result = X_XTD_NEUTURAL; + if (isBullishCrossedOverBearish) + { + result = X_XTD_BULLISH_CROSSED_OVER_BEARISH; + } + else if (isBullishCrossedUnderBearish) + { + result = X_XTD_BULLISH_CROSSED_UNDER_BEARISH; + } + else if (isBullishOverBearish) + { + result = X_XTD_BULLISH_OVER_BEARISH; + } + else if (isBullishUnderBearish) + { + result = X_XTD_BULLISH_UNDER_BEARISH; + } + else + { + result = X_XTD_NEUTURAL; + } + + // + return result; +} + +// +// Draw Crosses ... +void DrawCrosses( + int bar_index // the bars which required to draw cross arrow on it ... +) +{ + // + double stateValue = GetState(bar_index); + + // + bool isOver = stateValue == 2; + double low = iLow(_Symbol, _Period, bar_index); + double high = iHigh(_Symbol, _Period, bar_index); + + // + double price = isOver ? low : high; + datetime time = iTime(_Symbol, _Period, bar_index); + ENUM_ARROW_ANCHOR anchor = isOver ? ANCHOR_TOP : ANCHOR_BOTTOM; + uchar arrowCode = isOver ? bullishArrowCode : bearishArrowCode; + color arrowColor = isOver ? bullishArrowColor : bearishArrowColor; + string crossName = "Trend " + (isOver ? "Up" : "Down") + "_" + (string)time + "_" + (string)price; + + // + DrawArrow( + 0, + crossName, + 0, + time, + price, + arrowCode, + anchor, + arrowColor); +} +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtm.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtm.mq5 new file mode 100644 index 0000000..2ee52d1 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xtm.mq5 @@ -0,0 +1,351 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Candle Indicator +// --------------------------------------------- +// Name: XTM +// Description: Trend Magic Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XTM Indicator" +#property strict + +// +// START Constants ... +// +#define ShortName "XTM" + +// +// XTM Indicator States ... +enum ENUM_X_XTM_STATES +{ + X_XTM_BULLISH = 1, + X_XTM_BEARISH = -1, + X_XTM_NEUTURAL = 0, +}; +// +// END Constants ... +// + +// +// START Inputs ... +// + +// +input group "Market"; +input int maPeriod = 14; // Period +input int maShift = 0; // Shift +input ENUM_MA_METHOD maMethod = MODE_SMA; // Method +input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // Applied To + +// +input group "Presentation"; +input bool showLine = true; // Show Line + +// +// END Inputs ... +// + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 3 +#property indicator_plots 1 + +// +// maBuffer ... +#define maBufferIndex 0 +#define maColorBufferIndex 1 +#define stateBufferIndex 2 + +double maBuffer[]; +double maColorBuffer[]; +double stateBuffer[]; + +#property indicator_label1 "XTM" +#property indicator_type1 DRAW_COLOR_LINE +#property indicator_color1 clrLime, clrGray, clrRed, CLR_NONE +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +int maHandler = INVALID_HANDLE; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // Initializing MA Handler ... + maHandler = iMA( + _Symbol, + _Period, + maPeriod, + maShift, + maMethod, + maAppliedTo); + if (maHandler == INVALID_HANDLE) + { + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(0, maPeriod); + + // + // Check Calculated Bars ... + int maCalculatedBars = BarsCalculated(maHandler); + if (maCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedMas = CopyBuffer(maHandler, 0, 0, limit, maBuffer); + if (copiedMas <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + // + // Do Buffers Calculation ... + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (maPeriod >= 2) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + string maBufferLabel = "XTM " + "(" + (string)maPeriod + ")"; + + // + // Ma Buffer ... + ArraySetAsSeries(maBuffer, true); + SetIndexBuffer(maBufferIndex, maBuffer, INDICATOR_DATA); + PlotIndexSetString(maBufferIndex, PLOT_LABEL, maBufferLabel); + + // + // Ma Color Buffer ... + ArraySetAsSeries(maColorBuffer, true); + SetIndexBuffer(maColorBufferIndex, maColorBuffer, INDICATOR_COLOR_INDEX); + + // + // State Buffer ... + ArraySetAsSeries(stateBuffer, true); + SetIndexBuffer(stateBufferIndex, stateBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "(", maPeriod, ")"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ + // + // Requirements ... + XOHCL candle; + candle.Init( + _Symbol, + _Period, + bar_index + // + ); + + // + double maValue = maBuffer[bar_index]; + + // + double lineColorIndex = + maValue < candle.low ? 0 : maValue > candle.high ? 2 + : 1; + + // + // Define State Value ... + // lineColorIndex == 0 => Bullish => 1; + // lineColorIndex == 1 => Neutural => 0; + // lineColorIndex == 2 => Bearish => -1; + double stateValue = + lineColorIndex == 0 ? X_XTM_BULLISH : lineColorIndex == 2 ? X_XTM_BEARISH + : X_XTM_NEUTURAL; + + // + // Set Ma Buffer Color Index ... + maColorBuffer[bar_index] = showLine ? lineColorIndex : 3; + + // + // Set State Buffer Value ... + stateBuffer[bar_index] = stateValue; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xts.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xts.mq5 new file mode 100644 index 0000000..cbcf7a7 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xts.mq5 @@ -0,0 +1,548 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XTS Oscillator +// --------------------------------------------- +// Name: XTS +// Description: Time Sections Oscillator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XTS Oscillator" +#property strict + +// +// START Constants ... +// + +// +#define ShortName "XTS" + +// +// Includes Draw Library ... +#include "../Libraries/x-saherelm.draw.lib.mq5" + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// END Constants ... +// + +// +// START Inputs ... +// +input group "Current Period"; +input ENUM_APPLIED_PRICE currentAppliedTo = PRICE_CLOSE; // Current Applied To +// +input group "Nearest Period"; +input ENUM_X_PERIOD_METHOD nearestMethod = X_PERIOD_AUTO; // How to Find Nearest Period +input ENUM_TIMEFRAMES nearestPeriod = NULL; // Nearest Time Frame +input ENUM_APPLIED_PRICE nearestAppliedTo = PRICE_CLOSE; // Nearest Applied To +// +input group "Mediest Period"; +input ENUM_X_PERIOD_METHOD mediestMethod = X_PERIOD_AUTO; // How to Find Mediest Period +input ENUM_TIMEFRAMES mediestPeriod = NULL; // Mediest Time Frame +input ENUM_APPLIED_PRICE mediestAppliedTo = PRICE_CLOSE; // Mediest Applied To +// +input group "Farest Period"; +input ENUM_X_PERIOD_METHOD farestMethod = X_PERIOD_AUTO; // How to Find Farest Period +input ENUM_TIMEFRAMES farestPeriod = NULL; // Farest Time Frame +input ENUM_APPLIED_PRICE farestAppliedTo = PRICE_CLOSE; // Farest Applied To + +// +// START Buffers ... +// +// #property indicator_separate_window +#property indicator_chart_window + +// +#property indicator_buffers 4 +// #property indicator_plots 4 +#property indicator_plots 0 + +// +// Current ... +#define currentBufferIndex 0 + +double currentBuffer[]; + +// #property indicator_label1 "XTS C" +// #property indicator_type1 DRAW_LINE +// #property indicator_color1 clrBrown +// #property indicator_style1 STYLE_SOLID +// #property indicator_width1 1 + +// +// Nearest ... +#define nearestBufferIndex 1 + +double nearestBuffer[]; + +// #property indicator_label2 "XTS N" +// #property indicator_type2 DRAW_LINE +// #property indicator_color2 clrAqua +// #property indicator_style2 STYLE_SOLID +// #property indicator_width2 1 + +// +// Mediest ... +#define mediestBufferIndex 2 + +double mediestBuffer[]; + +// #property indicator_label3 "XTS M" +// #property indicator_type3 DRAW_LINE +// #property indicator_color3 clrLime +// #property indicator_style3 STYLE_SOLID +// #property indicator_width3 1 + +// +// Farest ... +#define farestBufferIndex 3 + +double farestBuffer[]; + +// #property indicator_label4 "XTS F" +// #property indicator_type4 DRAW_LINE +// #property indicator_color4 clrLightBlue +// #property indicator_style4 STYLE_SOLID +// #property indicator_width4 1 + +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// + +// +ENUM_TIMEFRAMES mNearestPeriod = NULL; +ENUM_TIMEFRAMES mMediestPeriod = NULL; +ENUM_TIMEFRAMES mFarestPeriod = NULL; + +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + drawPrefix = ShortName; + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Oscillator ShortName ... + SetOscillatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + Comment(""); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = 30; + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Main Loop ... + for (int i = 0; i < limit && !IsStopped(); i++) + { + // + // Do Buffers Calculation ... + CalculateBuffers(i); + } + + // + return rates_total; +} + +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = true; + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + int maxLength = 30; + + // + // Current ... + ArraySetAsSeries(currentBuffer, true); + SetIndexBuffer(currentBufferIndex, currentBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(currentBufferIndex, currentBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(currentBufferIndex, PLOT_DRAW_BEGIN, maxLength); + + // + // Nearest ... + ArraySetAsSeries(nearestBuffer, true); + SetIndexBuffer(nearestBufferIndex, nearestBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(nearestBufferIndex, nearestBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(nearestBufferIndex, PLOT_DRAW_BEGIN, maxLength); + + // + // Mediest ... + ArraySetAsSeries(mediestBuffer, true); + SetIndexBuffer(mediestBufferIndex, mediestBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(mediestBufferIndex, mediestBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(mediestBufferIndex, PLOT_DRAW_BEGIN, maxLength); + + // + // Farest ... + ArraySetAsSeries(farestBuffer, true); + SetIndexBuffer(farestBufferIndex, farestBuffer, INDICATOR_CALCULATIONS); + // SetIndexBuffer(farestBufferIndex, farestBuffer, INDICATOR_DATA); + // PlotIndexSetInteger(farestBufferIndex, PLOT_DRAW_BEGIN, maxLength); +} + +// +// Set Oscillator Short Name and also we can define Buffers Labels ... +void SetOscillatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ + // + // Current ... + CalculateCurrent(bar_index); + + // + // Nearest ... + CalculateNearest(bar_index); + + // + // Mediest ... + CalculateMediest(bar_index); + + // + // Farest ... + CalculateFarest(bar_index); + + // + // Commenting ... + string comment = GenerateDescriptionComment(); + Comment(comment); +} + +// +// Current ... +void CalculateCurrent(int bar_index) +{ + // + datetime barTime = iTime( + _Symbol, + _Period, + bar_index); + datetime startTime = GetPeriodStartTime( + _Symbol, + _Period, + barTime); + int startBarIndex = iBarShift( + _Symbol, + _Period, + startTime); + + // + XOHCL c; + c.Init( + _Symbol, + _Period, + startBarIndex + // + ); + + // + double value = c.GetPrice(currentAppliedTo); + + // + currentBuffer[bar_index] = value; +} + +// +// Nearest ... +void CalculateNearest(int bar_index) +{ + // + if (mNearestPeriod == NULL) + { + // + switch (nearestMethod) + { + // + case X_PERIOD_AUTO: + mNearestPeriod = GetNearestPeriod(_Period); + break; + + // + case X_PERIOD_NOTHING: + case X_PERIOD_MANUALLY: + mNearestPeriod = nearestPeriod; + break; + } + } + + // + datetime barTime = iTime( + _Symbol, + _Period, + bar_index); + datetime startTime = GetPeriodStartTime( + _Symbol, + mNearestPeriod, + barTime); + int startBarIndex = iBarShift( + _Symbol, + _Period, + startTime); + + // + XOHCL c; + c.Init( + _Symbol, + _Period, + startBarIndex + // + ); + + // + double value = c.GetPrice(nearestAppliedTo); + + // + nearestBuffer[bar_index] = value; +} + +// +// Mediest ... +void CalculateMediest(int bar_index) +{ + // + if (mMediestPeriod == NULL) + { + // + switch (mediestMethod) + { + // + case X_PERIOD_AUTO: + mMediestPeriod = GetMediestPeriod(_Period); + break; + + // + case X_PERIOD_NOTHING: + case X_PERIOD_MANUALLY: + mMediestPeriod = mediestPeriod; + break; + } + } + + // + datetime barTime = iTime( + _Symbol, + _Period, + bar_index); + datetime startTime = GetPeriodStartTime( + _Symbol, + mMediestPeriod, + barTime); + int startBarIndex = iBarShift( + _Symbol, + _Period, + startTime); + + // + XOHCL c; + c.Init( + _Symbol, + _Period, + startBarIndex + // + ); + + // + double value = c.GetPrice(mediestAppliedTo); + + // + mediestBuffer[bar_index] = value; +} + +// +// Farest ... +void CalculateFarest(int bar_index) +{ + // + if (mFarestPeriod == NULL) + { + // + switch (farestMethod) + { + // + case X_PERIOD_AUTO: + mFarestPeriod = GetLongestPeriod(_Period); + break; + + // + case X_PERIOD_NOTHING: + case X_PERIOD_MANUALLY: + mFarestPeriod = farestPeriod; + break; + } + } + + // + datetime barTime = iTime( + _Symbol, + _Period, + bar_index); + datetime startTime = GetPeriodStartTime( + _Symbol, + mFarestPeriod, + barTime); + int startBarIndex = iBarShift( + _Symbol, + _Period, + startTime); + + // + XOHCL c; + c.Init( + _Symbol, + _Period, + startBarIndex + // + ); + + // + double value = c.GetPrice(farestAppliedTo); + + // + farestBuffer[bar_index] = value; +} + +// +// Generate Comment ... +string GenerateDescriptionComment() +{ + // + string result = ""; + + // + result += "Nearest : " + EnumToString(mNearestPeriod) + "\n"; + result += "Mediest : " + EnumToString(mMediestPeriod) + "\n"; + result += "Farest : " + EnumToString(mFarestPeriod) + "\n"; + + // + return result; +} + +// +// END Functions ... +// diff --git a/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xzg.mq5 b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xzg.mq5 new file mode 100644 index 0000000..0abb368 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Indicators/x-saherelm.xzg.mq5 @@ -0,0 +1,750 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Indicator +// --------------------------------------------- +// Name: XZG +// Description: Zogzag Implementation ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm XZG Indicator" +#property strict + +// +#define ShortName "XZG" + +// +// DEFINITIONS ... +enum ENUM_X_ZG_SEARCH_MODE +{ + X_ZG_SEARCH_EXTREMUM = 0, // searching for the first extremum + X_ZG_SEARCH_PEAK = 1, // searching for the next ZigZag peak + X_ZG_SEARCH_VALE = -1 // searching for the next ZigZag vale +}; + +// +// How to Calculate Up and Down Price ... +enum ENUM_X_ZG_PRICE_MODE +{ + // + X_ZG_PRICE_HIGH_LOW_MODE = 1, + X_ZG_PRICE_OPEN_CLOSE_MODE = 2, +}; + +// +// INPUT ... + +// +input group "Market"; +input int depth = 12; // Depth +input int deviation = 5; // Deviation +input int backStep = 3; // Back Step +input ENUM_X_ZG_PRICE_MODE mode = X_ZG_PRICE_HIGH_LOW_MODE; // Mode + +// +input group "Presentation"; +input bool showZigZag = true; // Show ZigZag +input bool showPeaksAndVales = true; // Show Peaks and Vales + +// +// BUFFERS ... + +// +#property indicator_chart_window + +// +#property indicator_buffers 6 +#property indicator_plots 4 + +// +// ZigZag ... + +// +#define mainBufferIndex 0 +#define mainBufferPlotIndex 0 +double mainBuffer[]; + +#define mainColorBufferIndex 1 +double mainColorBuffer[]; + +// +#property indicator_label1 "XZG Main" +#property indicator_type1 DRAW_COLOR_SECTION +#property indicator_color1 CLR_NONE, clrRoyalBlue, clrSaddleBrown +#property indicator_width1 2 + +// +// Highs ... + +// +// ZigZag Pointer or Line Indicator ... +#define arrowBufferIndex 2 +#define arrowBufferPlotIndex 1 +double arrowBuffer[]; + +// +#define arrowColorBufferIndex 3 +double arrowColorBuffer[]; + +// +#property indicator_label2 "XZG PV" +#property indicator_type2 DRAW_COLOR_ARROW +#property indicator_color2 CLR_NONE, clrAqua, clrMagenta +#property indicator_width2 1 + +// +#define highsBufferIndex 4 +double highsBuffer[]; + +// +// Lows ... + +// +#define lowsBufferIndex 5 +double lowsBuffer[]; + +// +// VARIABLES ... + +// +int mRecalc = 3; // Number of last extremes for recalculation + +// +// EVENT Handlers ... + +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + // logTag = ShortName; + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed +} + +// +// Calculating what we want ... +int OnCalculate( + const int rates_total, // Total Bars on Chart ... + const int prev_calculated, // Total Calculated Bars on Charts ... + const datetime &time[], // History of Open Time ... + const double &open[], // History of Open Price ... + const double &high[], // History of High Price ... + const double &low[], // History of Low Price ... + const double &close[], // History of Close Price ... + const long &tick_volume[], // History of Tick Volumes on Bar ... + const long &volume[], // History of Trade Volumes ... + const int &spread[] // History of Spread Price ... +) +{ + // + double mZGHigh[]; + double mZGLow[]; + if (mode == X_ZG_PRICE_OPEN_CLOSE_MODE) + { + // + ArrayCopy( + mZGHigh, + open + // + ); + + // + ArrayCopy( + mZGLow, + close + // + ); + } + else + { + // + ArrayCopy( + mZGHigh, + high + // + ); + + // + ArrayCopy( + mZGLow, + low + // + ); + } + + // + int zigZagResult = CalcukateZigZag( + prev_calculated, + rates_total, + mZGHigh, + mZGLow + // + ); + + // + if (zigZagResult != rates_total) + { + return zigZagResult; + } + + // + return rates_total; +} + +// +// CUSTOM Functions ... + +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + result = + // + depth > 0 && + deviation > 0 && + backStep > 0 + // + ; + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + // Main ... + + // + SetIndexBuffer(mainBufferIndex, mainBuffer, INDICATOR_DATA); + SetIndexBuffer(mainColorBufferIndex, mainColorBuffer, INDICATOR_COLOR_INDEX); + + // + PlotIndexSetInteger(mainBufferPlotIndex, PLOT_SHOW_DATA, showZigZag); + PlotIndexSetInteger(mainBufferPlotIndex, PLOT_DRAW_BEGIN, 0); + PlotIndexSetDouble(mainBufferPlotIndex, PLOT_EMPTY_VALUE, 0); + + // + // Arrow ... + + // + SetIndexBuffer(arrowBufferIndex, arrowBuffer, INDICATOR_DATA); + + // + PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_SHOW_DATA, showPeaksAndVales); + PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_DRAW_BEGIN, 0); + PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_ARROW, 159); + PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_ARROW_SHIFT, 0); + PlotIndexSetDouble(arrowBufferPlotIndex, PLOT_EMPTY_VALUE, 0); + + // + // Arrow Color ... + SetIndexBuffer(arrowColorBufferIndex, arrowColorBuffer, INDICATOR_COLOR_INDEX); + + // + // Highs ... + SetIndexBuffer(highsBufferIndex, highsBuffer, INDICATOR_CALCULATIONS); + + // + // Lows ... + SetIndexBuffer(lowsBufferIndex, lowsBuffer, INDICATOR_CALCULATIONS); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + IndicatorSetString(INDICATOR_SHORTNAME, ShortName); +} + +// +// Calculating Zig Zag ... +int CalcukateZigZag( + const int prev_calculated, + const int rates_total, + double &high[], + double &low[] + // +) +{ + // + if (rates_total < 100) + { + return 0; + } + + // + // Define Variables ... + int i = 0; + + // + int start = 0; + int extreme_counter = 0; + int extreme_search = X_ZG_SEARCH_EXTREMUM; + int shift = 0; + int back = 0; + int last_high_pos = 0; + int last_low_pos = 0; + + // + double val = 0; + double res = 0; + double curlow = 0; + double curhigh = 0; + double last_high = 0; + double last_low = 0; + + // + double colorIDX = 0; + double lastZigZagValue = 0; + + // + // Initializing ... + if (prev_calculated == 0) + { + // + ArrayInitialize(mainBuffer, 0); + ArrayInitialize(highsBuffer, 0); + ArrayInitialize(lowsBuffer, 0); + + // + start = depth; + } + + // + // Already Calculated Before ... + if (prev_calculated > 0) + { + // + i = rates_total - 1; + + // + // Searching for the third X_ZG_SEARCH_EXTREMUM from the last UnComplete Bar ... + while (extreme_counter < mRecalc && i > rates_total - 100) + { + // + res = mainBuffer[i]; + if (res != 0) + { + extreme_counter++; + } + + // + i--; + } + + // + i++; + start = i; + + // + // What type of X_ZG_SEARCH_EXTREMUM we Search for ... + if (lowsBuffer[i] != 0) + { + // + curlow = lowsBuffer[i]; + extreme_search = X_ZG_SEARCH_PEAK; + } + else + { + // + curhigh = highsBuffer[i]; + extreme_search = X_ZG_SEARCH_VALE; + } + + // + // Clear Values ... + for (i = start + 1; i < rates_total && !IsStopped(); i++) + { + // + mainBuffer[i] = 0; + lowsBuffer[i] = 0; + highsBuffer[i] = 0; + } + } + + // + // Search for High and Low Extremes ... + for (shift = start; shift < rates_total && !IsStopped(); shift++) + { + // + // Low ... + val = low[Lowest(low, depth, shift)]; + if (val == last_low) + { + val = 0; + } + else + { + // + last_low = val; + + // + if ((low[shift] - val) > deviation * _Point) + { + val = 0; + } + else + { + // + for (back = 1; back <= backStep; back++) + { + // + res = lowsBuffer[shift - back]; + if ((res != 0) && (res > val)) + { + lowsBuffer[shift - back] = 0; + } + } + } + } + + // + if (low[shift] == val) + { + lowsBuffer[shift] = val; + } + else + { + lowsBuffer[shift] = 0; + } + + // + // High ... + val = high[Highest(high, depth, shift)]; + if (val == last_high) + { + val = 0; + } + else + { + // + last_high = val; + + // + if ((val - high[shift]) > deviation * _Point) + { + val = 0; + } + else + { + // + for (back = 1; back <= backStep; back++) + { + // + res = highsBuffer[shift - back]; + if ((res != 0) && (res < val)) + { + highsBuffer[shift - back] = 0; + } + } + } + } + + // + if (high[shift] == val) + { + highsBuffer[shift] = val; + } + else + { + highsBuffer[shift] = 0; + } + } + + // + // Set Last Value ... + if (extreme_search == 0) // Undefined Values ... + { + // + last_low = 0; + last_high = 0; + } + else + { + // + last_low = curlow; + last_high = curhigh; + } + + // + // Final Selection of Extreme Points for ZigZag ... + for (shift = start; shift < rates_total && !IsStopped(); shift++) + { + // + res = 0; + + // + switch (extreme_search) + { + // + case X_ZG_SEARCH_EXTREMUM: + // + if (last_low == 0 && last_high == 0) + { + // + if (highsBuffer[shift] != 0) + { + // + last_high_pos = shift; + last_high = high[shift]; + + // + extreme_search = X_ZG_SEARCH_VALE; + + // + mainBuffer[shift] = last_high; + + // + res = 1; + } + + // + if (lowsBuffer[shift] != 0) + { + // + last_low_pos = shift; + last_low = low[shift]; + + // + extreme_search = X_ZG_SEARCH_PEAK; + + // + mainBuffer[shift] = last_low; + + // + res = 1; + } + } + break; + + // + case X_ZG_SEARCH_PEAK: + // + if (lowsBuffer[shift] != 0 && lowsBuffer[shift] < last_low && highsBuffer[shift] == 0) + { + // + mainBuffer[last_low_pos] = 0; + + // + last_low_pos = shift; + last_low = lowsBuffer[shift]; + + // + mainBuffer[shift] = last_low; + + // + res = 1; + } + + // + if (highsBuffer[shift] != 0 && lowsBuffer[shift] == 0) + { + // + last_high_pos = shift; + last_high = highsBuffer[shift]; + + // + mainBuffer[shift] = last_high; + + // + extreme_search = X_ZG_SEARCH_VALE; + + // + res = 1; + } + break; + + // + case X_ZG_SEARCH_VALE: + // + if (highsBuffer[shift] != 0 && highsBuffer[shift] > last_high && lowsBuffer[shift] == 0) + { + // + mainBuffer[last_high_pos] = 0; + + // + last_high_pos = shift; + last_high = highsBuffer[shift]; + + // + mainBuffer[shift] = last_high; + } + + // + if (lowsBuffer[shift] != 0 && highsBuffer[shift] == 0) + { + // + last_low_pos = shift; + last_low = lowsBuffer[shift]; + + // + mainBuffer[shift] = last_low; + + // + extreme_search = X_ZG_SEARCH_PEAK; + } + break; + } + + // + double iZigZagForColor = lastZigZagValue; + double iZigZag = mainBuffer[shift]; + if (iZigZag == 0 && lastZigZagValue != 0) + { + arrowBuffer[shift] = lastZigZagValue; + } + else if (iZigZag != 0) + { + // + lastZigZagValue = iZigZag; + arrowBuffer[shift] = lastZigZagValue; + } + + // + colorIDX = + lastZigZagValue > iZigZagForColor + ? 1 + : lastZigZagValue < iZigZagForColor + ? 2 + : colorIDX; + + // + mainColorBuffer[shift] = showZigZag ? colorIDX : 0; + arrowColorBuffer[shift] = showPeaksAndVales ? colorIDX : 0; + } + + // + return rates_total; +} + +// +// TOOLS ... + +// +// Search for the index of the highest bar ... +int Highest( + const double &mArray[], + const int mDepth, + const int mStart // +) +{ + // + int result = 0; + + // + if (mStart < 0) + { + return result; + } + + // + double max = mArray[mStart]; + result = mStart; + + // + // Start searching ... + for (int i = mStart - 1; i > mStart - mDepth && i >= 0; i--) + { + // + if (mArray[i] > max) + { + // + result = i; + max = mArray[i]; + } + } + + // + // Return index of the highest bar + return result; +} + +// +// Search for the index of the lowest bar ... +int Lowest( + const double &mArray[], + const int mDepth, + const int mStart // +) +{ + // + int result = 0; + + // + if (mStart < 0) + { + return result; + } + + // + double min = mArray[mStart]; + result = mStart; + + // + // Start searching ... + for (int i = mStart - 1; i > mStart - mDepth && i >= 0; i--) + { + // + if (mArray[i] < min) + { + // + result = i; + min = mArray[i]; + } + } + + // + // Return index of the lowest bar + return result; +} diff --git a/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.common.lib.mq5 b/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.common.lib.mq5 new file mode 100644 index 0000000..2c2ad19 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.common.lib.mq5 @@ -0,0 +1,6882 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Common Library +// -------------------------------------- +// Name: XCommonLib +// Description: provide all commonly used functions ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.xmd5.class.mq5" + +// +// Models ... + +// +// Specified Price Type ... +enum ENUM_X_PRICE +{ + X_PRICE_HIGH, + X_PRICE_OPEN, + X_PRICE_CLOSE, + X_PRICE_LOW +}; + +// +// Swing Types Enum ... +enum ENUM_X_SWING_TYPE +{ + X_NO_SWING = 0, + X_SWING_HIGH = 1, + X_SWING_LOW = -1, +}; + +// +// XPERIOD Calculation Method ... +enum ENUM_X_PERIOD_METHOD +{ + // + X_PERIOD_NOTHING, // Nothing + X_PERIOD_AUTO, // Auto Select + X_PERIOD_MANUALLY // Manually +}; + +// +// Available Market Cycles ... +enum ENUM_X_MARKET_CYCLES +{ + // + X_MARKET_CYCLE_UNKNOWN, // Unknown Cycle + X_MARKET_CYCLE_SHORT, // Short Cycle + X_MARKET_CYCLE_MEDIUM, // Medium Cycle + X_MARKET_CYCLE_LONG, // Long Cycle + X_MARKET_CYCLE_HIND, // Hind Cycle +}; + +// +// Structs ... + +// +// Model a Bar Remains Time ... +struct XBarRemainsTime +{ + // + int days; + int hours; + int minutes; + int seconds; + + // + // Constructor ... + XBarRemainsTime() + { + Clean(); + } + + // + // Always Calculate Current 0 Bar Timing ... + bool Init( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL // Trading Period + ) + { + // + bool result = false; + + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + int minuteSecoonds = 60; + int hourSeconds = minuteSecoonds * 60; + int daySeconds = 24 * hourSeconds; + + // + int periodSeconds = PeriodSeconds( + mPeriod); + datetime startTime = GetBarTime( + mSymbol, + mPeriod, + 0 + // + ); + + // + int secondsDiff = (int)startTime + periodSeconds - (int)TimeCurrent(); + + // + int mWorkingSecondsDiff = secondsDiff; + if (mWorkingSecondsDiff > daySeconds) + { + // + days = mWorkingSecondsDiff / daySeconds; + mWorkingSecondsDiff -= days * daySeconds; + } + if (mWorkingSecondsDiff > hourSeconds) + { + // + hours = mWorkingSecondsDiff / hourSeconds; + mWorkingSecondsDiff -= hours * hourSeconds; + } + if (mWorkingSecondsDiff > minuteSecoonds) + { + // + minutes = mWorkingSecondsDiff / minuteSecoonds; + mWorkingSecondsDiff -= minutes * minuteSecoonds; + } + seconds = mWorkingSecondsDiff; + + // + result = true; + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + days = 0; + hours = 0; + minutes = 0; + seconds = 0; + } + + // + // To String Representation ... + string ToString( + string dayId = "d", + string hourId = "h", + string minuteId = "m", + string secondId = "s", + string idSeparator = ": ", + string separator = ", ", + bool ignoreZeroValues = true + // + ) + { + // + string result = ""; + + // + // Days ... + if (!ignoreZeroValues || days > 0) + { + result += dayId + idSeparator + (string)days + separator; + } + + // + // Hours ... + if (!ignoreZeroValues || hours > 0) + { + // + string strHour = ToString(hours); + if (StringLen(strHour) == 1) + { + strHour = "0" + strHour; + } + + // + result += hourId + idSeparator + strHour + separator; + } + + // + // Minutes ... + if (!ignoreZeroValues || minutes > 0) + { + // + string strMinute = ToString(minutes); + if (StringLen(strMinute) == 1) + { + strMinute = "0" + strMinute; + } + + // + result += minuteId + idSeparator + strMinute + separator; + } + + // + // Seconds ... + if (!ignoreZeroValues || seconds > 0) + { + // + string strSec = ToString(seconds); + if (StringLen(strSec) == 1) + { + strSec = "0" + strSec; + } + + // + result += secondId + idSeparator + strSec; + } + + // + return result; + } +}; + +// +// Describe an Specific Candle ... +struct XOHCL +{ + // + // Props ... + + // + double high; + double open; + double close; + double low; + + // + string symbol; + datetime time; + ENUM_TIMEFRAMES period; + + // + // Constructor ... + XOHCL() + { + Clean(); + } + + // + // Init a Bar ... + // Using Bar Index ... + bool Init( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Period + int barIndex = 0 // Bar Index + ) + { + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + symbol = mSymbol; + period = mPeriod; + + // + time = iTime( + mSymbol, + mPeriod, + barIndex + // + ); + + // + open = iOpen( + mSymbol, + mPeriod, + barIndex + // + ); + + // + close = iClose( + mSymbol, + mPeriod, + barIndex + // + ); + + // + high = iHigh( + mSymbol, + mPeriod, + barIndex); + + // + low = iLow( + mSymbol, + mPeriod, + barIndex + // + ); + + // + bool result = IsValid(); + + // + return result; + } + + // + // Init a Bar ... + // Using Bar Time ... + bool Init( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Period + datetime mTime = NULL // Bar Time + ) + { + // + mTime = NormalizeTime(mTime); + + // + int barIndex = iBarShift( + mSymbol, + mPeriod, + mTime, + false // + ); + + // + bool result = Init( + mSymbol, + mPeriod, + barIndex + // + ); + + // + return result; + } + + // + bool Init( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Period + double mOpen = 0, // Open + double mHigh = 0, // High + double mClose = 0, // Close + double mLow = 0, // Low + int barIndex = 0 // Bar Index + ) + { + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + symbol = mSymbol; + period = mPeriod; + + // + time = iTime( + mSymbol, + mPeriod, + barIndex + // + ); + + // + open = mOpen; + high = mHigh; + close = mClose; + low = mLow; + + // + return IsValid(); + } + + // + bool Init( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Period + double mOpen = 0, // Open + double mHigh = 0, // High + double mClose = 0, // Close + double mLow = 0, // Low + datetime mTime = NULL // Bar Time + ) + { + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + symbol = mSymbol; + period = mPeriod; + + // + int barIndex = iBarShift( + symbol, + period, + mTime); + + // + time = iTime( + mSymbol, + mPeriod, + barIndex + // + ); + + // + open = mOpen; + high = mHigh; + close = mClose; + low = mLow; + + // + return IsValid(); + } + + // + // Tools ... + + // + void Clean() + { + // + high = 0; + open = 0; + close = 0; + low = 0; + + // + time = NULL; + symbol = NULL; + period = NULL; + } + + // + // Validate Bar ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + high > 0 && + open > 0 && + close > 0 && + low > 0 + // + ; + + // + return result; + } + + // + // Calculate X_PRICE Specified Type ... + double GetPrice(ENUM_X_PRICE mPType) + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + switch (mPType) + { + // + case X_PRICE_OPEN: + result = open; + break; + // + case X_PRICE_HIGH: + result = high; + break; + // + case X_PRICE_CLOSE: + result = close; + break; + // + case X_PRICE_LOW: + result = low; + break; + } + + // + return result; + } + + // + // Retrieve Price base On Series Mode ... + double GetPrice(ENUM_SERIESMODE mMode) + { + // + ENUM_X_PRICE mXMode = ToPrice(mMode); + + // + return GetPrice(mXMode); + } + + // + // Calculate Applied Price ... + double GetPrice( + ENUM_APPLIED_PRICE mAppliedTo // Select Application Method + ) + { + // + double result = 0; + + // + // Calculate Applied Price ... + switch (mAppliedTo) + { + // + case PRICE_CLOSE: + result = close; + break; + + // + case PRICE_OPEN: + result = open; + break; + + // + case PRICE_HIGH: + result = high; + break; + + // + case PRICE_LOW: + result = low; + break; + + // + case PRICE_MEDIAN: + result = (high + low) / 2; + break; + + // + case PRICE_TYPICAL: + result = (high + low + close) / 3; + break; + + // + case PRICE_WEIGHTED: + result = (high + low + close + close) / 4; + break; + } + + // + return result; + } + + // + // Calculate Bar Mid Line ... + double GetMid() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = (high + low) / 2; + + // + return result; + } + + // + // Calculate up Price ... + double GetUp() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = MathMax(open, close); + + // + return result; + } + + // + // Calculate Down Price ... + double GetDown() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = MathMin(open, close); + + // + return result; + } + + // + // Calculate Bar Body ... + double GetBody() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = GetUp() - GetDown(); + + // + return result; + } + + // + // Calculate Bar Range ... + double GetRange() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = high - low; + + // + return result; + } + + // + // Calculate Bar Shadows ... + double GetShadows() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = GetRange() - GetBody(); + + // + return result; + } + + // + // Calculate Bar High Shadow ... + double GetHighShadow() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = + // + high - GetUp() + // + ; + + // + return result; + } + + // + // Calculate Bar Low Shadow ... + double GetLowShadow() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = + // + GetDown() - low; + // + ; + + // + return result; + } + + // + // Check Bar is Bullish ... + bool IsBullish() + { + // + bool result = false; + + // + if (!IsValid()) + { + return result; + } + + // + result = open < close; + + // + return result; + } + + // + // Check Bar is Bearish ... + bool IsBearish() + { + // + bool result = false; + + // + if (!IsValid()) + { + return result; + } + + // + result = open > close; + + // + return result; + } + + // + // Find Next Bar Time ... + datetime NextAt() + { + // + datetime result = NULL; + + // + if (!IsValid()) + { + return result; + } + + // + int prSeconds = PeriodSeconds(period); + + // + result = time + prSeconds; + + // + return result; + } + + // + // Find Prev Bar Time ... + datetime BeforeOn() + { + // + datetime result = NULL; + + // + if (!IsValid()) + { + return result; + } + + // + int prSeconds = PeriodSeconds(period); + + // + result = time - prSeconds; + + // + return result; + } + + // + // Find Current Bar Index on Chart ... + int Index() + { + // + int result = -1; + + // + if (!IsValid()) + { + return result; + } + + // + result = iBarShift( + symbol, + period, + time + // + ); + + // + return result; + } + + // + // Check Bar has Strong Body or Not ... + bool HasStrongBody() + { + // + bool result = false; + + // + if (!IsValid()) + { + return result; + } + + // + double body = GetBody(); + double shadow = GetShadows(); + + // + result = body > shadow * 1.5; + + // + return result; + } + + // + // Determines Swings based On this Bar ... + // Calculates Based on atleast 3 Bars Prev ... + ENUM_X_SWING_TYPE GetSwingType() + { + // + ENUM_X_SWING_TYPE result = X_NO_SWING; + + // + // Find Current Index of Bar ... + int barIndex = Index(); + if (barIndex <= -1) + { + return result; + } + + // + // First we have to Retrieve atleast 3 Bars before this bar ... + XOHCL bars[]; + int barsCount = GetBars( + bars, + symbol, + period, + barIndex + 1, + 3 + // + ); + if (barsCount < 3) + { + return result; + } + + // + // Check Swing Start Candle has Strong Body ... + bool isStrongBodyCandle = bars[2].HasStrongBody(); + if (!isStrongBodyCandle) + { + return result; + } + + // + // Check Swing Low Conditions ... + bool isSwingLowOrderBlock = + bars[2].low < bars[1].low && + bars[1].low < bars[0].low && + bars[2].low < bars[0].low; + if (isSwingLowOrderBlock) + { + result = X_SWING_LOW; + } + + // + // Check Swing High Conditions ... + bool isSwingHighOrderBlock = + bars[2].high > bars[1].high && + bars[1].high > bars[0].high && + bars[2].high > bars[0].high; + if (isSwingHighOrderBlock) + { + result = X_SWING_HIGH; + } + + // + return result; + } + + // + // Find Swings (Highs nd Lows) ... + int FindSwing( + ENUM_X_SWING_TYPE swing, // Swing Based On Price mode ... + int mLength // Loopback ... + ) + { + // + int result = -1; + + // + if (!IsValid() || + !IsValid(swing)) + { + return result; + } + + // + int current = Index(); + int founded = FindNextSwing( + swing, + (mLength * 2) + 1, + current - mLength + // + ); + + // + while (founded != current) + { + // + current = FindNextSwing( + swing, + mLength, + current + 1 + // + ); + + // + founded = FindNextSwing( + swing, + (mLength * 2) + 1, + current - mLength + // + ); + } + + // + result = current; + + // + return result; + } + + // + // Find Next Swing ... + int FindNextSwing( + ENUM_X_SWING_TYPE swing, // Swing Based On Price mode ... + int from, // from Bar Index + int mLength // Loopback ... + ) + { + // + int result = -1; + + // + if (!IsValid() || + !IsValid(swing)) + { + return result; + } + + // + if (from < 0) + { + mLength += from; + from = 0; + } + + // + ENUM_SERIESMODE mMode = swing == X_SWING_HIGH + ? MODE_HIGH + : MODE_LOW; + + // + result = swing == X_SWING_HIGH + ? iHighest( + symbol, + period, + mMode, + mLength, + from) + : iLowest( + symbol, + period, + mMode, + mLength, + from); + + // + return result; + } + + // + // Find Lowest Bar Index ... + int FindHighestIndex( + int mLength, // Loopback ... + ENUM_SERIESMODE mMode // Calculation mode + ) + { + // + int result = -1; + + // + if (!IsValid()) + { + return result; + } + + // + if (mLength < 2) + { + mLength = 2; + } + + // + result = iHighest( + symbol, + period, + mMode, + mLength, + Index()); + + // + return result; + } + + // + // Find Lowest ... + double FindHighest( + int mLength, // Loopback ... + ENUM_SERIESMODE mMode // Calculation mode + ) + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + int idx = FindHighestIndex( + mLength, + mMode); + if (idx <= -1) + { + return result; + } + + // + XOHCL iH; + result = iH.Init( + symbol, + period, + idx + // + ); + if (!result) + { + return result; + } + + // + result = iH.GetPrice(mMode); + + // + return result; + } + + // + // Find Lowest Bar Index ... + int FindLowestIndex( + int mLength, // Loopback ... + ENUM_SERIESMODE mMode // Calculation mode + ) + { + // + int result = -1; + + // + if (!IsValid()) + { + return result; + } + + // + if (mLength < 2) + { + mLength = 2; + } + + // + result = iLowest( + symbol, + period, + mMode, + mLength, + Index()); + + // + return result; + } + + // + // Find Lowest ... + double FindLowest( + int mLength, // Loopback ... + ENUM_SERIESMODE mMode // Calculation mode + ) + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + int idx = FindLowestIndex( + mLength, + mMode); + if (idx <= -1) + { + return result; + } + + // + XOHCL iL; + result = iL.Init( + symbol, + period, + idx + // + ); + if (!result) + { + return result; + } + + // + result = iL.GetPrice(mMode); + + // + return result; + } + + // + // Convert to String Representation ... + string ToString() + { + // + string result = ""; + + // + result = GetTypeName(this) + + "(O(" + ToString(open) + "),H(" + ToString(high) + "),C(" + ToString(close) + "),L(" + ToString(low) + "))"; + + // + return result; + } +}; + +// +// Model Support and Resistance +// for Specific Bar ... +struct XOHCLSupRes +{ + // + // Props ... + + // + /// Resistances ... + double res[]; + + // + // Supports ... + double sup[]; + + // + // Constructor ... + XOHCLSupRes() + { + Clean(); + } + + // + // Init ... + bool Init( + double price, // Price ... + const double &pivots[], // Provided Pivot Points ... + int count = 3, // Number of Requireds ... + double step = 0 // Distance between each item with it's Last Side ... + ) + { + // + bool result = false; + + // + Clean(); + + // + if (price <= 0) + { + return result; + } + + // + int pivotsCount = ArraySize(pivots); + if (pivotsCount <= 0) + { + return result; + } + + // + if (count <= 0 || + count > pivotsCount - 1) + { + return result; + } + + // + double lastR = 0; + double tmpR[]; + + // + double lastS = 0; + double tmpS[]; + + // + // Extract Supports ... + // which prices is under low of candle ... + // + // Extract Resistance ... + // which prices is over high of candle ... + for (int i = 0; i < pivotsCount; i++) + { + // + double iFlat = pivots[i]; + + // + if (iFlat > price) + { + // + bool canAdd = + step <= 0 + ? true + : lastR == 0 || MathAbs(iFlat - lastR) >= step; + if (canAdd) + { + // + Add( + iFlat, + tmpR); + + // + lastR = iFlat; + } + } + else if (iFlat < price) + { + // + bool canAdd = + step <= 0 + ? true + : lastS == 0 || MathAbs(iFlat - lastS) >= step; + if (canAdd) + { + // + Add( + iFlat, + tmpS); + + // + lastS = iFlat; + } + } + } + + // + // Sorting Founded Resistance and Supports ... + + // + // Since Resistance Levels must be Increasing ... + ArraySort(tmpR); + + // + // Since Support Levels must be Decreasing ... + ArraySort(tmpS); + ArrayReverse(tmpS); + + // + // Fill Resistance ... + int tmpRCount = ArraySize(tmpR); + if (tmpRCount > 0) + { + // + if (tmpRCount < count) + { + // + ArrayCopy( + res, + tmpR); + } + else + { + // + ArrayCopy( + res, + tmpR, + 0, + 0, + count); + } + } + + // + // Fill Supports ... + int tmpSCount = ArraySize(tmpS); + if (tmpSCount > 0) + { + // + if (tmpSCount < count) + { + // + ArrayCopy( + sup, + tmpS); + } + else + { + // + ArrayCopy( + sup, + tmpS, + 0, + 0, + count); + } + } + + // + result = IsValid(); + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + Clean(sup); + Clean(res); + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + CountSupports() > 0 || + CountResistances() > 0 + // + ; + + // + return result; + } + + // + int CountSupports() + { + return ArraySize(sup); + } + + // + int CountResistances() + { + return ArraySize(res); + } +}; + +// +// Tracking Times ... +struct XTimeTracker +{ + // + // Props ... + int xMonth; + int xDayOfWeek; + int xForWeekDay; + int xDay; + int xHour; + + // + // Constructor ... + XTimeTracker() + { + Clean(); + } + + // + // Tools ... + + // + void Clean() + { + // + xDay = -1; + xHour = -1; + xMonth = -1; + xDayOfWeek = -1; + xForWeekDay = -1; + } + + // + // Detecting New Houre ... + bool IsNewHour() + { + // + bool result = false; + + // + // Retrieve Current Time as Struct ... + MqlDateTime timeStruct = GetCurrentTime(); + + // + // Check Houre ... + result = timeStruct.hour != xHour; + if (result) + { + xHour = timeStruct.hour; + } + + // + return result; + } + + // + // Detecting New Day ... + bool IsNewDay() + { + // + bool result = false; + + // + // Retrieve Current Time as Struct ... + MqlDateTime timeStruct = GetCurrentTime(); + + // + // Check Houre ... + result = timeStruct.day_of_year != xDay; + if (result) + { + xDay = timeStruct.day_of_year; + } + + // + return result; + } + + // + // Detecting New Week ... + bool IsNewWeek() + { + // + bool result = false; + + // + // Retrieve Current Time as Struct ... + MqlDateTime timeStruct = GetCurrentTime(); + + // + // Check Week ... + // Since Week Starts From Monday in Forex World ... + // we Calculate Start of Week by 1-Monday ... + result = + xDayOfWeek == -1 && + xForWeekDay == -1 + ? true + : timeStruct.day_of_week == 1 && + timeStruct.day_of_year > xForWeekDay; + + // + xForWeekDay = timeStruct.day_of_year; + xDayOfWeek = timeStruct.day_of_week; + + // + return result; + } + + // + // Detecting End Of Week ... + bool IsWeekEnd() + { + // + bool result = false; + + // + // Retrieve Current Time as Struct ... + MqlDateTime timeStruct = GetCurrentTime(); + + // + // Check WeekEnd ... + // Since Week Starts From Monday in Forex World ... + // we Calculate End of Week by 5-Friday ... + result = + xDayOfWeek != -1 && + timeStruct.day_of_week == 5 && + timeStruct.hour == 23 && + timeStruct.min == 59 && + timeStruct.sec == 59; + + // + return result; + } + + // + // Detecting New Month ... + bool IsNewMonth() + { + // + bool result = false; + + // + // Retrieve Current Time as Struct ... + MqlDateTime timeStruct = GetCurrentTime(); + + // + // Check Houre ... + result = timeStruct.mon != xMonth; + if (result) + { + xMonth = timeStruct.mon; + } + + // + return result; + } +}; + +// +// Tracking Bars on Specified Environment ... +struct XBarTracker +{ + // + string symbol; // Tracking Symbol + ENUM_TIMEFRAMES period; // Tracking Time Frame + + // + int lastTrackedBar; // Last Tracked Bar ... + + // + // Constructor ... + XBarTracker() + { + Clean(); + } + + // + // Initializer ... + bool Init( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL // Trading Period + ) + { + // + bool result = false; + + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + this.symbol = mSymbol; + this.period = mPeriod; + + // + this.lastTrackedBar = 0; + + // + result = true; + + // + return result; + } + + // + // Retrieve all Bars ... + int CountBars() + { + // + return Bars( + symbol, + period + // + ); + } + + // + // Check if it's New Bar ... + bool IsNewBar() + { + // + bool result = false; + + // + int currentBars = CountBars(); + + // + result = currentBars > lastTrackedBar; + if (result) + { + lastTrackedBar = currentBars; + } + + // + return result; + } + + // + // Tools ... + void Clean() + { + // + symbol = NormalizeSymbol(NULL); + period = NormalizePeriod(NULL); + } +}; + +// +// Track Value Changes ... +template +struct XValueTracker +{ + // + // Definitions ... + + // + // Model a Value Change ... + struct XValueChange + { + // + // Props ... + datetime at; // Change Time + T from; // Before Change Value + T to; // After Change Value + + // + // Constructor ... + XValueChange() + { + Clean(); + } + + // + // Cleanup ... + void Clean() + { + // + at = NULL; + from = NULL; + to = NULL; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = IsValid(at); + if (!result) + { + return result; + } + + // + result = NotEmpty(from) && + NotEmpty(to); + + // + return result; + } + }; + + // + // Props ... + XValueChange changes[]; // Hold Changes + + // + // Constructor ... + XValueTracker() + { + Clean(); + } + + // + // Track a Change Happens Or Not ... + bool Track( + const T &source[] // Data Source for Track Changes + ) + { + // + bool result = false; + + // + if (ArraySize(source) <= 1) + { + return result; + } + + // + datetime time = TimeCurrent(); + + // + double from = source[1]; + double to = source[0]; + + // + result = to != from; + if (result) + { + return result; + } + + // + XValueChange lastChange; + bool hasLastChange = + GetLastItem( + lastChange, + changes + // + ); + result = + !hasLastChange + ? true + : lastChange.at < time && + lastChange.to != to && + lastChange.from != from; + if (!result) + { + return result; + } + + // + lastChange.Clean(); + + // + lastChange.to = to; + lastChange.at = time; + lastChange.from = from; + + // + AddRef( + lastChange, + changes + // + ); + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + Clean(changes); + } +}; + +// +// Model a Market Cycle ... +struct XMarketCycle +{ + // + // Props ... + + // + string prefix; // Prefix Trag ... + + // + string symbol; // Market Symbol ... + + // + ENUM_TIMEFRAMES period; // Period of Cycle ... + ENUM_X_PERIOD_METHOD method; // Period Selection Method ... + ENUM_X_MARKET_CYCLES cycle; // Cycles of MArket ... + + // + int length; // Number Of Candles per Current Time Frame ... + ENUM_TIMEFRAMES hostPeriod; // Current Time Frame ... + + // + datetime lastStart; // Last Candle Bar Time ... + + // + XBarTracker barTracker; // Bar Tracker ... + XBarRemainsTime remains; // Current Bar Remains Model ... + + // + // Constructor ... + XMarketCycle() + { + Clean(); + } + + // + // Init Cycle ... + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mHostPeriod, // Host Period + ENUM_X_MARKET_CYCLES mCycle, // Init Cycle + string mPrefix = "" // Prefix + ) + { + // + bool result = false; + + // + mSymbol = NormalizeSymbol(mSymbol); + mHostPeriod = NormalizePeriod(mHostPeriod); + + // + result = IsValid(mCycle); + if (!result) + { + return result; + } + + // + this.cycle = mCycle; + + // + // Set Automatically Prefix ... + if (StringLen(mPrefix) == 0) + { + this.prefix = ToString(cycle); + } + + // + result = IsValid( + method, + period // + ); + if (!result) + { + return result; + } + + // + this.symbol = mSymbol; + this.hostPeriod = mHostPeriod; + + // + // Find Cycle Period ... + if (method == X_PERIOD_AUTO) + { + // + // Select Period ... + this.period = GetCyclePeriod( + this.cycle, + this.hostPeriod); + } + + // + // Set Prefix if Provided ... + if (StringLen(mPrefix) > 0) + { + this.prefix = mPrefix; + } + + // + // Calculate Required Info ... + + // + // Length ... + this.length = PeriodSeconds(this.period) / PeriodSeconds(this.hostPeriod); + + // + // Update Additional Data ... + result = this.Update(0); + + // + return result; + } + + // + bool Init( + string mSymbol, // Trading Symbol + ENUM_TIMEFRAMES mHostPeriod, // Host Period + ENUM_X_MARKET_CYCLES mCycle, // Init Cycle + ENUM_X_PERIOD_METHOD mMethod, // Period Selection Method + ENUM_TIMEFRAMES mPeriod, // Provided Period + string mPrefix = "" // Prefix + ) + { + // + this.period = mPeriod; + this.method = mMethod; + + // + return Init( + mSymbol, + mHostPeriod, + mCycle, + mPrefix + // + ); + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + length = 0; + lastStart = 0; + + // + cycle = NULL; + prefix = NULL; + symbol = NULL; + period = NULL; + method = NULL; + hostPeriod = NULL; + + // + remains.Clean(); + barTracker.Clean(); + } + + // + // Check Structure Valid ... + bool IsValid() + { + // + bool result = false; + + // + result = IsValid( + method, + period); + if (!result) + { + return result; + } + + // + result = + // + length > 0 && + symbol != NULL && + period != NULL && + method != NULL && + hostPeriod != NULL && + method != X_PERIOD_NOTHING + // + ; + + // + return result; + } + + // + // Update Market Cycle Additional Info ... + bool Update(int hostBarIndex) + { + // + bool result = false; + + // + result = this.IsValid(); + if (!result) + { + return result; + } + + // + // Init Remains ... + result = remains.Init( + this.symbol, + this.period); + if (!result) + { + return result; + } + + // + // Init Bar Tracker ... + result = barTracker.Init( + this.symbol, + this.period); + if (!result) + { + return result; + } + + // + return result; + } + + // + // Count Bars ... + int CountBars() + { + // + int result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = barTracker.CountBars(); + + // + return result; + } + + // + // Check New Bar ... + bool IsNewBar() + { + // + bool result = false; + + // + if (!IsValid()) + { + return result; + } + + // + result = barTracker.IsNewBar(); + + // + return result; + } + + // + // Retrieve Current Bar Index based on Host Period bar Index ... + int GetBarIndex(int barIndex) + { + // + int result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + if (barIndex < 0) + { + return result; + } + + // + int totalBars = CountBars(); + if (barIndex >= totalBars) + { + // + result = totalBars - 1; + return result; + } + + // + datetime hostBarTime = iTime( + this.symbol, + this.hostPeriod, + barIndex + // + ); + + // + result = iBarShift( + this.symbol, + this.period, + hostBarTime + // + ); + + // + return result; + } + + // + // Retrieve Current Cycles Specific Bar ... + XOHCL GetBar(int barIndex) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int totalBars = CountBars(); + if (barIndex >= totalBars) + { + barIndex = totalBars - 1; + } + + // + XOHCL result; + result.Init( + this.symbol, + this.period, + barIndex + // + ); + + // + return result; + } + + // + // Extract Specific Range of Bars ... + // using Start Bar Index ... + int GetBars( + XOHCL &result[], // Hold Result + int from = 0, // Start Bar Index + int count = 1, // Number of Bars + bool forceClean = true // Clean Result Array + ) + { + // + int mResult = 0; + + // + if (from < 0) + { + from = 0; + } + + // + int total = Bars( + symbol, + period); + if (from > total - 2) + { + from = total - 2; + } + + // + if (count < 0) + { + count = 1; + } + + // + int start = from; + int end = start + count; + if (end > total - 1) + { + end = total - 1; + } + + // + if (forceClean) + { + Clean(result); + } + + // + int beforeSize = ArraySize(result); + + // + for (int i = start; i < end; i++) + { + // + XOHCL iBar; + bool isValid = iBar.Init( + symbol, + period, + i + // + ); + + // + if (isValid) + { + // + AddRef( + iBar, + result + // + ); + } + } + + // + int afterSize = ArraySize(result); + + // + mResult = afterSize - beforeSize; + + // + return mResult; + } + + // + // Extract Specific Range of Bars ... + // using Start Bar Time ... + int GetBars( + XOHCL &result[], // Hold Result + datetime from = NULL, // Start Bar Time + int count = 1, // Number of Bars + bool forceClean = true // Clean Result Array + ) + { + // + from = NormalizeTime(from); + + // + int barIndex = iBarShift( + symbol, + period, + from, + false + // + ); + + // + return GetBars( + result, + symbol, + period, + barIndex, + count, + forceClean + // + ); + } + + // + // Retrieve Bar Time ... + datetime GetBarTime(int barIndex) + { + // + datetime result = NULL; + + // + if (!IsValid()) + { + return result; + } + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int totalBars = CountBars(); + if (barIndex >= totalBars) + { + barIndex = totalBars - 1; + } + + // + result = iTime( + this.symbol, + this.period, + barIndex + // + ); + + // + return result; + } + + // + // Find Chart ID ... + ulong GetChartID() + { + // + ulong result = 0; + + // + long firstChart = ChartFirst(); + result = firstChart; + + // + while (result >= 0) + { + // + string chSymbol = ChartSymbol(result); + ENUM_TIMEFRAMES chPeriod = ChartPeriod(result); + + // + bool isOwnChart = + // + symbol == chSymbol && + period == chPeriod + // + ; + if (isOwnChart) + { + break; + } + + // + result = ChartNext(result); + if (result < 0) + { + break; + } + } + + // + return result; + } + + // + // Create and String Representation for Unique Taging ... + string ToString() + { + // + string result = ""; + + // + if (!IsValid()) + { + return result; + } + + // + result = + GetTypeName(this) + "(" + + "PRFX(" + this.prefix + ")" + + "SMBL(" + this.symbol + ")" + + "CYC(" + ToString(this.cycle) + ")" + + "PRD(" + ToString(this.period) + ")" + + "PRDHST(" + ToString(this.hostPeriod) + ")" + + "MTH(" + EnumToString(this.method) + ")" + + ")"; + + // + return result; + } + + // + // Here we Produce a Summary brief of + // state of Cycle ... + string GenerateSummary() + { + // + string result = ""; + + // + bool hasPrefix = + StringLen(this.prefix) > 0 && + this.prefix != ToString(this.cycle); + result += (hasPrefix ? this.prefix + "[" : "") + + ToString(this.cycle) + + (hasPrefix ? "]" : "") + "\n"; + + // + result += " - PR: " + ToString(this.period) + "\n"; + + // + XOHCL cBar = GetBar(0); + + // + result += " - State: " + (cBar.IsBullish() ? "Bullish" : cBar.IsBearish() ? "Bearish" + : "Neutural"); + + // + return result; + } +}; + +// +// Functions ... + +// +// Validators ... + +// +// Validate an String has length and not NULL ... +bool IsValid(string value) +{ + // + bool result = false; + + // + result = + // + value != NULL && + StringLen(value) > 0 + // + ; + + // + return result; +} +bool IsSpecifiedValid(string value) +{ + return IsValid(value); +} + +// +// Validate a Date ... +bool IsValid(datetime value) +{ + // + bool result = false; + + // + result = NotEmpty(value) && value != NULL; + + // + return result; +} + +// +// Validate a Period Param ... +bool IsValid(ENUM_TIMEFRAMES value) +{ + // + bool result = false; + + // + result = + // + value != NULL + // + ; + + // + return result; +} +bool IsSpecifiedValid(ENUM_TIMEFRAMES value) +{ + // + return IsValid(value); +} + +// +// Validate Specified Cycle ... +bool IsValid(ENUM_X_MARKET_CYCLES value) +{ + // + bool result = false; + + // + result = + // + value != NULL && + value != X_MARKET_CYCLE_UNKNOWN + // + ; + + // + return result; +} + +// +// Validate Specific Period Mode ... +bool IsValid( + ENUM_X_PERIOD_METHOD mMethod, // Period Select Method + ENUM_TIMEFRAMES mPeriod // Selected Period +) +{ + // + bool result = false; + + // + result = + // + mMethod == X_PERIOD_NOTHING + ? false + : mMethod == X_PERIOD_MANUALLY + ? mPeriod != NULL + : mMethod == X_PERIOD_AUTO + ? true + : false + // + ; + + // + return result; +} + +// +bool IsSpecifiedValid( + ENUM_X_PERIOD_METHOD mMethod, // Period Select Method + ENUM_TIMEFRAMES mPeriod // Selected Period +) +{ + return IsValid(mMethod, + mPeriod // + ); +} + +// +// Validate Swing Mode ... +bool IsValid(ENUM_X_SWING_TYPE value) +{ + // + bool result = false; + + // + result = + // + value == X_SWING_HIGH || + value == X_SWING_LOW + // + ; + + // + return result; +} + +// +// As IS ... + +// +// Determine a Position type is Long or not ... +bool IsLong(ENUM_POSITION_TYPE type) +{ + // + bool result = type == POSITION_TYPE_BUY; + + // + return result; +} +bool IsLong(ENUM_ORDER_TYPE type) +{ + // + bool result = type == ORDER_TYPE_BUY; + + // + return result; +} + +// +// Determine a Position type is Short or not ... +bool IsShort(ENUM_POSITION_TYPE type) +{ + // + bool result = type == POSITION_TYPE_SELL; + + // + return result; +} +bool IsShort(ENUM_ORDER_TYPE type) +{ + // + bool result = type == ORDER_TYPE_SELL; + + // + return result; +} + +// +// Check Expert Running in Testing Mode or not ... +bool IsRunningOnTestMode() +{ + // + bool result = false; + + // + // check programm mode ... + result = MQL5InfoInteger(MQL5_TESTING); + + // + return result; +} + +// +// Find Chart ID ... +long FindChartID( + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL // Trading Period +) +{ + // + long result = ChartFirst(); + long first = result; + + // + while (result > 0) + { + // + string chSymbol = ChartSymbol(result); + ENUM_TIMEFRAMES chPeriod = ChartPeriod(result); + + // + bool isOwn = + // + chSymbol == mSymbol && + chPeriod == mPeriod + // + ; + if (isOwn) + { + break; + } + + // + result = ChartNext(result); + } + + // + return result; +} + +// +// Normalizers ... + +// +// Check a Symbol provided or not ... +// if not use Default ... +string NormalizeSymbol(string value) +{ + // + string result = value; + + // + if (!IsValid(result)) + { + result = _Symbol; + } + + // + return result; +} + +// +// Check a Datetime provided or not ... +// if not use Current ... +datetime NormalizeTime(datetime value) +{ + // + datetime result = value; + + // + if (!IsValid(result)) + { + result = TimeCurrent(); + } + + // + return result; +} + +// +// Check a Period provided or not ... +// if not use Default ... +ENUM_TIMEFRAMES NormalizePeriod(ENUM_TIMEFRAMES value) +{ + // + ENUM_TIMEFRAMES result = value; + + // + if (!IsValid(value)) + { + result = _Period; + } + + // + return result; +} + +// +// Normalize Cycle ... +ENUM_X_MARKET_CYCLES NormalizeCycle(ENUM_X_MARKET_CYCLES value) +{ + // + ENUM_X_MARKET_CYCLES result = value; + + // + if (!IsValid(result)) + { + result = X_MARKET_CYCLE_SHORT; + } + + // + return value; +} + +// +// Validate a Buffer Size for Looping or etc ... +bool IsValidSize(int size) +{ + // + bool result = size > 0; + + // + return result; +} + +// +// Normalize Index Based On Specified Buffer ... +template +void NormalizeIndex( + int &index, + T &buffer[] // +) +{ + // + int bufferSize = ArraySize(buffer); + + // + if (bufferSize <= 0) + { + index = 0; + } + + // + if (index <= 0) + { + index = 0; + } + + // + if (index > bufferSize - 1) + { + index = bufferSize - 1; + } +} + +// +// Normalize a give Volume ... +double NormalizeVolume( + double mVolume, // desired volume to normalize + string mSymbol = NULL, // Trading Symbol + int mLength = 2 // Length of Digits +) +{ + // + double result = mVolume; + + // + mSymbol = NormalizeSymbol(mSymbol); + + // + // Normalize Digits ... + int digits = GetDigits(mSymbol); + + // + mLength = + mLength == 0 || mLength > digits + ? digits + : MathMin(mLength, digits); + + // + // Normalize Volume ... + result = NormalizeDouble(result, mLength); + + // + double maxAvailableVolume = SymbolInfoDouble(mSymbol, SYMBOL_VOLUME_MAX); + double minAvailableVolume = SymbolInfoDouble(mSymbol, SYMBOL_VOLUME_MIN); + + // + // Validate Result ... + if (result > maxAvailableVolume) + { + result = maxAvailableVolume; + } + else if (result < minAvailableVolume) + { + result = minAvailableVolume; + } + + // + return result; +} + +// +// Normallize Price ... +double NormalizePrice( + double mPrice, // desired Price for normalization + string mSymbol = NULL // Trading Symbol +) +{ + // + double result = 0; + + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double tickSize = 0; + result = SymbolInfoDouble(mSymbol, SYMBOL_TRADE_TICK_SIZE, tickSize); + + // + int digits = GetDigits(mSymbol); + result = NormalizeDouble(MathRound(mPrice / tickSize) * tickSize, digits); + + // + return result; +} + +// +// Prices ... + +// +// Retrieve Ask Price ... +double GetAsk( + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double result = SymbolInfoDouble(mSymbol, SYMBOL_ASK); + + // + return result; +} + +// +// Retrieve Bid Price ... +double GetBid( + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double result = SymbolInfoDouble(mSymbol, SYMBOL_BID); + + // + return result; +} + +// +// Retrieve Spread Price ... +double GetSpread( + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double ask = GetAsk(mSymbol); + double bid = GetBid(mSymbol); + + // + double result = MathAbs(ask - bid); + + // + return result; +} + +// +// Retrieve Point Value ... +double GetPoints( + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double result = SymbolInfoDouble(mSymbol, SYMBOL_POINT); + + // + return result; +} + +// +// Retrieve Point Digits ... +int GetDigits( + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + int result = (int)SymbolInfoInteger(mSymbol, SYMBOL_DIGITS); + + // + return result; +} + +// +// Retrieve Entry Price ... +double GetEntry( + string mSymbol = NULL, // Trading Symbol + ENUM_POSITION_TYPE type = POSITION_TYPE_BUY // Get entry price for Which direction trade ... +) +{ + // + double result = 0; + + // + mSymbol = NormalizeSymbol(mSymbol); + + // + result = + IsLong(type) + ? GetAsk(mSymbol) + : GetBid(mSymbol); + result = NormalizePrice(result, mSymbol); + + // + return result; +} + +// +// Retrieve Exit Price ... +double GetExit( + string mSymbol = NULL, // Trading Symbol + ENUM_POSITION_TYPE type = POSITION_TYPE_BUY // Get entry price for Which direction trade ... +) +{ + // + double result = 0; + + // + mSymbol = NormalizeSymbol(mSymbol); + + // + result = + IsLong(type) + ? GetBid(mSymbol) + : GetAsk(mSymbol); + result = NormalizePrice(result, mSymbol); + + // + return result; +} + +// +// Get 1 Pip in Price Value ... +double GetPipPrice( + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double symbolPoint = GetPoints(mSymbol); + int symbolDigits = GetDigits(mSymbol); + + // + double result = symbolPoint; + if (symbolDigits == 3 || symbolDigits == 5) + { + result *= 10; + } + + // + return result; +} + +// +// Converts Pips To Price ... +double PipsToPrice( + double mPips, // pips amount + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + + // + int digits = GetDigits(mSymbol); + double pipValue = GetPipPrice(mSymbol); + double result = mPips * pipValue; + + // + result = NormalizePrice(result, mSymbol); + + // + return result; +} + +// +// Converts Price to Pips ... +double PriceToPips( + double mPrice, // the price amount which required to calculate + string mSymbol = NULL // Trading Symbol +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + mPrice = NormalizePrice(mPrice, mSymbol); + + // + int digits = GetDigits(mSymbol); + double pipPrice = GetPipPrice(mSymbol); + + // + double result = mPrice / pipPrice; + + // + result = NormalizeDouble(result, digits); + + // + return result; +} + +// +// Convert Price to Point ... +double PriceToPoint( + double price, // the price amount which required to calculate + string mSymbol = NULL // Trading Symbol +) +{ + // + double result = 0; + + // + mSymbol = NormalizeSymbol(mSymbol); + price = NormalizePrice(price, mSymbol); + + // + double point = GetPoints(mSymbol); + result = price / point; + + // + return result; +} + +// +// Converts Point to Price ... +double PointToPrice( + double points, // Points Amount + string mSymbol = NULL // Trading Symbol +) +{ + // + double result = 0; + + // + mSymbol = NormalizeSymbol(mSymbol); + + // + double point = GetPoints(mSymbol); + result = points * point; + + // + result = NormalizePrice(result, mSymbol); + + // + return result; +} + +// +// Converts Series Mode to XPRICE ... +ENUM_X_PRICE ToPrice( + ENUM_SERIESMODE mMode // Specified Series Mode ... +) +{ + // + ENUM_X_PRICE result = X_PRICE_CLOSE; + + // + switch (mMode) + { + // + // High ... + case MODE_HIGH: + result = X_PRICE_HIGH; + break; + + // + // Open ... + case MODE_OPEN: + result = X_PRICE_OPEN; + break; + + // + // Low ... + case MODE_LOW: + result = X_PRICE_LOW; + break; + + // + // Close ... + // Default ... + case MODE_CLOSE: + default: + result = X_PRICE_CLOSE; + break; + } + + // + return result; +} + +// +// Retrieve Applied Price ... +template +double GetAppliedPrice( + ENUM_APPLIED_PRICE tprice, // Type of Price Selection + T &open[], // Open Prices + T &high[], // High Preices + T &low[], // Low Prices + T &close[], // Close Prices + int i // Bar Index +) +{ + switch (tprice) + { + case PRICE_CLOSE: + return (close[i]); + case PRICE_OPEN: + return (open[i]); + case PRICE_HIGH: + return (high[i]); + case PRICE_LOW: + return (low[i]); + case PRICE_MEDIAN: + return ((high[i] + low[i]) / 2.0); + case PRICE_TYPICAL: + return ((high[i] + low[i] + close[i]) / 3.0); + case PRICE_WEIGHTED: + return ((high[i] + low[i] + close[i] + close[i]) / 4.0); + } + return (0); +} + +// +// Symbols ... + +// +// Retrieve Available Symbols ... +int GetAllSymbols( + string &symbols[], // Hold Result + bool onlyInWatchList = false, // Specified Retrieve only Symbols which in Watch List + bool forceClean = true // Force To Clean Result Array +) +{ + // + int result = 0; + + // + if (forceClean) + { + Clean(symbols); + } + + // + int beforeSize = ArraySize(symbols); + + // + int symbolsCount = SymbolsTotal(onlyInWatchList); + if (symbolsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < symbolsCount; i++) + { + // + string iSymbol = SymbolName( + i, + onlyInWatchList + // + ); + if (!IsValid(iSymbol)) + { + continue; + } + + // + Add( + iSymbol, + symbols + // + ); + } + + // + int afterSize = ArraySize(symbols); + + // + result = afterSize - beforeSize; + + // + return result; +} + +// +// This is a Global Way to Filter Symbols +// you can pass Specific string as Query or a List String for Filtering ... +int FilterSymbols( + string query, // Which Query to Search Symbol + string &symbols[], // Hold Result + bool onlyInWatchList = false, // Specified Retrieve only Symbols which in Watch List + bool forceClean = true, // Force To Clean Result Array + bool ignoreCase = true, // Ignore Case + string querySeparator = "," // If Provided means query is a COllection of Queries and need to be Splitted +) +{ + // + int result = 0; + + // + if (forceClean) + { + Clean(symbols); + } + + // + if (!IsValid(query)) + { + return result; + } + + // + // Check Query is an String array or not ... + string mQueries[]; + int queriesCount = 0; + if (IsValid(querySeparator) && Contains(querySeparator, query, true)) + { + // + queriesCount = SplitContent( + mQueries, + query, + querySeparator + // + ); + } + + // + int beforeSize = ArraySize(symbols); + + // + string allSymbols[]; + int allSymbolsCount = GetAllSymbols( + allSymbols, + onlyInWatchList, + forceClean); + if (allSymbolsCount <= 0) + { + return result; + } + + // + // Loop Through all Symbols ... + for (int i = 0; i < allSymbolsCount; i++) + { + // + string iSymbol = allSymbols[i]; + + // + bool isFilterPassed = false; + if (queriesCount == 0) + { + // + isFilterPassed = Contains( + query, + iSymbol, + ignoreCase + // + ); + } + else if (queriesCount > 0) + { + // + isFilterPassed = Contains( + mQueries, + iSymbol, + ignoreCase + // + ); + } + + // + if (isFilterPassed) + { + // + Add( + iSymbol, + symbols + // + ); + } + } + + // + int afterSize = ArraySize(symbols); + + // + result = afterSize - beforeSize; + + // + return result; +} + +// +int FilterUSDSymbols( + string &symbols[], // Hold Result + bool onlyInWatchList = false, // Specified Retrieve only Symbols which in Watch List + bool forceClean = true, // Force To Clean Result Array + bool ignoreCase = true, // Ignore Case + string querySeparator = "," // If Provided means query is a COllection of Queries and need to be Splitted +) +{ + // + return FilterSymbols( + "USD", + symbols, + onlyInWatchList, + forceClean, + ignoreCase, + querySeparator + // + ); +} + +// +// Time / Date ... + +// +// Representation of Time Struct ... +// struct MqlDateTime +// { +// int year; // Year +// int mon; // Month +// int day; // Day +// int hour; // Hour +// int min; // Minutes +// int sec; // Seconds +// int day_of_week; // Day of week (0-Sunday, 1-Monday, ... ,6-Saturday) +// int day_of_year; // Day number of the year (January 1st is assigned the number value of zero) +// }; + +// +// Converts Time to Seconds ... +ulong TimeToSeconds( + datetime time // Specify time to Convert ... +) +{ + // + ulong result = (ulong)time; + + // + return result; +} +ulong TimeToSeconds( + MqlDateTime &time // Specify time to Convert ... +) +{ + // + datetime dTime = StructToTime(time); + + // + ulong result = TimeToSeconds(dTime); + + // + return result; +} + +// +// Converts Seconds To Time ... +datetime SecondsToTime( + ulong seconds // Specify Seconds to Convert ... +) +{ + // + datetime result = (datetime)seconds; + + // + return result; +} +MqlDateTime SecondsToStruct( + ulong seconds // Specify Seconds to Convert ... +) +{ + // + datetime dTime = SecondsToTime(seconds); + + // + MqlDateTime result = {}; + TimeToStruct( + dTime, + result); + + // + return result; +} + +// +// Converts Time to MilliSeconds ... +ulong TimeToMilliSeconds( + datetime time // Specify time to Convert ... +) +{ + // + ulong result = TimeToSeconds(time) * 1000; + + // + return result; +} +ulong TimeToMilliSeconds( + MqlDateTime &time // Specify time to Convert ... +) +{ + // + datetime dTime = StructToTime(time); + + // + ulong result = TimeToMilliSeconds(dTime); + + // + return result; +} + +// +// Converts MillisSeconds to Time ... +datetime MilliSecondsToTiem( + ulong milliSeconds // Specify MilliSeconds to Convert ... +) +{ + // + ulong seconds = milliSeconds / 1000; + + // + datetime result = SecondsToTime(seconds); + + // + return result; +} +MqlDateTime MilliSecondsToStruct( + ulong milliSeconds // Specify MilliSeconds to Convert ... +) +{ + // + datetime dTime = MilliSecondsToTiem(milliSeconds); + + // + MqlDateTime result = {}; + TimeToStruct( + dTime, + result); + + // + return result; +} + +// +// Retrieve DateTime Structure ... +MqlDateTime GetCurrentTime() +{ + // + MqlDateTime result = {}; + + // + TimeCurrent(result); + + // + return result; +} + +// +// Retrieve Current Time as Seconds ... +ulong GetCurrentTimeAsSeconds() +{ + // + datetime time = TimeCurrent(); + + // + ulong result = TimeToSeconds(time); + + // + return result; +} + +// +// Retrieve Current Time as MilliSeconds ... +ulong GetCurrentTimeAsMilliSeconds() +{ + // + datetime time = TimeCurrent(); + + // + ulong result = TimeToMilliSeconds(time); + + // + return result; +} + +// +// Bar Times ... + +// +// Retrieve Specified Bar Time ... +datetime GetBarTime( + string mSymbol = "", // Specify Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Specify TimeFrame + int barIndex = 0 // Specify Bar Index +) +{ + // + // Validate and Normalize Args ... + + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + // Retrieve Bar Time ... + datetime result = iTime( + mSymbol, + mPeriod, + barIndex); + + // + return result; +} + +// +// Retrieve Specified Bar Time ... +ulong GetBarTimeAsSeconds( + string mSymbol = "", // Specify Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Specify TimeFrame + int barIndex = 0 // Specify Bar Index +) +{ + // + // Retrieve Bar Time ... + datetime time = GetBarTime( + mSymbol, + mPeriod, + barIndex); + + // + ulong result = TimeToSeconds(time); + + // + return result; +} + +// +// Retrieve Specified Bar Time ... +ulong GetBarTimeAsMilliSeconds( + string mSymbol = "", // Specify Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Specify TimeFrame + int barIndex = 0 // Specify Bar Index +) +{ + // + // Retrieve Bar Time ... + datetime time = GetBarTime( + mSymbol, + mPeriod, + barIndex); + + // + ulong result = TimeToMilliSeconds(time); + + // + return result; +} + +// +// Retrieve a Bar Time Structure ... +MqlDateTime GetBarTimeStruct( + string mSymbol = "", // Specify Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Specify TimeFrame + int barIndex = 0 // Specify Bar Index +) +{ + // + MqlDateTime result = {}; + + // + // Retrieve Bar Time ... + datetime barTime = GetBarTime( + mSymbol, + mPeriod, + barIndex); + + // + // Convert to Structure ... + TimeToStruct(barTime, result); + + // + return result; +} + +// +// Other Tools ... + +// +template +bool IsSame( + T &buffer[], // Search Buffer + int count = 5, // Number of Searchs + int start = 0 // Start ... +) +{ + // + bool result = false; + + // + int bufferSize = ArraySize(buffer); + result = bufferSize > 0; + if (!result) + { + return result; + } + + // + // Validate Count ... + result = start + count < bufferSize; + if (!result) + { + return result; + } + + // + T iTem = buffer[start]; + for (int i = start; i < start + count; i++) + { + // + if (iTem != buffer[i]) + { + result = false; + break; + } + + // + if (!result) + { + result = true; + } + } + + // + return result; +} + +// +// Check first Cross Over second at index ... +bool IsCrossedOver( + const double &first[], // the buffer which check crossing over second buffer + const double &second[], // first buffer checks based on this buffer + const int index = 0 // check crosses in specific index +) +{ + // + bool result = false; + + // + // Validate Args ... + if (ArraySize(first) < index + 1 || ArraySize(second) < index + 1) + { + return result; + } + + // + result = first[index] > second[index] && + !(first[index + 1] > second[index + 1]); + + // + return result; +} + +// +// Check first is Over second at index ... +bool IsOver( + const double &first[], // the buffer which check over second buffer + const double &second[], // first buffer checks based on this buffer + const int index = 0 // check crosses in specific index +) +{ + // + bool result = false; + + // + // Validate Args ... + if (ArraySize(first) < index + 1 || ArraySize(second) < index + 1) + { + return result; + } + + // + result = first[index] > second[index] && + first[index + 1] > second[index + 1]; + + // + return result; +} + +// +// Check first Cross Under second at index ... +bool IsCrossedUnder( + const double &first[], // the buffer which check crossing under second buffer + const double &second[], // first buffer checks based on this buffer + const int index = 0 // check crosses in specific index +) +{ + // + bool result = false; + + // + // Validate Args ... + if (ArraySize(first) < index + 1 || ArraySize(second) < index + 1) + { + return result; + } + + // + result = first[index] < second[index] && + !(first[index + 1] < second[index + 1]); + + // + return result; +} + +// +// Check first is Under second at index ... +bool IsUnder( + const double &first[], // the buffer which check under second buffer + const double &second[], // first buffer checks based on this buffer + const int index = 0 // check crosses in specific index +) +{ + // + bool result = false; + + // + // Validate Args ... + if (ArraySize(first) < index + 1 || ArraySize(second) < index + 1) + { + return result; + } + + // + result = first[index] < second[index] && + first[index + 1] < second[index + 1]; + + // + return result; +} + +// +// Check if a Value Increasing in Loopback ... +bool IsIncreasing( + const int from, // Last Time Index + const int to, // Fisrs Tima Index + const double &buffer[] // the Buffer which required to search +) +{ + // + bool result = false; + + // + // Validate Args ... + if ( + from <= to || + ArraySize(buffer) < from + 1) + { + return result; + } + + // + // Loop through Items ... + double toValue = buffer[to]; + double fromValue = buffer[from]; + result = toValue > fromValue; + for (int i = to + 1; i <= from - 1; i++) + { + // + double iValue = buffer[i]; + bool isPassed = toValue >= iValue; + + // + bool isIIncreasing = IsIncreasing( + from, + i, + buffer); + + // + // Check Result ... + result = result && isPassed && isIIncreasing; + if (!result) + { + break; + } + } + + // + return result; +} + +// +// Check if a Value Decreasing in Loopback ... +bool IsDecreasing( + const int from, // Last Time Index + const int to, // Fisr Tima Index + const double &buffer[] // the Buffer which required to search +) +{ + // + bool result = false; + + // + // Validate Args ... + if ( + from <= to || + ArraySize(buffer) < from + 1) + { + return result; + } + + // + // Loop through Items ... + double toValue = buffer[to]; + double fromValue = buffer[from]; + result = toValue < fromValue; + for (int i = to + 1; i <= from - 1; i++) + { + // + double iValue = buffer[i]; + bool isPassed = toValue <= iValue; + + // + bool isIDecreasing = IsDecreasing( + from, + i, + buffer); + + // + // Check Result ... + result = result && isPassed && isIDecreasing; + if (!result) + { + break; + } + } + + // + return result; +} + +// +bool IsTrendingUp( + const double &buffer1[], // First Buffer + const double &buffer2[] // Seccend Buffer +) +{ + // + bool result = false; + + // + int buffer1Count = ArraySize(buffer1); + int buffer2Count = ArraySize(buffer2); + if (buffer1Count <= 0 || buffer2Count <= 0) + { + return result; + } + + // + int count = MathMin(buffer1Count, buffer2Count); + if (count <= 1) + { + return result; + } + + // + int upCounts = 0; + int downCounts = 0; + double value = MathAbs(buffer1[0] - buffer2[0]); + for (int i = 1; i < count; i++) + { + // + double iValue = MathAbs(buffer1[i] - buffer2[i]); + + // + if (value > iValue) + { + upCounts++; + } + + // + if (value < iValue) + { + downCounts++; + } + } + + // + result = upCounts > 1 && upCounts > downCounts; + + // + return result; +} + +// +bool IsTrendingDown( + const double &buffer1[], // First Buffer + const double &buffer2[] // Seccend Buffer +) +{ + // + bool result = false; + + // + int buffer1Count = ArraySize(buffer1); + int buffer2Count = ArraySize(buffer2); + if (buffer1Count <= 0 || buffer2Count <= 0) + { + return result; + } + + // + int count = MathMin(buffer1Count, buffer2Count); + if (count <= 1) + { + return result; + } + + // + int upCounts = 0; + int downCounts = 0; + double value = MathAbs(buffer1[0] - buffer2[0]); + for (int i = 1; i < count; i++) + { + // + double iValue = MathAbs(buffer1[i] - buffer2[i]); + + // + if (value > iValue) + { + upCounts++; + } + + // + if (value < iValue) + { + downCounts++; + } + } + + // + result = downCounts > 1 && downCounts > upCounts; + + // + return result; +} + +// +// Calculate Slope of Specified Buffer at Specified Index ... +double GetSlope( + const double &buffer[], // Buffer + int from, // In Past Index ... + int to // In Past Index ... +) +{ + // + double result = 0; + + // + if (from > ArraySize(buffer) || to > ArraySize(buffer)) + { + return result; + } + + // + double toValue = buffer[to]; + double fromValue = buffer[from]; + double deltaValue = toValue - fromValue; + double deltaTime = from - to; + + // + result = deltaValue / deltaTime; + + // + return result; +} + +// +// Calculate Fib Level ... +double GetFibonacciLevel( + double upPrice, // Upper Bound + double downPrice, // Downer Bound + double level, // Level Multiplier Factor + int direction // From Down to Up < 0, other wise Vice Versa + // +) +{ + // + double ling = upPrice - downPrice; + double pLevel = (ling / 100) * (level * 100); + + // + double result = direction > 0 ? upPrice - pLevel : downPrice + pLevel; + + // + return result; +} + +// +// Templates ... + +// +// Retrieve Specific Object Types Name ... +template +string GetTypeName(const T &t) +{ + return typename(T); +} + +// +template +string GetToken(T &item) +{ + // + string mType = GetTypeName(item); + + // + string result = mType; + + // + string parts[]; + int partsCount = SplitContent( + parts, + result, + " " + // + ); + if (partsCount <= 0) + { + // + result = mType; + return result; + } + + // + bool hasLastPart = GetLastItem( + result, + parts + // + ); + if (!hasLastPart) + { + // + result = mType; + return result; + } + + // + return result; +} + +// +// Same as Get Token for Use in Classes ... +template +string GetSpecificToken(T &item) +{ + // + string mType = GetTypeName(item); + + // + string result = mType; + + // + string parts[]; + int partsCount = SplitContent( + parts, + result, + " " + // + ); + if (partsCount <= 0) + { + // + result = mType; + return result; + } + + // + bool hasLastPart = GetLastItem( + result, + parts + // + ); + if (!hasLastPart) + { + // + result = mType; + return result; + } + + // + return result; +} + +// +// Generate Unique Tags ... +template +string GenerateTag(T &model) +{ + // + string result = ""; + + // + string tag = model.ToString(); + if (StringLen(tag) == 0) + { + return result; + } + + // + static XSCMD5 md5; + + // + result = md5.Hash(tag); + + // + return result; +} + +// +// Hash Specified Content ... +template +string ToMD5(T content) +{ + // + string result = ""; + + // + string strContent = ToString(content); + if (StringLen(strContent) == 0) + { + return result; + } + + // + static XSCMD5 md5; + + // + result = md5.Hash(strContent); + + // + return result; +} + +// +// Check a Value Not Empty ... +template +bool NotEmpty(T value) +{ + return value != EMPTY_VALUE; +} + +// +// Add Specified Item to Array ... +template +int Add( + T item, // item want to add + T &buffer[] // Destination buffer +) +{ + // + int result = 0; + + // + ArrayResize( + buffer, + ArraySize(buffer) + 1); + + // + buffer[ArraySize(buffer) - 1] = item; + + // + result = ArraySize(buffer); + + // + return result; +} +template +int AddSpecific( + T item, // item want to add + T &buffer[] // Destination buffer +) +{ + // + return Add( + item, + buffer // + ); +} +template +int AddRef( + T &item, // item want to add + T &buffer[] // Destination buffer +) +{ + // + int result = 0; + + // + ArrayResize( + buffer, + ArraySize(buffer) + 1); + + // + buffer[ArraySize(buffer) - 1] = item; + + // + result = ArraySize(buffer); + + // + return result; +} + +// +// Remove Specified Item from an Array ... +template +bool Remove( + T item, + T &buffer[]) +{ + // + bool result = false; + + // + int itemIndex = FindIndex( + item, + buffer); + if (itemIndex < 0) + { + return result; + } + + // + result = ArrayRemove( + buffer, + itemIndex, + 1); + + // + return result; +} + +// +// Clean Specified Array ... +template +void Clean(T &buffer[]) +{ + // + ArrayFree(buffer); + ArrayResize(buffer, 0); +} + +// +// Copy Whole Content of Source to Dest array ... +template +void Copy( + T &source[], // Source Buffer ... + T &dest[], // Dest Buffer ... + bool cleanDest = true // Force Clen Dest Buffer ... +) +{ + // + if (cleanDest) + { + Clean(dest); + } + + // + int sourceCount = ArraySize(source); + if (sourceCount <= 0) + { + return; + } + + // + for (int i = 0; i < sourceCount; i++) + { + // + T iSource = source[i]; + + // + AddRef( + iSource, + dest); + } +} + +// +// Copy Items from a Buffer ... +template +int Copy( + int start, // Start + int count, // Number of Items for read + T &source[], // Source Buffer + T &dest[], // Dest Buffer + bool forceClean = true // Force To Clean buffer +) +{ + // + int result = 0; + + // + if (forceClean) + { + Clean(dest); + } + + // + if (start < 0) + { + start = 0; + } + + // + if (start >= ArraySize(source)) + { + start = ArraySize(source) - 1; + } + + // + if (count == 0) + { + count = ArraySize(source); + } + + // + if (start + count > ArraySize(source)) + { + return result; + } + + // + int beforeSize = ArraySize(dest); + + // + bool asSeriesDest = ArrayGetAsSeries(dest); + bool asSeriesSource = ArrayGetAsSeries(source); + + // + ArraySetAsSeries(dest, true); + ArraySetAsSeries(source, true); + + // + ArrayCopy( + dest, + source, + 0, + start, + count + // + ); + + // + int afterSize = ArraySize(dest); + + // + result = afterSize - beforeSize; + + // + ArraySetAsSeries(dest, asSeriesDest); + ArraySetAsSeries(source, asSeriesSource); + + // + return result; +} + +// +// Copy Items from a Buffer ... +template +int CopyRef( + int start, // Start + int count, // Number of Items for read + T &source[], // Source Buffer + T &dest[], // Dest Buffer + bool forceClean = true // Force To Clean buffer +) +{ + // + int result = 0; + + // + if (forceClean) + { + Clean(dest); + } + + // + if (start < 0) + { + start = 0; + } + + // + if (start >= ArraySize(source)) + { + start = ArraySize(source) - 1; + } + + // + int beforeSize = ArraySize(dest); + + // + bool asSeriesDest = ArrayGetAsSeries(dest); + bool asSeriesSource = ArrayGetAsSeries(source); + + // + ArraySetAsSeries(dest, true); + ArraySetAsSeries(source, true); + + // + for (int i = start; i < start + count; i++) + { + // + AddRef( + source[i], + dest + // + ); + } + + // + int afterSize = ArraySize(dest); + + // + result = afterSize - beforeSize; + + // + ArraySetAsSeries(dest, asSeriesDest); + ArraySetAsSeries(source, asSeriesSource); + + // + return result; +} + +// +// Retrive Last Item of Specified Buffer ... +template +bool GetLastItem( + T &item, // Holds Result + T &buffer[] // Specified Buffer +) +{ + // + bool result = false; + + // + int bufferSize = ArraySize(buffer); + if (bufferSize <= 0) + { + return result; + } + + // + item = buffer[bufferSize - 1]; + + // + result = true; + return result; +} + +// +// Search Array For Specific Item ... +template +int FindIndex( + T item, // What is Search ... + T &buffer[] // Search in ... +) +{ + // + int result = -1; + + // + int count = ArraySize(buffer); + if (count <= 0) + { + return result; + } + + // + for (int i = 0; i < count; i++) + { + // + T iT = buffer[i]; + + // + if (iT == item) + { + // + result = i; + break; + } + } + + // + return result; +} + +// +// Check an Array Contains Specified Value ... +template +bool Contains( + T item, // What is Search ... + T &buffer[] // Search in ... +) +{ + // + bool result = false; + + // + int idx = FindIndex( + item, + buffer); + result = idx > -1; + + // + return result; +} + +// +// Calculate a Buffer's Average ... +template +double GetAverage( + T &buffer[], // the Buffer which required to search + int start = 0, // Start Index + int count = 0 // Count for Search +) +{ + // + double result = 0; + + // + T tmp[]; + int tmpCount = Copy( + start, + count, + buffer, + tmp + // + ); + if (tmpCount <= 0) + { + return result; + } + + // + // Calculate Summary ... + for (int i = 0; i < tmpCount; i++) + { + result += buffer[i]; + } + + // + // Calculate Average ... + result = result / tmpCount; + + // + return result; +} + +// +// Get Max of Specific Loopback of a Buffer ... +template +double GetMax( + T &buffer[], // the Buffer which required to search + int start = 0, // Start Index + int count = 0 // Count for Search +) +{ + // + double result = 0; + + // + if (count <= 0) + { + count = ArraySize(buffer); + } + + // + T tmp[]; + int tmpCount = Copy( + start, + count, + buffer, + tmp + // + ); + if (tmpCount <= 0) + { + return result; + } + + // + // Loop Through LoopBack ... + for (int i = 0; i < tmpCount; i++) + { + // + double iValue = tmp[i]; + + // + result = + // + result == 0 || result < iValue + // + ? iValue + // + : result + // + ; + } + + // + return result; +} + +// +// Get Min of Specific Loopback of a Buffer ... +template +double GetMin( + T &buffer[], // the Buffer which required to search + int start = 0, // Start Index + int count = 0 // Count for Search +) +{ + // + double result = 0; + + // + if (count <= 0) + { + count = ArraySize(buffer); + } + + // + T tmp[]; + int tmpCount = Copy( + start, + count, + buffer, + tmp + // + ); + if (tmpCount <= 0) + { + return result; + } + + // + // Loop Through LoopBack ... + for (int i = 0; i < tmpCount; i++) + { + // + double iValue = tmp[i]; + + // + result = + // + result == 0 || result > iValue + // + ? iValue + // + : result + // + ; + } + + // + return result; +} + +// +// Find a Value less than Specified ... +template +T FindLesserThan( + T value, // Specified Value ... + const T &source[], // Source ... + bool isDescend = false // Find Biggest Lesser Value ... +) +{ + // + T result = -1; + + // + int itemsCount = ArraySize(source); + if (itemsCount <= 0) + { + return result; + } + + // + // Make a Copy of source ... + T tmp[]; + + // + ArrayResize( + tmp, + ArraySize(source)); + + // + ArrayCopy( + tmp, + source); + + // + // Sort Temp Buffer ... + ArraySort(tmp); + if (isDescend) + { + ArrayReverse(tmp); + } + + // + int tmpCount = ArraySize(tmp); + for (int i = 0; i < tmpCount; i++) + { + // + T iValue = tmp[i]; + + // + if (iValue < value) + { + // + result = iValue; + break; + } + } + + // + return result; +} + +// +// Find a Value less than Specified ... +template +T FindBiggerThan( + T value, // Specified Value ... + const T &source[], // Source ... + bool isDescend = false // Find Smallest Bigger Value ... +) +{ + // + T result = -1; + + // + int itemsCount = ArraySize(source); + if (itemsCount <= 0) + { + return result; + } + + // + // Make a Copy of source ... + T tmp[]; + + // + ArrayResize( + tmp, + ArraySize(source)); + + // + ArrayCopy( + tmp, + source); + + // + // Sort Temp Buffer ... + ArraySort(tmp); + if (!isDescend) + { + ArrayReverse(tmp); + } + + // + int tmpCount = ArraySize(tmp); + for (int i = 0; i < tmpCount; i++) + { + // + T iValue = tmp[i]; + + // + if (iValue > value) + { + // + result = iValue; + break; + } + } + + // + return result; +} + +// +// Find Same Values in Array ... +template +void FindSames( + T &result[], // Holds Result ... + T &source[], // Source ... + int verifications = 3 // Number of Consequence Repeat ... +) +{ + // + Clean(result); + + // + // TenkanSen Flats ... + int sourceCount = ArraySize(source); + if (sourceCount > verifications) + { + // + T mLast = 0; + int mVerified = 0; + for (int i = 0; i < sourceCount; i++) + { + // + T iVal = source[i]; + if (mLast == 0) + { + mLast = iVal; + } + else if (mLast == iVal) + { + mVerified++; + } + else + { + mLast = iVal; + mVerified = 0; + } + + // + if (iVal == mLast && mVerified >= verifications) + { + // + Add( + iVal, + result); + + // + mLast = 0; + mVerified = 0; + } + } + } +} + +// +// Add an Item to a Buffer if not Exists ... +void AddIfNotExists( + double value, + double &values[], + double smoothingPoint = 3) +{ + // + double smoothingValue = smoothingPoint * GetPoints(_Symbol); + + // + int valuesCount = ArraySize(values); + if (valuesCount <= 0) + { + // + Add(value, + values); + } + else + { + // + bool isExists = false; + for (int i = 0; i < valuesCount; i++) + { + // + double iVal = values[i]; + + // + double diff = MathAbs(iVal - value); + + // + if (iVal == value || diff < smoothingValue) + { + // + isExists = true; + break; + } + } + + // + if (!isExists) + { + // + Add(value, + values); + } + } +} + +// +// Add a Buffers Child to another Buffer +// if it's not Contains them ... +void AddsIfNotExists( + double &source[], + double &dest[], + double smoothingPoint = 3) +{ + // + double smoothingValue = smoothingPoint * GetPoints(_Symbol); + + // + int sourceCount = ArraySize(source); + if (sourceCount <= 0) + { + return; + } + + // + for (int i = 0; i < sourceCount; i++) + { + // + double iSource = source[i]; + + // + AddIfNotExists( + iSource, + dest, + smoothingPoint); + } +} + +// +// Bar XOHCL ... + +// +// Extract Specific Range of Bars ... +// using Start Bar Index ... +int GetBars( + XOHCL &result[], // Hold Result + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Time Frame + int from = 0, // Start Bar Index + int count = 1, // Number of Bars + bool forceClean = true // Clean Result Array +) +{ + // + int mResult = 0; + + // + if (from < 0) + { + from = 0; + } + + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + int total = Bars( + mSymbol, + mPeriod); + if (from > total - 2) + { + from = total - 2; + } + + // + if (count < 0) + { + count = 1; + } + + // + int start = from; + int end = start + count; + if (end > total - 1) + { + end = total - 1; + } + + // + if (forceClean) + { + Clean(result); + } + + // + int beforeSize = ArraySize(result); + + // + for (int i = start; i < end; i++) + { + // + XOHCL iBar; + bool isValid = iBar.Init( + mSymbol, + mPeriod, + i + // + ); + + // + if (isValid) + { + // + AddRef( + iBar, + result + // + ); + } + } + + // + int afterSize = ArraySize(result); + + // + mResult = afterSize - beforeSize; + + // + return mResult; +} + +// +// Extract Specific Range of Bars ... +// using Start Bar Time ... +int GetBars( + XOHCL &result[], // Hold Result + string mSymbol = NULL, // Trading Symbol + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Time Frame + datetime from = NULL, // Start Bar Time + int count = 1, // Number of Bars + bool forceClean = true // Clean Result Array +) +{ + // + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + from = NormalizeTime(from); + + // + int barIndex = iBarShift( + mSymbol, + mPeriod, + from, + false + // + ); + + // + return GetBars( + result, + mSymbol, + mPeriod, + barIndex, + count, + forceClean + // + ); +} + +// +// String ... + +// +// Search a Content Contains Specific String or not ... +bool Contains( + string mQuery, // Search String + string mContent, // Search Content + bool ignoreCase = true // Ignore Case +) +{ + // + bool result = false; + + // + // Validate Query ... + result = IsValid(mQuery); + if (!result) + { + return result; + } + + // + // Validate Content ... + result = IsValid(mContent); + if (!result) + { + return result; + } + + // + // Normalize Inputs ... + string query = mQuery; + string content = mContent; + if (ignoreCase) + { + // + StringToLower(query); + StringToLower(content); + } + + // + int queryIdx = StringFind( + content, + query); + + // + result = queryIdx >= 0; + + // + return result; +} + +// +bool Contains( + string &mQueries[], // Search Strings + string mContent, // Search Content + bool ignoreCase = true // Ignore Case +) +{ + // + bool result = false; + + // + // Validate Queries ... + int queriesCount = ArraySize(mQueries); + result = queriesCount > 0; + if (!result) + { + return result; + } + + // + // Validate Content ... + result = IsValid(mContent); + if (!result) + { + return result; + } + + // + int containsCount = 0; + for (int i = 0; i < queriesCount; i++) + { + // + bool isContains = Contains( + mQueries[i], + mContent, + ignoreCase); + + // + if (!isContains) + { + // + result = false; + break; + } + + // + containsCount++; + } + + // + result = containsCount == queriesCount; + + // + return result; +} + +// +// Convert From String ... +template +T FromString(string value) +{ + // + T result = NULL; + + // + if (!IsValid(value)) + { + return result; + } + + // + result = (T)value; + + // + return result; +} + +// +// Converts an item to String ... +template +string ToString(T value) +{ + return (string)value; +} + +// +// Used In Report or Summary Generators ... +string ToString( + string prefix, // Title + bool value, // Value + bool ignoreFalseConditions = true, // Ignore False Conditions + string prefixSeparator = ":", // Title Separator + string lineSeparator = "\n" // Line Separator +) +{ + // + string result = NULL; + + // + result = (value || !ignoreFalseConditions) + ? prefix + + prefixSeparator + " " + + ToString(value) + + lineSeparator + : ""; + + // + return result; +} + +// +string SetLabel( + string mLabel, // Provided Label ... + string value, // Source Value ... + string separator = "\n", // Line Separator + bool addTopEmptyLine = true // Add Empty Line On top +) +{ + // + string result = value; + + // + if (StringLen(mLabel) <= 0) + { + return result; + } + + // + result = (StringLen(value) > 0) + ? (addTopEmptyLine ? separator : "") + + mLabel + + separator + + "-----------------------------" + + separator + + value + : value; + + // + return result; +} + +// +// Converts a Buffer to String Representation ... +template +string ToString( + const T &buffer[], // Specified Buffer + string separator = ",", // Specified Separator + bool addIndex = false, // Specified Add Items Indexes or Not + string indexLabel = "i:", // Specified Index Label + string indexSeparator = ">" // Specified Index Separator +) +{ + // + string result = ""; + + // + int bufferSize = ArraySize(buffer); + if (bufferSize <= 0) + { + return result; + } + + // + for (int i = 0; i < bufferSize; i++) + { + // + if (addIndex) + { + // + if (StringLen(indexLabel) > 0) + { + result += indexLabel + " "; + } + + // + result += (string)i + " "; + + // + if (StringLen(indexSeparator) > 0) + { + result += indexSeparator + " "; + } + } + + // + string iItemString = (string)buffer[i]; + + // + result += iItemString; + + // + if (i < bufferSize - 1) + { + result += separator; + } + } + + // + return result; +} + +// +// Converts String to boolean ... +bool ToBoolean(string value) +{ + // + bool result = false; + + // + if (StringLen(value) <= 0) + { + return result; + } + + // + StringToLower(value); + result = value == "true"; + + // + return result; +} + +// +// Split an String Representation of an Array ... +int SplitContent( + string &result[], // Hold Result ... + string content, // Source ... + string separator = ",", // Separator ... + bool forceCleanResult = true // Clean Result ... +) +{ + // + int mResult = 0; + + // + if (forceCleanResult) + { + Clean(result); + } + + // + int before = ArraySize(result); + + // + if (separator == NULL || StringLen(separator) == 0) + { + separator = ","; + } + + // + if (StringLen(content) == 0) + { + return mResult; + } + + // + StringSplit( + content, + StringGetCharacter( + separator, + 0), + result); + + // + int after = ArraySize(result); + + // + mResult = after - before; + + // + return mResult; +} + +// +// Extract Data from String ... +string ExtractString( + const string source, // Source String used for Extracting + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + string result = ""; + + // + // Validate String ... + if ( + StringLen(source) == 0 || + StringLen(endString) == 0 || + StringLen(startString) == 0) + { + return result; + } + + // + // Find Start String Position ... + int sPos = StringFind( + source, + startString); + if (sPos < 0) + { + return result; + } + + // + // Find End String Position after Start String ... + int searchEndFromPos = sPos + StringLen(startString); + int ePos = StringFind( + source, + endString, + searchEndFromPos); + if (ePos < 0) + { + return result; + } + + // + // Extract Data from Source ... + int dLength = ePos - searchEndFromPos; + result = StringSubstr( + source, + searchEndFromPos, + dLength); + + // + return result; +} + +// +// Extract an Array of Contents ... +int ExtractStrings( + string &result[], // Hold Result + const string source, // Source String used for Extracting + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + int mResult = 0; + + // + Clean(result); + + // + // Validate Args ... + int sourceLength = StringLen(source); + int startLength = StringLen(startString); + int endLength = StringLen(endString); + + // + int minRequiredLength = startLength + endLength; + + // + if ( + endLength <= 0 || + startLength <= 0 || + sourceLength <= 0 || + sourceLength < minRequiredLength) + { + return mResult; + } + + // + // Make a Copy of Source for Manipulating ... + string workStr = source; + + // + // Define a Loop ... + while (StringLen(workStr) > minRequiredLength) + { + // + // Find Item ... + string item = ExtractString( + workStr, + startString, + endString); + + // + // Breakout when couldn't find anymore item ... + int itemLength = StringLen(item); + if (itemLength <= 0) + { + break; + } + + // + // Prepare Item Source String for Replacing in Work String ... + string itemSource = startString + item + endString; + + // + // Add Item to Result Array ... + Add( + item, + result); + + // + // Replace Item Soure in Work String ... + StringReplace( + workStr, + itemSource, + ""); + } + + // + // Calculate Size of Array ... + mResult = ArraySize(result); + + // + return mResult; +} + +// +string ExtractSurrounded( + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + return ExtractString( + surrounded, + mToken + startString, + endString + // + ); +} + +// +int ParseIntSurrounded( + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + int result = NULL; + + // + string strContent = ExtractSurrounded( + surrounded, + mToken, + startString, + endString + // + ); + if (!IsValid(strContent)) + { + return result; + } + + // + result = (int)strContent; + + // + return result; +} +long ParseLongSurrounded( + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + long result = NULL; + + // + string strContent = ExtractSurrounded( + surrounded, + mToken, + startString, + endString + // + ); + if (!IsValid(strContent)) + { + return result; + } + + // + result = (long)strContent; + + // + return result; +} +string ParseStringSurrounded( + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + string result = NULL; + + // + string strContent = ExtractSurrounded( + surrounded, + mToken, + startString, + endString + // + ); + if (!IsValid(strContent)) + { + return result; + } + + // + result = (string)strContent; + + // + return result; +} +double ParseDoubleSurrounded( + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + double result = NULL; + + // + string strContent = ExtractSurrounded( + surrounded, + mToken, + startString, + endString + // + ); + if (!IsValid(strContent)) + { + return result; + } + + // + result = (double)strContent; + + // + return result; +} +datetime ParseTimeSurrounded( + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + const string startString = "(", // Expression Start String must be Unique + const string endString = ")" // Where to End Extraction, usually a Sign +) +{ + // + datetime result = NULL; + + // + string strContent = ExtractSurrounded( + surrounded, + mToken, + startString, + endString + // + ); + if (!IsValid(strContent)) + { + return result; + } + + // + result = (datetime)strContent; + + // + return result; +} + +// +int ParseIntArraySurrounded( + int &result[], // Holds Result + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + string separator = ",", // Separator ... + const string startString = "(", // Expression Start String must be Unique + const string endString = ")", // Where to End Extraction, usually a Sign + bool forceClean = true // Clean Result ... +) +{ + // + int count = 0; + + // + if (forceClean) + { + Clean(result); + } + + // + int before = ArraySize(result); + + // + string contentStr = ParseStringSurrounded(surrounded, mToken); + if (!IsValid(contentStr)) + { + return count; + } + + // + string tmps[]; + int tmpsCount = SplitContent( + tmps, + contentStr + // + ); + if (tmpsCount <= 0) + { + return count; + } + + // + for (int i = 0; i < tmpsCount; i++) + { + // + string iTMP = tmps[i]; + if (!IsValid(iTMP)) + { + continue; + } + + // + int iValue = (int)iTMP; + + // + Add( + iValue, + result + // + ); + } + + // + int after = ArraySize(result); + + // + count = after - before; + + // + return count; +} +int ParseLongArraySurrounded( + long &result[], // Holds Result + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + string separator = ",", // Separator ... + const string startString = "(", // Expression Start String must be Unique + const string endString = ")", // Where to End Extraction, usually a Sign + bool forceClean = true // Clean Result ... +) +{ + // + int count = 0; + + // + if (forceClean) + { + Clean(result); + } + + // + int before = ArraySize(result); + + // + string contentStr = ParseStringSurrounded(surrounded, mToken); + if (!IsValid(contentStr)) + { + return count; + } + + // + string tmps[]; + int tmpsCount = SplitContent( + tmps, + contentStr + // + ); + if (tmpsCount <= 0) + { + return count; + } + + // + for (int i = 0; i < tmpsCount; i++) + { + // + string iTMP = tmps[i]; + if (!IsValid(iTMP)) + { + continue; + } + + // + long iValue = (long)iTMP; + + // + Add( + iValue, + result + // + ); + } + + // + int after = ArraySize(result); + + // + count = after - before; + + // + return count; +} +int ParseDoubleArraySurrounded( + double &result[], // Holds Result + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + string separator = ",", // Separator ... + const string startString = "(", // Expression Start String must be Unique + const string endString = ")", // Where to End Extraction, usually a Sign + bool forceClean = true // Clean Result ... +) +{ + // + int count = 0; + + // + if (forceClean) + { + Clean(result); + } + + // + int before = ArraySize(result); + + // + string contentStr = ParseStringSurrounded(surrounded, mToken); + if (!IsValid(contentStr)) + { + return count; + } + + // + string tmps[]; + int tmpsCount = SplitContent( + tmps, + contentStr + // + ); + if (tmpsCount <= 0) + { + return count; + } + + // + for (int i = 0; i < tmpsCount; i++) + { + // + string iTMP = tmps[i]; + if (!IsValid(iTMP)) + { + continue; + } + + // + double iValue = (double)iTMP; + + // + Add( + iValue, + result + // + ); + } + + // + int after = ArraySize(result); + + // + count = after - before; + + // + return count; +} +int ParseTimeArraySurrounded( + datetime &result[], // Holds Result + const string surrounded, // Surrounded Content + const string mToken, // Specified Token + string separator = ",", // Separator ... + const string startString = "(", // Expression Start String must be Unique + const string endString = ")", // Where to End Extraction, usually a Sign + bool forceClean = true // Clean Result ... +) +{ + // + int count = 0; + + // + if (forceClean) + { + Clean(result); + } + + // + int before = ArraySize(result); + + // + string contentStr = ParseStringSurrounded(surrounded, mToken); + if (!IsValid(contentStr)) + { + return count; + } + + // + string tmps[]; + int tmpsCount = SplitContent( + tmps, + contentStr + // + ); + if (tmpsCount <= 0) + { + return count; + } + + // + for (int i = 0; i < tmpsCount; i++) + { + // + string iTMP = tmps[i]; + if (!IsValid(iTMP)) + { + continue; + } + + // + datetime iValue = (datetime)iTMP; + + // + Add( + iValue, + result + // + ); + } + + // + int after = ArraySize(result); + + // + count = after - before; + + // + return count; +} + +// +// Surround an String by Specific Token ... +template +string Surround( + string mToken, // an String which used to Tokenize + T &value, // a Value for Tokenize it + string startString = "(", // Token Start Content + string endString = ")" // Token End Content +) +{ + // + string result = NULL; + + // + string strValue = ToString(value); + if (!IsValid(strValue)) + { + return result; + } + + // + result = + // + (IsValid(mToken) + ? mToken + : "") + + // + startString + + strValue + + endString + // + ; + + // + return result; +} + +// +template +string SurroundArray( + string mToken, + T &value[], + string startString = "(", // Token Start Content + string endString = ")" // Token End Content +) +{ + // + string result = NULL; + + // + string valueStr = ToString(value); + if (!IsValid(valueStr)) + { + return result; + } + + // + result = Surround( + mToken, + valueStr, + startString, + endString + // + ); + + // + return result; +} + +// +// Periods / Cycles ... + +// +// Converts an String to TimeFrame ... +ENUM_TIMEFRAMES ToPeriod(string value) +{ + // + if (StringLen(value) == 0) + { + return _Period; + } + + // + StringTrimLeft(value); + StringTrimRight(value); + + // + ENUM_TIMEFRAMES result = _Period; + + // + if (value == "M1") + { + result = PERIOD_M1; + } + else if (value == "M2") + { + result = PERIOD_M2; + } + else if (value == "M3") + { + result = PERIOD_M3; + } + else if (value == "M4") + { + result = PERIOD_M4; + } + else if (value == "M5") + { + result = PERIOD_M5; + } + else if (value == "M6") + { + result = PERIOD_M6; + } + else if (value == "M10") + { + result = PERIOD_M10; + } + else if (value == "M12") + { + result = PERIOD_M12; + } + else if (value == "M15") + { + result = PERIOD_M15; + } + else if (value == "M20") + { + result = PERIOD_M20; + } + else if (value == "M30") + { + result = PERIOD_M30; + } + else if (value == "H1") + { + result = PERIOD_H1; + } + else if (value == "H2") + { + result = PERIOD_H2; + } + else if (value == "H3") + { + result = PERIOD_H3; + } + else if (value == "H4") + { + result = PERIOD_H4; + } + else if (value == "H6") + { + result = PERIOD_H6; + } + else if (value == "H8") + { + result = PERIOD_H8; + } + else if (value == "H12") + { + result = PERIOD_H12; + } + else if (value == "D1") + { + result = PERIOD_D1; + } + else if (value == "W1") + { + result = PERIOD_W1; + } + else if (value == "MN1") + { + result = PERIOD_MN1; + } + + // + return result; +} + +// +// Converts Period to String ... +string ToString(ENUM_TIMEFRAMES mPeriod) +{ + // + string result = ""; + + // + string mPStr = EnumToString(mPeriod); + + string mPStrParts[]; + int partsCount = StringSplit( + mPStr, + StringGetCharacter("_", 0), + mPStrParts); + if (partsCount <= 0) + { + return result; + } + + // + result = mPStrParts[1]; + + // + return result; +} + +// +// Retrieve All Available Period as an Array ...s +int GetAllAvailablePeriods( + ENUM_TIMEFRAMES &result[] // Holds Result ... +) +{ + // + Clean(result); + + // + Add( + PERIOD_M1, + result + // + ); + + // + Add( + PERIOD_M2, + result + // + ); + + // + Add( + PERIOD_M3, + result + // + ); + + // + Add( + PERIOD_M4, + result + // + ); + + // + Add( + PERIOD_M5, + result + // + ); + + // + Add( + PERIOD_M6, + result + // + ); + + // + Add( + PERIOD_M10, + result + // + ); + + // + Add( + PERIOD_M12, + result + // + ); + + // + Add( + PERIOD_M15, + result + // + ); + + // + Add( + PERIOD_M20, + result + // + ); + + // + Add( + PERIOD_M30, + result + // + ); + + // + Add( + PERIOD_H1, + result + // + ); + + // + Add( + PERIOD_H2, + result + // + ); + + // + Add( + PERIOD_H3, + result + // + ); + + // + Add( + PERIOD_H4, + result + // + ); + + // + Add( + PERIOD_H6, + result + // + ); + + // + Add( + PERIOD_H8, + result + // + ); + + // + Add( + PERIOD_H12, + result + // + ); + + // + Add( + PERIOD_D1, + result + // + ); + + // + Add( + PERIOD_W1, + result + // + ); + + // + Add( + PERIOD_MN1, + result + // + ); + + // + int mResult = ArraySize(result); + + // + return mResult; +} + +// +// Get Specific Time Frame Start Candle Time ... +datetime GetPeriodStartTime( + string mSymbol = NULL, // Specified Symbol ... + ENUM_TIMEFRAMES mPeriod = NULL, // Specified Period ... + datetime mTime = NULL // Specified Bar Time of Host Period ... +) +{ + // + // Normalize Arg ... + mTime = NormalizeTime(mTime); + mSymbol = NormalizeSymbol(mSymbol); + mPeriod = NormalizePeriod(mPeriod); + + // + int barIndex = iBarShift( + mSymbol, + mPeriod, + mTime, + false + // + ); + + // + datetime result = GetBarTime( + mSymbol, + mPeriod, + barIndex + // + ); + + // + return result; +} + +// +// Converts an String to it's related Market Cycle ... +ENUM_X_MARKET_CYCLES ToCycle(string value) +{ + // + ENUM_X_MARKET_CYCLES result = X_MARKET_CYCLE_UNKNOWN; + + // + ENUM_X_MARKET_CYCLES cycles[]; + int count = GetAllMarketCycles(cycles); + for (int i = 0; i < count; i++) + { + // + ENUM_X_MARKET_CYCLES iCycle = cycles[i]; + string iStr = ToString(iCycle); + + // + if (value == iStr) + { + // + result = iCycle; + break; + } + } + + // + return result; +} + +// +// Converts a Cycle to it's String Representation ... +string ToString(ENUM_X_MARKET_CYCLES cycle) +{ + // + string result = ""; + + // + string mPStr = EnumToString(cycle); + + string mPStrParts[]; + int partsCount = StringSplit( + mPStr, + StringGetCharacter("_", 0), + mPStrParts); + if (partsCount <= 0) + { + return result; + } + + // + result = mPStrParts[3]; + + // + return result; +} + +// +// Retrieve all Available Cycles ... +int GetAllMarketCycles(ENUM_X_MARKET_CYCLES &result[]) +{ + // + int mResult = 0; + + // + Clean(result); + + // + ENUM_X_MARKET_CYCLES tmp[] = { + X_MARKET_CYCLE_UNKNOWN, + X_MARKET_CYCLE_SHORT, + X_MARKET_CYCLE_MEDIUM, + X_MARKET_CYCLE_LONG, + X_MARKET_CYCLE_HIND}; + + // + Copy( + tmp, + result); + + // + Clean(tmp); + + // + mResult = ArraySize(result); + + // + return mResult; +} + +// +// Retrieve Nearest Period base on Given Period ... +ENUM_TIMEFRAMES GetNearestPeriod(ENUM_TIMEFRAMES mPeriod) +{ + // + ENUM_TIMEFRAMES result = _Period; + + // + mPeriod = NormalizePeriod(mPeriod); + + // + switch (mPeriod) + { + // + case PERIOD_M1: + case PERIOD_M2: + result = PERIOD_M4; + break; + + // + case PERIOD_M3: + case PERIOD_M4: + result = PERIOD_M6; + break; + + // + case PERIOD_M5: + case PERIOD_M6: + case PERIOD_M10: + case PERIOD_M12: + result = PERIOD_M15; + break; + + // + case PERIOD_M15: + case PERIOD_M20: + result = PERIOD_M30; + break; + + // + case PERIOD_H1: + case PERIOD_H2: + case PERIOD_H3: + result = PERIOD_H4; + break; + + // + case PERIOD_H6: + case PERIOD_H8: + result = PERIOD_H12; + break; + + // + case PERIOD_H12: + result = PERIOD_D1; + break; + + // + case PERIOD_D1: + result = PERIOD_W1; + break; + + // + default: + result = PERIOD_MN1; + break; + } + + // + return result; +} + +// +// Retrieve Mediest Period base on Given Period ... +ENUM_TIMEFRAMES GetMediestPeriod(ENUM_TIMEFRAMES mPeriod) +{ + // + ENUM_TIMEFRAMES result = _Period; + + // + mPeriod = NormalizePeriod(mPeriod); + + // + switch (mPeriod) + { + // + case PERIOD_M1: + case PERIOD_M2: + result = PERIOD_M15; + break; + + // + case PERIOD_M3: + case PERIOD_M4: + result = PERIOD_M30; + break; + + // + case PERIOD_M5: + case PERIOD_M6: + case PERIOD_M10: + case PERIOD_M12: + result = PERIOD_H1; + break; + + // + case PERIOD_M15: + case PERIOD_M20: + result = PERIOD_H2; + break; + + // + case PERIOD_H1: + case PERIOD_H2: + case PERIOD_H3: + result = PERIOD_H8; + break; + + // + case PERIOD_H6: + case PERIOD_H8: + result = PERIOD_D1; + break; + + // + case PERIOD_H12: + result = PERIOD_W1; + break; + + // + case PERIOD_D1: + result = PERIOD_MN1; + break; + + // + default: + result = PERIOD_MN1; + break; + } + + // + return result; +} + +// +// Retrieve Longest Period base on Given Period ... +ENUM_TIMEFRAMES GetLongestPeriod(ENUM_TIMEFRAMES mPeriod) +{ + // + ENUM_TIMEFRAMES result = _Period; + + // + mPeriod = NormalizePeriod(mPeriod); + + // + switch (mPeriod) + { + // + case PERIOD_M1: + case PERIOD_M2: + result = PERIOD_M30; + break; + + // + case PERIOD_M3: + case PERIOD_M4: + result = PERIOD_H1; + break; + + // + case PERIOD_M5: + case PERIOD_M6: + case PERIOD_M10: + case PERIOD_M12: + result = PERIOD_H2; + break; + + // + case PERIOD_M15: + case PERIOD_M20: + result = PERIOD_H4; + break; + + // + case PERIOD_H1: + case PERIOD_H2: + case PERIOD_H3: + result = PERIOD_H12; + break; + + // + case PERIOD_H6: + case PERIOD_H8: + result = PERIOD_W1; + break; + + // + case PERIOD_H12: + result = PERIOD_MN1; + break; + + // + case PERIOD_D1: + result = PERIOD_MN1; + break; + + // + default: + result = PERIOD_MN1; + break; + } + + // + return result; +} + +// +// Retrieve Hindmost Period base on Given Period ... +ENUM_TIMEFRAMES GetHindMostPeriod(ENUM_TIMEFRAMES mPeriod) +{ + // + ENUM_TIMEFRAMES result = _Period; + + // + mPeriod = NormalizePeriod(mPeriod); + + // + switch (mPeriod) + { + // + case PERIOD_M1: + case PERIOD_M2: + result = PERIOD_H1; + break; + + // + case PERIOD_M3: + case PERIOD_M4: + result = PERIOD_H2; + break; + + // + case PERIOD_M5: + case PERIOD_M6: + case PERIOD_M10: + case PERIOD_M12: + result = PERIOD_H4; + break; + + // + case PERIOD_M15: + case PERIOD_M20: + result = PERIOD_H8; + break; + + // + case PERIOD_H1: + case PERIOD_H2: + case PERIOD_H3: + result = PERIOD_D1; + break; + + // + case PERIOD_H6: + case PERIOD_H8: + result = PERIOD_MN1; + break; + + // + case PERIOD_H12: + result = PERIOD_MN1; + break; + + // + case PERIOD_D1: + result = PERIOD_MN1; + break; + + // + default: + result = PERIOD_MN1; + break; + } + + // + return result; +} + +// +// Retrieve Specified Cycles Period related to Host Period ... +ENUM_TIMEFRAMES GetCyclePeriod( + ENUM_X_MARKET_CYCLES mCycle = NULL, // Specified Cycle + ENUM_TIMEFRAMES mPeriod = NULL // Host Period +) +{ + // + ENUM_TIMEFRAMES result = NULL; + + // + mPeriod = NormalizePeriod(mPeriod); + mCycle = NormalizeCycle(mCycle); + + // + switch (mCycle) + { + // + // Short ... + case X_MARKET_CYCLE_SHORT: + result = GetNearestPeriod(mPeriod); + break; + + // + // Medium ... + case X_MARKET_CYCLE_MEDIUM: + result = GetMediestPeriod(mPeriod); + break; + + // + // Long ... + case X_MARKET_CYCLE_LONG: + result = GetLongestPeriod(mPeriod); + break; + + // + // Hind ... + case X_MARKET_CYCLE_HIND: + result = GetHindMostPeriod(mPeriod); + break; + } + + // + return result; +} \ No newline at end of file diff --git a/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.draw.lib.mq5 b/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.draw.lib.mq5 new file mode 100644 index 0000000..2bdaf10 --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.draw.lib.mq5 @@ -0,0 +1,2443 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Draw Library +// -------------------------------------- +// Name: XDraw +// Description: provides Draw abilities ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Global Definitions: Variables, Properties and etc ... + +// +// Retrieve Chart Size in Pixel ... +struct XSize +{ + long width; + long height; + + // + int x; + int y; + int w; + int h; + + // + int wStep; + int hStep; +}; + +// +// Define a Draw Specifications ... +struct XDrawSpecifications +{ + // + // Props ... + + // + bool draw; // Draw or Not ... + + // + int width; // Draw Witdth ... + color clr; // Draw Color ... + ENUM_LINE_STYLE style; // Draw Style ... + + // + bool back; // in the background + bool fill; // fill object if supported + bool selection; // highlight to move + bool rayRight; // line's continuation to the right + bool hidden; // hidden in the object list + long zOrder; // priority for mouse click + + // + string label; // Label ... + color labelColor; // Label Color ... + double labelAngel; // Label Angle ... + string labelFont; // Label Font ... + int labelFontSize; // Label Font Size ... + ENUM_ANCHOR_POINT labelAnchor; // Label Anchor Point ... + + // + // Constructor ... + XDrawSpecifications() + { + Clean(); + } + + // + // Operator ... + void operator=(const XDrawSpecifications &value) + { + // + clr = value.clr; + draw = value.draw; + width = value.width; + style = value.style; + + // + back = value.back; + hidden = value.hidden; + zOrder = value.zOrder; + rayRight = value.rayRight; + selection = value.selection; + + // + fill = value.fill; + + // + label = value.label; + labelColor = value.labelColor; + labelAngel = value.labelAngel; + labelFont = value.labelFont; + labelFontSize = value.labelFontSize; + labelAnchor = value.labelAnchor; + } + + // + // Functions ... + + // + void Clean() + { + // + draw = false; + width = 1; + clr = CLR_NONE; + style = STYLE_SOLID; + + // + back = false; + hidden = false; + rayRight = false; + selection = false; + fill = false; + + // + zOrder = 0; + + // + label = ""; + labelColor = CLR_NONE; + labelAngel = 0; + labelFont = "Arial"; + labelFontSize = 20; + labelAnchor = ANCHOR_LEFT_UPPER; + } + + // + void Label( + string mLabel = "", // Label ... + color mLabelColor = CLR_NONE, // Label Color ... + string mLabelFont = "Arial", // Label Font ... + int mLabelFontSize = 20, // Label Font Size ... + ENUM_ANCHOR_POINT mLabelAnchor = ANCHOR_LEFT_UPPER, // Label Anchor Point ... + double mLabelAngel = 0 // Label Angle ... + ) + { + // + label = mLabel; + labelFont = mLabelFont; + labelColor = mLabelColor; + labelAngel = mLabelAngel; + labelAnchor = mLabelAnchor; + labelFontSize = mLabelFontSize; + } +}; + +// +// Candle Draw Specifications ... +struct XOHCLDrawSpecification +{ + // + // Props ... + XDrawSpecifications openStyle; + XDrawSpecifications highStyle; + XDrawSpecifications closeStyle; + XDrawSpecifications lowStyle; + + // + // Constructors ... + XOHCLDrawSpecification() + { + Clean(); + } + + // + // Operators ... + void operator=(const XOHCLDrawSpecification &value) + { + // + lowStyle = value.lowStyle; + openStyle = value.openStyle; + highStyle = value.highStyle; + closeStyle = value.closeStyle; + } + + // + // Functions ... + + // + void Clean() + { + // + lowStyle.Clean(); + openStyle.Clean(); + highStyle.Clean(); + closeStyle.Clean(); + } + + // + void Default() + { + // + // Open ... + openStyle.width = 1; + openStyle.draw = true; + openStyle.clr = clrLime; + openStyle.style = STYLE_SOLID; + openStyle.Label( + "O", + openStyle.clr); + + // + // High ... + highStyle.width = 1; + highStyle.draw = true; + highStyle.clr = clrAqua; + highStyle.style = STYLE_SOLID; + highStyle.Label( + "H", + highStyle.clr); + + // + // Close ... + closeStyle.width = 1; + closeStyle.draw = true; + closeStyle.clr = clrRed; + closeStyle.style = STYLE_SOLID; + closeStyle.Label( + "C", + closeStyle.clr); + + // + // Low ... + lowStyle.width = 1; + lowStyle.draw = true; + lowStyle.clr = clrMagenta; + lowStyle.style = STYLE_SOLID; + lowStyle.Label( + "L", + lowStyle.clr); + } + + // + void Width(int value) + { + // + lowStyle.width = value; + openStyle.width = value; + highStyle.width = value; + closeStyle.width = value; + } + + // + void Style(ENUM_LINE_STYLE value) + { + // + lowStyle.style = value; + openStyle.style = value; + highStyle.style = value; + closeStyle.style = value; + } + + // + void Color(color value) + { + // + lowStyle.clr = value; + openStyle.clr = value; + highStyle.clr = value; + closeStyle.clr = value; + } + + // + void RayRight(bool value) + { + // + lowStyle.rayRight = value; + openStyle.rayRight = value; + highStyle.rayRight = value; + closeStyle.rayRight = value; + } + + // + void Draw(bool value) + { + // + lowStyle.draw = value; + openStyle.draw = value; + highStyle.draw = value; + closeStyle.draw = value; + } + + // + void Back(bool value) + { + // + lowStyle.back = value; + openStyle.back = value; + highStyle.back = value; + closeStyle.back = value; + } + + // + void Fill(bool value) + { + // + lowStyle.fill = value; + openStyle.fill = value; + highStyle.fill = value; + closeStyle.fill = value; + } + + // + void Label(string value) + { + // + lowStyle.Label(value); + openStyle.Label(value); + highStyle.Label(value); + closeStyle.Label(value); + } + + // + void SetLabelPrefix(string value) + { + // + lowStyle.label = value + " " + lowStyle.label; + openStyle.label = value + " " + openStyle.label; + highStyle.label = value + " " + highStyle.label; + closeStyle.label = value + " " + closeStyle.label; + } +}; + +// +string drawPrefix = "X-OBJ"; + +// +// Common Draw Functions ... + +// +// remove drawn objects ... +void RemoveDraws( + string tag = NULL, + long chartId = -1, + int subWindow = -1 // +) +{ + // + // Normalize Args ... + // + if (tag == NULL) + { + tag = drawPrefix; + } + + // + if (chartId == -1) + { + chartId = 0; + } + + // + if (subWindow == -1) + { + subWindow = 0; + } + + // + for (int iObj = ObjectsTotal(chartId, subWindow) - 1; iObj >= 0; iObj--) + { + // + string on = ObjectName(chartId, iObj, subWindow); + if (StringFind(on, tag) >= 0) + { + ObjectDelete(chartId, on); + } + } + + // + // Redraw Chart ... + ChartRedraw(); +} + +// +bool RemoveDraw( + string name, + long chartId = -1, + int subWindow = -1 // +) +{ + // + bool result = false; + + // + if (chartId == -1) + { + chartId = 0; + } + + // + if (subWindow == -1) + { + subWindow = 0; + } + + // + string objName = ""; + for (int iObj = ObjectsTotal(chartId, subWindow) - 1; iObj >= 0; iObj--) + { + // + string on = ObjectName(chartId, iObj, subWindow); + if (StringFind(on, name) >= 0) + { + // + objName = on; + break; + } + } + + // + if (StringLen(objName) > 0) + { + result = ObjectDelete(chartId, objName); + } + + // + return result; +} + +// +// Deselect All Draws ... +void DeselectAllDraws() +{ + // + int objs = ObjectsTotal(ChartID(), 0); + for (int o = 0; o < objs; o++) + { + ObjectSetInteger(ChartID(), ObjectName(ChartID(), o, 0), OBJPROP_SELECTED, false); + } + + // + ChartRedraw(); +} + +// +// Check Object Exists ... +bool IsDrawExists( + string name, + long chartId = -1, + int subWindow = -1 // +) +{ + // + bool result = false; + + // + if (chartId == -1) + { + chartId = 0; + } + + // + if (subWindow == -1) + { + subWindow = 0; + } + + // + for (int iObj = ObjectsTotal(chartId, subWindow) - 1; iObj >= 0; iObj--) + { + // + string on = ObjectName(chartId, iObj, subWindow); + result = StringFind(on, name) >= 0; + if (result) + { + break; + } + } + + // + return result; +} + +// +// Regular Draws ... + +// +// Arrow Functions ... + +// +// Draw an Arrow Object on Chart ... +bool DrawArrow( + const long chartID = 0, // chart's ID + const string name = "Arrow", // arrow name + const int subWindow = 0, // subwindow index + datetime time = 0, // anchor point time + double price = 0, // anchor point price + const uchar arrowCode = 252, // arrow code + const ENUM_ARROW_ANCHOR anchor = ANCHOR_BOTTOM, // anchor point position + const color clr = clrAqua, // arrow color + const ENUM_LINE_STYLE style = STYLE_SOLID, // border line style + const int width = 3, // arrow size + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = false, // hidden in the object list + const long zOrder = 0 // Order Object ... +) +{ + // + bool result = false; + + // + // set anchor point coordinates if they are not set ... + ChangeArrowEmptyPoint(time, price); + + // + // reset the error value ... + ResetLastError(); + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // create an arrow ... + result = ObjectCreate(chartID, objName, OBJ_ARROW, subWindow, time, price); + if (!result) + { + return result; + } + + // + // set the arrow code ... + ObjectSetInteger(chartID, objName, OBJPROP_ARROWCODE, arrowCode); + + // + // set anchor type ... + ObjectSetInteger(chartID, objName, OBJPROP_ANCHOR, anchor); + + // + // set the arrow color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set the border line style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set the arrow's size ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving the arrow by mouse + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is false by default, if you want making it possible to highlight and move the object + // change it to true ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, true); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Move the anchor point of Arrow ... +bool MoveArrow( + const long chartID = 0, // chart's ID + const string name = "Arrow", // object name + datetime time = 0, // anchor point time coordinate + double price = 0 // anchor point price coordinate +) +{ + // + bool result = false; + + // + // if point position is not set, move it to the current bar having Bid price ... + if (!time) + { + time = TimeCurrent(); + } + + // + if (!price) + { + price = SymbolInfoDouble(_Symbol, SYMBOL_BID); + } + + // + // move the anchor point ... + result = ObjectMove(chartID, name, 0, time, price); + + // + return result; +} + +// +// Delete an arrow ... +bool DeleteArrow( + const long chartID = 0, // chart's ID + const string name = "Arrow" // arrow name +) +{ + // + bool result = false; + + // + // delete an arrow ... + result = !ObjectDelete(chartID, name); + + // + return result; +} + +// +// Change the arrow code ... +bool ArrowCodeChange( + const long chartID = 0, // chart's ID + const string name = "Arrow", // object name + const uchar code = 252 // arrow code +) +{ + // + bool result = false; + + // + // change the arrow code ... + result = ObjectSetInteger(chartID, name, OBJPROP_ARROWCODE, code); + + // + return result; +} + +// +// Change anchor type ... +bool ArrowAnchorChange( + const long chartID = 0, // chart's ID + const string name = "Arrow", // object name + const ENUM_ARROW_ANCHOR anchor = ANCHOR_TOP // anchor type +) +{ + // + bool result = false; + + // + // change anchor type ... + result = !ObjectSetInteger(chartID, name, OBJPROP_ANCHOR, anchor); + + // + return result; +} + +// +// Check anchor point values and set default values +// for empty ones ... +void ChangeArrowEmptyPoint( + datetime &time, + double &price // +) +{ + // + // if the point's time is not set, it will be on the current bar ... + if (!time) + { + time = TimeCurrent(); + } + + // + // if the point's price is not set, it will have Bid value ... + if (!price) + { + price = SymbolInfoDouble(_Symbol, SYMBOL_BID); + } +} + +// +// Horizontal Line Functions ... + +// +// Create, Draw the horizontal line ... +bool DrawHorizontalLine( + const long chartID = 0, // chart's ID + const string name = "HLine", // line name + const int subWindow = 0, // subwindow index + double price = 0, // line price + const color clr = clrRed, // line color + const ENUM_LINE_STYLE style = STYLE_SOLID, // line style + const int width = 1, // line width + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = false, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // if the price is not set, set it at the current Bid price level ... + if (!price) + { + price = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // create a horizontal line ... + result = ObjectCreate(chartID, objName, OBJ_HLINE, subWindow, 0, price); + if (!result) + { + return result; + } + + // + // set line color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set line display style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set line width ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving the line by mouse + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is true by default making it possible to highlight and move the object + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, selection); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Move horizontal line ... +bool MoveHorizontalLine( + const long chartID = 0, // chart's ID + const string name = "HLine", // line name + double price = 0 // line price +) +{ + // + bool result = false; + + // + // if the line price is not set, move it to the current Bid price level ... + if (!price) + { + price = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + + // + // move a horizontal line ... + result = ObjectMove(chartID, name, 0, 0, price); + + // + return result; +} + +// +// Delete a horizontal line ... +bool DeleteHorizontalLine( + const long chartID = 0, // chart's ID + const string name = "HLine" // line name +) +{ + // + bool result = false; + + // + // delete a horizontal line ... + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Vertical Line Functions ... + +// +// Create the vertical line ... +bool DrawVerticalLine( + const long chartID = 0, // chart's ID + const string name = "VLine", // line name + const int subWindow = 0, // subwindow index + datetime time = 0, // line time + const color clr = clrRed, // line color + const ENUM_LINE_STYLE style = STYLE_SOLID, // line style + const int width = 1, // line width + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = false, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // if the line time is not set, draw it via the last bar ... + if (!time) + { + time = TimeCurrent(); + } + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // create a vertical line ... + result = ObjectCreate(chartID, objName, OBJ_VLINE, subWindow, time, 0); + if (!result) + { + return result; + } + + // + // set line color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set line display style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set line width ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving the line by mouse + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is true by default making it possible to highlight and move the object ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, true); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Move the vertical line ... +bool MoveVerticalLine( + const long chartID = 0, // chart's ID + const string name = "VLine", // line name + datetime time = 0 // line time +) +{ + // + bool result = false; + + // + // if line time is not set, move the line to the last bar ... + if (!time) + { + time = TimeCurrent(); + } + + // + // move the vertical line ... + result = ObjectMove(chartID, name, 0, time, 0); + + // + return result; +} + +// +// Delete the vertical line ... +bool DeleteVerticalLine( + const long chartID = 0, // chart's ID + const string name = "VLine" // line name +) +{ + // + bool result = false; + + // + // delete the vertical line ... + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Rectangle Functions ... + +// +// Create rectangle by the given coordinates ... +bool DrawRectangle( + const long chartID = 0, // chart's ID + const string name = "Rectangle", // rectangle name + const int subWindow = 0, // subwindow index + datetime time1 = 0, // first point time + double price1 = 0, // first point price + datetime time2 = 0, // second point time + double price2 = 0, // second point price + const color clr = clrRed, // rectangle color + const ENUM_LINE_STYLE style = STYLE_SOLID, // style of rectangle lines + const int width = 1, // width of rectangle lines + const bool fill = false, // filling rectangle with color + const bool back = false, // in the background + const bool selection = true, // highlight to move + const bool hidden = true, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // Set anchor points' coordinates if they are not set ... + ChangeRectangleEmptyPoints(time1, price1, time2, price2); + + // + // Create a rectangle by the given coordinates ... + result = ObjectCreate(chartID, name, OBJ_RECTANGLE, subWindow, time1, price1, time2, price2); + if (!result) + { + return result; + } + + // + // Set rectangle color ... + ObjectSetInteger(chartID, name, OBJPROP_COLOR, clr); + + // + // Set the style of rectangle lines + ObjectSetInteger(chartID, name, OBJPROP_STYLE, style); + + // + // Set width of the rectangle lines ... + ObjectSetInteger(chartID, name, OBJPROP_WIDTH, width); + + // + // Enable (true) or disable (false) the mode of filling the rectangle ... + ObjectSetInteger(chartID, name, OBJPROP_FILL, fill); + + // + // Display in the foreground (false) or background (true) ... + ObjectSetInteger(chartID, name, OBJPROP_BACK, back); + + // + // Enable (true) or disable (false) the mode of highlighting the rectangle for moving + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is true by default making it possible to highlight and move the object + ObjectSetInteger(chartID, name, OBJPROP_SELECTABLE, selection); + + // + ObjectSetInteger(chartID, name, OBJPROP_SELECTED, selection); + + // + // Hide (true) or display (false) graphical object name in the object list ... + ObjectSetInteger(chartID, name, OBJPROP_HIDDEN, hidden); + + // + // Set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, name, OBJPROP_ZORDER, zOrder); + + // + // Successful execution + return result; +} + +// +// Move the rectangle anchor point ...s +bool RectanglePointChange( + const long chartID = 0, // chart's ID + const string name = "Rectangle", // rectangle name + const int pointIndex = 0, // anchor point index + datetime time = 0, // anchor point time coordinate + double price = 0 // anchor point price coordinate +) +{ + // + bool result = false; + + // + // if point position is not set, move it to the current bar having Bid price ... + if (!time) + { + time = TimeCurrent(); + } + + // + if (!price) + { + price = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + + // + // Move the anchor point ... + result = ObjectMove(chartID, name, pointIndex, time, price); + + // + return result; +} + +// +// Delete the rectangle ... +bool DeleteRectangle( + const long chartID = 0, // chart's ID + const string name = "Rectangle" // rectangle name +) +{ + // + bool result = false; + + // + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Check the values of rectangle's anchor points and set default +// values for empty ones +void ChangeRectangleEmptyPoints( + datetime &time1, double &price1, + datetime &time2, double &price2 // +) +{ + // + // if the first point's time is not set, it will be on the current bar ... + if (!time1) + { + time1 = TimeCurrent(); + } + + // + // if the first point's price is not set, it will have Bid value ... + if (!price1) + { + price1 = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + + // + // if the second point's time is not set, it is located 9 bars left from the second one ... + if (!time2) + { + // + // array for receiving the open time of the last 10 bars ... + datetime temp[10]; + CopyTime(Symbol(), Period(), time1, 10, temp); + + // + // set the second point 9 bars left from the first one ... + time2 = temp[0]; + } + + // + // if the second point's price is not set, move it 300 points lower than the first one ... + if (!price2) + { + price2 = price1 - 300 * SymbolInfoDouble(Symbol(), SYMBOL_POINT); + } +} + +// +// RectangleLabel Functions ... + +// +// Create Rectangle Label Object ... +bool DrawRectangleLabel( + const long chartID = 0, // chart's ID + const string name = "RectLabel", // label name + const int subWindow = 0, // subwindow index + const int x = 0, // X coordinate + const int y = 0, // Y coordinate + const int width = 50, // width + const int height = 18, // height + const color bgColor = clrWhiteSmoke, // background color + const ENUM_BORDER_TYPE border = BORDER_SUNKEN, // border type + const ENUM_BASE_CORNER corner = CORNER_LEFT_UPPER, // chart corner for anchoring + const color clr = clrRed, // flat border color (Flat) + const ENUM_LINE_STYLE style = STYLE_SOLID, // flat border style + const int lineWidth = 1, // flat border width + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = false, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // create a rectangle label + result = ObjectCreate(chartID, objName, OBJ_RECTANGLE_LABEL, subWindow, 0, 0); + if (!result) + { + return result; + } + + // + // set label coordinates ... + ObjectSetInteger(chartID, objName, OBJPROP_XDISTANCE, x); + ObjectSetInteger(chartID, objName, OBJPROP_YDISTANCE, y); + + // + // set label size ... + ObjectSetInteger(chartID, objName, OBJPROP_XSIZE, width); + ObjectSetInteger(chartID, objName, OBJPROP_YSIZE, height); + + // + // set background color ... + ObjectSetInteger(chartID, objName, OBJPROP_BGCOLOR, bgColor); + + // + // set border type ... + ObjectSetInteger(chartID, objName, OBJPROP_BORDER_TYPE, border); + + // + // set the chart's corner, relative to which point coordinates are defined ... + ObjectSetInteger(chartID, objName, OBJPROP_CORNER, corner); + + // + // set flat border color (in Flat mode) ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set flat border line style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set flat border width ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, lineWidth); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving the label by mouse ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, selection); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Move Rectangle Label .. +bool MoveRectangleLabel( + const long chartID = 0, // chart's ID + const string name = "RectLabel", // label name + const int x = 0, // X coordinate + const int y = 0 // Y coordinate +) +{ + // + bool result = false; + + // + // move the rectangle label ... + result = ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, x); + if (!result) + { + return result; + } + + // + result = ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, y); + + // + return result; +} + +// +// Delete the rectangle label ... +bool DeleteRectangleLabel( + const long chartID = 0, // chart's ID + const string name = "RectLabel" // label name +) +{ + // + bool result = false; + + // + // delete the label ... + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Change Rectangle Label Size ... +bool ChangeSizeRectangleLabel( + const long chartID = 0, // chart's ID + const string name = "RectLabel", // label name + const int width = 50, // label width + const int height = 18 // label height +) +{ + // + bool result = false; + + // + // change label size ... + result = ObjectSetInteger(chartID, name, OBJPROP_XSIZE, width); + if (!result) + { + return result; + } + + // + result = ObjectSetInteger(chartID, name, OBJPROP_YSIZE, height); + + // + return result; +} + +// +// Change rectangle label border type ... +bool RectLabelChangeBorderType( + const long chartID = 0, // chart's ID + const string name = "RectLabel", // label name + const ENUM_BORDER_TYPE border = BORDER_SUNKEN // border type +) +{ + // + bool result = false; + + // + // change border type ... + result = ObjectSetInteger(chartID, name, OBJPROP_BORDER_TYPE, border); + + // + return result; +} + +// +// TrendLine Funcions ... + +// +// Create a trend line by the given coordinates ... +bool DrawTrendLine( + const long chartID = 0, // chart's ID + const string name = "TrendLine", // line name + const int subWindow = 0, // subwindow index + datetime time1 = 0, // first point time + double price1 = 0, // first point price + datetime time2 = 0, // second point time + double price2 = 0, // second point price + const color clr = clrYellow, // line color + const ENUM_LINE_STYLE style = STYLE_SOLID, // line style + const int width = 1, // line width + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool rayRight = false, // line's continuation to the right + const bool hidden = false, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // set anchor points' coordinates if they are not set ... + ChangeTrendLineEmptyPoints( + time1, + price1, + time2, + price2); + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // create a trend line by the given coordinates ... + result = ObjectCreate(chartID, objName, OBJ_TREND, subWindow, time1, price1, time2, price2); + if (!result) + { + return result; + } + + // + // set line color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set line display style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set line width ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving the line by mouse + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is true by default making it possible to highlight and move the object ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, true); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // enable true or disable false the mode of continuation of the line's display to the right ... + ObjectSetInteger(chartID, objName, OBJPROP_RAY_RIGHT, rayRight); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Move trend line anchor point ... | +bool ChangeTrendLinePoint( + const long chartID = 0, // chart's ID + const string name = "TrendLine", // line name + const int pointindex = 0, // anchor point index + datetime time = 0, // anchor point time coordinate + double price = 0 // anchor point price coordinate +) +{ + // + bool result = false; + + // + // if point position is not set, move it to the current bar having Bid price ... + if (!time) + { + time = TimeCurrent(); + } + + // + if (!price) + { + price = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + + // + // move trend line's anchor point ... + result = ObjectMove(chartID, name, pointindex, time, price); + + // + return result; +} + +// +// The function deletes the trend line from the chart ... +bool DeleteTrendLine( + const long chartID = 0, // chart's ID + const string name = "TrendLine" // line name +) +{ + // + bool result = false; + + // + // delete a trend line ... + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Check the values of trend line's anchor points and set default ... +// values for empty ones ... +void ChangeTrendLineEmptyPoints( + datetime &time1, + double &price1, + datetime &time2, + double &price2 // +) +{ + // + // if the first point's time is not set, it will be on the current bar ... + if (!time1) + { + time1 = TimeCurrent(); + } + + // + // if the first point's price is not set, it will have Bid value ... + if (!price1) + { + price1 = SymbolInfoDouble(Symbol(), SYMBOL_BID); + } + + // + // if the second point's time is not set, it is located 9 bars left from the second one ... + if (!time2) + { + // + // array for receiving the open time of the last 10 bars ... + datetime temp[10]; + CopyTime(Symbol(), Period(), time1, 10, temp); + + // + // set the second point 9 bars left from the first one ... + time2 = temp[0]; + } + + // + // if the second point's price is not set, it is equal to the first point's one ... + if (!price2) + { + price2 = price1; + } +} + +// +// Text Functions ... + +// +// Create and Draw a Text Object ... +bool DrawText( + const long chartID = 0, // chart's ID + const string name = "Text", // object name + const int subWindow = 0, // subwindow index + datetime time = 0, // anchor point time + double price = 0, // anchor point price + const string text = "Text", // the text itself + const string font = "Arial", // font + const int fontSize = 10, // font size + const color clr = clrRed, // color + const double angle = 0.0, // text slope + const ENUM_ANCHOR_POINT anchor = ANCHOR_CENTER, // anchor type + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = true, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // set anchor point coordinates if they are not set ... + ChangeTextEmptyPoint(time, price); + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // + // create Text object + result = ObjectCreate(chartID, objName, OBJ_TEXT, subWindow, time, price); + if (!result) + { + return result; + } + + // + // set the text ... + ObjectSetString(chartID, objName, OBJPROP_TEXT, text); + + // + // set text font ... + ObjectSetString(chartID, objName, OBJPROP_FONT, font); + + // + // set font size ... + ObjectSetInteger(chartID, objName, OBJPROP_FONTSIZE, fontSize); + + // + // set the slope angle of the text ... + ObjectSetDouble(chartID, objName, OBJPROP_ANGLE, angle); + + // + // set anchor type ... + ObjectSetInteger(chartID, objName, OBJPROP_ANCHOR, anchor); + + // + // set color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving the object by mouse ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, true); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Move the anchor point ... +bool MoveText( + const long chartID = 0, // chart's ID + const string name = "Text", // object name + datetime time = 0, // anchor point time coordinate + double price = 0 // anchor point price coordinate +) +{ + // + bool result = false; + + // + // + // if point position is not set, move it to the current bar having Bid price + if (!time) + { + time = TimeCurrent(); + } + + // + if (!price) + { + price = SymbolInfoDouble(_Symbol, SYMBOL_BID); + } + + // + // move the anchor point ... + result = ObjectMove(chartID, name, 0, time, price); + + // + return result; +} + +// +// Change the object text ... +bool ChangeText( + const long chartID = 0, // chart's ID + const string name = "Text", // object name + const string text = "Text" // text +) +{ + // + bool result = false; + + // + // change object text ... + result = ObjectSetString(chartID, name, OBJPROP_TEXT, text); + + // + return result; +} + +// +// Delete Text object ... +bool DeleteText( + const long chartID = 0, // chart's ID + const string name = "Text" // object name +) +{ + // + bool result = false; + + // + // delete the object ... + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Check anchor point values and set default values +// for empty ones ... +void ChangeTextEmptyPoint( + datetime &time, + double &price // +) +{ + // + // if the point's time is not set, it will be on the current bar ... + if (!time) + { + time = TimeCurrent(); + } + + // + // if the point's price is not set, it will have Bid value ... + if (!price) + { + price = SymbolInfoDouble(_Symbol, SYMBOL_BID); + } +} + +// +// Fibonacchi Functions ... + +// +// Create Fibonacci Retracement by the given coordinates ... +bool DrawFibonacci( + const long chartID = 0, // chart's ID + const string name = "Fibonacci", // object name + const int subWindow = 0, // subwindow index + datetime time1 = 0, // first point time + double price1 = 0, // first point price + datetime time2 = 0, // second point time + double price2 = 0, // second point price + const color clr = clrRed, // object color + const ENUM_LINE_STYLE style = STYLE_SOLID, // object line style + const int width = 1, // object line width + const bool back = false, // in the background + const bool selection = true, // highlight to move + const bool rayRight = false, // object's continuation to the right + const bool hidden = true, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // set anchor points' coordinates if they are not set ... + ChangeFibonacciEmptyPoints(time1, price1, time2, price2); + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // Create Fibonacci Retracement by the given coordinates ... + result = ObjectCreate(chartID, objName, OBJ_FIBO, subWindow, time1, price1, time2, price2); + if (!result) + { + return result; + } + + // + // set color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set line style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set line width ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of highlighting the channel for moving + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is true by default making it possible to highlight and move the object ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, true); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // enable true or disable false the mode of continuation of the object's display to the right ... + ObjectSetInteger(chartID, objName, OBJPROP_RAY_RIGHT, rayRight); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // successful execution ... + return result; +} + +// +// Create Fibonacci Retracement by the given coordinates ... +bool DrawCustomFibonacci( + // + int levels, // number of level lines + double &values[], // values of level lines + color &colors[], // color of level lines + ENUM_LINE_STYLE &styles[], // style of level lines + int &widths[], // width of level lines + string &descriptions[], // level Descriptions + // + const long chartID = 0, // chart's ID + const string name = "Fibonacci", // object name + const int subWindow = 0, // subwindow index + datetime time1 = 0, // first point time + double price1 = 0, // first point price + datetime time2 = 0, // second point time + double price2 = 0, // second point price + const color clr = clrAqua, // object color + const ENUM_LINE_STYLE style = STYLE_DOT, // object line style + const int width = 1, // object line width + const bool back = false, // in the background + const bool selection = true, // highlight to move + const bool rayRight = false, // object's continuation to the right + const bool hidden = true, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // set anchor points' coordinates if they are not set ... + ChangeFibonacciEmptyPoints(time1, price1, time2, price2); + + // + // Normalize Name ... + string objName = drawPrefix + "_" + name; + + // + // Create Fibonacci Retracement by the given coordinates ... + result = ObjectCreate(chartID, name, OBJ_FIBO, subWindow, time1, price1, time2, price2); + if (!result) + { + return result; + } + + // + // set color ... + ObjectSetInteger(chartID, objName, OBJPROP_COLOR, clr); + + // + // set line style ... + ObjectSetInteger(chartID, objName, OBJPROP_STYLE, style); + + // + // set line width ... + ObjectSetInteger(chartID, objName, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true ... + ObjectSetInteger(chartID, objName, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of highlighting the channel for moving + // when creating a graphical object using ObjectCreate function, the object cannot be + // highlighted and moved by default. Inside this method, selection parameter + // is true by default making it possible to highlight and move the object ... + ObjectSetInteger(chartID, objName, OBJPROP_SELECTABLE, true); + ObjectSetInteger(chartID, objName, OBJPROP_SELECTED, selection); + + // + // enable true or disable false the mode of continuation of the object's display to the right ... + ObjectSetInteger(chartID, objName, OBJPROP_RAY_RIGHT, rayRight); + + // + // hide true or display false graphical object name in the object list ... + ObjectSetInteger(chartID, objName, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart ... + ObjectSetInteger(chartID, objName, OBJPROP_ZORDER, zOrder); + + // + // Change Levels Of Fibonacci ... + result = FibonacciLevelsSet( + levels, + values, + colors, + styles, + widths, + descriptions, + chartID, + objName); + + // + // successful execution ... + return result; +} + +// +// Set number of levels and their parameters ... +bool FibonacciLevelsSet( + int levels, // number of level lines + double &values[], // values of level lines + color &colors[], // color of level lines + ENUM_LINE_STYLE &styles[], // style of level lines + int &widths[], // width of level lines + string &descriptions[], // level Descriptions + const long chartID = 0, // chart's ID + const string name = "Fibonacci" // object name +) +{ + // + bool result = false; + + // + // check array sizes ... + result = levels == ArraySize(colors) && + levels == ArraySize(styles) && + levels == ArraySize(widths) && + levels == ArraySize(widths); + if (!result) + { + return result; + } + + // + // set the number of levels ... + ObjectSetInteger(chartID, name, OBJPROP_LEVELS, levels); + + // + // set the properties of levels in the loop ... + for (int i = 0; i < levels; i++) + { + // + // level value ... + ObjectSetDouble(chartID, name, OBJPROP_LEVELVALUE, i, values[i]); + + // + // level color ... + ObjectSetInteger(chartID, name, OBJPROP_LEVELCOLOR, i, colors[i]); + + // + // level style ... + ObjectSetInteger(chartID, name, OBJPROP_LEVELSTYLE, i, styles[i]); + + // + // level width ... + ObjectSetInteger(chartID, name, OBJPROP_LEVELWIDTH, i, widths[i]); + + // + // level description ... + // ObjectSetString(chartID, name, OBJPROP_LEVELTEXT, i, DoubleToString(100 * values[i], 1)); + ObjectSetString(chartID, name, OBJPROP_LEVELTEXT, i, descriptions[i]); + } + + // + // successful execution ... + return result; +} + +// +// Move Fibonacci Retracement anchor point ... +bool FibonacciPointChange( + const long chartID = 0, // chart's ID + const string name = "Fibonacci", // object name + const int pointIndex = 0, // anchor point index + datetime time = 0, // anchor point time coordinate + double price = 0 // anchor point price coordinate +) +{ + // + bool result = false; + + // + // if point position is not set, move it to the current bar having Bid price ... + if (!time) + { + time = TimeCurrent(); + } + + // + if (!price) + { + price = SymbolInfoDouble(_Symbol, SYMBOL_BID); + } + + // + // move the anchor point ... + result = ObjectMove(chartID, name, pointIndex, time, price); + + // + return result; +} + +// +// Delete Fibonacci Retracement ... +bool DeleteFibonachi( + const long chartID = 0, // chart's ID + const string name = "Fibonacci" // object name +) +{ + // + bool result = false; + + // + // delete the object ... + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Check the values of Fibonacci Retracement anchor points and set +// default values for empty ones ... +void ChangeFibonacciEmptyPoints( + datetime &time1, + double &price1, + datetime &time2, + double &price2 // +) +{ + // + // if the second point's time is not set, it will be on the current bar ... + if (!time2) + { + time2 = TimeCurrent(); + } + + // + // if the second point's price is not set, it will have Bid value ... + if (!price2) + { + price2 = SymbolInfoDouble(_Symbol, SYMBOL_BID); + } + + // + // if the first point's time is not set, it is located 9 bars left from the second one ... + if (!time1) + { + // + // array for receiving the open time of the last 10 bars ... + datetime temp[10]; + CopyTime(Symbol(), Period(), time2, 10, temp); + + // + // set the first point 9 bars left from the second one ... + time1 = temp[0]; + } + + // + // if the first point's price is not set, move it 200 points below the second one ... + if (!price1) + { + price1 = price2 - 200 * SymbolInfoDouble(_Symbol, SYMBOL_POINT); + } +} + +// +// Event Functions ... + +// +// Create an Event ... +bool EventCreate( + const long chartID = 0, // chart's ID + const string name = "Event", // object name + const int subWindow = 0, // subwindow index + const string text = "Content", // event text + datetime time = 0, // anchor point time + const color clr = clrRed, // color + const int width = 1, // point width when highlighted + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = true, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + if (!time) + { + time = TimeCurrent(); + } + + // + result = ObjectCreate(chartID, name, OBJ_EVENT, subWindow, time, 0); + if (!result) + { + return result; + } + + // + // set event text + ObjectSetString(chartID, name, OBJPROP_TEXT, text); + + // + // set color + ObjectSetInteger(chartID, name, OBJPROP_COLOR, clr); + + // + // set anchor point width if the object is highlighted + ObjectSetInteger(chartID, name, OBJPROP_WIDTH, width); + + // + // display in the foreground false or background true + ObjectSetInteger(chartID, name, OBJPROP_BACK, back); + + // + // enable true or disable false the mode of moving event by mouse + ObjectSetInteger(chartID, name, OBJPROP_SELECTABLE, selection); + ObjectSetInteger(chartID, name, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list + ObjectSetInteger(chartID, name, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart + ObjectSetInteger(chartID, name, OBJPROP_ZORDER, zOrder); + + // + // successful execution + return result; +} + +// +// Change Event object text +bool EventTextChange( + const long chartID = 0, // chart's ID + const string name = "Event", // event name + const string text = "Content" // text +) +{ + // + bool result = false; + + // + // change object text + result = ObjectSetString(chartID, name, OBJPROP_TEXT, text); + + // + return result; +} + +// +// Move Event object +bool EventMove( + const long chartID = 0, // chart's ID + const string name = "Event", // event name + datetime time = 0 // time +) +{ + // + bool result = false; + + // + // if time is not set, move event to the last bar + if (!time) + { + time = TimeCurrent(); + } + + // + // move the object + result = ObjectMove(chartID, name, 0, time, 0); + + // + return result; +} + +// +// Delete Event object +bool EventDelete( + const long chartID = 0, // chart's ID + const string name = "Event" // event name +) +{ + // + bool result = false; + + // + // delete the object + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Button Functions ... + +// +// Create the button ... +bool ButtonCreate( + const long chartID = 0, // chart's ID + const string name = "Button", // button name + const int subWindow = 0, // subwindow index + const int x = 0, // X coordinate + const int y = 0, // Y coordinate + const int width = 50, // button width + const int height = 15, // button height + const ENUM_BASE_CORNER corner = CORNER_LEFT_UPPER, // chart corner for anchoring + const string text = "Button", // text + const string font = "Arial", // font + const int fontSize = 8, // font size + const color clr = clrBlack, // text color + const color bgColor = clrLightGray, // background color + const color borderColor = clrNONE, // border color + const bool state = false, // pressed/released + const bool back = false, // in the background + const bool selection = false, // highlight to move + const bool hidden = true, // hidden in the object list + const long zOrder = 0 // priority for mouse click +) +{ + // + bool result = false; + + // + // create the button + result = ObjectCreate(chartID, name, OBJ_BUTTON, subWindow, 0, 0); + if (!result) + { + return result; + } + + // + // set button coordinates + ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, x); + ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, y); + + // + // set button size + ObjectSetInteger(chartID, name, OBJPROP_XSIZE, width); + ObjectSetInteger(chartID, name, OBJPROP_YSIZE, height); + + // + // set the chart's corner, relative to which point coordinates are defined + ObjectSetInteger(chartID, name, OBJPROP_CORNER, corner); + + // + // set the text + ObjectSetString(chartID, name, OBJPROP_TEXT, text); + + // + // set text font + ObjectSetString(chartID, name, OBJPROP_FONT, font); + + // + // set font size + ObjectSetInteger(chartID, name, OBJPROP_FONTSIZE, fontSize); + + // + // set text color + ObjectSetInteger(chartID, name, OBJPROP_COLOR, clr); + + // + // set background color + ObjectSetInteger(chartID, name, OBJPROP_BGCOLOR, bgColor); + + // + // set border color + ObjectSetInteger(chartID, name, OBJPROP_BORDER_COLOR, borderColor); + + // + // display in the foreground false or background true + ObjectSetInteger(chartID, name, OBJPROP_BACK, back); + + // + // set button state + ObjectSetInteger(chartID, name, OBJPROP_STATE, state); + + // + // enable true or disable false the mode of moving the button by mouse + ObjectSetInteger(chartID, name, OBJPROP_SELECTABLE, selection); + ObjectSetInteger(chartID, name, OBJPROP_SELECTED, selection); + + // + // hide true or display false graphical object name in the object list + ObjectSetInteger(chartID, name, OBJPROP_HIDDEN, hidden); + + // + // set the priority for receiving the event of a mouse click in the chart + ObjectSetInteger(chartID, name, OBJPROP_ZORDER, zOrder); + + // + return result; +} + +// +// Move the button ... +bool ButtonMove( + const long chartID = 0, // chart's ID + const string name = "Button", // button name + const int x = 0, // X coordinate + const int y = 0 // Y coordinate +) +{ + // + bool result = false; + + // + // move the button + + // + result = ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, x); + if (!result) + { + return result; + } + + // + result = ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, y); + + // + return result; +} + +// +// Change button size ... +bool ButtonChangeSize( + const long chartID = 0, // chart's ID + const string name = "Button", // button name + const int width = 50, // button width + const int height = 18 // button height +) +{ + // + bool result = false; + + // + // change the button size + + // + result = ObjectSetInteger(chartID, name, OBJPROP_XSIZE, width); + if (!result) + { + return result; + } + + // + result = ObjectSetInteger(chartID, name, OBJPROP_YSIZE, height); + + // + return result; +} + +// +// Change corner of the chart for binding the button ... +bool ButtonChangeCorner( + const long chartID = 0, // chart's ID + const string name = "Button", // button name + const ENUM_BASE_CORNER corner = CORNER_LEFT_UPPER // chart corner for anchoring +) +{ + // + bool result = false; + + // + // change anchor corner + result = ObjectSetInteger(chartID, name, OBJPROP_CORNER, corner); + + // + return result; +} + +// +// Change button text ... +bool ButtonTextChange( + const long chartID = 0, // chart's ID + const string name = "Button", // button name + const string text = "Text" // text +) +{ + // + bool result = false; + + // + // change object text + result = ObjectSetString(chartID, name, OBJPROP_TEXT, text); + + // + return result; +} + +// +// Delete the button ... +bool ButtonDelete( + const long chartID = 0, // chart's ID + const string name = "Button" // button name +) +{ + // + bool result = false; + + // + // delete the button + result = ObjectDelete(chartID, name); + + // + return result; +} + +// +// Chart Style Drawers ... + +// +// Apply Styles On Chart ... +void ApplyChartStyle( + long mChartId = -1, // chart's ID + ENUM_CHART_MODE mMode = CHART_CANDLES, // chart's mMode + bool mShowBidLine = true, // show bid line + bool mShowAskLine = true, // show ask line + bool mShowGrid = false, // show grids on chart + bool mShowVolumes = false, // show volumes + bool mShowTradeLevels = true, // Displaying trade levels in the chart (levels of open positions, Stop Loss, Take Profit and pending orders) + bool mAutoScroll = true, // chart autoscroll + bool mQuickNavigation = true, // chart quick navigation state + color mForeGroundColor = clrWhite, // chart's foreground color + color mBackGroundColor = clrBlack, // chart's background color + color mUpColor = clrGreen, // Up Color + color mDownColor = clrRed, // Down Color + color mBullishColor = clrGreen, // Bullish color + color mBearishColor = clrRed, // Bearish color + color mGridColor = clrGray, // grid color + color mBidLineColor = clrGray, // bid line color + color mAskLineColor = clrRed, // ask line color + color mLineColor = clrLime, // line mMode and doji candlestick color + color mStopColor = clrGold, // Color of stop order levels (Stop Loss and Take Profit) + color mVolumesColor = clrGreen // volumes color +) +{ + // + // Validate Args ... + if (mChartId == -1) + { + mChartId = 0; + } + + // + ChartSetInteger(mChartId, CHART_MODE, mMode); + ChartSetInteger(mChartId, CHART_SHOW_BID_LINE, mShowBidLine); + ChartSetInteger(mChartId, CHART_SHOW_ASK_LINE, mShowAskLine); + ChartSetInteger(mChartId, CHART_SHOW_GRID, mShowGrid); + ChartSetInteger(mChartId, CHART_SHOW_VOLUMES, mShowVolumes); + ChartSetInteger(mChartId, CHART_SHOW_TRADE_LEVELS, mShowTradeLevels); + ChartSetInteger(mChartId, CHART_AUTOSCROLL, mAutoScroll); + ChartSetInteger(mChartId, CHART_QUICK_NAVIGATION, mQuickNavigation); + ChartSetInteger(mChartId, CHART_COLOR_FOREGROUND, mForeGroundColor); + ChartSetInteger(mChartId, CHART_COLOR_BACKGROUND, mBackGroundColor); + ChartSetInteger(mChartId, CHART_COLOR_CHART_UP, mUpColor); + ChartSetInteger(mChartId, CHART_COLOR_CHART_DOWN, mDownColor); + ChartSetInteger(mChartId, CHART_COLOR_CANDLE_BULL, mBullishColor); + ChartSetInteger(mChartId, CHART_COLOR_CANDLE_BEAR, mBearishColor); + ChartSetInteger(mChartId, CHART_COLOR_GRID, mGridColor); + ChartSetInteger(mChartId, CHART_COLOR_BID, mBidLineColor); + ChartSetInteger(mChartId, CHART_COLOR_ASK, mAskLineColor); + ChartSetInteger(mChartId, CHART_COLOR_STOP_LEVEL, mStopColor); + ChartSetInteger(mChartId, CHART_COLOR_CHART_LINE, mLineColor); + ChartSetInteger(mChartId, CHART_COLOR_VOLUME, mVolumesColor); +} + +// +// Tools ... + +// +// Retrieve Chart Size ... +bool GetChartSize( + XSize &result, // Holds Result ... + long chartID = 0 // Specified Chart ID ... +) +{ + // + bool mResult = false; + + // + mResult = ChartGetInteger(0, CHART_WIDTH_IN_PIXELS, 0, result.width); + if (!mResult) + { + return mResult; + } + + // + mResult = ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS, 0, result.height); + + // + return mResult; +} diff --git a/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.xtrade.lib.mq5 b/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.xtrade.lib.mq5 new file mode 100644 index 0000000..8a8e9af --- /dev/null +++ b/MQLTestWorkspace/BKPS/14030308/Libraries/x-saherelm.xtrade.lib.mq5 @@ -0,0 +1,4112 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Seriallize Library +// --------------------------------------- +// Name: XTradeLib +// Description: All models related to Trade ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include +#include "../Libraries/x-saherelm.common.lib.mq5" +#include "../Classes/x-saherelm.xdata-collector.class.mq5" + +// +// Definitions ... + +// +// a List of Used Tokens ... + +// +// Common ... +string XIDToken = "ID"; +string XTicketToken = "TK"; +string XModeToken = "MD"; +string XTypeToken = "TY"; +string XPeriodToken = "PR"; +string XProviderToken = "PRV"; +string XProfitToken = "PF"; + +// +string XTPToken = "TP"; +string XSLToken = "SL"; +string XTimeToken = "TM"; +string XEntryToken = "EN"; +string XVolumeToken = "VL"; +string XSymbolToken = "SMBL"; + +// +string XSupportToken = "SP"; +string XEQMSupportToken = "EQM"; + +// +string XSLTrailToken = "SLT"; + +// +string XActionToken = "A"; + +// +// Available Order Modes ... +enum ENUM_X_ORDER_MODES +{ + X_ORDER_MODE_NOTHING, // Nothing + X_ORDER_MODE_MARKET, // Market Order + X_ORDER_MODE_STOP, // Pending Stop Order + X_ORDER_MODE_LIMIT, // Pending Limit Order + X_ORDER_MODE_STOP_LIMIT, // Pending Stop Limit Order +}; + +// +// Select Positions Type ... +enum ENUM_X_POSITION_SELECT_METHODS +{ + X_POSITION_SELECT_NONE, // None + X_POSITION_SELECT_MAX, // Max + X_POSITION_SELECT_MIN, // Min + X_POSITION_SELECT_BOTH, // Min and Max + X_POSITION_SELECT_ALL, // All +}; + +// +// Signal Execution Result ... +// note that some of them must be handles in +// EA's ... +enum ENUM_X_SIGNAL_EXECUTION_RESULT +{ + // + X_SIGNAL_EXECUTION_UNKNOWN, // Unknown + X_SIGNAL_EXECUTION_SUCCEED, // Succed + X_SIGNAL_EXECUTION_FAILED_SPREAD, // Spread more than Max Allowed + X_SIGNAL_EXECUTION_FAILED_NO_EQUITY, // No Equity for Trade + X_SIGNAL_EXECUTION_FAILED_PRICE_ERROR, // Price Error + X_SIGNAL_EXECUTION_FAILED_MAX_REACHED, // Max Allowed Positions Reached + X_SIGNAL_EXECUTION_FAILED_INVALID_PARAMS, // Invalid Params +}; + +// +// How to Manage Signal TP and SL ... +enum ENUM_X_SIGNAL_MANAGING_ACTIONS +{ + // + X_SIGNAL_USE_NOTHING, // Use 0 index if exists and ignore if not + X_SIGNAL_USE_MAX, // Use Max Value + X_SIGNAL_USE_MIN, // Use Min Value + X_SIGNAL_PARTIAL_CLOSE, // Use Max as Regular but Partial Close at each Step + X_SIGNAL_TRAIL, // Use 0 index as SL and Trail Stop on TP Levels + X_SIGNAL_PARTIAL_TRAIL, // Use 0 index as SL and Trail Stop on TP Levels and also Partial Close on TP Levels +}; + +// +// Available Guard Action ... +enum ENUM_X_GUARD_ACTIONS +{ + X_GUARD_ACTION_NOTHING, // Nothing + X_GUARD_ACTION_HEDGE, // Hedge + X_GUARD_PARTIAL_CLOSE, // Partial Close + X_GUARD_ACTION_TRAIL_STOP, // Trail StopLoss + X_GUARD_ACTION_FORCE_CLOSE, // Force Close + X_GUARD_ACTION_ADD_SUPPORT_SIGNAL, // Add Support Signal + X_GUARD_ACTION_CANCEL_PENDING_ORDERS, // Cancel Pending Orders +}; + +// +// Structs ... + +// +// Model a Signal ... +struct XSignal +{ + // + // Props ... + + // + ulong positionId; // if Executed this filled ... + double entry; // Exntry or Execution Price ... + double volume; // Position Volume ... + + // + datetime time; // Issue Time ... + + // + ENUM_X_SIGNAL_MANAGING_ACTIONS action; // Signal Managing Action ... + + double tps[]; // a Collection of TP(s) ... + double sls[]; // a Collection of SL(s) ... + + // + string symbol; // Trading Symbol ... + string provider; // Signaller ... + string comment; // Comment ... + + // + ENUM_TIMEFRAMES period; // Trading TimeFrame ... + ENUM_POSITION_TYPE type; // Long (Buy) or Short (Sell) ... + ENUM_X_ORDER_MODES mode; // Execution Mode ... + + // + XSignal supports[]; // a Collecion of Support Signals ... + XOHCLSupRes supportResistances; // Support and Resistances ... + + // + // Constructor ... + XSignal() + { + Clean(); + } + + // + // DO All Calculations and Normalizations ... + bool Normalize() + { + // + bool result = false; + + // + // Normalizations ... + symbol = NormalizeSymbol(symbol); + period = NormalizePeriod(period); + + // + entry = NormalizePrice(entry, symbol); + volume = NormalizeVolume(volume, symbol); + + // + time = NormalizeTime(time); + + // + int slsCount = ArraySize(sls); + if (slsCount > 0) + { + // + for (int i = 0; i < slsCount; i++) + { + sls[i] = NormalizePrice(sls[i], symbol); + } + } + + // + int tpsCount = ArraySize(tps); + if (tpsCount > 0) + { + // + for (int i = 0; i < tpsCount; i++) + { + tps[i] = NormalizePrice(tps[i], symbol); + } + } + + // + result = IsValid(); + + // + return result; + } + + // + bool Prepare( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + ENUM_POSITION_TYPE mType, // Long (Buy) or Short (Sell) + ENUM_X_ORDER_MODES mMode, // Execution Mode + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + bool result = false; + + // + result = + // + IsValid(mMode) && + IsValid(mSymbol) && + IsValid(mPeriod) && + NotEmpty(mEntry) && + NotEmpty(mVolume) && + IsValid(mProvider) + // + ; + if (!result) + { + return result; + } + + // + if (tp < 0) + { + tp = 0; + } + + // + if (sl < 0) + { + sl = 0; + } + + // + if (tp == 0 && sl == 0) + { + action = X_SIGNAL_USE_NOTHING; + } + + // + type = mType; + mode = mMode; + symbol = mSymbol; + period = mPeriod; + provider = mProvider; + + // + // Normalization Values ... + sl = NormalizePrice(sl, mSymbol); + tp = NormalizePrice(tp, mSymbol); + mEntry = NormalizePrice(mEntry, mSymbol); + mVolume = NormalizeVolume(mVolume, mSymbol); + + // + entry = mEntry; + volume = mVolume; + + // + action = mAction; + + // + Add( + sl, + sls + // + ); + + // + Add( + tp, + tps + // + ); + + // + result = Normalize(); + + // + return result; + } + + // + bool PrepareLong( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + ENUM_X_ORDER_MODES mMode, // Execution Mode + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return Prepare( + mSymbol, + mProvider, + mPeriod, + POSITION_TYPE_BUY, + mMode, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + bool PrepareShort( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + ENUM_X_ORDER_MODES mMode, // Execution Mode + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return Prepare( + mSymbol, + mProvider, + mPeriod, + POSITION_TYPE_SELL, + mMode, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + // Market Mode ... + + // + bool PrepareMarketLong( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return PrepareLong( + mSymbol, + mProvider, + mPeriod, + X_ORDER_MODE_MARKET, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + bool PrepareMarketShort( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return PrepareShort( + mSymbol, + mProvider, + mPeriod, + X_ORDER_MODE_MARKET, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + // Stop Mode ... + + // + bool PrepareStopLong( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return PrepareLong( + mSymbol, + mProvider, + mPeriod, + X_ORDER_MODE_STOP, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + bool PrepareStopShort( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return PrepareShort( + mSymbol, + mProvider, + mPeriod, + X_ORDER_MODE_STOP, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + // Limit Mode ... + + // + bool PrepareLimitLong( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return PrepareLong( + mSymbol, + mProvider, + mPeriod, + X_ORDER_MODE_LIMIT, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + bool PrepareLimitShort( + string mSymbol, // Trading Symbol + string mProvider, // Signal Provider + ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame + double mEntry, // Entry Price + double mVolume, // Volume + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action + double sl = 0, // Stop Loss + double tp = 0 // Take Profit + ) + { + // + return PrepareShort( + mSymbol, + mProvider, + mPeriod, + X_ORDER_MODE_LIMIT, + mEntry, + mVolume, + mAction, + sl, + tp + // + ); + } + + // + // here we Can Modify TP and SL and also Action ... + bool Modify( + ENUM_X_SIGNAL_MANAGING_ACTIONS mAction, + double &mTps[], + double &mSls[] + // + ) + { + // + bool result = false; + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + // Only Position Manager works on Market Execution Positions ... + if (mAction != X_SIGNAL_USE_NOTHING && + mode != X_ORDER_MODE_MARKET) + { + return result; + } + + // + int mTpsCount = ArraySize(mTps); + int mSlsCount = ArraySize(mSls); + + // + if (mAction != X_SIGNAL_USE_NOTHING) + { + // + if (mAction == X_SIGNAL_USE_MAX || + mAction == X_SIGNAL_USE_MIN || + mAction == X_SIGNAL_PARTIAL_TRAIL) + { + result = mTpsCount > 0 || mSlsCount > 0; + } + else + { + result = mTpsCount > 0 && mSlsCount > 0; + } + } + + // + if (result) + { + // + double defaultValue = 0; + + // + Copy( + mTps, + tps + // + ); + if (ArraySize(tps) <= 0) + { + // + Add( + defaultValue, + tps + // + ); + } + + // + Copy( + mSls, + sls + // + ); + if (ArraySize(sls) <= 0) + { + // + Add( + defaultValue, + sls + // + ); + } + + // + action = mAction; + + // + result = IsValid(); + } + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + entry = 0; + volume = 0; + positionId = 0; + + // + time = NULL; + type = NULL; + mode = NULL; + symbol = NULL; + period = NULL; + comment = NULL; + provider = NULL; + + // + Clean(tps); + Clean(sls); + Clean(supports); + supportResistances.Clean(); + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(period) && + IsValid(symbol) && + NotEmpty(volume) && + NotEmpty(entry) && + (ArraySize(tps) > 0 || + ArraySize(sls) > 0) + // + ; + + // + if (!result) + { + return result; + } + + // + // Validate Actions ... + + // + // Only Position Manager works on Market Execution Positions ... + result = + // + !(action != X_SIGNAL_USE_NOTHING && + mode != X_ORDER_MODE_MARKET) + // + ; + if (!result) + { + return result; + } + + // + int tpsCount = ArraySize(tps); + int slsCount = ArraySize(sls); + + // + if (action != X_SIGNAL_USE_NOTHING) + { + // + if (action == X_SIGNAL_USE_MAX || + action == X_SIGNAL_USE_MIN || + action == X_SIGNAL_PARTIAL_TRAIL) + { + result = tpsCount > 0 || slsCount > 0; + } + else + { + result = tpsCount > 0 && slsCount > 0; + } + } + + // + return result; + } + + // + // Check Signal Executed or not ... + bool IsExecuted() + { + // + bool result = false; + + // + result = + // + IsValid() && + NotEmpty(positionId) + // + ; + + // + return result; + } + + // + // Generate Comment for Signal ... + string GenerateComment() + { + // + string result = NULL; + + // + if (!IsValid()) + { + return result; + } + + // + if (IsValid(provider)) + { + // + // Generate Provider Tag ... + result += GenerateProviderTag(provider); + } + + // + if (IsValid(period)) + { + // + // Generate Period Tag ... + result += GeneratePeriodTag(period); + } + + // + return result; + } + + // + // Check this instance is Same os Given instance or not ... + bool IsSameAs( + const XSignal &value // instance for Compare + ) + { + // + bool result = false; + + // + result = + // + type == value.type && + mode == value.mode && + entry == value.entry && + volume == value.volume && + symbol == value.symbol && + provider == value.provider && + positionId == value.positionId && + ArraySize(sls) == ArraySize(value.sls) && + ArraySize(tps) == ArraySize(value.tps) + // + ; + + // + return result; + } + + // + // Find index in a Collection ... + int FindIndex( + const XSignal &values[] // Collection to Find + ) + { + // + return FindIndex( + this, + values + // + ); + } + + // + // Check Items Passed Specific Filters or not ... + bool IsFiltersPassed( + string mSymbol = NULL, // Trading Symbol + string mProvider = NULL, // Signal Provider + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe + ENUM_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell) + ENUM_X_ORDER_MODES mMode = NULL // Execution Mode + ) + { + // + bool result = false; + + // + result = + // + // Symbol Filter ... + IsSymbolFilterPassed( + mSymbol, + this + // + ) + // + && + // + // Provider Filter ... + IsProviderFilterPassed( + mProvider, + this + // + ) + // + && + // + // Period Filter ... + IsPeriodFilterPassed( + mPeriod, + this + // + ) + // + && + // + // Type Filter ... + IsTypeFilterPassed( + mType, + this + // + ) + // + && + // + // Mode Filter ... + IsModeFilterPassed( + mMode, + this + // + ) + // + ; + + // + return result; + } + + // + string GetToken() + { + return GetToken(this); + } + + // + bool IsModelValid() + { + return IsValid(); + } + + // + // To String Representation ... + string ToModelString() + { + // + string result = NULL; + + // + if (!IsValid()) + { + return result; + } + + // + // For Modeling a Signal we Only Used: + // - Period; + // - Provider; + // - Type; + // - Mode; + // - Symbol; + // - PositionID; + // - Entry; + // - Volume; + // - TPS; + // - SLS; + // - Issue Time; + + // + int iPeriodInt = (int)period; + + // + string periodStr = Surround(XPeriodToken, iPeriodInt); + string providerStr = Surround(XProviderToken, provider); + string typeStr = Surround(XTypeToken, type); + string modeStr = Surround(XModeToken, mode); + string SymbolStr = Surround(XSymbolToken, symbol); + string positionIdStr = Surround(XIDToken, positionId); + string entryStr = Surround(XEntryToken, entry); + string volumeStr = Surround(XVolumeToken, volume); + string timeStr = Surround(XTimeToken, time); + + // + string actionStr = Surround(XActionToken, action); + + // + // TP ... + string tpsContentStr = ToString(tps); + string tpsStr = Surround(XTPToken, tpsContentStr); + + // + // SL ... + string slsContentStr = ToString(sls); + string slsStr = Surround(XSLToken, slsContentStr); + + // + result = + // + GetToken() + + "[" + + // + periodStr + + providerStr + + typeStr + + modeStr + + SymbolStr + + positionIdStr + + entryStr + + volumeStr + + actionStr + + tpsStr + + slsStr + + timeStr + + // + "]" + // + ; + + // + return result; + } + + // + // Parse String Model and Fill Available + // Items ... + bool ParseModel(string value) + { + // + bool result = false; + + // + Clean(); + + // + if (!IsValid(value)) + { + return false; + } + + // + // For Modeling a Signal we Only Used: + // - Period; + // - Provider; + // - Type; + // - Mode; + // - Symbol; + // - PositionID; + // - Entry; + // - Volume; + // - TPS; + // - SLS; + // - Issue Time; + + // + entry = ParseDoubleSurrounded(value, XEntryToken); + volume = ParseDoubleSurrounded(value, XVolumeToken); + positionId = ParseLongSurrounded(value, XIDToken); + + // + time = ParseTimeSurrounded(value, XTimeToken); + symbol = ParseStringSurrounded(value, XSymbolToken); + provider = ParseStringSurrounded(value, XProviderToken); + type = ((ENUM_POSITION_TYPE)ParseIntSurrounded(value, XTypeToken)); + mode = ((ENUM_X_ORDER_MODES)ParseIntSurrounded(value, XModeToken)); + period = ((ENUM_TIMEFRAMES)ParseIntSurrounded(value, XPeriodToken)); + + // + action = ((ENUM_X_SIGNAL_MANAGING_ACTIONS)ParseIntSurrounded(value, XActionToken)); + + // + // TPS ... + ParseDoubleArraySurrounded( + tps, + value, + XTPToken + // + ); + + // + // SLS ... + ParseDoubleArraySurrounded( + sls, + value, + XSLToken + // + ); + + // + // Validate ... + result = IsValid(); + ; + + // + return result; + } + + // + // Select Regular SL ... + bool RegularSL(double &sl) + { + // + bool result = false; + + // + sl = 0; + int slsCount = ArraySize(sls); + + // + result = IsValid() && slsCount > 0; + if (!result) + { + return result; + } + + // + if ( + action == X_SIGNAL_TRAIL || + action == X_SIGNAL_USE_NOTHING || + action == X_SIGNAL_PARTIAL_TRAIL) + { + sl = sls[0]; + } + else if (action == X_SIGNAL_USE_MAX || + action == X_SIGNAL_PARTIAL_CLOSE) + { + sl = GetMin(sls); + } + else if (action == X_SIGNAL_USE_MIN) + { + sl = GetMax(sls); + } + + // + return result; + } + + // + // Select Regular TP ... + bool RegularTP(double &tp) + { + // + bool result = false; + + // + tp = 0; + int tpsCount = ArraySize(tps); + + // + result = IsValid() && tpsCount > 0; + if (!result) + { + return result; + } + + // + if ( + action == X_SIGNAL_TRAIL || + action == X_SIGNAL_USE_NOTHING || + action == X_SIGNAL_PARTIAL_TRAIL) + { + tp = tps[0]; + } + else if (action == X_SIGNAL_USE_MAX || + action == X_SIGNAL_PARTIAL_CLOSE) + { + tp = GetMax(tps); + } + else if (action == X_SIGNAL_USE_MIN) + { + tp = GetMin(tps); + } + + // + return result; + } + + // + // Retrieve Entry Price ... + double GetEntry() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = GetEntry( + symbol, + type + // + ); + + // + return result; + } + + // + // Retrieve Exit ... + double GetExit() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = GetExit( + symbol, + type + // + ); + + // + return result; + } + + // + // Get Spread by Point ... + double GetSpread() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = PriceToPoint(GetSpread(symbol)); + + // + return result; + } +}; + +// +// Model an Open Position ... +struct XPosition +{ + // + // Props ... + + // + // Magic Number ... + ulong magic; + + // + // Ticket ID ... + ulong ticket; + + // + // Tradinng Symbol ... + string symbol; + + // + // Trading Period ... + ENUM_TIMEFRAMES period; + + // + // Position Type ... + ENUM_POSITION_TYPE type; + + // + // Take Profit ... + double tp; + + // + // Stop Loss ... + double sl; + + // + // Position Current Profit ... + double profit; + + // + // Position Open Price ... + double entry; + + // + // Current Symbol Price ... + double price; + + // + // Position Swap ... + double swap; + + // + // Position Commission ... + double commission; + + // + // Volume ... + double volume; + + // + // Position Open Time ... + datetime openAt; + + // + // Sifnal Provider ... + string provider; + + // + // Position Comment ... + string comment; + + // + // Constructor ... + XPosition() + { + Clean(); + } + + // + // Initializers ... + + bool ByIndex(int index) + { + // + bool result = false; + + // + static CPositionInfo mPositionInfo; + + // + result = mPositionInfo.SelectByIndex(index); + if (!result) + { + return result; + } + + // + ulong mTicket = mPositionInfo.Ticket(); + + // + result = ByTicket(mTicket); + + // + return result; + } + + bool ByTicket(ulong mTicket) + { + // + bool result = false; + + // + static CPositionInfo mPositionInfo; + + // + result = mPositionInfo.SelectByTicket(mTicket); + if (!result) + { + return result; + } + + // + swap = mPositionInfo.Swap(); + magic = mPositionInfo.Magic(); + openAt = mPositionInfo.Time(); + sl = mPositionInfo.StopLoss(); + ticket = mPositionInfo.Ticket(); + symbol = mPositionInfo.Symbol(); + tp = mPositionInfo.TakeProfit(); + profit = mPositionInfo.Profit(); + volume = mPositionInfo.Volume(); + comment = mPositionInfo.Comment(); + entry = mPositionInfo.PriceOpen(); + type = mPositionInfo.PositionType(); + price = mPositionInfo.PriceCurrent(); + commission = mPositionInfo.Commission(); + + // + period = ExtractPeriod(comment); + provider = ExtractProvider(comment); + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + magic = 0; + ticket = 0; + tp = 0; + sl = 0; + swap = 0; + entry = 0; + price = 0; + profit = 0; + volume = 0; + openAt = 0; + commission = 0; + + // + type = NULL; + period = NULL; + + // + symbol = NULL; + comment = NULL; + provider = NULL; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + NotEmpty(ticket) + // + ; + + // + return result; + } + + // + // Retrieve Entry Price ... + double GetEntry() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = GetEntry( + symbol, + type + // + ); + + // + return result; + } + + // + // Retrieve Exit ... + double GetExit() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = GetExit( + symbol, + type + // + ); + + // + return result; + } + + // + // Get Spread by Point ... + double GetSpread() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = PriceToPoint(GetSpread(symbol)); + + // + return result; + } + + // + // Calculate Age ... + int GetAge( + ENUM_TIMEFRAMES mPeriod // Calculate Age based on this period + ) + { + return GetAge(this, mPeriod); + } + + // + // Check this instance is Same os Given instance or not ... + bool IsSameAs( + const XPosition &value // instance for Compare + ) + { + // + bool result = false; + + // + result = + // + type == value.type && + magic == value.magic && + entry == value.entry && + ticket == value.ticket && + volume == value.volume && + symbol == value.symbol && + provider == value.provider + // + ; + + // + return result; + } + + // + // Find index in a Collection ... + int FindIndex( + const XPosition &values[] // Collection to Find + ) + { + // + return FindIndex( + this, + values + // + ); + } + + // + // Check Items Passed Specific Filters or not ... + bool IsFiltersPassed( + string mSymbol = NULL, // Trading Symbol + string mProvider = NULL, // Signal Provider + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe + ENUM_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell) + ulong mMagic = NULL, // Magic Number + bool mFilterByMagic = true // Get Only Self Open Positions + ) + { + // + bool result = false; + + // + result = + // + // Magic Filter ... + IsMagicFilterPassed( + mMagic, + mFilterByMagic, + this + // + ) + // + && + // + // Symbol Filter ... + IsSymbolFilterPassed( + mSymbol, + this + // + ) + // + && + // + // Provider Filter ... + IsProviderFilterPassed( + mProvider, + this + // + ) + // + && + // + // Period Filter ... + IsPeriodFilterPassed( + mPeriod, + this + // + ) + // + && + // + // Type Filter ... + IsTypeFilterPassed( + mType, + this + // + ) + // + ; + + // + return result; + } +}; + +// +// Model an Order ... +struct XOrder +{ + // + // Time of order placement ... + datetime setupAt; + + // + // Time of order expiration ... + datetime expiredAt; + + // + // Time of order execution or cancellation ... + datetime executedAt; + + // + // Order type ... + ENUM_ORDER_TYPE type; + + // + // Order state ... + ENUM_ORDER_STATE state; + + // + // Type of execution by remainder ... + ENUM_ORDER_TYPE_FILLING filling; + + // + // Order lifetime ... + ENUM_ORDER_TYPE_TIME lifetime; + + // + // Order ticket ... + ulong ticket; + + // + // Magic Number ... + long magic; + + // + // Position id, that is placed on order, + // when it is executed. Each executed order invokes a + // deal, that opens new or changes existing + // position. Id of that position is placed on + // executed order in this moment. + long positionId; + + // + // Initial volume on order placement ... + double initialVolume; + + // + // Unfilled volume ... + double currentVolume; + + // + // Price, specified in the order ... + double openPrice; + + // + // Current price by order symbol ... + double currentPrice; + + // + // Price of placing Limit order when StopLimit order is triggered ... + double stopLimitPrice; + + // + // Take Profit level ... + double tp; + + // + // Stop Loss level ... + double sl; + + // + // Trading Symbol ... + string symbol; + + // + // Signal Provider ... + string provider; + + // + // Order Comment ... + string comment; + + // + ENUM_TIMEFRAMES period; + + // + // Constructor ... + XOrder() + { + Clean(); + } + + // + // Initializers ... + bool ByIndex( + int index // Fill By Index ... + ) + { + // + bool result = false; + + // + int ordersCount = OrdersTotal(); + if (ordersCount <= 0) + { + return result; + } + + // + static COrderInfo mOrderInfo; + + // + result = mOrderInfo.SelectByIndex(index); + if (!result) + { + return result; + } + + // + // Reading Order Info ... + magic = mOrderInfo.Magic(); + sl = mOrderInfo.StopLoss(); + tp = mOrderInfo.TakeProfit(); + ticket = mOrderInfo.Ticket(); + openPrice = mOrderInfo.PriceOpen(); + positionId = mOrderInfo.PositionId(); + currentPrice = mOrderInfo.PriceCurrent(); + initialVolume = mOrderInfo.VolumeInitial(); + currentVolume = mOrderInfo.VolumeCurrent(); + stopLimitPrice = mOrderInfo.PriceStopLimit(); + + // + symbol = mOrderInfo.Symbol(); + comment = mOrderInfo.Comment(); + + // + state = mOrderInfo.State(); + type = mOrderInfo.OrderType(); + lifetime = mOrderInfo.TypeTime(); + filling = mOrderInfo.TypeFilling(); + + // + setupAt = mOrderInfo.TimeSetup(); + executedAt = mOrderInfo.TimeDone(); + expiredAt = mOrderInfo.TimeExpiration(); + + // + period = ExtractPeriod(comment); + provider = ExtractProvider(comment); + + // + result = IsValid(); + + // + return result; + } + + // + // Retrieve Specific History Order ... + bool HistoryByIndex( + int index // Fill By Index ... + ) + { + // + bool result = false; + + // + int ordersCount = HistoryOrdersTotal(); + if (ordersCount <= 0) + { + return result; + } + + // + static CHistoryOrderInfo mOrderInfo; + + // + result = mOrderInfo.SelectByIndex(index); + if (!result) + { + return result; + } + + // + // Reading Order Info ... + magic = mOrderInfo.Magic(); + sl = mOrderInfo.StopLoss(); + tp = mOrderInfo.TakeProfit(); + ticket = mOrderInfo.Ticket(); + openPrice = mOrderInfo.PriceOpen(); + positionId = mOrderInfo.PositionId(); + currentPrice = mOrderInfo.PriceCurrent(); + initialVolume = mOrderInfo.VolumeInitial(); + currentVolume = mOrderInfo.VolumeCurrent(); + stopLimitPrice = mOrderInfo.PriceStopLimit(); + + // + symbol = mOrderInfo.Symbol(); + comment = mOrderInfo.Comment(); + + // + state = mOrderInfo.State(); + type = mOrderInfo.OrderType(); + lifetime = mOrderInfo.TypeTime(); + filling = mOrderInfo.TypeFilling(); + + // + setupAt = mOrderInfo.TimeSetup(); + executedAt = mOrderInfo.TimeDone(); + expiredAt = mOrderInfo.TimeExpiration(); + + // + period = ExtractPeriod(comment); + provider = ExtractProvider(comment); + + // + result = IsValid(); + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + tp = 0; + sl = 0; + magic = 0; + ticket = 0; + positionId = 0; + openPrice = 0; + currentPrice = 0; + initialVolume = 0; + currentVolume = 0; + stopLimitPrice = 0; + + // + setupAt = NULL; + expiredAt = NULL; + executedAt = NULL; + + // + symbol = NULL; + comment = NULL; + provider = NULL; + + // + type = NULL; + state = NULL; + period = NULL; + filling = NULL; + lifetime = NULL; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + NotEmpty(ticket) && + NotEmpty(positionId) + // + ; + + // + return result; + } + + // + // Calculate Age ... + int GetAge( + ENUM_TIMEFRAMES mPeriod // Calculate Age based on this period + ) + { + return GetAge(this, mPeriod); + } + + // + // Check this instance is Same os Given instance or not ... + bool IsSameAs( + const XOrder &value // instance for Compare + ) + { + // + bool result = false; + + // + result = + // + type == value.type && + state == value.state && + magic == value.magic && + ticket == value.ticket && + symbol == value.symbol && + provider == value.provider && + positionId == value.positionId + // + ; + + // + return result; + } + + // + // Find index in a Collection ... + int FindIndex( + const XOrder &values[] // Collection to Find + ) + { + // + return FindIndex( + this, + values + // + ); + } + + // + // Check Items Passed Specific Filters or not ... + bool IsFiltersPassed( + string mSymbol = NULL, // Trading Symbol + string mProvider = NULL, // Signal Provider + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe + ENUM_ORDER_TYPE mType = NULL, // Long (Buy), Short (Sell) + ENUM_ORDER_STATE mState = NULL, // Order State + ulong mMagic = NULL, // Magic Number + bool mFilterByMagic = true // Get Only Self Open Positions + ) + { + // + bool result = false; + + // + result = + // + // Magic Filter ... + IsMagicFilterPassed( + mMagic, + mFilterByMagic, + this + // + ) + // + && + // + // Symbol Filter ... + IsSymbolFilterPassed( + mSymbol, + this + // + ) + // + && + // + // Provider Filter ... + IsProviderFilterPassed( + mProvider, + this + // + ) + // + && + // + // Period Filter ... + IsPeriodFilterPassed( + mPeriod, + this + // + ) + // + && + // + // Type Filter ... + IsTypeFilterPassed( + mType, + this + // + ) + // + && + // + // State Filter ... + IsStateFilterPassed( + mState, + this + // + ) + // + ; + + // + return result; + } +}; + +// +// Model a Deal ... +struct XDeal +{ + // + // the ID of the Expert Advisor, that executed the deal ... + ulong magic; + + // + // the ID of position, in which the deal was involved ... + ulong positionId; + + // + // Ticket ... + ulong ticket; + + // + // the name of the deal symbol ... + string symbol; + + // + // order by which the deal is executed ... + ulong order; + + // + // the time of deal execution ... + datetime time; + + // + // Deal price ... + double price; + + // + // the financial result of the deal (in deposit currency) ... + double profit; + + // + // the amount of swap when position is closed ... + double swap; + + // + // the amount of commission of the deal ... + double commission; + + // + // the volume of deal ... + double volume; + + // + // the deal comment ... + string comment; + + // + string provider; + + // + ENUM_TIMEFRAMES period; + + // + // the deal type ... + // ------------------------------------------------------------------ + // DEAL_TYPE_BUY => Buy ... + // DEAL_TYPE_SELL => Sell ... + // DEAL_TYPE_BUY_CANCELED => Canceled buy deal ... + // There can be a situation when a previously executed buy deal is canceled. In this case, + // the type of the previously executed deal (DEAL_TYPE_BUY) is changed to DEAL_TYPE_BUY_CANCELED, + // and its profit/loss is zeroized. Previously obtained profit/loss is charged/withdrawn using a separated balance operation ... + // + // DEAL_TYPE_SELL_CANCELED => Canceled sell deal ... + // There can be a situation when a previously executed sell deal is canceled. In this case, + // the type of the previously executed deal (DEAL_TYPE_SELL) is changed to DEAL_TYPE_SELL_CANCELED, + // and its profit/loss is zeroized. Previously obtained profit/loss is charged/withdrawn using a separated balance operation + // + // DEAL_TYPE_BALANCE => Balance ... + // DEAL_TYPE_CREDIT => Credit ... + // DEAL_TYPE_CHARGE => Additional charge ... + // DEAL_TYPE_CORRECTION => Correction ... + // DEAL_TAX => Tax charges ... + // DEAL_TYPE_BONUS => Bonus ... + // DEAL_TYPE_INTEREST => Interest rate ... + // DEAL_DIVIDEND => Dividend operations... + // DEAL_DIVIDEND_FRANKED => Franked (non-taxable) dividend operations ... + // DEAL_TYPE_COMMISSION => Additional commission ... + // DEAL_TYPE_COMMISSION_DAILY => Daily commission ... + // DEAL_TYPE_COMMISSION_MONTHLY => Monthly commission ... + // DEAL_TYPE_COMMISSION_AGENT_DAILY => Daily agent commission ... + // DEAL_TYPE_COMMISSION_AGENT_MONTHLY => Monthly agent commission + ENUM_DEAL_TYPE type; + + // + // the deal direction ... + // ---------------------------------- + // DEAL_ENTRY_IN => Entry in ... + // DEAL_ENTRY_OUT => Entry out ... + // DEAL_ENTRY_INOUT => Reverse ... + // DEAL_ENTRY_OUT_BY => Close a position by an opposite one ... + ENUM_DEAL_ENTRY entry; + + // + // deal reson ... + // --------------------- + // DEAL_REASON_SL => The deal was executed as a result of Stop Loss activation ... + // DEAL_REASON_TP => The deal was executed as a result of Take Profit activation ... + // DEAL_REASON_SO => The deal was executed as a result of the Stop Out event ... + // DEAL_REASON_WEB => The deal was executed as a result of activation of an order placed from the web platform ... + // DEAL_REASON_SPLIT => The deal was executed after the split (price reduction) of an instrument, which had an open position during split announcement ... + // DEAL_REASON_CLIENT => The deal was executed as a result of activation of an order placed from a desktop terminal ... + // DEAL_REASON_MOBILE => The deal was executed as a result of activation of an order placed from a mobile application ... + // DEAL_REASON_EXPERT => The deal was executed as a result of activation of an order placed from an MQL5 program, i.e. an Expert Advisor or a script ... + // DEAL_REASON_VMARGIN => The deal was executed after charging the variation margin ... + // DEAL_REASON_ROLLOVER => The deal was executed due to a rollover ... + ENUM_DEAL_REASON reason; + + // + // Constructor ... + XDeal() + { + Clean(); + } + + // + // Initializers ... + bool ByIndex( + int index // Deal Index + ) + { + // + bool result = false; + + // + int dealsCount = HistoryDealsTotal(); + result = dealsCount > 0; + if (!result) + { + return result; + } + + // + static CDealInfo mDealInfo; + + // + result = mDealInfo.SelectByIndex(index); + if (!result) + { + // + return result; + } + + // + // Reading Order Info ... + swap = mDealInfo.Swap(); + magic = mDealInfo.Magic(); + order = mDealInfo.Order(); + ticket = mDealInfo.Ticket(); + time = mDealInfo.Time(); + price = mDealInfo.Price(); + symbol = mDealInfo.Symbol(); + profit = mDealInfo.Profit(); + volume = mDealInfo.Volume(); + comment = mDealInfo.Comment(); + positionId = mDealInfo.PositionId(); + entry = mDealInfo.Entry(); + commission = mDealInfo.Commission(); + type = mDealInfo.DealType(); + reason = (ENUM_DEAL_REASON)HistoryDealGetInteger( + ticket, + DEAL_REASON); + + // + period = ExtractPeriod(comment); + provider = ExtractProvider(comment); + + // + result = IsValid(); + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + magic = 0; + positionId = 0; + ticket = 0; + order = 0; + time = 0; + price = 0; + profit = 0; + swap = 0; + commission = 0; + volume = 0; + + // + symbol = NULL; + comment = NULL; + provider = NULL; + + // + type = NULL; + entry = NULL; + period = NULL; + reason = NULL; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + NotEmpty(ticket) && + NotEmpty(positionId) + // + ; + + // + return result; + } + + // + // Calculate Age ... + int GetAge( + ENUM_TIMEFRAMES mPeriod // Calculate Age based on this period + ) + { + return GetAge(this, mPeriod); + } + + // + // Check this instance is Same os Given instance or not ... + bool IsSameAs( + const XDeal &value // instance for Compare + ) + { + // + bool result = false; + + // + result = + // + type == value.type && + magic == value.magic && + entry == value.entry && + reason == value.reason && + ticket == value.ticket && + volume == value.volume && + symbol == value.symbol && + provider == value.provider && + positionId == value.positionId + // + ; + + // + return result; + } + + // + // Find index in a Collection ... + int FindIndex( + const XDeal &values[] // Collection to Find + ) + { + // + return FindIndex( + this, + values + // + ); + } + + // + // Check Items Passed Specific Filters or not ... + bool IsFiltersPassed( + string mSymbol = NULL, // Trading Symbol + string mProvider = NULL, // Signal Provider + ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe + ENUM_DEAL_TYPE mType = NULL, // Deal Type + ENUM_DEAL_ENTRY mEntry = NULL, // Deal Entry + ENUM_DEAL_REASON mReason = NULL, // Deal Reason + ulong mMagic = NULL, // Magic Number + bool mFilterByMagic = true // Get Only Self Open Positions + ) + { + // + bool result = false; + + // + result = + // + // Magic Filter ... + IsMagicFilterPassed( + mMagic, + mFilterByMagic, + this + // + ) + // + && + // + // Symbol Filter ... + IsSymbolFilterPassed( + mSymbol, + this + // + ) + // + && + // + // Provider Filter ... + IsProviderFilterPassed( + mProvider, + this + // + ) + // + && + // + // Period Filter ... + IsPeriodFilterPassed( + mPeriod, + this + // + ) + // + && + // + // Type Filter ... + IsTypeFilterPassed( + mType, + this + // + ) + // + && + // + // Entry Filter ... + IsEntryFilterPassed( + mEntry, + this + // + ) + // + && + // + // Reason Filter ... + IsReasonFilterPassed( + mReason, + this + // + ) + // + ; + + // + return result; + } +}; + +// +// Model OnTrade Event Handler Result on XCTrade Class ... +struct XOnTradeHandlerState +{ + // + bool hasNewDeal; + int newDeals; + + // + bool hasNewOrder; + int newOrders; + + // + bool hasNewPosition; + int newPositions; + + // + bool hasNewHistoryOrder; + int newHistoryOrders; + + // + // Constructor ... + XOnTradeHandlerState() + { + Clean(); + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + hasNewDeal = false; + hasNewOrder = false; + hasNewPosition = false; + hasNewHistoryOrder = false; + + // + newDeals = 0; + newOrders = 0; + newPositions = 0; + newHistoryOrders = 0; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + ( + // + hasNewDeal + ? newDeals > 0 + : true + // + ) + // + && + // + ( + // + hasNewOrder + ? newOrders > 0 + : true + // + ) + // + && + // + ( + // + hasNewPosition + ? newPositions > 0 + : true + // + ) + // + && + // + ( + // + hasNewHistoryOrder + ? newHistoryOrders > 0 + : true + // + ) + // + ; + + // + return result; + } +}; + +// +// Model Guard Info ... +struct XGuard +{ + // + string symbol; // Trading Symbol ... + string provider; // Signal Provider ... + ENUM_TIMEFRAMES period; // Trading Timeframe ... + ENUM_POSITION_TYPE type; // Position Type ... + ENUM_X_GUARD_ACTIONS action; // Which Action to Do ... + + // + double dblPayLoad; + string strPayload; + + // + // Constructor ... + XGuard() + { + Clean(); + } + + // + // Initialize ... + + // + // Global Initializer ... + bool Init( + string mSymbol, // Trading Symbol ... + ENUM_TIMEFRAMES mPeriod, // Trading Timeframe ... + ENUM_X_GUARD_ACTIONS mAction, // Which Action to Do ... + ENUM_POSITION_TYPE mType = NULL, // Position Type ... + string mProvider = NULL, // Signal Provider ... + double mDblPayLoad = NULL, + string mStrPayload = NULL // + ) + { + // + type = mType; + symbol = mSymbol; + period = mPeriod; + action = mAction; + provider = mProvider; + dblPayLoad = mDblPayLoad; + strPayload = mStrPayload; + + // + bool result = IsValid(); + + // + return result; + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + symbol = NULL; + provider = NULL; + period = NULL; + action = X_GUARD_ACTION_NOTHING; + + // + strPayload = NULL; + dblPayLoad = EMPTY_VALUE; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + action != X_GUARD_ACTION_NOTHING + // + ; + + // + return result; + } +}; + +// +// Model a Position with all of it's Supports ... +struct XPositionPack +{ + // + ulong ticket; // Main Position's Ticket + + // + XPosition position; // Main Position (if Exists) + + // + int supportOrdersCount; // Supported Orders (Untriggered) + int supportPositionsCount; // Supported Positions + + // + XOrder supportOrders[]; // Supported Orders (Untriggered) + XPosition supportPositions[]; // Supported Positions + + // + // Constructor ... + XPositionPack() + { + Clean(); + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + ticket = 0; + + // + position.Clean(); + + // + supportOrdersCount = 0; + supportPositionsCount = 0; + + // + Clean(supportOrders); + Clean(supportPositions); + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + NotEmpty(ticket) && + ( + // + supportOrdersCount > 0 + ? ArraySize(supportOrders) == supportOrdersCount + : true + // + ) + // + && + // + ( + // + supportPositionsCount > 0 + ? ArraySize(supportPositions) == supportPositionsCount + : true + // + ) + // + ; + + // + return result; + } +}; + +// +// Check Position SL Trails Structure ... +struct XTrail +{ + // + ulong ticket; // Position Ticket ... + ENUM_POSITION_TYPE type; // Type ... + datetime time; // Trail Time ... + double before; // SL Value Before Trailing ... + double after; // SL Value After Trailing ... + int level; // Number of Trails SL ... + double profit; // Profit in SL Time ... + + // + // Constructor ... + XTrail() + { + Clean(); + } + + // + // Tools ... + + // + bool Init( + ulong mTicket, // Ticket + ENUM_POSITION_TYPE mType, // Type + double mProfit, // Profit + double mBefore, // Before + double mAfter // After + ) + { + // + Clean(); + + // + type = mType; + after = mAfter; + ticket = mTicket; + before = mBefore; + profit = mProfit; + + // + level++; + + // + time = TimeCurrent(); + + // + return IsValid(); + } + + // + bool Update( + double mSl, // new SL ... + double mProfit // Profit + ) + { + // + bool result = false; + + // + time = TimeCurrent(); + + // + double cAfter = after; + after = mSl; + before = cAfter; + profit = mProfit; + + // + level++; + + // + result = IsValid(); + + // + return result; + } + + // + string GenerateTag() + { + // + string result = NULL; + + // + string ticketLevelStr = ToString(ticket) + "," + ToString(level); + + // + result = Surround( + XSLTrailToken, + ticketLevelStr // + ); + + // + return result; + } + + // + // Cleanup ... + void Clean() + { + // + ticket = 0; + time = 0; + before = 0; + after = 0; + level = 0; + } + + // + // Validate ... + bool IsValid() + { + // + bool result = false; + + // + result = + // + ticket > 0 && + time > 0 && + level > 0 + // + ; + + // + return result; + } +}; + +// +// TypeDefs ... + +// +typedef void (*TOnDealsChanged)(int count); + +// +typedef void (*TOnOrdersChanged)(int count); + +// +typedef void (*TOnPositionsChanged)(int count); + +// +typedef void (*TOnStopLoss)(const XDeal &deal); +typedef void (*TOnTakeProfit)(const XDeal &deal); + +// +typedef void (*TOnTradeStateChanged)(const XOnTradeHandlerState &state); + +// +// Classes ... + +// +// Create a Signal Specfic Data Collector ... +class XSCSignalCollector +{ + // + // Public ... +public: + // + // Props ... + + // + // Constructor ... + void XSCSignalCollector() + { + // + XSCDataCollector mBase; + mBase.Clear(); + } + + // + // Deconstructor ... + + // + // Tools ... + + // + // Inheritanced Functions ... + + // + // Cleaning Store ... + void Clear() + { + // + XSCDataCollector mBase; + + // + mBase.Clear(); + } + + // + // Collect All Store ... + int Collect(XSignal &result[]) + { + // + int mResult = 0; + + // + XSCDataCollector mBase; + + // + mResult = mBase.Collect(result); + + // + return mResult; + } + + // + // Add Item To Store ... + bool Add(XSignal &item) + { + // + bool result = false; + + // + XSCDataCollector mBase; + + // + result = mBase.Add(item); + + // + return result; + } + + // + // Add Item(s) To Store ... + int Add(XSignal &items[]) + { + // + int result = 0; + + // + XSCDataCollector mBase; + + // + result = mBase.Add(items); + + // + return result; + } + + // + // Remove an Item from Store ... + bool Remove(XSignal &item) + { + // + bool result = false; + + // + XSCDataCollector mBase; + + // + result = mBase.Remove(item); + + // + return result; + } + + // + // Custom Functions ... + + // + int CollectSignals( + XSignal &result[], // Hold Result + string symbol = NULL, // Trading Symbol + string provider = NULL, // Signal Provider + ENUM_TIMEFRAMES period = NULL, // Trading Timeframe + ENUM_POSITION_TYPE type = NULL, // Long (Buy), Short (Sell) + ENUM_X_ORDER_MODES mode = NULL // Execution Mode + ) + { + // + int mResult = 0; + + // + XSignal signals[]; + int signalsCount = Collect(signals); + if (signalsCount <= 0) + { + return mResult; + } + + // + mResult = ArraySize(result); + + // + // Now we Have to Apply Filters ... + for (int i = 0; i < signalsCount; i++) + { + // + XSignal iSignal = signals[i]; + + // + bool isFiltersPassed = + iSignal.IsFiltersPassed( + symbol, + provider, + period, + type, + mode + // + ); + if (!isFiltersPassed) + { + continue; + } + + // + AddRef( + iSignal, + result + // + ); + } + + // + return mResult; + } + + // + // Protected ... +protected: + // + // Tools ... + + // + // Private ... +private: + // + // Props ... + + // + // Tools ... +}; + +// +// Tools ... + +// +bool IsValid(ENUM_X_ORDER_MODES value) +{ + return value != X_ORDER_MODE_NOTHING; +} + +// +// Ages ... + +// +// Retrieve a Position Age ... +int GetAge( + XPosition &position, // Selected Position ... + ENUM_TIMEFRAMES period = NULL // Dest Time Frame ... +) +{ + // + int result = -1; + + // + if (period == NULL) + { + period = _Period; + } + + // + result = iBarShift( + position.symbol, + period, + position.openAt); + + // + return result; +} + +// +// Retrieve an Order Age ... +int GetAge( + XOrder &order, // Selected Order ... + ENUM_TIMEFRAMES period = NULL // Dest Time Frame ... +) +{ + // + int result = -1; + + // + if (period == NULL) + { + period = _Period; + } + + // + result = iBarShift( + order.symbol, + period, + order.setupAt); + + // + return result; +} + +// +// Retrieve a Deal Age ... +int GetAge( + XDeal &deal, // Selected Deal ... + ENUM_TIMEFRAMES period = NULL // Dest Time Frame ... +) +{ + // + int result = -1; + + // + if (period == NULL) + { + period = _Period; + } + + // + result = iBarShift( + deal.symbol, + period, + deal.time); + + // + return result; +} + +// +// Get Oldest Deal ... +int GetOldest( + XDeal &item, // Hold Result ... + XDeal &items[] // Source Array ... +) +{ + // + int result = -1; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + int tmpAge = 0; + XDeal tmpItem; + for (int i = 0; i < itemsCount; i++) + { + // + XDeal iItem = items[i]; + + // + int iAge = GetAge(iItem); + if (iAge > 0 && + (tmpAge == 0 || tmpAge < iAge)) + { + // + tmpAge = iAge; + tmpItem = iItem; + } + } + + // + if (tmpAge > 0) + { + // + result = tmpAge; + item = tmpItem; + } + + // + return result; +} + +// +// Get Youngest Deal ... +int GetYoungest( + XDeal &item, // Hold Result ... + XDeal &items[] // Source Array ... +) +{ + // + int result = -1; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + int tmpAge = 0; + XDeal tmpItem; + for (int i = 0; i < itemsCount; i++) + { + // + XDeal iItem = items[i]; + + // + int iAge = GetAge(iItem); + if (iAge > 0 && + (tmpAge == 0 || tmpAge > iAge)) + { + // + tmpAge = iAge; + tmpItem = iItem; + } + } + + // + if (tmpAge > 0) + { + // + result = tmpAge; + item = tmpItem; + } + + // + return result; +} + +// +// Get Oldest Order ... +int GetOldest( + XOrder &item, // Hold Result ... + XOrder &items[] // Source Array ... +) +{ + // + int result = -1; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + int tmpAge = 0; + XOrder tmpItem; + for (int i = 0; i < itemsCount; i++) + { + // + XOrder iItem = items[i]; + + // + int iAge = GetAge(iItem); + if (iAge > 0 && + (tmpAge == 0 || tmpAge < iAge)) + { + // + tmpAge = iAge; + tmpItem = iItem; + } + } + + // + if (tmpAge > 0) + { + // + result = tmpAge; + item = tmpItem; + } + + // + return result; +} + +// +// Get Youngest Order ... +int GetYoungest( + XOrder &item, // Hold Result ... + XOrder &items[] // Source Array ... +) +{ + // + int result = -1; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + int tmpAge = 0; + XOrder tmpItem; + for (int i = 0; i < itemsCount; i++) + { + // + XOrder iItem = items[i]; + + // + int iAge = GetAge(iItem); + if (iAge > 0 && + (tmpAge == 0 || tmpAge > iAge)) + { + // + tmpAge = iAge; + tmpItem = iItem; + } + } + + // + if (tmpAge > 0) + { + // + result = tmpAge; + item = tmpItem; + } + + // + return result; +} + +// +// Get Oldes Position ... +int GetOldest( + XPosition &item, // Hold Result ... + XPosition &items[] // Source Array ... +) +{ + // + int result = -1; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + int tmpAge = 0; + XPosition tmpItem; + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = items[i]; + + // + int iAge = GetAge(iItem); + if (iAge > 0 && + (tmpAge == 0 || tmpAge < iAge)) + { + // + tmpAge = iAge; + tmpItem = iItem; + } + } + + // + if (tmpAge > 0) + { + // + result = tmpAge; + item = tmpItem; + } + + // + return result; +} + +// +// Get Youngest Position ... +int GetYoungest( + XPosition &item, // Hold Result ... + XPosition &items[] // Source Array ... +) +{ + // + int result = -1; + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + int tmpAge = 0; + XPosition tmpItem; + for (int i = 0; i < itemsCount; i++) + { + // + XPosition iItem = items[i]; + + // + int iAge = GetAge(iItem); + if (iAge > 0 && + (tmpAge == 0 || tmpAge > iAge)) + { + // + tmpAge = iAge; + tmpItem = iItem; + } + } + + // + if (tmpAge > 0) + { + // + result = tmpAge; + item = tmpItem; + } + + // + return result; +} + +// +// Check Filters ... + +// +// Magic Filter ... +template +bool IsMagicFilterPassed( + ulong magic, + bool filterByMagic, + T &item + // +) +{ + // + return !filterByMagic + ? true + : !NotEmpty(magic) + ? false + : magic == item.magic; +} + +// +// Symbol Filter ... +template +bool IsSymbolFilterPassed( + string symbol, + T &item + // +) +{ + // + return !IsValid(symbol) + ? true + : symbol == item.symbol; +} + +// +// Provider Filter ... +template +bool IsProviderFilterPassed( + string provider, + T &item + // +) +{ + // + return !IsValid(provider) + ? true + : provider == item.provider; +} + +// +// Period Filter ... +template +bool IsPeriodFilterPassed( + ENUM_TIMEFRAMES period, + T &item + // +) +{ + // + return !IsValid(period) + ? true + : period == item.period; +} + +// +// Type Filter ... +template +bool IsTypeFilterPassed( + ENUM_POSITION_TYPE type, + T &item + // +) +{ + // + return type == NULL + ? true + : type == item.type; +} +template +bool IsTypeFilterPassed( + ENUM_ORDER_TYPE type, + T &item + // +) +{ + // + return type == NULL + ? true + : type == item.type; +} +template +bool IsTypeFilterPassed( + ENUM_DEAL_TYPE type, + T &item + // +) +{ + // + return type == NULL + ? true + : type == item.type; +} + +// +// Mode Filter ... +template +bool IsModeFilterPassed( + ENUM_X_ORDER_MODES mode, + T &item + // +) +{ + // + return mode == NULL + ? true + : mode == item.mode; +} + +// +// Entry Filter ... +template +bool IsEntryFilterPassed( + ENUM_DEAL_ENTRY entry, + T &item + // +) +{ + // + return entry == NULL + ? true + : entry == item.entry; +} + +// +// Reason Filter ... +template +bool IsReasonFilterPassed( + ENUM_DEAL_REASON reason, + T &item + // +) +{ + // + return reason == NULL + ? true + : reason == item.reason; +} + +// +// State Filter ... +template +bool IsStateFilterPassed( + ENUM_ORDER_STATE state, + T &item + // +) +{ + // + return state == NULL + ? true + : state == item.state; +} + +// + +// +// Find Specific Item Index inside a Collection ... +template +int FindIndex( + T &item, // Item to Find + const T &items[] // Items for Search +) +{ + // + int result = -1; + + // + // Check Item Validation ... + if (!item.IsValid()) + { + return result; + } + + // + int itemsCount = ArraySize(items); + if (itemsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < itemsCount; i++) + { + // + T iItem = items[i]; + + // + // Validate Item ... + if (!iItem.IsValid()) + { + continue; + } + + // + bool isSame = item.IsSameAs(iItem); + if (isSame && result <= -1) + { + // + result = i; + break; + } + } + + // + return result; +} + +// +// +// Calculate Positions Profit Summary ... +double SpecifiedCalculatePositionsProfit( + XPosition &positions[] // Source +) +{ + // + double result = 0; + + // + int positionsCount = ArraySize(positions); + if (positionsCount <= 0) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + result += iPosition.profit; + } + + // + return result; +} + +// +// Calculate Required Profit for Hedging ... +double SpecifiedCalculateRequiredProfitForHedge( + XPosition &positions[], // Source + double mMinProfitPerTrade, + double mMinProfitPerVolumeFactor // +) +{ + // + double result = 0; + + // + int positionsCount = ArraySize(positions); + if (positionsCount <= 0) + { + return result; + } + + // + bool isHedgingEnable = mMinProfitPerTrade > 0 && mMinProfitPerVolumeFactor > 0; + if (!isHedgingEnable) + { + return result; + } + + // + for (int i = 0; i < positionsCount; i++) + { + // + XPosition iPosition = positions[i]; + + // + if (mMinProfitPerTrade > 0 && mMinProfitPerVolumeFactor > 0) + { + // + result += + ((iPosition.volume / mMinProfitPerVolumeFactor) * + mMinProfitPerTrade) + + (-1 * iPosition.swap); + } + } + + // + return result; +} + +// +bool SpecifiedIsPositionsReadyForHedge( + XPosition &positions[], // Source + double mMinProfitPerTrade, + double mMinProfitPerVolumeFactor // +) +{ + // + double profit = SpecifiedCalculatePositionsProfit(positions); + double requiredProfit = SpecifiedCalculateRequiredProfitForHedge( + positions, + mMinProfitPerTrade, + mMinProfitPerVolumeFactor // + ); + + // + bool result = requiredProfit > 0 + ? profit >= requiredProfit + : profit > requiredProfit; + + // + return result; +} + +// +// Retrieve String Representation ... +string ToString(ENUM_X_SIGNAL_EXECUTION_RESULT value) +{ + // + string result = NULL; + + // + switch (value) + { + // + case X_SIGNAL_EXECUTION_UNKNOWN: + result = "Unknown"; + break; + + // + case X_SIGNAL_EXECUTION_SUCCEED: + result = "Succed"; + break; + + // + case X_SIGNAL_EXECUTION_FAILED_SPREAD: + result = "Spread more than Max Allowed"; + break; + + // + case X_SIGNAL_EXECUTION_FAILED_NO_EQUITY: + result = "No Equity for Trade"; + break; + + // + case X_SIGNAL_EXECUTION_FAILED_PRICE_ERROR: + result = "Price Error"; + break; + + // + case X_SIGNAL_EXECUTION_FAILED_MAX_REACHED: + result = "Max Allowed Positions Reached"; + break; + + // + case X_SIGNAL_EXECUTION_FAILED_INVALID_PARAMS: + result = "Invalid Params"; + break; + } + + // + return result; +} + +// +// Converts Position Type to Order Type ... +ENUM_ORDER_TYPE ToOrderType(ENUM_POSITION_TYPE value) +{ + // + bool isLong = IsLong(value); + + // + ENUM_ORDER_TYPE result = + isLong + ? ORDER_TYPE_BUY + : ORDER_TYPE_SELL; + + // + return result; +} + +// +// Tagging ... + +// +// Generate Specified Tag for Using in Comments ... +string GeneratePeriodTag(ENUM_TIMEFRAMES period) +{ + // + string strPeriod = ToString(period); + return Surround( + XPeriodToken, + strPeriod + // + ); +} + +// +// Extract Period from a Tagged string ... +ENUM_TIMEFRAMES ExtractPeriod(string value) +{ + // + ENUM_TIMEFRAMES result = NULL; + + // + string pStr = ParseStringSurrounded( + value, + XPeriodToken + // + ); + if (!IsValid(pStr)) + { + return result; + } + + // + result = ToPeriod(pStr); + + // + return result; +} + +// Generate Specified Tag for Using in Comments ... +string GenerateProviderTag(string provider) +{ + // + return Surround( + XProviderToken, + provider + // + ); +} + +// +// Extract Provider from a Tagged string ... +string ExtractProvider(string value) +{ + // + return ParseStringSurrounded( + value, + XProviderToken + // + ); +} + +// +// Generate Support Comment Tag ... +string GenerateSupportTag(ulong ticket) +{ + // + return Surround( + XSupportToken, + ticket + // + ); +} + +// +// Extract Support Positions from a Tagged string ... +ulong ExtractSupportedTicket(string value) +{ + // + return ParseLongSurrounded( + value, + XSupportToken + // + ); +} + +// +// Generate EQM Support Comment Tag ... +string GenerateEQMSupportTag(ulong ticket) +{ + // + return Surround( + XEQMSupportToken, + ticket + // + ); +} + +// +// Extract EQM Support Positions from a Tagged string ... +ulong ExtractEQMSupportedTicket(string value) +{ + // + return ParseLongSurrounded( + value, + XEQMSupportToken + // + ); +} + +// +// SL Trails ... + +// +// Extract SL Trail Level ... +int ExtractSLTrailLevel(string comment) +{ + // + int result = 0; + + // + if (!IsValid(comment)) + { + return result; + } + + // + result = ParseIntSurrounded( + comment, + XSLTrailToken + // + ); + + // + return result; +} + +// +// Generate SL Trail Comment Tag ... +string GenerateSLTrailTag(int level) +{ + // + string result = NULL; + + // + if (level <= 0) + { + return result; + } + + // + result = Surround( + XSLTrailToken, + level + // + ); + + // + return result; +} + +// +// Prepare SL Trail Comment ... +string PrepareSLTrailTag( + const string comment // Original Position Comment ... +) +{ + // + string result = NULL; + + // + int level = 0; + result = comment; + + // + // Check Comment Contains SL Trailing or not ... + int lastTrailLevel = ExtractSLTrailLevel(comment); + if (lastTrailLevel <= 0) + { + level++; + } + else + { + // + level = lastTrailLevel + 1; + string lastLevelStr = GenerateSLTrailTag(lastTrailLevel); + StringReplace( + result, + lastLevelStr, + "" + // + ); + } + + // + // Generate level Comment ... + string levelStr = GenerateSLTrailTag(level); + result += levelStr; + + // + return result; +} + +// +// EQM Support Orders ... + +// +int GenerateEQMOrders( + XSignal &orders[], // Result + XPosition &position, // Supported Position + XOHCLSupRes &supRes, // Data Source + bool longs = true, + bool shorts = true // +) +{ + // + int result = 0; + + // + Clean(orders); + + // + if (!supRes.IsValid() || + !position.IsValid()) + { + return result; + } + + // + if (longs) + { + // + double longLevels[]; + + // + Copy( + supRes.res, + longLevels // + ); + + // + double minSup = GetMin( + supRes.sup // + ); + if (minSup > 0) + { + // + Add( + minSup, + longLevels // + ); + } + + // + ArraySort(longLevels); + + // + if (ArraySize(longLevels) > 2) + { + // + for (int i = 0; i < ArraySize(longLevels) - 2; i++) + { + // + double iSL = longLevels[i]; + double iEntry = longLevels[i + 1]; + double iTP = longLevels[i + 2]; + + // + XSignal iSignal; + bool isPrepared = iSignal.PrepareStopLong( + position.symbol, + XEQMSupportToken, + position.period, + iEntry, + position.volume, + X_SIGNAL_USE_NOTHING, + iSL, + iTP // + ); + if (isPrepared) + { + // + string comment = GenerateSupportTag(position.ticket); + iSignal.comment = comment; + + // + AddRef( + iSignal, + orders // + ); + } + } + } + } + + // + if (shorts) + { + // + double shortLevels[]; + + // + Copy( + supRes.sup, + shortLevels // + ); + + // + double maxRes = GetMax( + supRes.res // + ); + if (maxRes > 0) + { + // + Add( + maxRes, + shortLevels // + ); + } + + // + ArraySort(shortLevels); + ArrayReverse(shortLevels); + + // + if (ArraySize(shortLevels) > 2) + { + // + for (int i = 0; i < ArraySize(shortLevels) - 2; i++) + { + // + double iSL = shortLevels[i]; + double iEntry = shortLevels[i + 1]; + double iTP = shortLevels[i + 2]; + + // + XSignal iSignal; + bool isPrepared = iSignal.PrepareStopShort( + position.symbol, + XEQMSupportToken, + position.period, + iEntry, + position.volume, + X_SIGNAL_USE_NOTHING, + iSL, + iTP // + ); + if (isPrepared) + { + // + string comment = GenerateSupportTag(position.ticket); + iSignal.comment = comment; + + // + AddRef( + iSignal, + orders // + ); + } + } + } + } + + // + result = ArraySize(orders); + + // + return result; +}