last ...
This commit is contained in:
@@ -92,7 +92,8 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
/**
|
||||
* Retrieve POI Drawer Instance Pointer ...
|
||||
**/
|
||||
XCPOIDrawer* GetDrawer() {
|
||||
XCPOIDrawer *GetDrawer()
|
||||
{
|
||||
return mPOIDrawer;
|
||||
}
|
||||
|
||||
@@ -423,7 +424,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
// Update Last Issued Tick ...
|
||||
mLastTick = cTick;
|
||||
SaveTickData();
|
||||
CleanupTicks();
|
||||
|
||||
//
|
||||
// Update POIs ...
|
||||
@@ -1015,35 +1015,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
mBarTracker.Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup Ticks Size ...
|
||||
*/
|
||||
void CleanupTicks()
|
||||
{
|
||||
//
|
||||
int maxRequiredTicks = MaxAllowedSaveTicks();
|
||||
int ticksCount = ArraySize(mTicks);
|
||||
if (!IsValidSize(ticksCount) ||
|
||||
ticksCount <= maxRequiredTicks)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int removeCount = ticksCount - maxRequiredTicks;
|
||||
if (!IsValidSize(removeCount))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ArrayRemove(
|
||||
mTicks,
|
||||
0,
|
||||
removeCount //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Tick Data to Collection ...
|
||||
*/
|
||||
@@ -1057,11 +1028,30 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int beforeCount = ArraySize(mTicks);
|
||||
|
||||
//
|
||||
AddRef(
|
||||
tick,
|
||||
mTicks //
|
||||
);
|
||||
|
||||
//
|
||||
int afterCount = ArraySize(mTicks);
|
||||
|
||||
//
|
||||
bool isAdded = afterCount == beforeCount + 1;
|
||||
if (isAdded)
|
||||
{
|
||||
//
|
||||
// Cleaning Up Unused Items ...
|
||||
int maxAllowed = MaxAllowedSaveTicks();
|
||||
CleanupArray(
|
||||
mTicks,
|
||||
maxAllowed //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,168 +28,8 @@
|
||||
|
||||
enum ENUM_X121SMC_CHARTOBJECTS
|
||||
{
|
||||
X_XPVPIVOT_OBJ, // XPVPivot Object ...
|
||||
X_121_NONE_OBJ
|
||||
};
|
||||
|
||||
//
|
||||
// Implementations ...
|
||||
|
||||
//
|
||||
// XPVPivot Object ...
|
||||
class XCXPVPivotObject : public XCBaseObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param pivot: XPVPivot instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
long chart_id,
|
||||
int window,
|
||||
XPVPivot &pivot,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = pivot.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string name = pivot.GetTag();
|
||||
if (IsValid(prefix))
|
||||
{
|
||||
name = prefix + "_" + name;
|
||||
}
|
||||
|
||||
//
|
||||
result = mRect.Create(
|
||||
chart_id,
|
||||
name,
|
||||
window,
|
||||
pivot.from,
|
||||
pivot.upper,
|
||||
pivot.to,
|
||||
pivot.lower //
|
||||
);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
ObjName(name);
|
||||
}
|
||||
|
||||
//
|
||||
string mTrendName = "MID_" + name;
|
||||
double mid = pivot.CalculateMid();
|
||||
result = mTrend.Create(
|
||||
chart_id,
|
||||
mTrendName,
|
||||
window,
|
||||
pivot.from,
|
||||
mid,
|
||||
pivot.to,
|
||||
mid //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mRect.Delete();
|
||||
mRect.Detach();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Pivot Width ...
|
||||
*
|
||||
* @param value: Integer ...
|
||||
*/
|
||||
void PivotWidth(int value)
|
||||
{
|
||||
//
|
||||
if (value < 1)
|
||||
{
|
||||
value = 1;
|
||||
}
|
||||
|
||||
//
|
||||
mRect.Width(value);
|
||||
mTrend.Width(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Color ...
|
||||
*
|
||||
* @param value: Color ...
|
||||
*/
|
||||
void PivotColor(color value)
|
||||
{
|
||||
//
|
||||
mRect.Color(value);
|
||||
mTrend.Color(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Style ...
|
||||
*
|
||||
* @param value: ENUM_LINE_STYLE member ...
|
||||
*/
|
||||
void PivotStyle(ENUM_LINE_STYLE value)
|
||||
{
|
||||
//
|
||||
mRect.Style(value);
|
||||
mTrend.Style(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Fill ...
|
||||
*
|
||||
* @param value: Boolean ...
|
||||
*/
|
||||
void PivotFill(bool value)
|
||||
{
|
||||
mRect.Fill(value);
|
||||
}
|
||||
|
||||
//
|
||||
// Virtual ...
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_X121SMC_CHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_X121SMC_CHARTOBJECTS Type()
|
||||
{
|
||||
return X_XPVPIVOT_OBJ;
|
||||
}
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
|
||||
//
|
||||
// Props ...
|
||||
CChartObjectRectangle mRect;
|
||||
CChartObjectTrend mTrend;
|
||||
};
|
||||
@@ -1398,6 +1398,53 @@ class XC121SMCCycleHelper : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Market Structure based on Peaks and Vales ...
|
||||
*
|
||||
* @param dir: ENUM_X_DIRECTION member Reference ...
|
||||
* @param minVerification: Integer ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasPVDirection(
|
||||
ENUM_X_DIRECTION &dir,
|
||||
int minVerification = 12 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (minVerification < 7)
|
||||
{
|
||||
minVerification = 7;
|
||||
}
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
int bullishSum = mBullishPeaks + mBullishVales;
|
||||
int bearishSum = mBearishPeaks + mBearishVales;
|
||||
|
||||
//
|
||||
int diff = MathAbs(bullishSum - bearishSum);
|
||||
bool isDiffPassed = diff >= minVerification;
|
||||
result = isDiffPassed;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
dir = bullishSum > bearishSum
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Change Values Actions ...
|
||||
|
||||
@@ -2180,7 +2227,9 @@ class XC121SMCCycleHelper : public XCBase
|
||||
|
||||
//
|
||||
bool isNewPeak = conditions.x121Conditions.isNewPeak;
|
||||
double peak = conditions.x121Conditions.peaksBuffer[0];
|
||||
double peak = conditions.x121Conditions.peaksBuffer[1];
|
||||
double peakPrev = conditions.x121Conditions.peaksBuffer[2];
|
||||
bool isPeakSameAsPrev = peak == peakPrev;
|
||||
bool isNewPeakOverLast = conditions.x121Conditions.isNewPeakOverLast;
|
||||
bool isNewPeakUnderLast = conditions.x121Conditions.isNewPeakUnderLast;
|
||||
|
||||
@@ -2229,7 +2278,9 @@ class XC121SMCCycleHelper : public XCBase
|
||||
|
||||
//
|
||||
bool isNewVale = conditions.x121Conditions.isNewVale;
|
||||
double vale = conditions.x121Conditions.valesBuffer[0];
|
||||
double vale = conditions.x121Conditions.valesBuffer[1];
|
||||
double valePrev = conditions.x121Conditions.valesBuffer[2];
|
||||
bool isValeSameAsPrev = vale == valePrev;
|
||||
bool isNewValeOverLast = conditions.x121Conditions.isNewValeOverLast;
|
||||
bool isNewValeUnderLast = conditions.x121Conditions.isNewValeUnderLast;
|
||||
|
||||
@@ -2273,6 +2324,99 @@ class XC121SMCCycleHelper : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Count Bullish / Bearish Peaks and Vales ...
|
||||
|
||||
//
|
||||
// Peaks ...
|
||||
|
||||
//
|
||||
if (isNewPeakOverLast)
|
||||
{
|
||||
//
|
||||
mBullishPeaks++;
|
||||
mIsLastPeakBullish = true;
|
||||
}
|
||||
|
||||
//
|
||||
if (isNewPeakUnderLast)
|
||||
{
|
||||
//
|
||||
mBearishPeaks++;
|
||||
mIsLastPeakBullish = false;
|
||||
}
|
||||
|
||||
//
|
||||
if (isPeakSameAsPrev)
|
||||
{
|
||||
//
|
||||
if (mIsLastPeakBullish)
|
||||
{
|
||||
//
|
||||
mBullishPeaks++;
|
||||
mBearishPeaks--;
|
||||
if (mBearishPeaks < 0)
|
||||
{
|
||||
mBearishPeaks = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
mBullishPeaks--;
|
||||
mBearishPeaks++;
|
||||
if (mBullishPeaks < 0)
|
||||
{
|
||||
mBullishPeaks = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Vales ...
|
||||
|
||||
//
|
||||
if (isNewValeOverLast)
|
||||
{
|
||||
//
|
||||
mBullishVales++;
|
||||
mIsLastValeBullish = true;
|
||||
}
|
||||
|
||||
//
|
||||
if (isNewValeUnderLast)
|
||||
{
|
||||
//
|
||||
mBearishVales++;
|
||||
mIsLastValeBullish = false;
|
||||
}
|
||||
|
||||
//
|
||||
if (isValeSameAsPrev)
|
||||
{
|
||||
//
|
||||
if (mIsLastValeBullish)
|
||||
{
|
||||
//
|
||||
mBullishVales++;
|
||||
mBearishVales--;
|
||||
if (mBearishVales < 0)
|
||||
{
|
||||
mBearishVales = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
mBullishVales--;
|
||||
mBearishVales++;
|
||||
if (mBullishVales < 0)
|
||||
{
|
||||
mBullishVales = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// VWap Direction Change ...
|
||||
|
||||
@@ -2962,6 +3106,16 @@ class XC121SMCCycleHelper : public XCBase
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
bool mIsLastPeakBullish;
|
||||
int mBullishPeaks; // Count Bullish Peaks ...
|
||||
int mBearishPeaks; // Count Bearish Peaks ...
|
||||
|
||||
//
|
||||
bool mIsLastValeBullish;
|
||||
int mBullishVales; // Count Bullish Vales ...
|
||||
int mBearishVales; // Count Bearish Vales ...
|
||||
|
||||
//
|
||||
// Change Holders ...
|
||||
int mMaxAllowedSavedChanges; // Max llowed Changes to Save ...
|
||||
|
||||
@@ -24,6 +24,74 @@
|
||||
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
||||
#include "../Libraries/x-121.smc.lib.mq5"
|
||||
|
||||
//
|
||||
const string X121SMCXTWPV_Method_1_Token = "X121SMCXTWPV_1";
|
||||
const string X121SMCXTWPV_Method_2_Token = "X121SMCXTWPV_2";
|
||||
|
||||
//
|
||||
enum ENUM_X_X121SMC_XTWPV_METHODS
|
||||
{
|
||||
X_X121SMC_XTWPV_METHOD_UNKNOWN,
|
||||
X_X121SMC_XTWPV_METHOD_1,
|
||||
X_X121SMC_XTWPV_METHOD_2,
|
||||
};
|
||||
|
||||
//
|
||||
string ToString(ENUM_X_X121SMC_XTWPV_METHODS value)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
if (value == X_X121SMC_XTWPV_METHOD_UNKNOWN)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
switch (value)
|
||||
{
|
||||
//
|
||||
case X_X121SMC_XTWPV_METHOD_1:
|
||||
result = "Method_1";
|
||||
break;
|
||||
|
||||
//
|
||||
case X_X121SMC_XTWPV_METHOD_2:
|
||||
result = "Method_2";
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_X121SMC_XTWPV_METHODS ParseMethod(string value)
|
||||
{
|
||||
//
|
||||
ENUM_X_X121SMC_XTWPV_METHODS result = X_X121SMC_XTWPV_METHOD_UNKNOWN;
|
||||
|
||||
//
|
||||
if (!IsValid(value))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (Contains(X121SMCXTWPV_Method_1_Token, value))
|
||||
{
|
||||
result = X_X121SMC_XTWPV_METHOD_1;
|
||||
}
|
||||
else if (Contains(X121SMCXTWPV_Method_2_Token, value))
|
||||
{
|
||||
result = X_X121SMC_XTWPV_METHOD_2;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
struct X121SMCStrategyXTWPVSignalConditions
|
||||
@@ -52,6 +120,9 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
double point;
|
||||
XPVPivot pivot;
|
||||
|
||||
//
|
||||
string method;
|
||||
|
||||
//
|
||||
bool hasSupportZone;
|
||||
bool hasResistanceZone;
|
||||
@@ -184,6 +255,9 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
point = 0;
|
||||
pivot.Clean();
|
||||
|
||||
//
|
||||
method = NULL;
|
||||
|
||||
//
|
||||
CleanPriceInsideZones();
|
||||
}
|
||||
@@ -418,10 +492,14 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
double ask = GetAsk(symbol);
|
||||
double bid = GetBid(symbol);
|
||||
datetime cTime = TimeCurrent();
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
double ll = cBar.FindLowest(9, MODE_LOW);
|
||||
double hh = cBar.FindHighest(9, MODE_HIGH);
|
||||
int swingLoopback = 9;
|
||||
double ll = cBar.FindLowest(swingLoopback, MODE_LOW);
|
||||
double hh = cBar.FindHighest(swingLoopback, MODE_HIGH);
|
||||
double llDown = cBar.FindLowesttDown(swingLoopback);
|
||||
double hhUp = cBar.FindHighestUp(swingLoopback);
|
||||
|
||||
//
|
||||
int zoneValidationDivider = 10;
|
||||
@@ -564,6 +642,16 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
// Detect Trend Based On Peaks and Vales ...
|
||||
ENUM_X_DIRECTION trend;
|
||||
bool hasTrend = analyseCycleHelper
|
||||
.HasPVDirection(trend);
|
||||
bool hasBullishTrend = hasTrend &&
|
||||
IsBullish(trend);
|
||||
bool hasBearishTrend = hasTrend &&
|
||||
IsBearish(trend);
|
||||
|
||||
//
|
||||
// Retrieve Active Pivots ...
|
||||
|
||||
@@ -659,12 +747,20 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
|
||||
//
|
||||
double peak = helperConditions.x121Conditions.peaksBuffer[1];
|
||||
double peakPrev = helperConditions.x121Conditions.peaksBuffer[2];
|
||||
double peakDiff = MathAbs(peakPrev - peak);
|
||||
|
||||
//
|
||||
bool isNewPeak = helperConditions.x121Conditions.isNewPeak;
|
||||
bool isNewPeakOverLast = helperConditions.x121Conditions.isNewPeakOverLast;
|
||||
bool isNewPeakUnderLast = helperConditions.x121Conditions.isNewPeakUnderLast;
|
||||
|
||||
//
|
||||
double vale = helperConditions.x121Conditions.valesBuffer[1];
|
||||
double valePrev = helperConditions.x121Conditions.valesBuffer[2];
|
||||
double valeDiff = MathAbs(valePrev - vale);
|
||||
|
||||
//
|
||||
bool isNewVale = helperConditions.x121Conditions.isNewVale;
|
||||
bool isNewValeOverLast = helperConditions.x121Conditions.isNewValeOverLast;
|
||||
bool isNewValeUnderLast = helperConditions.x121Conditions.isNewValeUnderLast;
|
||||
@@ -680,12 +776,6 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
// Calculate Conditions ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
|
||||
//
|
||||
double bullishFib = GetFibonacciLevel(
|
||||
helperCBar.high,
|
||||
@@ -704,11 +794,35 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
|
||||
//
|
||||
bool isBearishFiboPassed = bullishFib <= conditions.pivot.lower;
|
||||
bool isBullishFiboPassed = bearishFib >= conditions.pivot.upper;
|
||||
|
||||
//
|
||||
// Bullish Conditions 1 ...
|
||||
bool bullishConditions1 =
|
||||
//
|
||||
// false
|
||||
hasBullishTrend &&
|
||||
isNewPeakOverLast &&
|
||||
isBullishFiboPassed &&
|
||||
helperCBar.IsBullish() &&
|
||||
conditions.pivot.upper < peak &&
|
||||
conditions.pivot.upper < helperCBar.GetUp() &&
|
||||
conditions.pivot.upper > helperCBar.GetDown()
|
||||
//
|
||||
;
|
||||
if (bullishConditions1)
|
||||
{
|
||||
//
|
||||
conditions.point = conditions.pivot.upper;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_1);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Conditions 1 ...
|
||||
bool bearishConditions1 =
|
||||
//
|
||||
// false
|
||||
hasBearishTrend &&
|
||||
isNewValeUnderLast &&
|
||||
isBearishFiboPassed &&
|
||||
helperCBar.IsBearish() &&
|
||||
@@ -719,7 +833,9 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
;
|
||||
if (bearishConditions1)
|
||||
{
|
||||
//
|
||||
conditions.point = conditions.pivot.lower;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_1);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -760,16 +876,43 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
double donOpenUpper = helperConditions.x121Conditions.donOpenUpperBuffer[1];
|
||||
double donOpenLower = helperConditions.x121Conditions.donOpenLowerBuffer[1];
|
||||
|
||||
//
|
||||
int condition2MinPVDiffPoint = 30;
|
||||
bool isPeakDiffPointPassed = peakDiff >= (condition2MinPVDiffPoint * points);
|
||||
bool isValeDiffPointPassed = valeDiff >= (condition2MinPVDiffPoint * points);
|
||||
|
||||
//
|
||||
bool bullishConditions2 =
|
||||
//
|
||||
false
|
||||
// hasBullishTrend &&
|
||||
// isNewValeOverLast &&
|
||||
// donCloseLower > vale &&
|
||||
// isValeDiffPointPassed
|
||||
//
|
||||
;
|
||||
if (bullishConditions2)
|
||||
{
|
||||
//
|
||||
conditions.point = vale;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
|
||||
}
|
||||
|
||||
//
|
||||
bool bearishConditions2 =
|
||||
//
|
||||
isNewPeakUnderLast &&
|
||||
donCloseUpper > peak
|
||||
false
|
||||
// hasBearishTrend &&
|
||||
// isNewPeakUnderLast &&
|
||||
// donCloseUpper > peak &&
|
||||
// isPeakDiffPointPassed
|
||||
//
|
||||
;
|
||||
if (bearishConditions2)
|
||||
{
|
||||
//
|
||||
conditions.point = peak;
|
||||
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -778,7 +921,8 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
isBullish =
|
||||
//
|
||||
false
|
||||
bullishConditions1 ||
|
||||
bullishConditions2
|
||||
//
|
||||
;
|
||||
|
||||
@@ -798,6 +942,18 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
Print("Bullish ...");
|
||||
}
|
||||
|
||||
//
|
||||
if (isBearish)
|
||||
{
|
||||
Print("Bearish ...");
|
||||
}
|
||||
|
||||
//
|
||||
conditions.setupTime = cTime;
|
||||
conditions.dir =
|
||||
@@ -1212,6 +1368,59 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
bool hasBullishPriceInsideZone = conditions.HasBullishPriceInsideZone();
|
||||
bool hasBearishPriceInsideZone = conditions.HasBearishPriceInsideZone();
|
||||
|
||||
//
|
||||
if (
|
||||
isBullish &&
|
||||
isBasedOnVale &&
|
||||
hasPriceInsideZones &&
|
||||
hasBullishPriceInsideZone //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Demand ...
|
||||
if (conditions.hasDemandZone)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.demandZone.Lower(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Support ...
|
||||
if (conditions.hasSupportZone)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.supportZone.Lower(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Order Block ...
|
||||
if (conditions.hasOrderBlock)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.orderBlock.Lower(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Fair Value Gap ...
|
||||
if (conditions.hasFairValueGap)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.fairValueGap.Lower(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (
|
||||
isBearish &&
|
||||
@@ -1285,6 +1494,18 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
: entry - targetDelta;
|
||||
}
|
||||
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
Print("Bullish ...");
|
||||
}
|
||||
|
||||
//
|
||||
if (isBearish)
|
||||
{
|
||||
Print("Bearish ...");
|
||||
}
|
||||
|
||||
//
|
||||
conditions.sl = sl;
|
||||
conditions.target = target;
|
||||
@@ -1297,6 +1518,97 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw Conditions Pivot Zone ...
|
||||
*
|
||||
* @param conditions: X121SMCStrategyXTWPVSignalConditions instance Reference ...
|
||||
* @param drawer: XCPOIDrawer pointer ...
|
||||
* @param drawnObjects: XCBaseObject instance Reference Collection ...
|
||||
* @param drawState: Boolean ...
|
||||
* @param drawTicksZone: Boolean ...
|
||||
* @param ignoreSwingHighs: Boolean ...
|
||||
* @param ignoreSwingLows: Boolean ...
|
||||
* @param ignoreSupportZones: Boolean ...
|
||||
* @param ignoreResistanceZones: Boolean ...
|
||||
* @param ignoreSupplyZones: Boolean ...
|
||||
* @param ignoreDemandZones: Boolean ...
|
||||
* @param ignoreBullishOrderBlocks: Boolean ...
|
||||
* @param ignoreBearishOrderBlocks: Boolean ...
|
||||
* @param ignoreBullishFairValueGaps: Boolean ...
|
||||
* @param ignoreBearishFairValueGaps: Boolean ...
|
||||
* @param ignoreBullishRejectionBars: Boolean ...
|
||||
* @param ignoreBearishRejectionBars: Boolean ...
|
||||
* @param ignoreBullishMomentumBars: Boolean ...
|
||||
* @param ignoreBearishMomentumBars: Boolean ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DrawXTWPVPivotZone(
|
||||
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||
XCPOIDrawer *drawer,
|
||||
XCBaseObject *&drawnObjects[],
|
||||
bool drawState = false,
|
||||
bool drawTicksZone = false,
|
||||
bool ignoreSwingHighs = false,
|
||||
bool ignoreSwingLows = false,
|
||||
bool ignoreSupportZones = false,
|
||||
bool ignoreResistanceZones = false,
|
||||
bool ignoreSupplyZones = false,
|
||||
bool ignoreDemandZones = false,
|
||||
bool ignoreBullishOrderBlocks = false,
|
||||
bool ignoreBearishOrderBlocks = false,
|
||||
bool ignoreBullishFairValueGaps = false,
|
||||
bool ignoreBearishFairValueGaps = false,
|
||||
bool ignoreBullishRejectionBars = false,
|
||||
bool ignoreBearishRejectionBars = false,
|
||||
bool ignoreBullishMomentumBars = false,
|
||||
bool ignoreBearishMomentumBars = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(drawnObjects);
|
||||
|
||||
//
|
||||
if (drawer == NULL ||
|
||||
!conditions.HasPivot())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
drawer.DrawPivot(
|
||||
//
|
||||
conditions.pivot,
|
||||
drawnObjects,
|
||||
//
|
||||
drawState,
|
||||
drawTicksZone,
|
||||
ignoreSwingHighs,
|
||||
ignoreSwingLows,
|
||||
ignoreSupportZones,
|
||||
ignoreResistanceZones,
|
||||
ignoreSupplyZones,
|
||||
ignoreDemandZones,
|
||||
ignoreBullishOrderBlocks,
|
||||
ignoreBearishOrderBlocks,
|
||||
ignoreBullishFairValueGaps,
|
||||
ignoreBearishFairValueGaps,
|
||||
ignoreBullishRejectionBars,
|
||||
ignoreBearishRejectionBars,
|
||||
ignoreBullishMomentumBars,
|
||||
ignoreBearishMomentumBars //
|
||||
);
|
||||
|
||||
//
|
||||
result = ArraySize(drawnObjects);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drw Conditions Price Inside Zones ...
|
||||
*
|
||||
@@ -1306,7 +1618,7 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DrawPriceInsideZones(
|
||||
int DrawTWPVPriceInsideZones(
|
||||
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||
XCPOIDrawer *drawer,
|
||||
XCBaseObject *&drawnObjects[] //
|
||||
|
||||
@@ -280,7 +280,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
result = PrepareSignal(signal);
|
||||
|
||||
|
||||
//
|
||||
hasLong = false;
|
||||
hasShort = false;
|
||||
@@ -709,20 +709,59 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Price Inside Zones ...
|
||||
if (mXTWPVConditions.HasPriceInsideZones())
|
||||
// Handle Required Drawings ...
|
||||
bool hasPivot = mXTWPVConditions.HasPivot();
|
||||
bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones();
|
||||
bool canDraw = hasPivot ||
|
||||
hasPriceInsideZone;
|
||||
if (canDraw)
|
||||
{
|
||||
//
|
||||
ClearDraws();
|
||||
|
||||
//
|
||||
XCBaseObject *drawnObjects[];
|
||||
int drawnObjectsCount = DrawPriceInsideZones(
|
||||
mXTWPVConditions,
|
||||
mPOIDrawer,
|
||||
drawnObjects //
|
||||
);
|
||||
AddObjectsIfNotExists(drawnObjects);
|
||||
// Draw Pivot Zone ...
|
||||
if (hasPivot)
|
||||
{
|
||||
//
|
||||
XCBaseObject *drawnObjects[];
|
||||
int drawnObjectsCount = DrawXTWPVPivotZone(
|
||||
mXTWPVConditions,
|
||||
mPOIDrawer,
|
||||
drawnObjects,
|
||||
true, // Draw State ...
|
||||
true, // Draw Ticks Zone ...
|
||||
true, // Ignore SwingHighs ...
|
||||
true, // Ignore SwingLows ...
|
||||
true, // Ignore SupportZones ...
|
||||
true, // Ignore ResistanceZones ...
|
||||
true, // Ignore SupplyZones ...
|
||||
true, // Ignore DemandZones ...
|
||||
true, // Ignore BullishOrderBlocks ...
|
||||
true, // Ignore BearishOrderBlocks ...
|
||||
true, // Ignore BullishFairValueGaps ...
|
||||
true, // Ignore BearishFairValueGaps ...
|
||||
true, // Ignore BullishRejectionBars ...
|
||||
true, // Ignore BearishRejectionBars ...
|
||||
true, // Ignore BullishMomentumBars ...
|
||||
true // Ignore BearishMomentumBars ...
|
||||
);
|
||||
AddObjectsIfNotExists(drawnObjects);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Price Inside Zones ...
|
||||
if (hasPriceInsideZone)
|
||||
{
|
||||
//
|
||||
XCBaseObject *drawnObjects[];
|
||||
int drawnObjectsCount = DrawTWPVPriceInsideZones(
|
||||
mXTWPVConditions,
|
||||
mPOIDrawer,
|
||||
drawnObjects //
|
||||
);
|
||||
AddObjectsIfNotExists(drawnObjects);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user