This commit is contained in:
2024-11-07 05:23:22 +03:30
parent cd441ef6bf
commit aec54aa45a
23 changed files with 14777 additions and 272 deletions
@@ -367,6 +367,14 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
ENUM_XPOI_EVENTS _4HStates[];
m4HPOI.Update(_4HStates);
//
ENUM_XPOI_EVENTS _2HStates[];
m2HPOI.Update(_2HStates);
//
ENUM_XPOI_EVENTS _1HStates[];
m1HPOI.Update(_1HStates);
//
ENUM_XPOI_EVENTS _15MStates[];
m15MPOI.Update(_15MStates);
@@ -383,6 +391,8 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
// Read all POI States ...
m1DPOI.GetState(_1DState);
m4HPOI.GetState(_4HState);
m2HPOI.GetState(_2HState);
m1HPOI.GetState(_1HState);
m15MPOI.GetState(_15MState);
m5MPOI.GetState(_5MState);
m1MPOI.GetState(_1MState);
@@ -398,6 +408,14 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
_4HState,
_States //
);
AddRef(
_2HState,
_States //
);
AddRef(
_1HState,
_States //
);
AddRef(
_15MState,
_States //
@@ -467,219 +485,6 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
return result;
}
/**
* Detect Valid Market Conditions ...
*
* @param conditions: X121SMCStrategyConditions instance ...
*
* @return ( virtual bool )
*/
virtual bool DetecConditions(X121SMCStrategyConditions &conditions)
{
//
bool result = false;
//
conditions.Clean();
//
return result;
}
/**
* Detect Market Structure based on Conditions ...
*
* @param structure: X121SMCMarketStructure instance ...
* @param conditions: X121SMCStrategyConditions instance ...
*/
virtual void DetectMarketStructure(
X121SMCMarketStructure &structure,
X121SMCStrategyConditions &conditions //
)
{
}
/**
* Remove Specific Conditions if Exists ...
*
* @param conditions: X121SMCStrategyConditions instance ...
*/
virtual void RemoveConditionsIfExists(X121SMCStrategyConditions &conditions)
{
}
/**
* Search Conditions for Find SL Candidates ...
*
* @param candidates: Double Array ...
* @param entry: Double ...
* @param structure: X121SMCStrategyConditions instance ...
* @param type: ENUM_X_POSITION_TYPES member ...
*
* @return ( virtual int )
*/
virtual int DetectSLCandidates(
double &candidates[],
double entry,
X121SMCStrategyConditions &conditions,
ENUM_X_POSITION_TYPES type //
)
{
//
int result = 0;
//
if (type == X_POSITION_TYPE_NONE ||
type == X_POSITION_TYPE_ALL)
{
return result;
}
//
bool useSwings = true;
bool useMomentumBars = true;
bool useRejectionBars = true;
//
Clean(candidates);
//
XOHCL candidateBars[];
if (type == X_POSITION_TYPE_LONG)
{
//
// Search Bullish Momentum, Rejection Bars and Swing Lows ...
//
// Swing Lows ...
if (useSwings)
{
//
Copy(
conditions.swingLows,
candidateBars,
false //
);
}
//
// Bullish Momentum Bars ...
if (useMomentumBars)
{
//
Copy(
conditions.bullishMomentumBars,
candidateBars,
false //
);
}
//
// Bullish Rejection Bars ...
if (useRejectionBars)
{
//
Copy(
conditions.bullishRejectionBars,
candidateBars,
false //
);
}
//
int count = ArraySize(candidateBars);
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XOHCL iBar = candidateBars[i];
//
if (iBar.low < entry)
{
//
Add(
iBar.low,
candidates //
);
}
}
}
}
else if (type == X_POSITION_TYPE_SHORT)
{
//
// Search Bearish Momentum, Rejection Bars and Swing Highs ...
//
// Swing Highs ...
if (useSwings)
{
//
Copy(
conditions.swingHighs,
candidateBars,
false //
);
}
//
// Bearish Momentum Bars ...
if (useMomentumBars)
{
//
Copy(
conditions.bearishMomentumBars,
candidateBars,
false //
);
}
//
// Bearish Rejection Bars ...
if (useRejectionBars)
{
//
Copy(
conditions.bearishRejectionBars,
candidateBars,
false //
);
}
//
int count = ArraySize(candidateBars);
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XOHCL iBar = candidateBars[i];
//
if (iBar.high > entry)
{
//
Add(
iBar.low,
candidates //
);
}
}
}
}
//
Clean(candidateBars);
result = ArraySize(candidates);
//
return result;
}
/**
* Customize Strategy Identifier ...
*
@@ -702,6 +507,8 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
// Point Of Interests ...
XCPOI *m1DPOI;
XCPOI *m4HPOI;
XCPOI *m2HPOI;
XCPOI *m1HPOI;
XCPOI *m15MPOI;
XCPOI *m5MPOI;
XCPOI *m1MPOI;
@@ -709,6 +516,8 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
//
XPOIState _1DState;
XPOIState _4HState;
XPOIState _2HState;
XPOIState _1HState;
XPOIState _15MState;
XPOIState _5MState;
XPOIState _1MState;
@@ -723,10 +532,8 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
MqlTick mLastTick; // Last Issued Tick ...
//
X121SMCStrategyConditions mConditions[];
//
XBarTracker mBarTracker; // Strategy Time Tracker ...
XBarTracker mBarTracker; // Strategy Time Tracker ...
X121SMCStrategyConditions mConditions; // Market Conditions ...
//
// Actions ...
@@ -985,15 +792,8 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
return result;
}
/**
* Clear All Conditions ...
*/
void ClearConditions()
{
Clean(mConditions);
}
//
/**
* Notified Signal Event Handler(s) ...
*
@@ -1146,50 +946,6 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
mDrawnObjects.Add(iObj);
}
/**
* Draw Conditions ...
*
* @param conditions: X121SMCStrategyConditions instance ...
*/
void DrawConditions(X121SMCStrategyConditions &conditions)
{
//
XC121SMCConditionsObject *iObj;
iObj = new XC121SMCConditionsObject(mPOIDrawer);
bool isCreated = iObj.CreateByConditions(
ChartIdentification(),
conditions.GetTag(true),
SubWindowIdentification(),
conditions //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
/**
* Draw Market Structure ...
*
* @param structure: X121SMCMarketStructure instance ...
*/
void DrawMarketStructure(X121SMCMarketStructure &structure)
{
//
XC121SMCMarketStructureObject *iObj;
iObj = new XC121SMCMarketStructureObject(mPOIDrawer);
bool isCreated = iObj.CreateByStructure(
ChartIdentification(),
structure.GetTag(),
SubWindowIdentification(),
structure //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
// Private ...
private:
@@ -1299,6 +1055,42 @@ class XCX121SMCBaseStrategy : public XSCBaseAlert
//
m4HPOI.Init();
//
// 2H Period ...
// POI Detector ...
m2HPOI = new XCPOI(
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(
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 ...