complete X786 ...

This commit is contained in:
2024-05-28 19:25:53 +03:30
parent dd276cf704
commit 179efd4170
5 changed files with 1579 additions and 553 deletions
+132 -540
View File
@@ -265,6 +265,7 @@ public:
// Current ...
cMarketInputs.pvInputs = this.pvInputs;
cMarketInputs.zgInputs = this.zgInputs;
cMarketInputs.tdInputs = this.tdInputs;
cMarketInputs.mcInputs = this.mcInputs;
cMarketInputs.hkInputs = this.hkInputs;
cMarketInputs.mrbInputs = this.mrbInputs;
@@ -291,6 +292,7 @@ public:
// Short ...
sMarketInputs.pvInputs = this.pvInputs;
sMarketInputs.zgInputs = this.zgInputs;
sMarketInputs.tdInputs = this.tdInputs;
sMarketInputs.mcInputs = this.mcInputs;
sMarketInputs.hkInputs = this.hkInputs;
sMarketInputs.mrbInputs = this.mrbInputs;
@@ -317,6 +319,7 @@ public:
// Medium ...
mMarketInputs.pvInputs = this.pvInputs;
mMarketInputs.zgInputs = this.zgInputs;
mMarketInputs.tdInputs = this.tdInputs;
mMarketInputs.mcInputs = this.mcInputs;
mMarketInputs.hkInputs = this.hkInputs;
mMarketInputs.mrbInputs = this.mrbInputs;
@@ -343,6 +346,7 @@ public:
// Long ...
lMarketInputs.pvInputs = this.pvInputs;
lMarketInputs.zgInputs = this.zgInputs;
lMarketInputs.tdInputs = this.tdInputs;
lMarketInputs.mcInputs = this.mcInputs;
lMarketInputs.hkInputs = this.hkInputs;
lMarketInputs.mrbInputs = this.mrbInputs;
@@ -369,6 +373,7 @@ public:
// Hind ...
hMarketInputs.pvInputs = this.pvInputs;
hMarketInputs.zgInputs = this.zgInputs;
hMarketInputs.tdInputs = this.tdInputs;
hMarketInputs.mcInputs = this.mcInputs;
hMarketInputs.hkInputs = this.hkInputs;
hMarketInputs.mrbInputs = this.mrbInputs;
@@ -3091,17 +3096,19 @@ public:
? entry - risk
: entry + risk;
}
//
// TODOO: Remove this ...
sl = hasLong
? sMarket.pv.GetMCLL(0)
: sMarket.pv.GetMCHH(0);
double risk = MathAbs(entry - sl);
double reward = risk * r2r;
tp = hasLong
? entry + reward
: entry - reward;
else
{
//
// TODOO: Remove this ...
sl = hasLong
? sMarket.pv.GetMCLL(0)
: sMarket.pv.GetMCHH(0);
double risk = MathAbs(entry - sl);
double reward = risk * r2r;
tp = hasLong
? entry + reward
: entry - reward;
}
//
result = mSignal.Prepare(
@@ -7570,422 +7577,6 @@ private:
//
bool result = false;
//
// XSTR
// XPV
// XHK
// XCHE
// XTD
// XDON
//
// Conditions ...
// - [] XPV,XDON: XPV Vale and XDON LL (Low Lower) must be same;
// - [] XDON: Candle Crossed Down XDON HL (High Lower);
// - [] XDON: Candle Crossed Up XDON HL (High Lower);
// - [] XTD: When Candle Crossed Up XTD Must in Bullish Mode;
// - [] XCHE: Check CHE Long Exits Exists;
// - [] XSTR: Check STR Trend is Bullish;
// - [] XPV: Not In Fibo Section Changed;
// - [] XPV: Fibo Level 5 Crossed Using Don HL Crosser Cndle;
//
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
//
// XSTR ...
ENUM_XSTR_TREND_STATES cStrState = cMarket
.str
.GetState(cIndex);
double cStrTrend = cMarket.str.GetTrend(cIndex);
bool isCStrBullish = cStrState == X_STR_BULLISH;
bool isCStrBearish = cStrState == X_STR_BEARISH;
//
ENUM_XSTR_TREND_STATES pStrState = cMarket
.str
.GetState(pIndex);
double pStrTrend = cMarket.str.GetTrend(pIndex);
bool isPStrBullish = pStrState == X_STR_BULLISH;
bool isPStrBearish = pStrState == X_STR_BEARISH;
//
bool isTrendBullish = isCStrBullish;
bool isTrendBearish = isCStrBearish;
//
bool isTrendSwitchedToBullish =
//
isCStrBullish &&
!isPStrBullish
//
;
//
bool isTrendSwitchedToBearish =
//
isCStrBearish &&
!isPStrBearish
//
;
//
// XCHE ...
//
double cCHELongExit1 = cMarket.che.GetLongExit1(cIndex);
double cCHELongExit2 = cMarket.che.GetLongExit2(cIndex);
//
double pCHELongExit1 = cMarket.che.GetLongExit1(pIndex);
double pCHELongExit2 = cMarket.che.GetLongExit2(pIndex);
//
double cCHEShortExit1 = cMarket.che.GetShortExit1(cIndex);
double cCHEShortExit2 = cMarket.che.GetShortExit2(cIndex);
//
double pCHEShortExit1 = cMarket.che.GetShortExit1(pIndex);
double pCHEShortExit2 = cMarket.che.GetShortExit2(pIndex);
//
bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1);
bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2);
//
bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1);
bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2);
//
bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1);
bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2);
//
bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1);
bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2);
//
bool isCCHEBullish =
//
CCHEHasLongExit1 &&
CCHEHasLongExit2
//
;
//
bool isCCHEBearish =
//
CCHEHasShortExit1 &&
CCHEHasShortExit2
//
;
//
bool isPCHEBullish =
//
PCHEHasLongExit1 &&
PCHEHasLongExit2
//
;
//
bool isPCHEBearish =
//
PCHEHasShortExit1 &&
PCHEHasShortExit2
//
;
//
bool isCHEBullish = isCCHEBullish;
bool isCHEBearish = isCCHEBearish;
bool isCHESwitchedToBullish =
//
isCCHEBullish &&
!isPCHEBullish
//
;
bool isCHESwitchedToBearish =
//
isCCHEBearish &&
!isPCHEBearish
//
;
//
// XPV ...
double cPVPeak = cMarket.pv.GetPeak(cIndex);
double cPVVale = cMarket.pv.GetVale(cIndex);
//
double pPVPeak = cMarket.pv.GetPeak(pIndex);
double pPVVale = cMarket.pv.GetVale(pIndex);
//
double cPVSup = cMarket.pv.GetSupport(cIndex);
double pPVSup = cMarket.pv.GetSupport(pIndex);
//
double cPVRes = cMarket.pv.GetResistance(cIndex);
double pPVRes = cMarket.pv.GetResistance(pIndex);
//
double cPVFib1 = cMarket.pv.GetFib1(cIndex);
double cPVFib2 = cMarket.pv.GetFib2(cIndex);
double cPVFib3 = cMarket.pv.GetFib3(cIndex);
double cPVFib4 = cMarket.pv.GetFib4(cIndex);
double cPVFib5 = cMarket.pv.GetFib5(cIndex);
//
double pPVFib1 = cMarket.pv.GetFib1(pIndex);
double pPVFib2 = cMarket.pv.GetFib2(pIndex);
double pPVFib3 = cMarket.pv.GetFib3(pIndex);
double pPVFib4 = cMarket.pv.GetFib4(pIndex);
double pPVFib5 = cMarket.pv.GetFib5(pIndex);
//
bool isNewPeak = cPVPeak != pPVPeak;
bool isNewPeakUnderLast =
//
isNewPeak &&
cPVPeak < pPVPeak
//
;
bool isNewPeakOverLast =
//
isNewPeak &&
cPVPeak > pPVPeak
//
;
//
bool isNewVale = cPVVale != pPVVale;
bool isNewValeUnderLast =
//
isNewVale &&
cPVVale < pPVVale
//
;
bool isNewValeOverLast =
//
isNewVale &&
cPVVale > pPVVale
//
;
//
bool isFiboIncreased =
//
cPVFib1 > pPVFib1 &&
cPVFib2 > pPVFib2 &&
cPVFib3 > pPVFib3 &&
cPVFib4 > pPVFib4 &&
cPVFib5 > pPVFib5
//
;
//
bool isFiboDecreased =
//
cPVFib1 < pPVFib1 &&
cPVFib2 < pPVFib2 &&
cPVFib3 < pPVFib3 &&
cPVFib4 < pPVFib4 &&
cPVFib5 < pPVFib5
//
;
//
bool isFiboSectionChanged =
//
(isFiboDecreased &&
isNewPeakUnderLast)
//
||
//
(isFiboIncreased &&
isNewValeOverLast)
//
;
//
// XFI ...
//
double cFI = fiHelper.GetMain(cIndex);
double pFI = fiHelper.GetMain(pIndex);
//
bool isCFIOverZero = cFI > 0;
bool isCFIUnderZero = cFI > 0;
//
bool isPFIOverZero = pFI > 0;
bool isPFIUnderZero = pFI > 0;
//
bool isFICrossedOverZero =
//
isCFIOverZero &&
!isPFIOverZero
//
;
//
bool isFICrossedUnderZero =
//
isCFIUnderZero &&
!isPFIUnderZero
//
;
//
// XHK ...
//
XOHCL cSMHKBar;
cMarket.hk.SMAsOHCL(
cSMHKBar,
cIndex //
);
//
XOHCL pSMHKBar;
cMarket.hk.SMAsOHCL(
pSMHKBar,
pIndex //
);
//
bool isCSMHKBullish = cSMHKBar.IsBullish();
bool isCSMHKBearish = cSMHKBar.IsBearish();
//
bool isPSMHKBullish = pSMHKBar.IsBullish();
bool isPSMHKBearish = pSMHKBar.IsBearish();
//
bool isSMHKSwitchedToBullish =
//
isCSMHKBullish &&
isPSMHKBearish
//
;
//
bool isSMHKSwitchedToBearish =
//
isCSMHKBearish &&
isPSMHKBullish
//
;
//
// XTD ...
//
double cTDBullish = tdHelper.GetBullish(cIndex);
double pTDBullish = tdHelper.GetBullish(pIndex);
//
double cTDBearish = tdHelper.GetBearish(cIndex);
double pTDBearish = tdHelper.GetBearish(pIndex);
//
bool isCTDBullish =
//
cTDBullish > cTDBearish
//
;
//
bool isCTDBearish =
//
cTDBearish > cTDBullish
//
;
//
bool isPTDBullish =
//
pTDBullish > pTDBearish
//
;
//
bool isPTDBearish =
//
pTDBearish > pTDBullish
//
;
//
bool isTDBullish = isCTDBullish;
bool isTDBearish = isCTDBearish;
bool isTDSwitchedToBullish =
//
isCTDBullish &&
!isPTDBullish
//
;
bool isTDSwitchedToBearsih =
//
isCTDBearish &&
!isPTDBearish
//
;
//
// XDON ...
//
XOHCL cBar = cMarket.GetBar(cIndex);
XOHCL pBar = cMarket.GetBar(pIndex);
//
double cDONUpperOpen = cMarket.don.GetUpperO(cIndex);
double cDONUpperClose = cMarket.don.GetUpperC(cIndex);
double cDONUpperHigh = cMarket.don.GetUpperH(cIndex);
double cDONUpperLow = cMarket.don.GetUpperL(cIndex);
//
double cDONLowerOpen = cMarket.don.GetLowerO(cIndex);
double cDONLowerClose = cMarket.don.GetLowerC(cIndex);
double cDONLowerHigh = cMarket.don.GetLowerH(cIndex);
double cDONLowerLow = cMarket.don.GetLowerL(cIndex);
//
double pDONUpperOpen = cMarket.don.GetUpperO(pIndex);
double pDONUpperClose = cMarket.don.GetUpperC(pIndex);
double pDONUpperHigh = cMarket.don.GetUpperH(pIndex);
double pDONUpperLow = cMarket.don.GetUpperL(pIndex);
//
double pDONLowerOpen = cMarket.don.GetLowerO(pIndex);
double pDONLowerClose = cMarket.don.GetLowerC(pIndex);
double pDONLowerHigh = cMarket.don.GetLowerH(pIndex);
double pDONLowerLow = cMarket.don.GetLowerL(pIndex);
//
bool isBarCrossedDownDONLowerHigh =
//
cBar.IsBreakDown(pDONLowerHigh)
//
;
//
result =
//
isTrendSwitchedToBullish
//
;
if (result) {
Print("Salam");
}
//
return result;
}
@@ -8003,86 +7594,85 @@ private:
bool result = false;
//
bool isCMStrLong =
//
mConditions.cMarketConditions.isTrendSwitchedToBullish &&
(mConditions.hMarketConditions.isTrendBullish &&
mConditions.lMarketConditions.isTrendBullish &&
mConditions.mMarketConditions.isTrendBullish &&
mConditions.sMarketConditions.isTrendBullish)
//
;
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
//
bool isSMStrLong =
//
mConditions.sMarketConditions.isTrendSwitchedToBullish &&
(mConditions.hMarketConditions.isTrendBullish &&
mConditions.lMarketConditions.isTrendBullish &&
mConditions.mMarketConditions.isTrendBullish &&
mConditions.cMarketConditions.isTrendBullish)
//
;
// Current Market ...
double cLowerHigh = cMarket.don.GetLowerH(cIndex);
bool cHasX786 = cMarket.HasX786LongConditions();
if (cHasX786)
{
sl = cLowerHigh;
}
//
bool isMMStrLong =
//
mConditions.mMarketConditions.isTrendSwitchedToBullish &&
(mConditions.hMarketConditions.isTrendBullish &&
mConditions.lMarketConditions.isTrendBullish &&
mConditions.sMarketConditions.isTrendBullish &&
mConditions.cMarketConditions.isTrendBullish)
//
;
// Short Market ...
double sLowerHigh = sMarket.don.GetLowerH(cIndex);
bool sHasX786 = sMarket.HasX786LongConditions();
if (sHasX786)
{
sl = sLowerHigh;
}
//
bool isLMStrLong =
//
mConditions.lMarketConditions.isTrendSwitchedToBullish &&
(mConditions.hMarketConditions.isTrendBullish &&
mConditions.mMarketConditions.isTrendBullish &&
mConditions.sMarketConditions.isTrendBullish &&
mConditions.cMarketConditions.isTrendBullish)
//
;
// Medium Market ...
double mLowerHigh = mMarket.don.GetLowerH(cIndex);
bool mHasX786 = mMarket.HasX786LongConditions();
if (mHasX786)
{
sl = mLowerHigh;
}
//
bool isHMStrLong =
//
mConditions.hMarketConditions.isTrendSwitchedToBullish &&
(mConditions.lMarketConditions.isTrendBullish &&
mConditions.mMarketConditions.isTrendBullish &&
mConditions.sMarketConditions.isTrendBullish &&
mConditions.cMarketConditions.isTrendBullish)
//
;
// Long Market ...
double lLowerHigh = lMarket.don.GetLowerH(cIndex);
bool lHasX786 = lMarket.HasX786LongConditions();
if (lHasX786)
{
sl = lLowerHigh;
}
//
// bool isScorePassed = IsScorePassedForLong();
// Hind Market ...
double hLowerHigh = hMarket.don.GetLowerH(cIndex);
bool hHasX786 = hMarket.HasX786LongConditions();
if (hHasX786)
{
sl = hLowerHigh;
}
//
result =
//
// isCMStrLong
// //
// ||
// //
// isSMStrLong
// //
// ||
//
isMMStrLong
cHasX786
//
||
//
isLMStrLong
sHasX786
//
||
//
isHMStrLong
mHasX786
//
||
//
lHasX786
//
// ||
// //
// hHasX786
//
;
//
if (result)
{
//
r2r = 2;
}
//
return result;
}
@@ -9155,83 +8745,85 @@ private:
bool result = false;
//
bool isCMStrShort =
//
mConditions.cMarketConditions.isTrendSwitchedToBearish &&
(mConditions.hMarketConditions.isTrendBearish &&
mConditions.lMarketConditions.isTrendBearish &&
mConditions.mMarketConditions.isTrendBearish &&
mConditions.sMarketConditions.isTrendBearish)
//
;
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
//
bool isSMStrShort =
//
mConditions.sMarketConditions.isTrendSwitchedToBearish &&
(mConditions.hMarketConditions.isTrendBearish &&
mConditions.lMarketConditions.isTrendBearish &&
mConditions.mMarketConditions.isTrendBearish &&
mConditions.cMarketConditions.isTrendBearish)
//
;
// Current Market ...
double cUpperLow = cMarket.don.GetUpperL(cIndex);
bool cHasX786 = cMarket.HasX786ShortConditions();
if (cHasX786)
{
sl = cUpperLow;
}
//
bool isMMStrShort =
//
mConditions.mMarketConditions.isTrendSwitchedToBearish &&
(mConditions.hMarketConditions.isTrendBearish &&
mConditions.lMarketConditions.isTrendBearish &&
mConditions.sMarketConditions.isTrendBearish &&
mConditions.cMarketConditions.isTrendBearish)
//
;
// Short Market ...
double sUpperLow = sMarket.don.GetUpperL(cIndex);
bool sHasX786 = sMarket.HasX786ShortConditions();
if (sHasX786)
{
sl = sUpperLow;
}
//
bool isLMStrShort =
//
mConditions.lMarketConditions.isTrendSwitchedToBearish &&
(mConditions.hMarketConditions.isTrendBearish &&
mConditions.mMarketConditions.isTrendBearish &&
mConditions.sMarketConditions.isTrendBearish &&
mConditions.cMarketConditions.isTrendBearish)
//
;
// Medium Market ...
double mUpperLow = mMarket.don.GetUpperL(cIndex);
bool mHasX786 = mMarket.HasX786ShortConditions();
if (mHasX786)
{
sl = mUpperLow;
}
//
bool isHMStrShort =
//
mConditions.hMarketConditions.isTrendSwitchedToBearish &&
(mConditions.lMarketConditions.isTrendBearish &&
mConditions.mMarketConditions.isTrendBearish &&
mConditions.sMarketConditions.isTrendBearish &&
mConditions.cMarketConditions.isTrendBearish)
//
;
// Long Market ...
double lUpperLow = lMarket.don.GetUpperL(cIndex);
bool lHasX786 = lMarket.HasX786ShortConditions();
if (lHasX786)
{
sl = lUpperLow;
}
//
// Hind Market ...
double hUpperLow = hMarket.don.GetUpperL(cIndex);
bool hHasX786 = hMarket.HasX786ShortConditions();
if (hHasX786)
{
sl = hUpperLow;
}
//
result =
//
// isCMStrShort
// //
// ||
// //
// isSMStrShort
// //
// ||
//
isMMStrShort
cHasX786
//
||
//
isLMStrShort
sHasX786
//
||
//
isHMStrShort
mHasX786
//
||
//
lHasX786
//
// ||
// //
// hHasX786
//
;
//
if (result)
{
//
r2r = 2;
}
//
return result;
}
+12 -6
View File
@@ -730,16 +730,16 @@ public:
}
//
void HandleTrailManagement(XPosition &positions[])
void HandleTrailManagement(XPosition &positions[])
{
//
// TODO:
// Make them Configurable ...
int maxTrailTPs = 5;
// int levelsOnClose = 6;
int riskFreeLevel = 4;
int riskFreeLevel = 0;
int requiredAgeForTrail = 0;
int requiredDistanceForTrail = 10;
int requiredDistanceForTrail = 50;
//
int positionsCount = ArraySize(positions);
@@ -811,13 +811,19 @@ public:
//
double slDiff = PointToPrice(priceDistance, iPosition.symbol);
double appliedSL = slDiff;
double appliedSL = slDiff / 2;
//
// double sl =
// IsLong(iPosition.type)
// ? iPosition.sl + appliedSL
// : iPosition.sl - appliedSL;
//
double sl =
IsLong(iPosition.type)
? iPosition.sl + appliedSL
: iPosition.sl - appliedSL;
? iPosition.entry + appliedSL
: iPosition.entry - appliedSL;
//
// double sl =
File diff suppressed because it is too large Load Diff