add support for FVG and Order Blocks in along side Support and Resistance ...
This commit is contained in:
@@ -270,6 +270,9 @@ public:
|
||||
MODE_LOW //
|
||||
);
|
||||
|
||||
//
|
||||
// Support nad Resistance ...
|
||||
|
||||
//
|
||||
// Check Support Exists or Find ...
|
||||
bool hasSupport = support.IsValid();
|
||||
@@ -322,6 +325,118 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
|
||||
//
|
||||
bool hasBullishOB = bullishOB.IsValid();
|
||||
if (!hasBullishOB)
|
||||
{
|
||||
//
|
||||
hasBullishOB =
|
||||
//
|
||||
cBar.HasBullishOrderBlock(bullishOB)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (hasBullishOB)
|
||||
{
|
||||
//
|
||||
DrawBullishOrderBlock(
|
||||
bullishOB,
|
||||
ChartID() //
|
||||
);
|
||||
|
||||
//
|
||||
bullishOBTime = cBar.time;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasBearishOB = bearishOB.IsValid();
|
||||
if (!hasBearishOB)
|
||||
{
|
||||
//
|
||||
hasBearishOB =
|
||||
//
|
||||
cBar.HasBearishOrderBlock(bearishOB)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (hasBearishOB)
|
||||
{
|
||||
//
|
||||
DrawBearishOrderBlock(
|
||||
bearishOB,
|
||||
ChartID() //
|
||||
);
|
||||
|
||||
//
|
||||
bearishOBTime = cBar.time;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FVG ...
|
||||
|
||||
//
|
||||
bool hasBullishFVG = bullishFVG.IsValid();
|
||||
if (!hasBullishFVG)
|
||||
{
|
||||
//
|
||||
hasBullishFVG =
|
||||
//
|
||||
cBar.HasBullishFVG(bullishFVGUpper, bullishFVGLower)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (hasBullishFVG)
|
||||
{
|
||||
//
|
||||
bullishFVG = cBar;
|
||||
DrawBullishFVG(
|
||||
bullishFVG,
|
||||
bullishFVGUpper,
|
||||
bullishFVGLower,
|
||||
ChartID() //
|
||||
);
|
||||
|
||||
//
|
||||
bullishFVGTime = cBar.time;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasBearishFVG = bearishFVG.IsValid();
|
||||
if (!hasBearishFVG)
|
||||
{
|
||||
//
|
||||
hasBearishFVG =
|
||||
//
|
||||
cBar.HasBearishFVG(bearishFVGUpper, bearishFVGLower)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (hasBearishFVG)
|
||||
{
|
||||
//
|
||||
bearishFVG = cBar;
|
||||
DrawBearishFVG(
|
||||
bearishFVG,
|
||||
bearishFVGUpper,
|
||||
bearishFVGLower,
|
||||
ChartID() //
|
||||
);
|
||||
|
||||
//
|
||||
bearishFVGTime = cBar.time;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// For Trend ...
|
||||
XOHCL tmpHSW[];
|
||||
@@ -332,7 +447,9 @@ public:
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
bool hasBullishPower = cBar.HasBullishPower();
|
||||
bool hasBullishPattern = HasBullishPattern(cBar);
|
||||
bool hasBullishPressure = cBar.HasBullishPressure();
|
||||
bool isBullishTrend = cBar.HasBullishTrend(
|
||||
tmpHSW,
|
||||
tmpLSW,
|
||||
@@ -341,7 +458,9 @@ public:
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
bool hasBearishPower = cBar.HasBearishPower();
|
||||
bool hasBearishPattern = HasBearishPattern(cBar);
|
||||
bool hasBearishPressure = cBar.HasBearishPressure();
|
||||
bool isBearishTrend = cBar.HasBearishTrend(
|
||||
tmpHSW,
|
||||
tmpLSW,
|
||||
@@ -1086,7 +1205,7 @@ public:
|
||||
// Bullish Conclusion ...
|
||||
|
||||
//
|
||||
bool isCHSTRCBullish =
|
||||
bool isCHSTRBullish =
|
||||
//
|
||||
(
|
||||
//
|
||||
@@ -1294,7 +1413,7 @@ public:
|
||||
//
|
||||
// Preparing Signals for Execution ...
|
||||
bool allowCHMSignals = false;
|
||||
bool allowCHHKSignals = true;
|
||||
bool allowCHHKSignals = false;
|
||||
bool allowCHSTRSignals = false;
|
||||
|
||||
//
|
||||
@@ -1362,9 +1481,15 @@ public:
|
||||
//
|
||||
hasLong =
|
||||
//
|
||||
isCHHKBullish &&
|
||||
hasBullishPattern &&
|
||||
chhkDistanceDiffInPoint <= pressureDistance
|
||||
false
|
||||
//
|
||||
// isCHMBullish &&
|
||||
// isCHHKBullish &&
|
||||
// isCHSTRBullish &&
|
||||
// hasBullishPower &&
|
||||
// hasBullishPressure &&
|
||||
// hasBullishPattern &&
|
||||
// chhkDistanceDiffInPoint <= pressureDistance
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1373,7 +1498,7 @@ public:
|
||||
{
|
||||
//
|
||||
type = POSITION_TYPE_BUY;
|
||||
sl = chhkLowMax;
|
||||
sl = chhkLowMin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1383,9 +1508,15 @@ public:
|
||||
//
|
||||
hasShort =
|
||||
//
|
||||
isCHHKBearish &&
|
||||
hasBearishPattern &&
|
||||
chhkDistanceDiffInPoint <= pressureDistance
|
||||
false
|
||||
//
|
||||
// isCHMBearish &&
|
||||
// isCHHKBearish &&
|
||||
// isCHSTRBearish &&
|
||||
// hasBearishPower &&
|
||||
// hasBearishPressure &&
|
||||
// hasBearishPattern &&
|
||||
// chhkDistanceDiffInPoint <= pressureDistance
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1394,7 +1525,7 @@ public:
|
||||
{
|
||||
//
|
||||
type = POSITION_TYPE_SELL;
|
||||
sl = chhkHighMin;
|
||||
sl = chhkHighMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1406,6 +1537,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Long Conditions ...
|
||||
|
||||
//
|
||||
// forceCloseLongs = isCHHKBullishBreaked;
|
||||
// forceCloseShorts = isCHHKBearishBreaked;
|
||||
@@ -1447,6 +1581,16 @@ public:
|
||||
//
|
||||
CheckSupportValidation();
|
||||
CheckResistanceValidation();
|
||||
|
||||
//
|
||||
CheckBullishOBValidation();
|
||||
CheckBearishOBValidation();
|
||||
|
||||
//
|
||||
CheckBullishFVGValidation();
|
||||
CheckBearishFVgValidation();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1470,6 +1614,46 @@ public:
|
||||
resistance.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
if (hasBullishOB)
|
||||
{
|
||||
//
|
||||
bullishOBTime = NULL;
|
||||
RemoveBullishOrderBlock(bullishOB);
|
||||
bullishOB.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
if (hasBearishOB)
|
||||
{
|
||||
//
|
||||
bearishOBTime = NULL;
|
||||
RemoveBearishOrderBlock(bearishOB);
|
||||
bearishOB.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
if (hasBullishFVG)
|
||||
{
|
||||
//
|
||||
bullishFVGUpper = 0;
|
||||
bullishFVGLower = 0;
|
||||
bullishFVGTime = NULL;
|
||||
RemoveBullishFVG(bullishFVG);
|
||||
bullishFVG.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
if (hasBearishFVG)
|
||||
{
|
||||
//
|
||||
bearishFVGUpper = 0;
|
||||
bearishFVGLower = 0;
|
||||
bearishFVGTime = NULL;
|
||||
RemoveBullishFVG(bearishFVG);
|
||||
bearishFVG.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Entry Price based on Position Type ...
|
||||
entry = GetEntry(mSymbol, type);
|
||||
@@ -1512,6 +1696,18 @@ protected:
|
||||
//
|
||||
XOHCL support;
|
||||
XOHCL resistance;
|
||||
XOHCL bullishOB;
|
||||
XOHCL bearishOB;
|
||||
|
||||
//
|
||||
double bullishFVGUpper;
|
||||
double bullishFVGLower;
|
||||
XOHCL bullishFVG;
|
||||
|
||||
//
|
||||
double bearishFVGUpper;
|
||||
double bearishFVGLower;
|
||||
XOHCL bearishFVG;
|
||||
|
||||
//
|
||||
// XPV ...
|
||||
@@ -1557,6 +1753,26 @@ private:
|
||||
resistanceTime = NULL;
|
||||
isResistanceTested = false;
|
||||
|
||||
//
|
||||
// Short ...
|
||||
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES scPeriod = NULL; // PERIOD_M20; // Time Period
|
||||
|
||||
//
|
||||
// Medium ...
|
||||
ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES mcPeriod = NULL; // PERIOD_M30; // Time Period
|
||||
|
||||
//
|
||||
// Long ...
|
||||
ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES lcPeriod = NULL; // PERIOD_H1; // Time Period
|
||||
|
||||
//
|
||||
// Hind ...
|
||||
ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES hcPeriod = NULL; // PERIOD_H2; // Time Period
|
||||
|
||||
//
|
||||
// XPV ...
|
||||
|
||||
@@ -1564,14 +1780,14 @@ private:
|
||||
pvInputs.Default();
|
||||
|
||||
//
|
||||
pvInputs.scMethod = X_PERIOD_MANUALLY;
|
||||
pvInputs.scPeriod = PERIOD_M10;
|
||||
pvInputs.mcMethod = X_PERIOD_MANUALLY;
|
||||
pvInputs.mcPeriod = PERIOD_M15;
|
||||
pvInputs.lcMethod = X_PERIOD_MANUALLY;
|
||||
pvInputs.lcPeriod = PERIOD_M20;
|
||||
pvInputs.hcMethod = X_PERIOD_MANUALLY;
|
||||
pvInputs.hcPeriod = PERIOD_M30;
|
||||
pvInputs.scMethod = scMethod;
|
||||
pvInputs.scPeriod = scPeriod;
|
||||
pvInputs.mcMethod = mcMethod;
|
||||
pvInputs.mcPeriod = mcPeriod;
|
||||
pvInputs.lcMethod = lcMethod;
|
||||
pvInputs.lcPeriod = lcPeriod;
|
||||
pvInputs.hcMethod = hcMethod;
|
||||
pvInputs.hcPeriod = hcPeriod;
|
||||
|
||||
//
|
||||
pvInputs.showPeaksAndVales = true;
|
||||
@@ -1598,10 +1814,10 @@ private:
|
||||
cheInputs.Default();
|
||||
|
||||
//
|
||||
cheInputs.showLongExit1Line = false;
|
||||
cheInputs.showShortExit1Line = false;
|
||||
cheInputs.showLongExit2Line = false;
|
||||
cheInputs.showShortExit2Line = false;
|
||||
cheInputs.showLongExit1Line = true;
|
||||
cheInputs.showShortExit1Line = true;
|
||||
cheInputs.showLongExit2Line = true;
|
||||
cheInputs.showShortExit2Line = true;
|
||||
|
||||
//
|
||||
cheHelper = new XSCXCHEHelper();
|
||||
@@ -1618,14 +1834,14 @@ private:
|
||||
chmInputs.Default();
|
||||
|
||||
//
|
||||
chmInputs.scMethod = X_PERIOD_MANUALLY;
|
||||
chmInputs.scPeriod = PERIOD_M10;
|
||||
chmInputs.mcMethod = X_PERIOD_MANUALLY;
|
||||
chmInputs.mcPeriod = PERIOD_M15;
|
||||
chmInputs.lcMethod = X_PERIOD_MANUALLY;
|
||||
chmInputs.lcPeriod = PERIOD_M20;
|
||||
chmInputs.hcMethod = X_PERIOD_MANUALLY;
|
||||
chmInputs.hcPeriod = PERIOD_M30;
|
||||
chmInputs.scMethod = scMethod;
|
||||
chmInputs.scPeriod = scPeriod;
|
||||
chmInputs.mcMethod = mcMethod;
|
||||
chmInputs.mcPeriod = mcPeriod;
|
||||
chmInputs.lcMethod = lcMethod;
|
||||
chmInputs.lcPeriod = lcPeriod;
|
||||
chmInputs.hcMethod = hcMethod;
|
||||
chmInputs.hcPeriod = hcPeriod;
|
||||
|
||||
//
|
||||
chmInputs.showFast = true;
|
||||
@@ -1656,21 +1872,21 @@ private:
|
||||
chhkInputs.Default();
|
||||
|
||||
//
|
||||
chhkInputs.scMethod = X_PERIOD_MANUALLY;
|
||||
chhkInputs.scPeriod = PERIOD_M10;
|
||||
chhkInputs.mcMethod = X_PERIOD_MANUALLY;
|
||||
chhkInputs.mcPeriod = PERIOD_M15;
|
||||
chhkInputs.lcMethod = X_PERIOD_MANUALLY;
|
||||
chhkInputs.lcPeriod = PERIOD_M20;
|
||||
chhkInputs.hcMethod = X_PERIOD_MANUALLY;
|
||||
chhkInputs.hcPeriod = PERIOD_M30;
|
||||
chhkInputs.scMethod = scMethod;
|
||||
chhkInputs.scPeriod = scPeriod;
|
||||
chhkInputs.mcMethod = mcMethod;
|
||||
chhkInputs.mcPeriod = mcPeriod;
|
||||
chhkInputs.lcMethod = lcMethod;
|
||||
chhkInputs.lcPeriod = lcPeriod;
|
||||
chhkInputs.hcMethod = hcMethod;
|
||||
chhkInputs.hcPeriod = hcPeriod;
|
||||
|
||||
//
|
||||
chhkInputs.showCurrent = false;
|
||||
chhkInputs.showShort = false;
|
||||
chhkInputs.showMedium = false;
|
||||
chhkInputs.showLong = false;
|
||||
chhkInputs.showHind = false;
|
||||
chhkInputs.showHind = true;
|
||||
|
||||
//
|
||||
chhkHelper = new XSCXCHHKHelper();
|
||||
@@ -1687,20 +1903,20 @@ private:
|
||||
chstrInputs.Default();
|
||||
|
||||
//
|
||||
chstrInputs.scMethod = X_PERIOD_MANUALLY;
|
||||
chstrInputs.scPeriod = PERIOD_M10;
|
||||
chstrInputs.mcMethod = X_PERIOD_MANUALLY;
|
||||
chstrInputs.mcPeriod = PERIOD_M15;
|
||||
chstrInputs.lcMethod = X_PERIOD_MANUALLY;
|
||||
chstrInputs.lcPeriod = PERIOD_M20;
|
||||
chstrInputs.hcMethod = X_PERIOD_MANUALLY;
|
||||
chstrInputs.hcPeriod = PERIOD_M30;
|
||||
chstrInputs.scMethod = scMethod;
|
||||
chstrInputs.scPeriod = scPeriod;
|
||||
chstrInputs.mcMethod = mcMethod;
|
||||
chstrInputs.mcPeriod = mcPeriod;
|
||||
chstrInputs.lcMethod = lcMethod;
|
||||
chstrInputs.lcPeriod = lcPeriod;
|
||||
chstrInputs.hcMethod = hcMethod;
|
||||
chstrInputs.hcPeriod = hcPeriod;
|
||||
|
||||
//
|
||||
chstrInputs.showCurrent = true;
|
||||
chstrInputs.showShort = true;
|
||||
chstrInputs.showMedium = true;
|
||||
chstrInputs.showLong = true;
|
||||
chstrInputs.showCurrent = false;
|
||||
chstrInputs.showShort = false;
|
||||
chstrInputs.showMedium = false;
|
||||
chstrInputs.showLong = false;
|
||||
chstrInputs.showHind = true;
|
||||
|
||||
//
|
||||
@@ -1829,6 +2045,90 @@ private:
|
||||
resistanceTime = NULL;
|
||||
resistance.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
datetime bullishOBTime;
|
||||
void CheckBullishOBValidation()
|
||||
{
|
||||
//
|
||||
if (!IsValid(bullishOBTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int age = (int)(((int)(TimeToSeconds(TimeCurrent()) - TimeToSeconds(bullishOBTime))) / PeriodSeconds(mPeriod));
|
||||
if (age >= 50)
|
||||
{
|
||||
//
|
||||
bullishOBTime = NULL;
|
||||
RemoveBullishOrderBlock(bullishOB);
|
||||
bullishOB.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
datetime bearishOBTime;
|
||||
void CheckBearishOBValidation()
|
||||
{
|
||||
//
|
||||
if (!IsValid(bearishOBTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int age = (int)(((int)(TimeToSeconds(TimeCurrent()) - TimeToSeconds(bearishOBTime))) / PeriodSeconds(mPeriod));
|
||||
if (age >= 50)
|
||||
{
|
||||
//
|
||||
bearishOBTime = NULL;
|
||||
RemoveBearishOrderBlock(bearishOB);
|
||||
bearishOB.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
datetime bullishFVGTime;
|
||||
void CheckBullishFVGValidation()
|
||||
{
|
||||
//
|
||||
if (!IsValid(bullishFVGTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int age = (int)(((int)(TimeToSeconds(TimeCurrent()) - TimeToSeconds(bullishFVGTime))) / PeriodSeconds(mPeriod));
|
||||
if (age >= 50)
|
||||
{
|
||||
//
|
||||
bullishFVGTime = NULL;
|
||||
RemoveBullishFVG(bullishFVG);
|
||||
bullishFVG.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
datetime bearishFVGTime;
|
||||
void CheckBearishFVgValidation()
|
||||
{
|
||||
//
|
||||
if (!IsValid(bearishFVGTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int age = (int)(((int)(TimeToSeconds(TimeCurrent()) - TimeToSeconds(bearishFVGTime))) / PeriodSeconds(mPeriod));
|
||||
if (age >= 50)
|
||||
{
|
||||
//
|
||||
bearishFVGTime = NULL;
|
||||
RemoveBearishFVG(bearishFVG);
|
||||
bearishFVG.Clean();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user