Files
xMQL5/MQLTestWorkspace/BKPS/Templates/ichimoku.test.short.signals.mq5
T

252 lines
5.2 KiB
Plaintext

bool XTestPRVDHasShortCondition()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
_Symbol,
_Period,
1);
//
XOHCL c2 = GetCandle(
_Symbol,
_Period,
2);
//
XIchiInfo ichiInfo = XICHIHLPGetInfo(2);
//
bool isCandleClosedUnderPsar =
//
c1.high < atrslSarBuffer[1]
//
;
//
bool isTrendSwitched =
//
XTRNDHLPIsTrendStronglyBearish(1)
//
;
//
bool isNewValeHappends =
//
XPVHLPIsVale(1) &&
!XPVHLPIsVale(2)
//
;
//
bool isKumoBearish =
//
XICHIHLPIsKumoBearish(1)
//
;
//
bool isTenkanSenUnderKijunSen =
//
XICHIHLPIsTenkanSenUnderKijunSen(1)
//
;
//
bool isTenkanSenCrossedUnderKijunSen =
//
XICHIHLPIsTenkanSenCrossedUnderKijunSen(1)
//
;
//
bool isBullishKumoBreakout =
//
XICHIHLPIsKumoBullish(1) &&
XICHIHLPIsKumoBullish(2) &&
(c2.high > MathMax(ichiInfo.senkouSpanA, ichiInfo.senkouSpanB) &&
c2.low < MathMin(ichiInfo.senkouSpanA, ichiInfo.senkouSpanB)) &&
c1.high < MathMin(ichiInfo.senkouSpanA, ichiInfo.senkouSpanB)
//
;
//
bool isCandloClosedUnderTenkanSen =
//
c1.high < ichiInfo.tenkanSen
//
;
//
bool isKijunbSenUnderKumo =
//
ichiInfo.kijunSen < MathMin(ichiInfo.senkouSpanA, ichiInfo.senkouSpanB)
//
;
//
bool isChikouSpanFree =
//
c1.close < GetLowestLow(
_Symbol,
_Period,
1,
26)
//
;
//
bool isKumoSoFat =
//
MathAbs(ichiInfo.senkouSpanA - ichiInfo.senkouSpanB) > MathAbs(GetHighestHigh(
_Symbol,
_Period,
1,
17) -
GetLowestLow(
_Symbol,
_Period,
1,
17))
//
;
//
bool isKijunSenInsideFutureKumo =
//
ichiInfo.kijunSen < MathMax(ichiInfo.senkouSpanAFuture, ichiInfo.senkouSpanBFuture) &&
ichiInfo.kijunSen > MathMin(ichiInfo.senkouSpanAFuture, ichiInfo.senkouSpanBFuture)
//
;
//
bool isFutureKumoBearish =
//
XICHIHLPIsKumoBearish(1, true)
// &&
//
// TODO: Remove this ...
// MathMax(ichiInfo.senkouSpanA, ichiInfo.senkouSpanB) < MathMax(ichiInfo.senkouSpanAFuture, ichiInfo.senkouSpanBFuture)
//
;
//
bool signal1 =
//
isKumoBearish &&
isTrendSwitched &&
isNewValeHappends &&
isCandleClosedUnderPsar &&
isTenkanSenUnderKijunSen
//
;
//
bool signal2 =
//
isKijunbSenUnderKumo &&
isBullishKumoBreakout &&
isTenkanSenUnderKijunSen &&
isCandloClosedUnderTenkanSen
//
;
//
bool signal3 =
//
!isKumoSoFat &&
isChikouSpanFree &&
isFutureKumoBearish &&
isKijunbSenUnderKumo &&
!isKijunSenInsideFutureKumo &&
isCandloClosedUnderTenkanSen &&
isTenkanSenCrossedUnderKijunSen
//
;
//
result =
//
// signal1
// //
// ||
//
// signal2
// //
// ||
//
signal3
//
;
//
return result;
}
///
//
XOHCL c1 = GetCandle(
_Symbol,
_Period,
1);
//
XOHCL c2 = GetCandle(
_Symbol,
_Period,
2);
//
XIchiInfo ichiInfo = XICHIHLPGetInfo(1);
//
bool isKumoSwitchedToBeraish =
//
XICHIHLPIsKumoSwitchedToBearish(1)
//
;
//
double ll9Value = GetLowestLow(
_Symbol,
_Period,
9,
1);
double hh9Value = GetHighestHigh(
_Symbol,
_Period,
9,
1);
bool isChikouSpanUnderPrice =
//
ichiInfo.chikouSpan < ll9Value &&
ichiInfo.chikouSpan < hh9Value
//
;
//
bool isTenkanSenOverKijunSen =
//
XICHIHLPIsTenkanSenOverKijunSen(1)
//
;
//
bool isPriceUnderTenkanSen =
c1.high < ichiInfo.tenkanSen;
//
bool signal1 =
//
isChikouSpanUnderPrice &&
isKumoSwitchedToBeraish &&
(isTenkanSenOverKijunSen
? isPriceUnderTenkanSen
: true)
//
;