Files
xEaPacks/EURUSD-5M-V0.1/MQ5/Libraries/x-saherelm.xtest.provider.indicators.lib.mq5
T
2024-01-25 04:08:38 +03:30

2317 lines
56 KiB
Plaintext

///////////////////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 XTEST Signal Provider Indicators Library
// ----------------------------------------------------------------
//
// 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 Provider Inputs ...
#include "x-saherelm.xtest.provider.inputs.lib.mq5";
//
// START Define Enums ...
//
//
// Represent Signals Methods ...
enum ENUM_X_SIGNAL_METHODS
{
X_SIGNAL_METHOD_1,
X_SIGNAL_METHOD_2,
X_SIGNAL_METHOD_3,
};
//
// Represent Market Conditions ...
struct X_TEST_MARKET_CONDITIONS
{
//
// XTM ...
bool isXTMPeak;
bool isXTMVale;
//
// XTD ...
bool isXTDSignalPeak;
bool isXTDSignalVale;
bool isXTDSignalOverBear;
bool isXTDSignalUnderBear;
bool isXTDSignalCrossedOverBear;
bool isXTDSignalCrossedUnderBear;
//
// XRSI ...
bool isXRSIPeak;
bool isXRSIVale;
bool isXRSICrossedOverLongExit;
bool isXRSICrossedOverLongEntry;
bool isXRSICrossedUnderShortExit;
bool isXRSICrossedUnderShortEntry;
//
// XOBD ...
bool isXOBDPeak;
bool isXOBDVale;
bool isXOBDSignalOverSwingHigh;
bool isXOBDSignalUnderSwingHigh;
bool isXOBDSignalCrossedOverSwingHigh;
bool isXOBDSignalCrossedUnderSwingHigh;
//
// XCHLH ...
//
bool isXCHLHSignalBOverSignalT;
bool isXCHLHSignalBUnderSignalT;
bool isXCHLHSignalBCrossedOverSignalT;
bool isXCHLHSignalBCrossedUnderSignalT;
//
bool isXCHLHSignalBOverLCLL;
bool isXCHLHSignalBUnderLCLL;
bool isXCHLHSignalBCrossedOverLCLL;
bool isXCHLHSignalBCrossedUnderLCLL;
//
bool isXCHLHSCMCHHSame;
bool isXCHLHSCMCLLSame;
//
bool isXCHLHSCLCHHSame;
bool isXCHLHSCLCLLSame;
//
bool isXCHLHMCLCHHSame;
bool isXCHLHMCLCLLSame;
//
// XCHMA ...
//
bool isXCHMASCPeak;
bool isXCHMASCVale;
bool isXCHMASCFastOverSlow;
bool isXCHMASCFastUnderSlow;
bool isXCHMASCFastCrossedOverSlow;
bool isXCHMASCFastCrossedUnderSlow;
//
bool isXCHMAMCPeak;
bool isXCHMAMCVale;
bool isXCHMAMCFastOverSlow;
bool isXCHMAMCFastUnderSlow;
bool isXCHMAMCFastCrossedOverSlow;
bool isXCHMAMCFastCrossedUnderSlow;
//
bool isXCHMALCPeak;
bool isXCHMALCVale;
bool isXCHMALCFastOverSlow;
bool isXCHMALCFastUnderSlow;
bool isXCHMALCFastCrossedOverSlow;
bool isXCHMALCFastCrossedUnderSlow;
};
//
// END Define Enums ...
//
//
// Imports all Indicators Helper here ...
input group "XTEST Provider Indicators";
//
#include "x-saherelm.xtm.indicator.helper.lib.mq5";
#include "x-saherelm.xtd.oscillator.helper.lib.mq5";
#include "x-saherelm.xrsi.oscillator.helper.lib.mq5";
#include "x-saherelm.xobd.oscillator.helper.lib.mq5";
#include "x-saherelm.xchlh.oscillator.helper.lib.mq5";
#include "x-saherelm.xchma.oscillator.helper.lib.mq5";
//
int xTESTMaxLengthOfInputs = 0;
int xTESTCalculatedBars = 0;
//
// Here we Define some Global Market Variables to Analyse MArket Conditions
// using them at each time ...
X_TEST_MARKET_CONDITIONS conditions = {};
//
// Init Indicators ...
bool XTESTInitIndicators()
{
//
bool result = false;
//
// Check and Calculate Max Length in Inputs ...
//
//
// XTM ...
xTESTMaxLengthOfInputs = MathMax(
xTMMaPeriod,
xTESTNumberOfItemsPerTick);
//
// XTD ...
xTESTMaxLengthOfInputs = MathMax(
xTDLength,
xTESTMaxLengthOfInputs);
//
// XRSI ...
xTESTMaxLengthOfInputs = MathMax(
xRSILength,
xTESTMaxLengthOfInputs);
//
// XOBD ...
xTESTMaxLengthOfInputs = MathMax(
xOBDLength,
xTESTMaxLengthOfInputs);
//
// XCHLH ...
xTESTMaxLengthOfInputs = MathMax(
xCHLHLcLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHLHMcLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHLHScLength,
xTESTMaxLengthOfInputs);
//
// XCHMA ...
xTESTMaxLengthOfInputs = MathMax(
xCHMAScFastLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHMAScSlowLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHMAMcFastLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHMAMcSlowLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHMALcFastLength,
xTESTMaxLengthOfInputs);
xTESTMaxLengthOfInputs = MathMax(
xCHMALcSlowLength,
xTESTMaxLengthOfInputs);
//
// Initialize Indicator/Oscillator Handlers ...
ResetLastError();
//
// XTM Init ...
result = XTMInitHandlers();
if (!result)
{
return result;
}
//
// XTD Init ...
result = XTDInitHandlers();
if (!result)
{
return result;
}
//
// XRSI Init ...
result = XRSIInitHandlers();
if (!result)
{
return result;
}
//
// XOBD Init ...
result = XOBDInitHandlers();
if (!result)
{
return result;
}
//
// XCLH Init ...
result = XCHLHInitHandlers();
if (!result)
{
return result;
}
//
// XCHMA Init ...
result = XCHMAInitHandlers();
if (!result)
{
return result;
}
//
result = true;
//
return result;
}
//
// Release Indicators ...
void XTESTReleaseIndicators()
{
//
// Release Handlers ...
XTMReleaseHandlers();
XTDReleaseHandlers();
XRSIReleaseHandlers();
XOBDReleaseHandlers();
XCHMAReleaseHandlers();
XCHLHReleaseHandlers();
}
//
// Handle Reading Buffers ...
void XTESTHandleReadingBuffers()
{
//
// Reading Calculated Bars for a Simple Handler ...
xTESTCalculatedBars = BarsCalculated(xTMHandler);
//
// Read Indicators Buffers ...
XTMReadBuffers(xTESTNumberOfItemsPerTick);
XTDReadBuffers(xTESTNumberOfItemsPerTick);
XRSIReadBuffers(xTESTNumberOfItemsPerTick);
XOBDReadBuffers(xTESTNumberOfItemsPerTick);
XCHMAReadBuffers(xTESTNumberOfItemsPerTick);
XCHLHReadBuffers(xTESTNumberOfItemsPerTick);
//
XTESTReadConditions();
}
//
//
// START Combination Functions ...
//
//
//
// Can Open Long Trade ...
// this is a Function will Check all market Conditions and get all
// Strategy requirement Verifications for Long Signals ...
bool XTESTCanOpenLongTrade(
double &providedSignals // Recieve Which Number of Providers has Conditions here, used for Volume Increasing
)
{
//
bool result = false;
//
bool hasSignal = XTESTHasLongSignal(providedSignals);
//
result =
//
hasSignal
//
;
//
// TODO: Remove this On Production ...
if (result)
{
//
string message = XTESTGetConditionsString("\n");
//
XTESTClearConditions();
//
if (StringFind(message, "true") >= 0)
{
LogMessage(message);
}
}
//
return result;
}
//
// Can Close Long Trade ...
// this is a Function will Check all market Conditions and get all
// Strategy requirement Verifications for Long Signals ...
bool XTESTCanCloseLongTrade()
{
//
bool result = false;
//
// TODO: Check Market Conditions for Close Long Trades ...
// result = isXCHMASCFastCrossedUnderMax;
//
return result;
}
//
// Can Open Short Trade ...
// this is a Function will Check all market Conditions and get all
// Strategy requirement Verifications for Short Signals ...
bool XTESTCanOpenShortTrade(
double &providedSignals // Recieve Which Number of Providers has Conditions here, used for Volume Increasing
)
{
//
bool result = false;
//
bool hasSignal = XTESTHasShortSignal(providedSignals);
//
result =
//
hasSignal
//
;
//
// TODO: Remove this On Production ...
if (result)
{
//
string message = XTESTGetConditionsString("\n");
//
XTESTClearConditions();
//
if (StringFind(message, "true") >= 0)
{
LogMessage(message);
}
}
//
return result;
}
//
// Can Close Short Trade ...
// this is a Function will Check all market Conditions and get all
// Strategy requirement Verifications for Short Signals ...
bool XTESTCanCloseShortTrade()
{
//
bool result = false;
//
// TODO: Check Market Conditions for Close Short Trades ...
// result = XTESTHasShortCloseConditions(xTESTNumberOfItemsPerTick);
//
return result;
}
//
//
// END Combination Functions ...
//
//
//
//
// START Combination Signaling ...
//
//
//
// TODO: Works i Had To Do:
//
// - [] Test All Strategies in All Available Brokers;
// - [] Find a Good Age for Closing Long Time Trades;
// - [] Find a Good Value for Closing Max DrawDown Equity Trades;
// - [] For All Strategies, Find Desired Long/Short Exit Points;
// - [] Find a Combination Point for Close All Trades;
// - [x] Try to Increase Trade Volume on Giving Multiple Signals at Same Time;
// - [] Prepare Signal and Event Alerts and Test Them for Production Environment;
// - [] Add SUpport for Daily and Hourly Alerts and also Make Report of Account State in Start Of Each Day;
// - [] Test All Methods for Find other Assets to Trade On them;
// - [] Do R&D about Multi Asset Trading in MT5;
// - [] Test Other Indicators/Oscillators or Exists Examples to Check and Found Market Conditions;
//
//
// Read All Globally Required Conditions ...
void XTESTReadConditions()
{
//
XTESTClearConditions();
//
// XTM ...
conditions.isXTMPeak = XTMIsPeak();
conditions.isXTMVale = XTMIsVale();
//
// XTD ...
conditions.isXTDSignalPeak = XTDIsSignalPeak();
conditions.isXTDSignalVale = XTDIsSignalVale();
conditions.isXTDSignalOverBear = XTDIsSignalOverBear(1);
conditions.isXTDSignalUnderBear = XTDIsSignalUnderBear(1);
conditions.isXTDSignalCrossedOverBear = XTDIsSignalCrossedOverBear(1);
conditions.isXTDSignalCrossedUnderBear = XTDIsSignalCrossedUnderBear(1);
//
// XRSI ...
conditions.isXRSIPeak = XRSIIsPeak();
conditions.isXRSIVale = XRSIIsVale();
conditions.isXRSICrossedOverLongExit = XRSIIsCrossedOverLongExit(1);
conditions.isXRSICrossedOverLongEntry = XRSIIsCrossedOverLongEntry(1);
conditions.isXRSICrossedUnderShortExit = XRSIIsCrossedUnderShortExit(1);
conditions.isXRSICrossedUnderShortEntry = XRSIIsCrossedUnderShortEntry(1);
//
// XOBD ...
conditions.isXOBDPeak = XOBDIsPeak();
conditions.isXOBDVale = XOBDIsVale();
conditions.isXOBDSignalOverSwingHigh = XOBDIsSignalOverSwingHigh(1);
conditions.isXOBDSignalUnderSwingHigh = XOBDIsSignalUnderSwingHigh(1);
conditions.isXOBDSignalCrossedOverSwingHigh = XOBDIsSignalCrossedOverSwingHigh(1);
conditions.isXOBDSignalCrossedUnderSwingHigh = XOBDIsSignalCrossedUnderSwingHigh(1);
//
// XCHLH ...
//
conditions.isXCHLHSignalBOverSignalT = XCHLHIsSignalBOverSignalT(1);
conditions.isXCHLHSignalBUnderSignalT = XCHLHIsSignalBUnderSignalT(1);
conditions.isXCHLHSignalBCrossedOverSignalT = XCHLHIsSignalBCrossedOverSignalT(1);
conditions.isXCHLHSignalBCrossedUnderSignalT = XCHLHIsSignalBCrossedUnderSignalT(1);
//
conditions.isXCHLHSignalBOverLCLL = XCHLHIsSignalBOverLCLL(1);
conditions.isXCHLHSignalBUnderLCLL = XCHLHIsSignalBUnderLCLL(1);
conditions.isXCHLHSignalBCrossedOverLCLL = XCHLHIsSignalBCrossedOverLCLL(1);
conditions.isXCHLHSignalBCrossedUnderLCLL = XCHLHIsSignalBCrossedUnderLCLL(1);
//
conditions.isXCHLHSCMCHHSame = XCHLHIsMCSCHasSameHH(1);
conditions.isXCHLHSCMCLLSame = XCHLHIsMCSCHasSameLL(1);
//
conditions.isXCHLHSCLCHHSame = XCHLHIsLCSCHasSameHH(1);
conditions.isXCHLHSCLCLLSame = XCHLHIsLCSCHasSameLL(1);
//
conditions.isXCHLHMCLCHHSame = XCHLHIsLCMCHasSameHH(1);
conditions.isXCHLHMCLCLLSame = XCHLHIsLCMCHasSameLL(1);
//
// XCHMA ...
//
conditions.isXCHMASCPeak = XCHMAIsSCPeak();
conditions.isXCHMASCVale = XCHMAIsSCVale();
conditions.isXCHMASCFastOverSlow = XCHMAIsSCFastOverSlow(1);
conditions.isXCHMASCFastUnderSlow = XCHMAIsSCFastUnderSlow(1);
conditions.isXCHMASCFastCrossedOverSlow = XCHMAIsSCFastCrossedOverSlow(1);
conditions.isXCHMASCFastCrossedUnderSlow = XCHMAIsSCFastCrossedUnderSlow(1);
//
conditions.isXCHMAMCPeak = XCHMAIsMCPeak();
conditions.isXCHMAMCVale = XCHMAIsMCVale();
conditions.isXCHMAMCFastOverSlow = XCHMAIsMCFastOverSlow(1);
conditions.isXCHMAMCFastUnderSlow = XCHMAIsMCFastUnderSlow(1);
conditions.isXCHMAMCFastCrossedOverSlow = XCHMAIsMCFastCrossedOverSlow(1);
conditions.isXCHMAMCFastCrossedUnderSlow = XCHMAIsMCFastCrossedUnderSlow(1);
//
conditions.isXCHMALCPeak = XCHMAIsLCPeak();
conditions.isXCHMALCVale = XCHMAIsLCVale();
conditions.isXCHMALCFastOverSlow = XCHMAIsLCFastOverSlow(1);
conditions.isXCHMALCFastUnderSlow = XCHMAIsLCFastUnderSlow(1);
conditions.isXCHMALCFastCrossedOverSlow = XCHMAIsLCFastCrossedOverSlow(1);
conditions.isXCHMALCFastCrossedUnderSlow = XCHMAIsLCFastCrossedUnderSlow(1);
}
//
// Cleanup Conditions ...
void XTESTClearConditions()
{
//
X_TEST_MARKET_CONDITIONS mConditions = {};
//
conditions = mConditions;
}
//
// Converts Market Conditions to Specific String Representation ...
string XTESTGetConditionsString(
string separator = ",", // Specify Separator
bool ignoreFalses = true // Ignore False Conditions
)
{
//
string result = "";
//
// XTM ...
result +=
"| XTM |" + separator;
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTMPeak))
{
result += "isXTMPeak: " + (string)conditions.isXTMPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTMVale))
{
result += "isXTMVale: " + (string)conditions.isXTMVale + separator;
}
//
// Separator ...
result += separator;
//
// XTD ...
result +=
"| XTD |" + separator;
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTDSignalPeak))
{
result += "isXTDSignalPeak: " + (string)conditions.isXTDSignalPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTDSignalVale))
{
result += "isXTDSignalVale: " + (string)conditions.isXTDSignalVale + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTDSignalOverBear))
{
result += "isXTDSignalOverBear: " + (string)conditions.isXTDSignalOverBear + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTDSignalUnderBear))
{
result += "isXTDSignalUnderBear: " + (string)conditions.isXTDSignalUnderBear + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTDSignalCrossedOverBear))
{
result += "isXTDSignalCrossedOverBear: " + (string)conditions.isXTDSignalCrossedOverBear + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXTDSignalCrossedUnderBear))
{
result += "isXTDSignalCrossedUnderBear: " + (string)conditions.isXTDSignalCrossedUnderBear + separator;
}
//
// Separator ...
result += separator;
//
// XRSI ...
result +=
"| XRSI |" + separator;
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXRSIPeak))
{
result += "isXRSIPeak: " + (string)conditions.isXRSIPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXRSIVale))
{
result += "isXRSIVale: " + (string)conditions.isXRSIVale + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXRSICrossedOverLongExit))
{
result += "isXRSICrossedOverLongExit: " + (string)conditions.isXRSICrossedOverLongExit + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXRSICrossedOverLongEntry))
{
result += "isXRSICrossedOverLongEntry: " + (string)conditions.isXRSICrossedOverLongEntry + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXRSICrossedUnderShortExit))
{
result += "isXRSICrossedUnderShortExit: " + (string)conditions.isXRSICrossedUnderShortExit + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXRSICrossedUnderShortEntry))
{
result += "isXRSICrossedUnderShortEntry: " + (string)conditions.isXRSICrossedUnderShortEntry + separator;
}
//
// Separator ...
result += separator;
//
// XOBD ...
result +=
"| XOBD |" + separator;
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXOBDPeak))
{
result += "isXOBDPeak: " + (string)conditions.isXOBDPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXOBDVale))
{
result += "isXOBDVale: " + (string)conditions.isXOBDVale + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXOBDSignalOverSwingHigh))
{
result += "isXOBDSignalOverSwingHigh: " + (string)conditions.isXOBDSignalOverSwingHigh + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXOBDSignalUnderSwingHigh))
{
result += "isXOBDSignalUnderSwingHigh: " + (string)conditions.isXOBDSignalUnderSwingHigh + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXOBDSignalCrossedOverSwingHigh))
{
result += "isXOBDSignalCrossedOverSwingHigh: " + (string)conditions.isXOBDSignalCrossedOverSwingHigh + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXOBDSignalCrossedUnderSwingHigh))
{
result += "isXOBDSignalCrossedUnderSwingHigh: " + (string)conditions.isXOBDSignalCrossedUnderSwingHigh + separator;
}
//
// Separator ...
result += separator;
//
// XCHLH ...
result +=
"| XCHLH |" + separator;
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBOverSignalT))
{
result += "isXCHLHSignalBOverSignalT: " + (string)conditions.isXCHLHSignalBOverSignalT + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBUnderSignalT))
{
result += "isXCHLHSignalBUnderSignalT: " + (string)conditions.isXCHLHSignalBUnderSignalT + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBCrossedOverSignalT))
{
result += "isXCHLHSignalBCrossedOverSignalT: " + (string)conditions.isXCHLHSignalBCrossedOverSignalT + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBCrossedUnderSignalT))
{
result += "isXCHLHSignalBCrossedUnderSignalT: " + (string)conditions.isXCHLHSignalBCrossedUnderSignalT + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBOverLCLL))
{
result += "isXCHLHSignalBOverLCLL: " + (string)conditions.isXCHLHSignalBOverLCLL + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBUnderLCLL))
{
result += "isXCHLHSignalBUnderLCLL: " + (string)conditions.isXCHLHSignalBUnderLCLL + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBCrossedOverLCLL))
{
result += "isXCHLHSignalBCrossedOverLCLL: " + (string)conditions.isXCHLHSignalBCrossedOverLCLL + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSignalBCrossedUnderLCLL))
{
result += "isXCHLHSignalBCrossedUnderLCLL: " + (string)conditions.isXCHLHSignalBCrossedUnderLCLL + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSCMCHHSame))
{
result += "isXCHLHSCMCHHSame: " + (string)conditions.isXCHLHSCMCHHSame + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSCMCLLSame))
{
result += "isXCHLHSCMCLLSame: " + (string)conditions.isXCHLHSCMCLLSame + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSCLCHHSame))
{
result += "isXCHLHSCLCHHSame: " + (string)conditions.isXCHLHSCLCHHSame + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHSCLCLLSame))
{
result += "isXCHLHSCLCLLSame: " + (string)conditions.isXCHLHSCLCLLSame + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHMCLCHHSame))
{
result += "isXCHLHMCLCHHSame: " + (string)conditions.isXCHLHMCLCHHSame + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHLHMCLCLLSame))
{
result += "isXCHLHMCLCLLSame: " + (string)conditions.isXCHLHMCLCLLSame + separator;
}
//
// Separator ...
result += separator;
//
// XCHMA ...
result +=
"| XCHMA |" + separator;
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMASCPeak))
{
result += "isXCHMASCPeak: " + (string)conditions.isXCHMASCPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMASCVale))
{
result += "isXCHMASCVale: " + (string)conditions.isXCHMASCVale + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMASCFastOverSlow))
{
result += "isXCHMASCFastOverSlow: " + (string)conditions.isXCHMASCFastOverSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMASCFastUnderSlow))
{
result += "isXCHMASCFastUnderSlow: " + (string)conditions.isXCHMASCFastUnderSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMASCFastCrossedOverSlow))
{
result += "isXCHMASCFastCrossedOverSlow: " + (string)conditions.isXCHMASCFastCrossedOverSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMASCFastCrossedUnderSlow))
{
result += "isXCHMASCFastCrossedUnderSlow: " + (string)conditions.isXCHMASCFastCrossedUnderSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMAMCPeak))
{
result += "isXCHMAMCPeak: " + (string)conditions.isXCHMAMCPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMAMCVale))
{
result += "isXCHMAMCVale: " + (string)conditions.isXCHMAMCVale + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMAMCFastOverSlow))
{
result += "isXCHMAMCFastOverSlow: " + (string)conditions.isXCHMAMCFastOverSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMAMCFastUnderSlow))
{
result += "isXCHMAMCFastUnderSlow: " + (string)conditions.isXCHMAMCFastUnderSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMAMCFastCrossedOverSlow))
{
result += "isXCHMAMCFastCrossedOverSlow: " + (string)conditions.isXCHMAMCFastCrossedOverSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMAMCFastCrossedUnderSlow))
{
result += "isXCHMAMCFastCrossedUnderSlow: " + (string)conditions.isXCHMAMCFastCrossedUnderSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMALCPeak))
{
result += "isXCHMALCPeak: " + (string)conditions.isXCHMALCPeak + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMALCVale))
{
result += "isXCHMALCVale: " + (string)conditions.isXCHMALCVale + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMALCFastOverSlow))
{
result += "isXCHMALCFastOverSlow: " + (string)conditions.isXCHMALCFastOverSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMALCFastUnderSlow))
{
result += "isXCHMALCFastUnderSlow: " + (string)conditions.isXCHMALCFastUnderSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMALCFastCrossedOverSlow))
{
result += "isXCHMALCFastCrossedOverSlow: " + (string)conditions.isXCHMALCFastCrossedOverSlow + separator;
}
//
if (
!ignoreFalses ||
(ignoreFalses && conditions.isXCHMALCFastCrossedUnderSlow))
{
result += "isXCHMALCFastCrossedUnderSlow: " + (string)conditions.isXCHMALCFastCrossedUnderSlow + separator;
}
//
// Separator ...
result += separator;
//
return result;
}
//
// Check Market Conditions by Combination of Power of All tools for LONGs ...
bool XTESTHasLongSignal(
double &providedSignals // Recieve Which Number of Providers has Conditions here, used for Volume Increasing
)
{
//
bool result = false;
ENUM_X_SIGNAL_METHODS methods[];
//
// START Custom Mechanism ...
//
//
// Required Data ...
double entry = GetEntry(X_SIGNAL_LONG);
double nearHH = GetHighestHigh(3, 1);
double nearLL = GetLowestLow(3, 1);
XOHCL candle1 = GetCandle(1);
//
bool isSharpChanged = IsSharpChanged(
5,
1,
xTMMaBuffer);
//
bool isCandleSharpChanged = IsSharpChanged(
5,
1,
PRICE_CLOSE);
//
// XRSI ...
bool isXRSIOverLongExit =
xRSIBuffer[1] > xRSILongExitValue;
//
// XTD ...
// bool isXTDSignalIncreasing =
// xTDSignalBuffer[1] > xTDSignalBuffer[2] &&
// xTDSignalBuffer[1] > xTDSignalBuffer[3];
//
// XCHLH ...
bool isDecreasingMCHH = IsDecreasing(
12,
1,
xCHLHMcHHBuffer);
//
// XCHMA ...
//
double xCHMAMin1 = XCHMAGetMin(1);
double xCHMAMin2 = XCHMAGetMin(2);
//
double xCHMAMax1 = XCHMAGetMax(1);
double xCHMAMax2 = XCHMAGetMax(2);
//
// Calculate Non SC Max ...
double xCHMANonSCMax1 = MathMax(xCHMAMcFastBuffer[1], xCHMAMcSlowBuffer[1]);
xCHMANonSCMax1 = MathMax(xCHMANonSCMax1, xCHMALcFastBuffer[1]);
xCHMANonSCMax1 = MathMax(xCHMANonSCMax1, xCHMALcSlowBuffer[1]);
//
// Calculate Non SC Min ...
double xCHMANonSCMin1 = MathMin(xCHMAMcFastBuffer[1], xCHMAMcSlowBuffer[1]);
xCHMANonSCMin1 = MathMin(xCHMANonSCMin1, xCHMALcFastBuffer[1]);
xCHMANonSCMin1 = MathMin(xCHMANonSCMin1, xCHMALcSlowBuffer[1]);
//
double xCHMASCMin1 = MathMin(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]);
double xCHMASCMin2 = MathMin(xCHMAScFastBuffer[2], xCHMAScSlowBuffer[2]);
//
double xCHMASCMax1 = MathMax(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]);
double xCHMASCMax2 = MathMax(xCHMAScFastBuffer[2], xCHMAScSlowBuffer[2]);
//
double xCHMAMCTrend1 = MathAbs(xCHMAMcFastBuffer[1] - xCHMAMcSlowBuffer[1]);
double xCHMAMCTrend5 = MathAbs(xCHMAMcFastBuffer[5] - xCHMAMcSlowBuffer[5]);
double xCHMAMCTrend10 = MathAbs(xCHMAMcFastBuffer[10] - xCHMAMcSlowBuffer[10]);
//
double xCHMALCTrend1 = MathAbs(xCHMALcFastBuffer[1] - xCHMALcSlowBuffer[1]);
double xCHMALCTrend5 = MathAbs(xCHMALcFastBuffer[5] - xCHMALcSlowBuffer[5]);
double xCHMALCTrend10 = MathAbs(xCHMALcFastBuffer[10] - xCHMALcSlowBuffer[10]);
//
bool isXCHMASCCrossedOverMin =
//
xCHMASCMin2 <= xCHMAMin2 &&
xCHMASCMin1 > xCHMAMin1
//
;
//
bool isXCHMASCFastCrossedOverMax =
xCHMASCMax2 < xCHMAMax2 &&
xCHMASCMax1 >= xCHMAMax1;
//
bool isXCHMASCFastCrossedUnderMin =
xCHMASCMin2 > xCHMAMin2 &&
xCHMASCMin1 <= xCHMAMin1;
//
bool isXCHMASCFastCrossedUnderMax =
xCHMASCMax2 >= xCHMAMax2 &&
xCHMASCMax1 < xCHMAMax1;
//
// Condition 1 ...
// this Method waits for XCHMA Short Cycle's Fast to Going down
// of all Cycles Minimum Value, then Check when its Crossed Over
// min value and then start to Open Long Trades based On Conditions,
// and Recieved Verifications from other Indicator/Oscillator(s) ...
bool customMethodCond1 =
//
isXCHMASCCrossedOverMin
//
&&
//
entry < nearHH
//
&&
//
candle1.high != nearHH
//
&&
//
!isCandleSharpChanged
//
&&
//
!(
//
(
//
conditions.isXCHMASCFastUnderSlow ||
conditions.isXCHMASCFastCrossedUnderSlow
//
)
//
&&
//
(
//
conditions.isXCHMAMCFastUnderSlow ||
conditions.isXCHMAMCFastCrossedUnderSlow
//
)
//
&&
//
(
//
conditions.isXCHMALCFastUnderSlow ||
conditions.isXCHMALCFastCrossedUnderSlow
//
)
//
)
//
&&
//
(
//
conditions.isXCHMAMCFastOverSlow
//
?
//
xCHMAMCTrend1 >= xCHMAMCTrend5 &&
xCHMAMCTrend5 >= xCHMAMCTrend10
//
:
//
xCHMAMCTrend1 < xCHMAMCTrend5 &&
xCHMAMCTrend5 < xCHMAMCTrend10
//
)
//
&&
//
!(
//
(
//
conditions.isXCHMAMCFastUnderSlow ||
conditions.isXCHMAMCFastCrossedUnderSlow
//
)
//
&&
//
(
//
conditions.isXCHMALCFastUnderSlow ||
conditions.isXCHMALCFastCrossedUnderSlow
//
)
//
)
//
&&
//
(
//
conditions.isXCHMAMCFastUnderSlow &&
xTDSignalBuffer[1] < xTDSignalBuffer[2]
//
?
//
xCHMAMcFastBuffer[1] > xCHMANonSCMin1
//
&&
//
!(
//
xCHLHSignalTBuffer[1] > xCHLHScHHBuffer[1] &&
xCHLHSignalBBuffer[1] < xCHLHLcLLBuffer[1]
//
)
//
:
//
true
//
)
//
&&
//
!(
//
conditions.isXCHMASCVale &&
conditions.isXCHMASCFastUnderSlow
//
&&
//
(
//
(
//
conditions.isXCHLHMCLCHHSame
//
&&
//
(
//
conditions.isXCHLHMCLCLLSame ||
conditions.isXCHLHSCMCLLSame
//
)
//
)
//
)
//
)
//
&&
//
!(
//
(
//
xRSIBuffer[1] > xRSILongExitValue ||
conditions.isXRSICrossedOverLongExit
//
)
//
&&
//
conditions.isXCHLHSCMCHHSame &&
conditions.isXCHLHSCMCLLSame &&
//
conditions.isXCHMAMCFastUnderSlow
//
)
//
&&
//
!(
//
(
//
conditions.isXCHLHSignalBOverLCLL ||
conditions.isXCHLHSignalBCrossedOverLCLL
//
)
//
&&
conditions.isXCHLHMCLCLLSame &&
//
conditions.isXCHMAMCFastUnderSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalOverBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCLLSame &&
//
conditions.isXCHMAMCFastUnderSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalOverBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBUnderLCLL &&
conditions.isXCHLHMCLCLLSame &&
//
conditions.isXCHMASCFastOverSlow &&
conditions.isXCHMAMCFastUnderSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalOverBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCHHSame &&
//
conditions.isXCHMASCFastOverSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastUnderSlow
//
)
//
;
//
// Filling Methods ...
if (customMethodCond1)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_METHOD_1;
}
//
// Condition 2 ...
// this Method waits for XCHMA Medium Cycles Fast Line Crossed Over Slow,
// then start to Open Long Trades based On Conditions, and Recieved Verifications from
// other Indicator/Oscillator(s) ...
bool customMethodCond2 =
//
// MCFast Based ...
(
//
conditions.isXCHMAMCFastCrossedOverSlow &&
//
(
//
conditions.isXCHMASCFastOverSlow
//
&&
//
conditions.isXCHMALCFastOverSlow
//
)
//
)
//
&&
//
!(
//
(
//
conditions.isXOBDSignalUnderSwingHigh ||
conditions.isXOBDSignalCrossedUnderSwingHigh
//
)
//
&&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHSCMCHHSame
//
)
//
&&
//
!(
//
conditions.isXTDSignalCrossedOverBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCLLSame
//
)
//
&&
//
!(
//
xCHLHScHHBuffer[1] > xCHLHSignalTBuffer[1] &&
xCHLHScLLBuffer[1] > xCHLHSignalTBuffer[1] &&
xCHLHSignalBBuffer[1] < xCHLHSignalTBuffer[1] &&
xCHLHSignalBBuffer[1] < xCHLHMcLLBuffer[1]
//
)
//
&&
//
!(
//
conditions.isXTDSignalOverBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBCrossedOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHSCMCHHSame &&
conditions.isXCHLHMCLCLLSame
//
)
//
&&
//
!(
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCHHSame &&
conditions.isXCHLHMCLCLLSame
//
)
//
&&
//
!(
//
conditions.isXTDSignalOverBear &&
//
conditions.isXRSICrossedOverLongExit &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL
//
)
//
&&
//
!(
//
conditions.isXTDSignalCrossedUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL
//
)
//
//
&&
//
entry < nearHH
//
&&
//
nearHH != candle1.high
//
&&
//
!isXRSIOverLongExit
//
;
//
// Filling Methods ...
if (customMethodCond2)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_METHOD_2;
}
//
// Condition 3 ...
// this Method waits for XCHMA Short Cycle's Fast to Crossed Over all Cycles max value
// and then start to Open Long Trades based On Conditions,
// and Recieved Verifications from other Indicator/Oscillator(s) ...
bool customMethodCond3 =
//
isXCHMASCFastCrossedOverMax
//
&&
//
conditions.isXCHMALCFastOverSlow
//
&&
//
!(
//
xCHLHScLLBuffer[1] > xCHLHMcLLBuffer[1] &&
xCHLHMcLLBuffer[1] > xCHLHSignalBBuffer[1] &&
xCHLHSignalBBuffer[1] > xCHLHSignalTBuffer[1] &&
xCHLHSignalTBuffer[1] > xCHLHLcLLBuffer[1]
//
)
//
&&
//
!(
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
(
//
conditions.isXCHLHSCMCHHSame ||
conditions.isXCHLHMCLCLLSame
//
)
//
)
//
&&
//
!(
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
//
(
//
conditions.isXCHLHSCMCHHSame ||
conditions.isXCHLHMCLCLLSame ||
conditions.isXCHLHMCLCHHSame ||
conditions.isXCHLHSCMCLLSame
//
)
//
)
//
&&
//
!isSharpChanged
//
&&
//
!isCandleSharpChanged
//
&&
//
entry < nearHH
//
&&
//
candle1.close > xTMMaBuffer[1];
//
;
//
// Filling Methods ...
if (customMethodCond3)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_METHOD_3;
}
//
// Combine Custom Methods together ...
bool isCustomMethodHasSignal =
//
customMethodCond1
//
||
//
customMethodCond2
//
||
//
customMethodCond3
//
;
//
// END Custom Mechanism ...
//
//
result =
//
// isXTMHasSignal
// isXTDHasSignal
// isXCHMAHasSignal
//
// isXTMMethodHasSignal
//
// ||
//
// isXTDMethodHasSignal
//
// ||
// //
// isXOBDMethodHasSignal
// //
// ||
// //
// isXCHMAMethodHasSignal
// //
// ||
// //
// isXCHLHMethodHasSignal
// //
// ||
// //
// isXRSIMethodHasSignal
//
// ||
isCustomMethodHasSignal
//
;
//
if (result)
{
//
// Set Number of Occured Conditions for Increasing Volume ...
providedSignals = ArraySize(methods);
}
//
return result;
}
//
// Check Market Conditions by Combination of Power of All tools for SHORTs ...
bool XTESTHasShortSignal(
double &providedSignals // Recieve Which Number of Providers has Conditions here, used for Volume Increasing
)
{
//
bool result = false;
ENUM_X_SIGNAL_METHODS methods[];
//
// START Custom Mechanism ...
//
//
// Required Data ...
double entry = GetEntry(X_SIGNAL_SHORT);
double nearHH = GetHighestHigh(3, 1);
double nearLL = GetLowestLow(3, 1);
XOHCL candle1 = GetCandle(1);
//
bool isSharpChanged = IsSharpChanged(
5,
1,
xTMMaBuffer);
//
bool isCandleSharpChanged = IsSharpChanged(
5,
1,
PRICE_CLOSE);
//
// XRSI ...
bool isXRSIOverLongExit =
xRSIBuffer[1] > xRSILongExitValue;
//
// XCHLH ...
bool isIncreasingMCHH = IsIncreasing(
12,
1,
xCHLHMcHHBuffer);
//
double xCHLHLCRange1 = xCHLHLcHHBuffer[1] - xCHLHLcLLBuffer[1];
double xCHLHMCRange1 = xCHLHMcHHBuffer[1] - xCHLHMcLLBuffer[1];
double xCHLHSCRange1 = xCHLHScHHBuffer[1] - xCHLHScLLBuffer[1];
//
double xCHLHNonLCMax1 = MathMax(xCHLHScHHBuffer[1], xCHLHMcHHBuffer[1]);
double xCHLHNonLCMin1 = MathMin(xCHLHScLLBuffer[1], xCHLHMcLLBuffer[1]);
double xCHLHNonLCRange1 = xCHLHNonLCMax1 - xCHLHNonLCMin1;
// //
// bool isIncreasingMCLL = IsIncreasing(
// 12,
// 1,
// xCHLHMcLLBuffer);
// //
// bool isDecreasingSCHH = IsDecreasing(
// 12,
// 1,
// xCHLHScHHBuffer);
// //
// bool isDecreasingSCLL = IsDecreasing(
// 12,
// 1,
// xCHLHScLLBuffer);
//
// XCHMA ...
//
double xCHMAMin1 = XCHMAGetMin(1);
double xCHMAMin2 = XCHMAGetMin(2);
//
double xCHMAMax1 = XCHMAGetMax(1);
double xCHMAMax2 = XCHMAGetMax(2);
//
// Calculate Non SC Max ...
double xCHMANonSCMax1 = MathMax(xCHMAMcFastBuffer[1], xCHMAMcSlowBuffer[1]);
xCHMANonSCMax1 = MathMax(xCHMANonSCMax1, xCHMALcFastBuffer[1]);
xCHMANonSCMax1 = MathMax(xCHMANonSCMax1, xCHMALcSlowBuffer[1]);
//
// Calculate Non SC Min ...
double xCHMANonSCMin1 = MathMin(xCHMAMcFastBuffer[1], xCHMAMcSlowBuffer[1]);
xCHMANonSCMin1 = MathMin(xCHMANonSCMin1, xCHMALcFastBuffer[1]);
xCHMANonSCMin1 = MathMin(xCHMANonSCMin1, xCHMALcSlowBuffer[1]);
//
// Calculate Non LC Max ...
double xCHMANonLCMax1 = MathMax(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]);
xCHMANonLCMax1 = MathMax(xCHMANonLCMax1, xCHMAMcFastBuffer[1]);
xCHMANonLCMax1 = MathMax(xCHMANonLCMax1, xCHMAMcSlowBuffer[1]);
//
// Calculate Non LC Min ...
double xCHMANonLCMin1 = MathMin(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]);
xCHMANonLCMin1 = MathMin(xCHMANonLCMin1, xCHMAMcFastBuffer[1]);
xCHMANonLCMin1 = MathMin(xCHMANonLCMin1, xCHMAMcSlowBuffer[1]);
//
// Check LC On Top Of Others ...
double xCHMALCMin1 = MathMin(xCHMALcFastBuffer[1], xCHMALcSlowBuffer[1]);
//
double xCHMASCMin1 = MathMin(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]);
double xCHMASCMin2 = MathMin(xCHMAScFastBuffer[2], xCHMAScSlowBuffer[2]);
//
double xCHMASCMax1 = MathMax(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]);
double xCHMASCMax2 = MathMax(xCHMAScFastBuffer[2], xCHMAScSlowBuffer[2]);
//
double xCHMAMCTrend1 = MathAbs(xCHMAMcFastBuffer[1] - xCHMAMcSlowBuffer[1]);
double xCHMAMCTrend5 = MathAbs(xCHMAMcFastBuffer[5] - xCHMAMcSlowBuffer[5]);
double xCHMAMCTrend10 = MathAbs(xCHMAMcFastBuffer[10] - xCHMAMcSlowBuffer[10]);
//
double xCHMALCTrend1 = MathAbs(xCHMALcFastBuffer[1] - xCHMALcSlowBuffer[1]);
double xCHMALCTrend5 = MathAbs(xCHMALcFastBuffer[5] - xCHMALcSlowBuffer[5]);
double xCHMALCTrend10 = MathAbs(xCHMALcFastBuffer[10] - xCHMALcSlowBuffer[10]);
//
bool isXCHMASCCrossedOverMin =
//
xCHMASCMin2 <= xCHMAMin2 &&
xCHMASCMin1 > xCHMAMin1
//
;
//
bool isXCHMASCFastCrossedOverMax =
xCHMASCMax2 < xCHMAMax2 &&
xCHMASCMax1 >= xCHMAMax1;
//
bool isXCHMASCFastCrossedUnderMin =
xCHMASCMin2 > xCHMAMin2 &&
xCHMASCMin1 <= xCHMAMin1;
//
bool isXCHMASCFastCrossedUnderMax =
xCHMASCMax2 >= xCHMAMax2 &&
xCHMASCMax1 < xCHMAMax1;
//
// Condition 1 ...
// this Method waits for XCHMA Short Cycle's Fast to Going up
// of all Cycles Maximum Value, then Check when its Crossed Under
// max value and then start to Open Short Trades based On Conditions,
// and Recieved Verifications from other Indicator/Oscillator(s) ...
bool customMethodCond1 =
//
isXCHMASCFastCrossedUnderMax
//
&&
//
entry > nearLL
//
&&
//
!isSharpChanged
//
&&
//
!isCandleSharpChanged
//
&&
//
candle1.low != nearLL
//
&&
//
!conditions.isXCHLHMCLCLLSame
//
&&
//
(
//
xCHLHNonLCRange1 > (xCHLHLCRange1 / 2)
//
?
//
true
//
:
//
xCHLHMcHHBuffer[1] > (xCHLHLcHHBuffer[1] - (xCHLHLCRange1 / 2)) &&
MathAbs(xCHLHMcLLBuffer[1] - xCHLHLcLLBuffer[1]) > (MathAbs(xCHLHMcHHBuffer[1] - xCHLHLcHHBuffer[1]) / 2)
//
)
//
&&
//
!(
//
xCHLHMcLLBuffer[1] > (xCHLHLcHHBuffer[1] - (xCHLHLCRange1 / 2)) &&
xCHLHSignalTBuffer[1] < xCHLHSignalBBuffer[1] &&
MathAbs(xCHLHScLLBuffer[1] - xCHLHMcLLBuffer[1]) > MathAbs(xCHLHScHHBuffer[1] - xCHLHMcHHBuffer[1])
//
)
//
&&
//
!(
//
xTDSignalBuffer[1] > xTDSignalBuffer[2] &&
xTDSignalBuffer[2] > xTDSignalBuffer[3] &&
xTDSignalBuffer[1] > xTDSignalBuffer[3]
//
)
//
&&
//
!(
//
(
//
conditions.isXCHMASCFastOverSlow ||
conditions.isXCHMASCFastCrossedOverSlow
//
)
//
&&
//
(
//
conditions.isXCHMAMCFastOverSlow ||
conditions.isXCHMAMCFastCrossedOverSlow
//
)
//
&&
//
(
//
conditions.isXCHMALCFastOverSlow ||
conditions.isXCHMALCFastCrossedOverSlow
//
)
//
)
//
&&
//
!(
//
(
//
conditions.isXCHMAMCFastOverSlow ||
conditions.isXCHMAMCFastCrossedOverSlow
//
)
//
&&
//
(
//
conditions.isXCHMALCFastOverSlow ||
conditions.isXCHMALCFastCrossedOverSlow
//
)
//
)
//
&&
//
(
//
conditions.isXCHMAMCFastOverSlow
//
?
//
xCHMAMCTrend1 < xCHMAMCTrend5
//
&&
//
(
//
xCHMAMCTrend1 < xCHMAMCTrend10 ||
xCHMAMCTrend5 < xCHMAMCTrend10
//
)
//
:
//
true
//
)
//
&&
//
(
//
conditions.isXCHMALCFastOverSlow
//
?
//
xCHMALCTrend1 <= xCHMALCTrend5
//
&&
//
(
//
xCHMALCTrend1 <= xCHMALCTrend10 ||
xCHMALCTrend5 <= xCHMALCTrend10
//
)
//
:
//
true
//
)
//
&&
//
!(
//
conditions.isXCHMASCVale ||
conditions.isXCHMAMCVale ||
conditions.isXCHMASCPeak ||
conditions.isXCHMAMCPeak
//
)
//
&&
//
(
conditions.isXCHMASCFastOverSlow ||
conditions.isXCHMAMCFastOverSlow
//
?
//
xOBDSwingHighBuffer[1] < xOBDSwingLowBuffer[1]
//
:
//
true)
//
;
//
// Filling Methods ...
if (customMethodCond1)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_METHOD_1;
}
//
// Condition 2 ...
// this Method waits for XCHMA Medium Cycle Fast Line Crossed Under Slow,
// then start to Open Short Trades based On Conditions, and Recieved Verifications from
// other Indicator/Oscillator(s) ...
bool customMethodCond2 =
//
conditions.isXCHMAMCFastCrossedUnderSlow
//
&&
//
entry > nearLL
//
&&
//
candle1.low != nearLL
//
&&
//
xCHMALCMin1 < xCHMANonLCMax1
//
&&
//
conditions.isXTDSignalUnderBear
//
&&
//
(
//
conditions.isXCHLHMCLCHHSame
//
?
//
xOBDSwingHighBuffer[1] < xOBDSwingLowBuffer[1]
//
:
//
true
//
)
//
&&
//
!(
conditions.isXCHLHSCMCLLSame ||
conditions.isXCHLHSCLCLLSame
//
)
//
&&
//
!(
//
xCHLHMcHHBuffer[1] < xCHLHLcHHBuffer[1] &&
//
xCHLHScHHBuffer[1] < xCHLHMcHHBuffer[1] &&
xCHLHScLLBuffer[1] > xCHLHMcLLBuffer[1] &&
//
xCHLHMcLLBuffer[1] > xCHLHSignalBBuffer[1] &&
xCHLHMcLLBuffer[1] > xCHLHSignalTBuffer[1] &&
//
xCHLHSignalBBuffer[1] > xCHLHLcLLBuffer[1] &&
xCHLHSignalTBuffer[1] > xCHLHLcLLBuffer[1] &&
//
MathAbs(xCHLHScLLBuffer[1] - xCHLHMcLLBuffer[1]) < MathAbs(xCHLHScHHBuffer[1] - xCHLHMcHHBuffer[1])
//
)
//
;
//
// Filling Methods ...
if (customMethodCond2)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_METHOD_2;
}
//
// Condition 3 ...
// this Method waits for XCHMA Short Cycle's Fast to Crossed Under all Cycles min value
// and then start to Open Short Trades based On Conditions,
// and Recieved Verifications from other Indicator/Oscillator(s) ...
bool customMethodCond3 =
//
isXCHMASCFastCrossedUnderMin
//
&&
//
xCHMAScSlowBuffer[1] < xCHMANonSCMin1
//
&&
//
(
//
conditions.isXCHMASCFastCrossedUnderSlow ||
conditions.isXCHMASCFastUnderSlow
//
)
//
&&
//
(
//
(
//
conditions.isXCHMAMCFastCrossedUnderSlow ||
conditions.isXCHMAMCFastUnderSlow
//
)
//
&&
//
(
//
conditions.isXCHMALCFastCrossedUnderSlow ||
conditions.isXCHMALCFastUnderSlow
//
)
//
)
//
&&
//
(
//
(
//
conditions.isXTDSignalCrossedUnderBear ||
conditions.isXTDSignalUnderBear
//
)
//
&&
//
xTDBullishBuffer[1] < xTDBearishBuffer[1]
//
)
//
&&
//
!(
//
xCHLHMCRange1 < (xCHLHLCRange1 / 2)
//
&&
//
xCHLHMcHHBuffer[1] < (xCHLHLcHHBuffer[1] - (xCHLHLCRange1 / 2))
//
)
//
&&
//
!(
//
conditions.isXCHMAMCFastUnderSlow
//
&&
//
(
//
xCHMAMcFastBuffer[1] > xCHMAMcFastBuffer[5] &&
xCHMAMcFastBuffer[1] > xCHMAMcFastBuffer[10]
//
)
//
&&
//
(
//
xCHMAMCTrend1 < xCHMAMCTrend5 &&
xCHMAMCTrend1 < xCHMAMCTrend10
//
)
//
)
//
;
//
// Filling Methods ...
if (customMethodCond3)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_METHOD_3;
}
//
// Combine Custom Methods together ...
bool isCustomMethodHasSignal =
//
customMethodCond1
//
||
//
customMethodCond2
//
||
//
customMethodCond3
//
;
//
// END Custom Mechanism ...
//
//
// Fill Result ...
result =
//
isCustomMethodHasSignal
//
;
//
if (result)
{
//
// Set Number of Occured Conditions for Increasing Volume ...
providedSignals = ArraySize(methods);
}
//
return result;
}
//
//
// END Combination Signaling ...
//
//