Files
xMQL5/BKPS/Series2/Temp/Short Conditions Calculations.mq5
T
2024-01-25 04:09:42 +03:30

1121 lines
26 KiB
Plaintext

enum ENUM_X_SIGNAL_METHODS
{
// //
// // UNKNOWN ...
// X_SIGNAL_UNKNOWN_METHOD,
// //
// // XTM Based ...
// X_SIGNAL_XTM_METHOD,
// //
// // XTD Based ...
// X_SIGNAL_XTD_METHOD,
// //
// // XOBD ...
// X_SIGNAL_XOBD_METHOD,
// //
// // XCHLH ...
// X_SIGNAL_XCHLH_METHOD,
// //
// // XCHMA ...
// X_SIGNAL_XCHMA_METHOD,
// //
// // XRSI ...
// X_SIGNAL_XRSI_METHOD,
//
// These Must Be Used ...
X_SIGNAL_METHOD_1,
X_SIGNAL_METHOD_2,
};
//
// Retrieve all Long Signals based on Stuffs ...
bool isXTMHasSignal = XTMHasShortConditions(xTESTNumberOfItemsPerTick);
bool isXTDHasSignal = XTDHasShortConditions(xTESTNumberOfItemsPerTick);
bool isXRSIHasSignal = XRSIHasShortConditions(xTESTNumberOfItemsPerTick);
bool isXOBDHasSignal = XOBDHasShortConditions(xTESTNumberOfItemsPerTick);
bool isXCHLHHasSignal = XCHLHHasShortConditions(xTESTNumberOfItemsPerTick);
bool isXCHMAHasSignal = XCHMAHasShortConditions(xTESTNumberOfItemsPerTick);
//
// START XTM Method ...
//
//
// Condition 1 ...
bool xTMMethodCond1 =
//
conditions.isXTDSignalVale &&
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalOverSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCHHSame &&
//
conditions.isXCHMASCFastCrossedUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastOverSlow
//
;
// //
// // Condition 2 ...
// bool xTMMethodCond2 =
// //
// conditions.isXTDSignalUnderBear &&
// //
// conditions.isXOBDSignalUnderSwingHigh &&
// //
// conditions.isXCHLHSignalBOverSignalT &&
// conditions.isXCHLHSignalBOverLCLL &&
// conditions.isXCHLHSCMCHHSame &&
// //
// conditions.isXCHMASCFastCrossedUnderSlow &&
// conditions.isXCHMAMCFastOverSlow &&
// conditions.isXCHMALCFastUnderSlow
// //
// ;
//
// Condition 3 ...
bool xTMMethodCond3 =
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCHHSame &&
//
conditions.isXCHMASCFastOverSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastUnderSlow
//
;
//
// Condition 4 ...
bool xTMMethodCond4 =
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
//
conditions.isXCHMASCFastCrossedUnderSlow &&
conditions.isXCHMAMCFastUnderSlow &&
conditions.isXCHMALCFastUnderSlow
//
;
//
// Condition 5 ...
bool xTMMethodCond5 =
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBCrossedUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
//
conditions.isXCHMASCFastCrossedUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastUnderSlow
//
;
//
// Condition 6 ...
bool xTMMethodCond6 =
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBCrossedUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
//
conditions.isXCHMASCFastCrossedUnderSlow &&
conditions.isXCHMAMCFastUnderSlow &&
conditions.isXCHMALCFastOverSlow
//
;
//
// In this Method we give XTM Signals as a Base and then try to
// get Verifications from other stuffs ...
bool isXTMMethodHasSignal =
//
isXTMHasSignal
//
&&
//
conditions.isXTMPeak
//
&&
//
(
//
xTMMethodCond1 ||
// xTMMethodCond2 ||
xTMMethodCond3 ||
xTMMethodCond4 ||
xTMMethodCond5 ||
xTMMethodCond6
//
)
//
;
//
// Filling Methods Buffer ...
if (isXTMMethodHasSignal)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_XTM_METHOD;
}
//
// END XTM Method ...
//
//
// START XTD Method ...
//
//
// Condition 1
bool xTDMethodCond1 =
//
false
//
;
//
// Condition 2
bool xTDMethodCond2 =
//
false
//
;
//
// Condition 3
bool xTDMethodCond3 =
//
false
//
;
//
// Condition 4
bool xTDMethodCond4 =
//
false
//
;
//
// Condition 5
bool xTDMethodCond5 =
//
false
//
;
//
// Condition 6
bool xTDMethodCond6 =
//
false
//
;
//
// In this Method we give XTD Signals as a Base and then try to
// get Verifications from other stuffs ...
bool isXTDMethodHasSignal =
//
isXTDHasSignal
//
// &&
// //
// Merge Positions Conditions here ...
// conditions.isXTDSignalVale
//
// &&
// //
// (
// //
// xTDMethodCond1 ||
// xTDMethodCond2 ||
// xTDMethodCond3 ||
// xTDMethodCond4 ||
// xTDMethodCond5 ||
// xTDMethodCond6
// //
// )
//
;
//
// Filling Methods Buffer ...
if (isXTDMethodHasSignal)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_XTD_METHOD;
}
//
// END XTD Method ...
//
//
// START XOBD Method ...
//
//
// Implement Market Conditions ...
bool xOBDMethodCond1 =
//
false
//
;
//
bool isXOBDMethodHasSignal =
//
false
//
;
//
// Filling Methods Buffer ...
if (isXOBDMethodHasSignal)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_XOBD_METHOD;
}
//
// END XOBD Method ...
//
//
// START XCHMA Method ...
//
//
// Implement Market Conditions ...
bool xCHMAMethodCond1 =
//
false
//
;
//
bool isXCHMAMethodHasSignal =
//
false
//
;
//
// Filling Methods Buffer ...
if (isXCHMAMethodHasSignal)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_XCHMA_METHOD;
}
//
// END XCHMA Method ...
//
//
// START XCHLH Method ...
//
//
// Implement Market Conditions ...
bool xCHLHMethodCond1 =
//
false
//
;
//
bool isXCHLHMethodHasSignal =
//
false
//
;
//
// Filling Methods Buffer ...
if (isXCHLHMethodHasSignal)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_XCHLH_METHOD;
}
//
// END XCHLH Method ...
//
//
// START XRSI Method ...
//
//
// Implement Market Conditions ...
bool xRSIMethodCond1 =
//
false
//
;
//
bool isXRSIMethodHasSignal =
//
false
//
;
//
// Filling Methods Buffer ...
if (isXRSIMethodHasSignal)
{
//
ArrayResize(
methods,
ArraySize(methods) + 1);
//
methods[ArraySize(methods) - 1] = X_SIGNAL_XRSI_METHOD;
}
//
// END XRSI Method ...
//
//
result =
//
// isXTMHasSignal
// isXTDHasSignal
// isXTMMethodHasSignal
//
// ||
//
isXTDMethodHasSignal
//
// ||
// //
// isXOBDMethodHasSignal
// //
// ||
// //
// isXCHMAMethodHasSignal
// //
// ||
// //
// isXCHLHMethodHasSignal
// //
// ||
// //
// isXRSIMethodHasSignal
//
;
//
// 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
//
&&
//
!conditions.isXRSICrossedUnderShortExit
//
&&
//
!(
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHSCMCLLSame &&
//
conditions.isXCHMASCFastCrossedUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
&&
//
!(
//
(
//
conditions.isXTDSignalOverBear ||
conditions.isXTDSignalCrossedUnderBear
//
)
//
&&
//
(
//
conditions.isXOBDSignalUnderSwingHigh ||
conditions.isXOBDSignalOverSwingHigh
//
)
//
&&
//
conditions.isXCHLHSignalBUnderSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHSCMCHHSame &&
//
(
//
(
//
conditions.isXCHMASCFastCrossedUnderSlow &&
conditions.isXCHMAMCFastUnderSlow &&
conditions.isXCHMALCFastOverSlow
//
) ||
(
//
conditions.isXCHMASCFastOverSlow &&
conditions.isXCHMAMCFastUnderSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
)
//
)
//
&&
//
!(
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
xOBDSwingLowBuffer[1] < xOBDSwingHighBuffer[1] &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
//
conditions.isXCHMASCFastUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalOverSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
//
conditions.isXCHMASCFastUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalOverBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCHHSame &&
//
conditions.isXCHMASCPeak &&
conditions.isXCHMASCFastOverSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXOBDSignalUnderSwingHigh &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHSCMCLLSame &&
conditions.isXCHLHMCLCHHSame &&
//
conditions.isXCHMAMCPeak &&
conditions.isXCHMASCFastUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastUnderSlow
//
)
//
&&
//
!(
//
conditions.isXTDSignalUnderBear &&
//
conditions.isXCHLHSignalBOverSignalT &&
conditions.isXCHLHSignalBOverLCLL &&
conditions.isXCHLHMCLCHHSame &&
//
conditions.isXCHMASCFastUnderSlow &&
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMALCFastOverSlow
//
)
//
;
//
// 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
//
)
//
//
//
// &&
// //
// candle1.close < xTMMaBuffer[1]
// //
// &&
// //
// conditions.isXTDSignalUnderBear
// //
// &&
// //
// MathMin(xCHMAScFastBuffer[1], xCHMAScSlowBuffer[1]) > xCHMAMin1
// //
// &&
// (
// //
// conditions.isXCHMASCFastCrossedUnderSlow ||
// conditions.isXCHMASCFastUnderSlow
// //
// )
// //
// &&
// //
// (
// //
// (
// //
// conditions.isXCHMAMCFastCrossedUnderSlow ||
// conditions.isXCHMAMCFastUnderSlow
// //
// )
// //
// ||
// //
// (
// //
// conditions.isXCHMALCFastCrossedUnderSlow ||
// conditions.isXCHMALCFastUnderSlow
// //
// )
// //
// )
//
// &&
// //
// !(
// //
// xCHLHScHHBuffer[1] <= xCHLHNonLCMax1 &&
// xCHLHNonLCMax1 < (xCHLHLcHHBuffer[1] - (xCHLHLCRange1 / 2))
// //
// )
//
//
// &&
// //
// (
// //
// // Check if MC Fast Over Slow, it must be Decreasing ...
// conditions.isXCHMAMCFastOverSlow ||
// conditions.isXCHMAMCFastCrossedOverSlow
// //
// ?
// //
// !(
// //
// xCHMAMCTrend1 > xCHMAMCTrend5 &&
// xCHMAMCTrend1 > xCHMAMCTrend10
// //
// )
// //
// :
// //
// // Check if LC Fast Over Slow, it must be Decreasing ...
// conditions.isXCHMALCFastOverSlow ||
// conditions.isXCHMALCFastCrossedOverSlow
// //
// ?
// //
// !(
// //
// xCHMALCTrend1 > xCHMALCTrend5 &&
// xCHMALCTrend1 > xCHMALCTrend10
// //
// )
// //
// :
// //
// true
// //
// )
// //
// &&
// //
// (
// //
// // Check if MC Fast Under Slow, it must be Increasing ...
// conditions.isXCHMAMCFastUnderSlow ||
// conditions.isXCHMAMCFastCrossedUnderSlow
// //
// ?
// //
// !(
// //
// xCHMAMCTrend1 < xCHMAMCTrend5 &&
// xCHMAMCTrend1 < xCHMAMCTrend10
// //
// )
// //
// :
// //
// // Check if LC Fast Under Slow, it must be Increasing ...
// conditions.isXCHMALCFastUnderSlow ||
// conditions.isXCHMALCFastCrossedUnderSlow
// //
// ?
// //
// !(
// //
// xCHMALCTrend1 < xCHMALCTrend5 &&
// xCHMALCTrend1 < xCHMALCTrend10
// //
// )
// //
// :
// //
// true
// //
// )
//
// &&
// //
// !(
// //
// xCHLHSignalTBuffer[1] >= xCHLHScHHBuffer[1] &&
// isIncreasingMCHH
// //
// )
// //
// &&
// //
// !(
// //
// xCHLHLcLLBuffer[1] > xCHLHLcLLBuffer[3] &&
// xCHLHSignalTBuffer[1] > xCHLHSignalTBuffer[3]
// )
// //
// &&
// //
// xOBDSwingHighBuffer[1] != xOBDSwingLowBuffer[1] &&
// xOBDSignalBuffer[1] != 0
// //
// &&
// //
// (
// //
// conditions.isXOBDSignalUnderSwingHigh
// ? xOBDSwingLowBuffer[1] > xOBDSwingHighBuffer[1]
// : true
// //
// )
// //
// &&
// //
// !(
// //
// conditions.isXTDSignalUnderBear &&
// //
// conditions.isXOBDSignalCrossedUnderSwingHigh &&
// //
// conditions.isXCHLHSignalBUnderSignalT &&
// conditions.isXCHLHSignalBOverLCLL &&
// conditions.isXCHLHMCLCLLSame &&
// //
// conditions.isXCHMASCFastUnderSlow &&
// conditions.isXCHMAMCFastUnderSlow &&
// conditions.isXCHMALCFastOverSlow
// //
// )
// //
// &&
// //
// !(
// //
// conditions.isXTDSignalUnderBear &&
// //
// conditions.isXOBDSignalUnderSwingHigh &&
// //
// conditions.isXCHLHSignalBOverSignalT &&
// conditions.isXCHLHSignalBOverLCLL &&
// conditions.isXCHLHMCLCHHSame &&
// //
// conditions.isXCHMASCFastUnderSlow &&
// conditions.isXCHMAMCFastOverSlow &&
// conditions.isXCHMALCFastUnderSlow
// //
// )
//
;
//
// IMPORTANT ...
//
bool swingBasedSignal =
//
// Selecet Swing High as base ...
conditions.isXOBDSwingHigh
//
&&
//
conditions.isXLHHighAttachedHH
//
&&
//
(
//
conditions.isXTMBullish ? !conditions.isXTMPeak : true
//
)
//
&&
//
(
//
(
//
conditions.isXCHMAMCFastOverSlow &&
conditions.isXCHMAMCTrendsUp
? !conditions.isXCHMAMCPeak
: true
//
)
//
&&
//
(
//
conditions.isXCHMALCFastOverSlow &&
conditions.isXCHMALCTrendsUp
? !conditions.isXCHMALCPeak
: true
//
)
//
)
//
&&
//
!(
//
(
//
conditions.isXCHMASCTrendsDown &&
conditions.isXCHMASCFastOverSlow
//
)
//
&&
//
(
//
conditions.isXCHMAMCTrendsDown &&
conditions.isXCHMAMCFastOverSlow
//
)
//
&&
//
(
//
conditions.isXCHMALCTrendsDown &&
conditions.isXCHMALCFastOverSlow
//
)
//
)
//
&&
//
(
//
conditions.isXCHMASCFastOverSlow &&
conditions.isXCHMASCTrendsUp &&
conditions.isXCHMASCPeak
?
//
!(
//
conditions.isXCHMAMCTrendsDown &&
conditions.isXCHMAMCFastUnderSlow &&
conditions.isXCHMALCTrendsDown &&
conditions.isXCHMALCFastUnderSlow
//
)
//
:
//
true
//
)
//
;
//
if (swingBasedSignal)
{
//
info.signalPusher++;
//
info.tp = (MathAbs(xLHLLBuffer[1] - entry));
info.riskFree = (MathAbs(xLHSignalBuffer[1] - entry));
}