last ...
This commit is contained in:
@@ -43,6 +43,7 @@ enum ENUM_XCHARTOBJECTS
|
|||||||
//
|
//
|
||||||
X_SIGNAL_OBJ = 8860,
|
X_SIGNAL_OBJ = 8860,
|
||||||
X_TREND_OBJ = 8861,
|
X_TREND_OBJ = 8861,
|
||||||
|
X_XPVPIVOT_OBJ = 8862,
|
||||||
//
|
//
|
||||||
// Structured ...
|
// Structured ...
|
||||||
X_TRADE_DAY_OBJ = 9860,
|
X_TRADE_DAY_OBJ = 9860,
|
||||||
@@ -78,49 +79,51 @@ enum ENUM_X_CHART_IDS
|
|||||||
X_TP
|
X_TP
|
||||||
};
|
};
|
||||||
|
|
||||||
string ToString(ENUM_X_CHART_IDS value) {
|
string ToString(ENUM_X_CHART_IDS value)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
string result = NULL;
|
string result = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
switch(value) {
|
switch (value)
|
||||||
//
|
{
|
||||||
case X_TO:
|
//
|
||||||
|
case X_TO:
|
||||||
result = "TO";
|
result = "TO";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_FROM:
|
case X_FROM:
|
||||||
result = "FROM";
|
result = "FROM";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_UPPER:
|
case X_UPPER:
|
||||||
result = "UPPER";
|
result = "UPPER";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_LOWER:
|
case X_LOWER:
|
||||||
result = "LOWER";
|
result = "LOWER";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_ENTRY:
|
case X_ENTRY:
|
||||||
result = "ENTRY";
|
result = "ENTRY";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_TARGET:
|
case X_TARGET:
|
||||||
result = "TARGET";
|
result = "TARGET";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_SL:
|
case X_SL:
|
||||||
result = "SL";
|
result = "SL";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case X_TP:
|
case X_TP:
|
||||||
result = "TP";
|
result = "TP";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1719,6 +1722,7 @@ class XCBearishFairValueGapObject : public XCZoneObject
|
|||||||
return X_BEARISH_FVG_OBJ;
|
return X_BEARISH_FVG_OBJ;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signal ...
|
// Signal ...
|
||||||
class XCSignalObject : public XCBaseObject
|
class XCSignalObject : public XCBaseObject
|
||||||
@@ -1814,25 +1818,26 @@ class XCSignalObject : public XCBaseObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// TARGET ...
|
// TARGET ...
|
||||||
if (signal.target > 0) {
|
if (signal.target > 0)
|
||||||
//
|
|
||||||
string targetName = ToString(X_TARGET) + "_" + nameMD5;
|
|
||||||
result = mTargetTrend.Create(
|
|
||||||
chart_id,
|
|
||||||
targetName,
|
|
||||||
window,
|
|
||||||
time1,
|
|
||||||
signal.target,
|
|
||||||
time2,
|
|
||||||
signal.target //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
mTPTrend.Delete();
|
string targetName = ToString(X_TARGET) + "_" + nameMD5;
|
||||||
mSLTrend.Delete();
|
result = mTargetTrend.Create(
|
||||||
return result;
|
chart_id,
|
||||||
}
|
targetName,
|
||||||
|
window,
|
||||||
|
time1,
|
||||||
|
signal.target,
|
||||||
|
time2,
|
||||||
|
signal.target //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mTPTrend.Delete();
|
||||||
|
mSLTrend.Delete();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2048,6 +2053,166 @@ class XCSignalObject : public XCBaseObject
|
|||||||
CChartObjectTrend mTargetTrend;
|
CChartObjectTrend mTargetTrend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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_XCHARTOBJECTS )
|
||||||
|
*/
|
||||||
|
virtual ENUM_XCHARTOBJECTS Type()
|
||||||
|
{
|
||||||
|
return X_XPVPIVOT_OBJ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
CChartObjectRectangle mRect;
|
||||||
|
CChartObjectTrend mTrend;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Zone Ticks ...
|
// Zone Ticks ...
|
||||||
|
|
||||||
@@ -2256,6 +2421,14 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double points = GetPoints(zone.symbol);
|
||||||
|
if (points <= 0)
|
||||||
|
{
|
||||||
|
points = 1;
|
||||||
|
}
|
||||||
|
double distance = 1 * points;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (IsValid(prefix))
|
if (IsValid(prefix))
|
||||||
{
|
{
|
||||||
@@ -2279,13 +2452,17 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
string lblName = "LBL_" + name;
|
int fromToDiff = ((int) to - (int) from);
|
||||||
result = mLabel.Create(
|
datetime labelsDate = (datetime)((int)to - (fromToDiff / 5));
|
||||||
|
|
||||||
|
//
|
||||||
|
string lblName = "LBLT_" + name;
|
||||||
|
result = mTLabel.Create(
|
||||||
chart_id,
|
chart_id,
|
||||||
lblName,
|
lblName,
|
||||||
window,
|
window,
|
||||||
to,
|
labelsDate,
|
||||||
zone.high //
|
zone.high - distance //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -2293,7 +2470,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
mLabel.Description(ToString(zone.percent) + "%");
|
mTLabel.Description("T: " + ToString(zone.percent) + "%");
|
||||||
|
|
||||||
//
|
//
|
||||||
string lblVName = "LBLV_" + name;
|
string lblVName = "LBLV_" + name;
|
||||||
@@ -2301,8 +2478,8 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
chart_id,
|
chart_id,
|
||||||
lblVName,
|
lblVName,
|
||||||
window,
|
window,
|
||||||
to,
|
labelsDate,
|
||||||
zone.low //
|
zone.low + (2.5 * distance) //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -2310,7 +2487,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
mVLabel.Description(ToString(zone.volumePercent) + "%");
|
mVLabel.Description("V: " + ToString(zone.volumePercent) + "%");
|
||||||
|
|
||||||
//
|
//
|
||||||
ObjName(name);
|
ObjName(name);
|
||||||
@@ -2390,7 +2567,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
void LabelColor(color value)
|
void LabelColor(color value)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
mLabel.Color(value);
|
mTLabel.Color(value);
|
||||||
mVLabel.Color(value);
|
mVLabel.Color(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2402,7 +2579,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
void LabelSize(int value)
|
void LabelSize(int value)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
mLabel.FontSize(value);
|
mTLabel.FontSize(value);
|
||||||
mVLabel.FontSize(value);
|
mVLabel.FontSize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2414,7 +2591,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
void LabelFont(string value)
|
void LabelFont(string value)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
mLabel.Font(value);
|
mTLabel.Font(value);
|
||||||
mVLabel.Font(value);
|
mVLabel.Font(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2426,7 +2603,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
void LabelAngle(double value)
|
void LabelAngle(double value)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
mLabel.Angle(value);
|
mTLabel.Angle(value);
|
||||||
mVLabel.Angle(value);
|
mVLabel.Angle(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2435,7 +2612,7 @@ class XCTickZoneObject : public XCBaseObject
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
CChartObjectRectangle mRect;
|
CChartObjectRectangle mRect;
|
||||||
CChartObjectLabel mLabel;
|
CChartObjectLabel mTLabel;
|
||||||
CChartObjectLabel mVLabel;
|
CChartObjectLabel mVLabel;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ input bool eaUseDynamicVolume = false; // Use Dy
|
|||||||
input double eaDynamicVolumeStep = 0.01; // Increase Volume Step
|
input double eaDynamicVolumeStep = 0.01; // Increase Volume Step
|
||||||
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
|
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
|
||||||
input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades
|
input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades
|
||||||
input int eaMaxAllowedSLToPauseSignallingPerSymbol = 2; // Max Allowed SL for Pause Signalling Per Symbol
|
input int eaMaxAllowedSLToPauseSignallingPerSymbol = 0; // Max Allowed SL for Pause Signalling Per Symbol
|
||||||
input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 14400; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds
|
input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 14400; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -2466,7 +2466,7 @@ struct XOHCL
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Lowest Bar Index ...
|
// Find Highest Bar Index ...
|
||||||
int FindHighestIndex(
|
int FindHighestIndex(
|
||||||
int mLength, // Loopback ...
|
int mLength, // Loopback ...
|
||||||
ENUM_SERIESMODE mMode // Calculation mode
|
ENUM_SERIESMODE mMode // Calculation mode
|
||||||
@@ -2500,7 +2500,7 @@ struct XOHCL
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Lowest ...
|
// Find Highest ...
|
||||||
double FindHighest(
|
double FindHighest(
|
||||||
int mLength, // Loopback ...
|
int mLength, // Loopback ...
|
||||||
ENUM_SERIESMODE mMode // Calculation mode
|
ENUM_SERIESMODE mMode // Calculation mode
|
||||||
@@ -2544,6 +2544,29 @@ struct XOHCL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Highest ...
|
||||||
|
double FindHighestUp(
|
||||||
|
int mLength // Loopback ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = FindHighest(mLength, MODE_OPEN);
|
||||||
|
result = MathMax(mLength, FindHighest(mLength, MODE_CLOSE));
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Lowest Bar Index ...
|
// Find Lowest Bar Index ...
|
||||||
int FindLowestIndex(
|
int FindLowestIndex(
|
||||||
@@ -2623,6 +2646,29 @@ struct XOHCL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Lowest ...
|
||||||
|
double FindLowesttDown(
|
||||||
|
int mLength // Loopback ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = FindLowest(mLength, MODE_OPEN);
|
||||||
|
result = MathMax(mLength, FindLowest(mLength, MODE_CLOSE));
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Bullish Pressure ...
|
// Retrieve Bullish Pressure ...
|
||||||
double GetBullishPressure(
|
double GetBullishPressure(
|
||||||
|
|||||||
@@ -2544,6 +2544,10 @@ class XCTickZone : public CObject
|
|||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
string symbol;
|
||||||
|
ENUM_TIMEFRAMES period;
|
||||||
|
|
||||||
|
//
|
||||||
double high;
|
double high;
|
||||||
double low;
|
double low;
|
||||||
int ticks;
|
int ticks;
|
||||||
@@ -2780,6 +2784,10 @@ class XCTicksZone : public XCTwoBarZone
|
|||||||
// Instance a New Zone ...
|
// Instance a New Zone ...
|
||||||
XCTickZone *iZone = new XCTickZone();
|
XCTickZone *iZone = new XCTickZone();
|
||||||
|
|
||||||
|
//
|
||||||
|
iZone.symbol = symbol;
|
||||||
|
iZone.period = period;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate Each Zones High / Low based on Range ...
|
// Calculate Each Zones High / Low based on Range ...
|
||||||
double iH = mRangeHigh - mRangeSize * i / Levels();
|
double iH = mRangeHigh - mRangeSize * i / Levels();
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
/**
|
/**
|
||||||
* Retrieve POI Drawer Instance Pointer ...
|
* Retrieve POI Drawer Instance Pointer ...
|
||||||
**/
|
**/
|
||||||
XCPOIDrawer* GetDrawer() {
|
XCPOIDrawer *GetDrawer()
|
||||||
|
{
|
||||||
return mPOIDrawer;
|
return mPOIDrawer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +424,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
// Update Last Issued Tick ...
|
// Update Last Issued Tick ...
|
||||||
mLastTick = cTick;
|
mLastTick = cTick;
|
||||||
SaveTickData();
|
SaveTickData();
|
||||||
CleanupTicks();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update POIs ...
|
// Update POIs ...
|
||||||
@@ -1015,35 +1015,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
mBarTracker.Clean();
|
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 ...
|
* Add new Tick Data to Collection ...
|
||||||
*/
|
*/
|
||||||
@@ -1057,11 +1028,30 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int beforeCount = ArraySize(mTicks);
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
tick,
|
tick,
|
||||||
mTicks //
|
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
|
enum ENUM_X121SMC_CHARTOBJECTS
|
||||||
{
|
{
|
||||||
X_XPVPIVOT_OBJ, // XPVPivot Object ...
|
X_121_NONE_OBJ
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Implementations ...
|
// 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;
|
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 ...
|
// Change Values Actions ...
|
||||||
|
|
||||||
@@ -2180,7 +2227,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isNewPeak = conditions.x121Conditions.isNewPeak;
|
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 isNewPeakOverLast = conditions.x121Conditions.isNewPeakOverLast;
|
||||||
bool isNewPeakUnderLast = conditions.x121Conditions.isNewPeakUnderLast;
|
bool isNewPeakUnderLast = conditions.x121Conditions.isNewPeakUnderLast;
|
||||||
|
|
||||||
@@ -2229,7 +2278,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isNewVale = conditions.x121Conditions.isNewVale;
|
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 isNewValeOverLast = conditions.x121Conditions.isNewValeOverLast;
|
||||||
bool isNewValeUnderLast = conditions.x121Conditions.isNewValeUnderLast;
|
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 ...
|
// VWap Direction Change ...
|
||||||
|
|
||||||
@@ -2962,6 +3106,16 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
// Props ...
|
// 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 ...
|
// Change Holders ...
|
||||||
int mMaxAllowedSavedChanges; // Max llowed Changes to Save ...
|
int mMaxAllowedSavedChanges; // Max llowed Changes to Save ...
|
||||||
|
|||||||
@@ -24,6 +24,74 @@
|
|||||||
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
||||||
#include "../Libraries/x-121.smc.lib.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 ...
|
// Definitions ...
|
||||||
struct X121SMCStrategyXTWPVSignalConditions
|
struct X121SMCStrategyXTWPVSignalConditions
|
||||||
@@ -52,6 +120,9 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
double point;
|
double point;
|
||||||
XPVPivot pivot;
|
XPVPivot pivot;
|
||||||
|
|
||||||
|
//
|
||||||
|
string method;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasSupportZone;
|
bool hasSupportZone;
|
||||||
bool hasResistanceZone;
|
bool hasResistanceZone;
|
||||||
@@ -184,6 +255,9 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
point = 0;
|
point = 0;
|
||||||
pivot.Clean();
|
pivot.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
method = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
CleanPriceInsideZones();
|
CleanPriceInsideZones();
|
||||||
}
|
}
|
||||||
@@ -418,10 +492,14 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
double ask = GetAsk(symbol);
|
double ask = GetAsk(symbol);
|
||||||
double bid = GetBid(symbol);
|
double bid = GetBid(symbol);
|
||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
|
double points = GetPoints(symbol);
|
||||||
|
|
||||||
//
|
//
|
||||||
double ll = cBar.FindLowest(9, MODE_LOW);
|
int swingLoopback = 9;
|
||||||
double hh = cBar.FindHighest(9, MODE_HIGH);
|
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;
|
int zoneValidationDivider = 10;
|
||||||
@@ -564,6 +642,16 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// return result;
|
// 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 ...
|
// Retrieve Active Pivots ...
|
||||||
|
|
||||||
@@ -659,12 +747,20 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
double peak = helperConditions.x121Conditions.peaksBuffer[1];
|
double peak = helperConditions.x121Conditions.peaksBuffer[1];
|
||||||
|
double peakPrev = helperConditions.x121Conditions.peaksBuffer[2];
|
||||||
|
double peakDiff = MathAbs(peakPrev - peak);
|
||||||
|
|
||||||
|
//
|
||||||
bool isNewPeak = helperConditions.x121Conditions.isNewPeak;
|
bool isNewPeak = helperConditions.x121Conditions.isNewPeak;
|
||||||
bool isNewPeakOverLast = helperConditions.x121Conditions.isNewPeakOverLast;
|
bool isNewPeakOverLast = helperConditions.x121Conditions.isNewPeakOverLast;
|
||||||
bool isNewPeakUnderLast = helperConditions.x121Conditions.isNewPeakUnderLast;
|
bool isNewPeakUnderLast = helperConditions.x121Conditions.isNewPeakUnderLast;
|
||||||
|
|
||||||
//
|
//
|
||||||
double vale = helperConditions.x121Conditions.valesBuffer[1];
|
double vale = helperConditions.x121Conditions.valesBuffer[1];
|
||||||
|
double valePrev = helperConditions.x121Conditions.valesBuffer[2];
|
||||||
|
double valeDiff = MathAbs(valePrev - vale);
|
||||||
|
|
||||||
|
//
|
||||||
bool isNewVale = helperConditions.x121Conditions.isNewVale;
|
bool isNewVale = helperConditions.x121Conditions.isNewVale;
|
||||||
bool isNewValeOverLast = helperConditions.x121Conditions.isNewValeOverLast;
|
bool isNewValeOverLast = helperConditions.x121Conditions.isNewValeOverLast;
|
||||||
bool isNewValeUnderLast = helperConditions.x121Conditions.isNewValeUnderLast;
|
bool isNewValeUnderLast = helperConditions.x121Conditions.isNewValeUnderLast;
|
||||||
@@ -680,12 +776,6 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
//
|
//
|
||||||
// Calculate Conditions ...
|
// Calculate Conditions ...
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double bullishFib = GetFibonacciLevel(
|
double bullishFib = GetFibonacciLevel(
|
||||||
helperCBar.high,
|
helperCBar.high,
|
||||||
@@ -704,11 +794,35 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isBearishFiboPassed = bullishFib <= conditions.pivot.lower;
|
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 ...
|
// Bearish Conditions 1 ...
|
||||||
bool bearishConditions1 =
|
bool bearishConditions1 =
|
||||||
//
|
//
|
||||||
|
// false
|
||||||
|
hasBearishTrend &&
|
||||||
isNewValeUnderLast &&
|
isNewValeUnderLast &&
|
||||||
isBearishFiboPassed &&
|
isBearishFiboPassed &&
|
||||||
helperCBar.IsBearish() &&
|
helperCBar.IsBearish() &&
|
||||||
@@ -719,7 +833,9 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
;
|
;
|
||||||
if (bearishConditions1)
|
if (bearishConditions1)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
conditions.point = conditions.pivot.lower;
|
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 donOpenUpper = helperConditions.x121Conditions.donOpenUpperBuffer[1];
|
||||||
double donOpenLower = helperConditions.x121Conditions.donOpenLowerBuffer[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 =
|
bool bearishConditions2 =
|
||||||
//
|
//
|
||||||
isNewPeakUnderLast &&
|
false
|
||||||
donCloseUpper > peak
|
// hasBearishTrend &&
|
||||||
|
// isNewPeakUnderLast &&
|
||||||
|
// donCloseUpper > peak &&
|
||||||
|
// isPeakDiffPointPassed
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (bearishConditions2)
|
if (bearishConditions2)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
conditions.point = peak;
|
conditions.point = peak;
|
||||||
|
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -778,7 +921,8 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
//
|
//
|
||||||
isBullish =
|
isBullish =
|
||||||
//
|
//
|
||||||
false
|
bullishConditions1 ||
|
||||||
|
bullishConditions2
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -798,6 +942,18 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
Print("Bullish ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBearish)
|
||||||
|
{
|
||||||
|
Print("Bearish ...");
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.setupTime = cTime;
|
conditions.setupTime = cTime;
|
||||||
conditions.dir =
|
conditions.dir =
|
||||||
@@ -1212,6 +1368,59 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
bool hasBullishPriceInsideZone = conditions.HasBullishPriceInsideZone();
|
bool hasBullishPriceInsideZone = conditions.HasBullishPriceInsideZone();
|
||||||
bool hasBearishPriceInsideZone = conditions.HasBearishPriceInsideZone();
|
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 (
|
if (
|
||||||
isBearish &&
|
isBearish &&
|
||||||
@@ -1285,6 +1494,18 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
: entry - targetDelta;
|
: entry - targetDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
Print("Bullish ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBearish)
|
||||||
|
{
|
||||||
|
Print("Bearish ...");
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.sl = sl;
|
conditions.sl = sl;
|
||||||
conditions.target = target;
|
conditions.target = target;
|
||||||
@@ -1297,6 +1518,97 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
return result;
|
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 ...
|
* Drw Conditions Price Inside Zones ...
|
||||||
*
|
*
|
||||||
@@ -1306,7 +1618,7 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int DrawPriceInsideZones(
|
int DrawTWPVPriceInsideZones(
|
||||||
X121SMCStrategyXTWPVSignalConditions &conditions,
|
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||||
XCPOIDrawer *drawer,
|
XCPOIDrawer *drawer,
|
||||||
XCBaseObject *&drawnObjects[] //
|
XCBaseObject *&drawnObjects[] //
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
result = PrepareSignal(signal);
|
result = PrepareSignal(signal);
|
||||||
|
|
||||||
//
|
//
|
||||||
hasLong = false;
|
hasLong = false;
|
||||||
hasShort = false;
|
hasShort = false;
|
||||||
@@ -709,20 +709,59 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw Price Inside Zones ...
|
// Handle Required Drawings ...
|
||||||
if (mXTWPVConditions.HasPriceInsideZones())
|
bool hasPivot = mXTWPVConditions.HasPivot();
|
||||||
|
bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones();
|
||||||
|
bool canDraw = hasPivot ||
|
||||||
|
hasPriceInsideZone;
|
||||||
|
if (canDraw)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ClearDraws();
|
ClearDraws();
|
||||||
|
|
||||||
//
|
//
|
||||||
XCBaseObject *drawnObjects[];
|
// Draw Pivot Zone ...
|
||||||
int drawnObjectsCount = DrawPriceInsideZones(
|
if (hasPivot)
|
||||||
mXTWPVConditions,
|
{
|
||||||
mPOIDrawer,
|
//
|
||||||
drawnObjects //
|
XCBaseObject *drawnObjects[];
|
||||||
);
|
int drawnObjectsCount = DrawXTWPVPivotZone(
|
||||||
AddObjectsIfNotExists(drawnObjects);
|
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