Fix all Refactors issues on X121SMC for start Implementing Strategy ...

This commit is contained in:
2024-11-15 10:36:57 +03:30
parent b921b45eb2
commit 801b37806e
15 changed files with 1584 additions and 151 deletions
@@ -23,11 +23,11 @@
// Imports ...
//
#include "../../Classes/x-saherelm.x-alert.class.mq5"
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
#include "../../Classes/x-saherelm.x-poi.class.mq5"
#include "../../Classes/x-saherelm.xalert.class.mq5"
#include "../../Classes/x-saherelm.xtrade.class.mq5"
#include "../../Classes/z-saherelm.x-bar.analyser.class.mq5"
#include "../Classes/x-121.smc.chart.objects.class.mq5"
#include "../../Classes/x-saherelm.x-trade.class.mq5"
#include "../Classes/x-121.smc.cobjects.class.mq5"
#include "../Libraries/x-121.smc.lib.mq5"
//
@@ -35,7 +35,7 @@
//
// XStrategy Class Implementation(s) ...
class XCX121SMCBaseStrategy : public XSCBaseAlert
class XCX121SMCBaseStrategy : public XCBaseAlert
{
//
// Public ...
@@ -311,6 +311,13 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
//
// Virtual Actions ...
/**
* Destroy All Class Implementations ...
*/
virtual void Destroy()
{
}
/**
* Handle Tick Processing ...
*/
@@ -486,6 +493,23 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
return result;
}
/**
* Detect SL Candidates based on Strategy and Conditions ...
*
* @param result: Double array reference ...
* @param entry: Double, Position Entry Price ...
* @param conditions: X121SMCStrategyConditions instance, Provides Configurations ...
* @param type: ENUM_X_POSITION_TYPES member, Specified Position Type ...
*/
virtual void DetectSLCandidates(
double &result[],
double entry,
X121SMCStrategyConditions &conditions,
ENUM_X_POSITION_TYPES type //
)
{
}
/**
* Customize Strategy Identifier ...
*
@@ -506,13 +530,13 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
//
// Point Of Interests ...
XCPOI *m1DPOI;
XCPOI *m4HPOI;
XCPOI *m2HPOI;
XCPOI *m1HPOI;
XCPOI *m15MPOI;
XCPOI *m5MPOI;
XCPOI *m1MPOI;
XCPOIDetector *m1DPOI;
XCPOIDetector *m4HPOI;
XCPOIDetector *m2HPOI;
XCPOIDetector *m1HPOI;
XCPOIDetector *m15MPOI;
XCPOIDetector *m5MPOI;
XCPOIDetector *m1MPOI;
//
XPOIState _1DState;
@@ -1024,128 +1048,77 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
//
// 1D Period ...
// POI Detector ...
m1DPOI = new XCPOI(
m1DPOI = new XCPOIDetector(
symbol,
PERIOD_D1 //
);
//
m1DPOI.DisableDrawPOIs();
m1DPOI.SupplyZonePeriod(PERIOD_W1);
m1DPOI.DemandZonePeriod(PERIOD_W1);
m1DPOI.SubWindowIdentification(0);
m1DPOI.ChartIdentification(ChartID());
//
m1DPOI.Init();
//
// 4H Period ...
// POI Detector ...
m4HPOI = new XCPOI(
m4HPOI = new XCPOIDetector(
symbol,
PERIOD_H4 //
);
//
m4HPOI.DisableDrawPOIs();
m4HPOI.SupplyZonePeriod(PERIOD_D1);
m4HPOI.DemandZonePeriod(PERIOD_D1);
m4HPOI.SubWindowIdentification(0);
m4HPOI.ChartIdentification(ChartID());
//
m4HPOI.Init();
//
// 2H Period ...
// POI Detector ...
m2HPOI = new XCPOI(
m2HPOI = new XCPOIDetector(
symbol,
PERIOD_H2 //
);
//
m2HPOI.DisableDrawPOIs();
m2HPOI.SupplyZonePeriod(PERIOD_H12);
m2HPOI.DemandZonePeriod(PERIOD_H12);
m2HPOI.SubWindowIdentification(0);
m2HPOI.ChartIdentification(ChartID());
//
m2HPOI.Init();
//
// 1H Period ...
// POI Detector ...
m1HPOI = new XCPOI(
m1HPOI = new XCPOIDetector(
symbol,
PERIOD_H1 //
);
//
m1HPOI.DisableDrawPOIs();
m1HPOI.SupplyZonePeriod(PERIOD_H6);
m1HPOI.DemandZonePeriod(PERIOD_H6);
m1HPOI.SubWindowIdentification(0);
m1HPOI.ChartIdentification(ChartID());
//
m1HPOI.Init();
//
// 15M Period ...
// POI Detector ...
m15MPOI = new XCPOI(
m15MPOI = new XCPOIDetector(
symbol,
PERIOD_M15 //
);
//
m15MPOI.DisableDrawPOIs();
m15MPOI.MaxNumberOfRequiredPOIs(2);
m15MPOI.SupplyZonePeriod(PERIOD_H4);
m15MPOI.DemandZonePeriod(PERIOD_H4);
m15MPOI.SubWindowIdentification(0);
m15MPOI.ChartIdentification(ChartID());
//
m15MPOI.Init();
//
// 5M Period ...
// POI Detector ...
m5MPOI = new XCPOI(
m5MPOI = new XCPOIDetector(
symbol,
PERIOD_M5 //
);
//
m5MPOI.DisableDrawPOIs();
m5MPOI.MaxNumberOfRequiredPOIs(2);
m5MPOI.SupplyZonePeriod(PERIOD_M15);
m5MPOI.DemandZonePeriod(PERIOD_M15);
m5MPOI.SubWindowIdentification(0);
m5MPOI.ChartIdentification(ChartID());
//
m5MPOI.Init();
//
// 1M Period ...
// POI Detector ...
m1MPOI = new XCPOI(
m1MPOI = new XCPOIDetector(
symbol,
PERIOD_M1 //
);
//
m1MPOI.DisableDrawPOIs();
m1MPOI.SupplyZonePeriod(PERIOD_M5);
m1MPOI.DemandZonePeriod(PERIOD_M5);
m1MPOI.SubWindowIdentification(0);
m1MPOI.ChartIdentification(ChartID());
//
m1MPOI.Init();
@@ -1168,7 +1141,7 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
delete mPOIDrawer;
//
// ClearDraws();
Destroy();
}
/**
@@ -24,6 +24,7 @@
//
#include "../../Classes/x-saherelm.x-alert.class.mq5"
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
#include "../../Classes/x-saherelm.x-trade.class.mq5"
//
@@ -1301,7 +1302,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
return mMaxAllowedSLReachedPauseDelay;
}
//
//
void MaxAllowedSLReachedPauseDelay(int value)
{
//
@@ -2742,7 +2743,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
// Protected ...
protected:
//
XCTrade *mTrader; // Instance of Trader Class
XCTrade *mTrader; // Instance of Trader Class
X121SMCTradeCollector *mCollector; // Instance of Trade Collector Class
//
@@ -3180,63 +3181,22 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
// Common Conditions For Bullish and Bearish Powers ...
//
// For Trend ...
XOHCL tmpHSW[];
XOHCL tmpLSW[];
//
// Detect Bullish/Bearish Patterns and Trends ...
//
// Bullish ...
bool hasBullishPower = cBar.HasBullishPower();
bool hasBullishPattern = HasBullishPattern(cBar);
bool hasBullishPattern = mBarAnalyser.HasBullishPattern(cBar);
bool hasBullishPressure = cBar.HasBullishPressure();
bool isBullishTrend = cBar.HasBullishTrend(
tmpHSW,
tmpLSW,
true //
);
bool isBullishTrend1 = cBar.HasBullishTrend(
tmpHSW,
tmpLSW,
false //
);
bool hasBullishTrend =
//
isBullishTrend
//
||
//
isBullishTrend1
//
;
bool hasBullishTrend = mBarAnalyser.HasBullishTrend(cBar, true);
//
// Bearish ...
bool hasBearishPower = cBar.HasBearishPower();
bool hasBearishPattern = HasBearishPattern(cBar);
bool hasBearishPattern = mBarAnalyser.HasBearishPattern(cBar);
bool hasBearishPressure = cBar.HasBearishPressure();
bool isBearishTrend = cBar.HasBearishTrend(
tmpHSW,
tmpLSW,
true //
);
bool isBearishTrend1 = cBar.HasBearishTrend(
tmpHSW,
tmpLSW,
false //
);
bool hasBearishTrend =
//
isBearishTrend
//
||
//
isBearishTrend1
//
;
bool hasBearishTrend = mBarAnalyser.HasBearishTrend(cBar, true);
//
// Define Conditions ...
@@ -3810,6 +3770,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
double mHedgeBEMinProfitPerVolumeStep; // Minimum Required Profit For BE Hedge Per Volume Step
//
XCBarAnalyser mBarAnalyser;
X121SMCSymbolPositionInfo mSymbolInfos[];
/**