last ...
This commit is contained in:
@@ -2681,3 +2681,301 @@
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
int consolidationsCount = mTriggerCycleHelper.CountConsolidationZones();
|
||||||
|
result = IsValidSize(consolidationsCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
XConsolidationZone consolidations[];
|
||||||
|
mTriggerCycleHelper.FillConsolidationZones(consolidations);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Bid inside Of Zones ...
|
||||||
|
bool hasSupply = false;
|
||||||
|
bool hasDemand = false;
|
||||||
|
XCSupplyZone *supplyZone;
|
||||||
|
XCDemandZone *demandZone;
|
||||||
|
bool isBidInsideZone = false;
|
||||||
|
XConsolidationZone bidContainsConsolidationZone;
|
||||||
|
for (int i = consolidationsCount - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XConsolidationZone iZone = consolidations[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Supply or Demand Zone ...
|
||||||
|
hasSupply = iZone.HasSupplyZone(supplyZone);
|
||||||
|
hasDemand = iZone.HasDemandZone(demandZone);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = hasSupply ||
|
||||||
|
hasDemand;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Bid inside Zone ...
|
||||||
|
if (hasSupply)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = bid < supplyZone.Upper() &&
|
||||||
|
bid > supplyZone.Lower();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = bid < demandZone.Upper() &&
|
||||||
|
bid > demandZone.Lower();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasSupply)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
supplyZone.To(cTime);
|
||||||
|
XCSupplyZoneObject *iSupplyZoneObj;
|
||||||
|
result = mPOIDrawer.CreateSupplyZone(
|
||||||
|
supplyZone,
|
||||||
|
iSupplyZoneObj //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasDemand)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
demandZone.To(cTime);
|
||||||
|
XCDemandZoneObject *iDemandZoneObj;
|
||||||
|
result = mPOIDrawer.CreateDemandZone(
|
||||||
|
demandZone,
|
||||||
|
iDemandZoneObj //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Print("BID Inside Zone ...");
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
bool DetectCandlestic(
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
int cIndex = 1;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
result = cBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
cIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
result = pBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
pIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum Bars ...
|
||||||
|
XCMomentumBar *cBullishMomentum = NULL;
|
||||||
|
XCMomentumBar *cBearishMomentum = NULL;
|
||||||
|
XCMomentumBar *pBullishMomentum = NULL;
|
||||||
|
XCMomentumBar *pBearishMomentum = NULL;
|
||||||
|
int bullishMomentumBarsCount = conditions.triggerConditions.state
|
||||||
|
.CountBullishMomentumBars();
|
||||||
|
int bearishMomentumBarsCount = conditions.triggerConditions.state
|
||||||
|
.CountBearishMomentumBars();
|
||||||
|
if (IsValidSize(bullishMomentumBarsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cBullishMomentum = conditions.triggerConditions.state.bullishMomentumBars[bullishMomentumBarsCount - 1];
|
||||||
|
pBullishMomentum = conditions.triggerConditions.state.bullishMomentumBars[bullishMomentumBarsCount - 2];
|
||||||
|
}
|
||||||
|
if (IsValidSize(bearishMomentumBarsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cBearishMomentum = conditions.triggerConditions.state.bearishMomentumBars[bearishMomentumBarsCount - 1];
|
||||||
|
pBearishMomentum = conditions.triggerConditions.state.bearishMomentumBars[bearishMomentumBarsCount - 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rejection Bars ...
|
||||||
|
XCRejectionBar *cBullishRejection = NULL;
|
||||||
|
XCRejectionBar *cBearishRejection = NULL;
|
||||||
|
XCRejectionBar *pBullishRejection = NULL;
|
||||||
|
XCRejectionBar *pBearishRejection = NULL;
|
||||||
|
int bullishRejectionBarsCount = conditions.triggerConditions.state
|
||||||
|
.CountBullishRejectionBars();
|
||||||
|
int bearishRejectionBarsCount = conditions.triggerConditions.state
|
||||||
|
.CountBearishRejectionBars();
|
||||||
|
if (IsValidSize(bullishRejectionBarsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cBullishRejection = conditions.triggerConditions.state.bullishRejectionBars[bullishRejectionBarsCount - 1];
|
||||||
|
pBullishRejection = conditions.triggerConditions.state.bullishRejectionBars[bullishRejectionBarsCount - 2];
|
||||||
|
}
|
||||||
|
if (IsValidSize(bearishRejectionBarsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cBearishRejection = conditions.triggerConditions.state.bearishRejectionBars[bearishRejectionBarsCount - 1];
|
||||||
|
pBearishRejection = conditions.triggerConditions.state.bearishRejectionBars[bearishRejectionBarsCount - 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
// pBar is Rejection and cBar is Momentum ...
|
||||||
|
// pBar is Momentum and cBar is Rejection ...
|
||||||
|
// cBar is Momentum and Rejection ...
|
||||||
|
//
|
||||||
|
pBullishMomentum != NULL &&
|
||||||
|
pBullishMomentum.IsValid() &&
|
||||||
|
//
|
||||||
|
cBullishMomentum != NULL &&
|
||||||
|
cBullishMomentum.IsValid() &&
|
||||||
|
//
|
||||||
|
//
|
||||||
|
pBullishRejection != NULL &&
|
||||||
|
pBullishRejection.IsValid() &&
|
||||||
|
//
|
||||||
|
cBullishRejection != NULL &&
|
||||||
|
cBullishRejection.IsValid() &&
|
||||||
|
//
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(pBar.time == pBullishRejection.BarTime() &&
|
||||||
|
cBar.time == cBullishMomentum.BarTime())
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(pBar.time == pBullishMomentum.BarTime() &&
|
||||||
|
cBar.time == cBullishRejection.BarTime())
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(cBar.time == cBullishMomentum.BarTime() &&
|
||||||
|
cBar.time == cBullishRejection.BarTime())
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
// pBar is Rejection and cBar is Momentum ...
|
||||||
|
// pBar is Momentum and cBar is Rejection ...
|
||||||
|
// cBar is Momentum and Rejection ...
|
||||||
|
//
|
||||||
|
pBearishMomentum != NULL &&
|
||||||
|
pBearishMomentum.IsValid() &&
|
||||||
|
//
|
||||||
|
cBearishMomentum != NULL &&
|
||||||
|
cBearishMomentum.IsValid() &&
|
||||||
|
//
|
||||||
|
//
|
||||||
|
pBearishRejection != NULL &&
|
||||||
|
pBearishRejection.IsValid() &&
|
||||||
|
//
|
||||||
|
cBearishRejection != NULL &&
|
||||||
|
cBearishRejection.IsValid() &&
|
||||||
|
//
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(pBar.time == pBearishRejection.BarTime() &&
|
||||||
|
cBar.time == cBearishMomentum.BarTime())
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(pBar.time == pBearishMomentum.BarTime() &&
|
||||||
|
cBar.time == cBearishRejection.BarTime())
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(cBar.time == cBearishMomentum.BarTime() &&
|
||||||
|
cBar.time == cBearishRejection.BarTime())
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -683,14 +683,16 @@ class XCBarZone : public XCZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM_TIMEFRAMES GetPeriod() {
|
ENUM_TIMEFRAMES GetPeriod()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
ENUM_TIMEFRAMES result = NULL;
|
ENUM_TIMEFRAMES result = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL bar;
|
XOHCL bar;
|
||||||
bool isFilled = FillBar(bar);
|
bool isFilled = FillBar(bar);
|
||||||
if (!isFilled) {
|
if (!isFilled)
|
||||||
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,6 +743,16 @@ class XCBarZone : public XCZone
|
|||||||
mTo = value;
|
mTo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Bar Time ...
|
||||||
|
*
|
||||||
|
* @return ( datetime )
|
||||||
|
*/
|
||||||
|
datetime BarTime()
|
||||||
|
{
|
||||||
|
return mBar.time;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides ...
|
// Overrides ...
|
||||||
|
|
||||||
@@ -1021,14 +1033,16 @@ class XCTwoBarZone : public XCZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM_TIMEFRAMES GetPeriod() {
|
ENUM_TIMEFRAMES GetPeriod()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
ENUM_TIMEFRAMES result = NULL;
|
ENUM_TIMEFRAMES result = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL bar;
|
XOHCL bar;
|
||||||
bool isFilled = FillStartBar(bar);
|
bool isFilled = FillStartBar(bar);
|
||||||
if (!isFilled) {
|
if (!isFilled)
|
||||||
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1239,14 +1253,16 @@ class XCSwing : public XCBasePOI
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM_TIMEFRAMES GetPeriod() {
|
ENUM_TIMEFRAMES GetPeriod()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
ENUM_TIMEFRAMES result = NULL;
|
ENUM_TIMEFRAMES result = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL bar;
|
XOHCL bar;
|
||||||
bool isFilled = FillBar(bar);
|
bool isFilled = FillBar(bar);
|
||||||
if (!isFilled) {
|
if (!isFilled)
|
||||||
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3667,7 +3683,6 @@ struct XPOIState
|
|||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Consolidation Zone ...
|
// Consolidation Zone ...
|
||||||
struct XConsolidationZone
|
struct XConsolidationZone
|
||||||
|
|||||||
@@ -31,6 +31,26 @@
|
|||||||
//
|
//
|
||||||
// Implementations ...
|
// Implementations ...
|
||||||
|
|
||||||
|
enum ENUM_X_CYCLES
|
||||||
|
{
|
||||||
|
X_CYCLE_TRIGGER,
|
||||||
|
X_CYCLE_DECISION,
|
||||||
|
X_CYCLE_ANALYSE,
|
||||||
|
X_CYCLE_VERIFICATION,
|
||||||
|
X_CYCLE_CONSOLIDATION,
|
||||||
|
X_CYCLE_VISION,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ENUM_X_CYCLE_EVENTS
|
||||||
|
{
|
||||||
|
SAR_CHANGE_DETECTED,
|
||||||
|
NEW_PEAK_DETECTED,
|
||||||
|
NEW_VALE_DETECTED,
|
||||||
|
VWAP_ORDER_CHANGE_ETECTED,
|
||||||
|
VWAP_STATE_CHANGE_DETCTED,
|
||||||
|
CONSOLIDATION_BREAKED_DETECTED
|
||||||
|
};
|
||||||
|
|
||||||
class XC121SMCCycleHelper : public XCBase
|
class XC121SMCCycleHelper : public XCBase
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -46,6 +66,10 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
// POI Detector ...
|
// POI Detector ...
|
||||||
XCPOIDetector *mPOIDetector;
|
XCPOIDetector *mPOIDetector;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bar Analyser
|
||||||
|
XCBarAnalyser *mBarAnalyser;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XC121SMCCycleHelper()
|
XC121SMCCycleHelper()
|
||||||
@@ -333,6 +357,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
/**
|
/**
|
||||||
* Retrieve Cycle Conditions ...
|
* Retrieve Cycle Conditions ...
|
||||||
*
|
*
|
||||||
|
* @param events: ENUM_X_CYCLE_EVENTS member, Array ...
|
||||||
* @param conditions: X121SMCCycleConditions instance ...
|
* @param conditions: X121SMCCycleConditions instance ...
|
||||||
* @param barIndex: Integer ...
|
* @param barIndex: Integer ...
|
||||||
* @param loopback: Integer ...
|
* @param loopback: Integer ...
|
||||||
@@ -340,6 +365,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
|
ENUM_X_CYCLE_EVENTS &events[],
|
||||||
X121SMCCycleConditions &conditions,
|
X121SMCCycleConditions &conditions,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
int loopback = 7 //
|
int loopback = 7 //
|
||||||
@@ -390,6 +416,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
Calculate(
|
Calculate(
|
||||||
barIndex,
|
barIndex,
|
||||||
|
events,
|
||||||
conditions //
|
conditions //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -928,13 +955,18 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
* Calculate Requirements ...
|
* Calculate Requirements ...
|
||||||
*
|
*
|
||||||
* @param barIndex: Integer, Bar Index ...
|
* @param barIndex: Integer, Bar Index ...
|
||||||
|
* @param events: ENUM_X_CYCLE_EVENTS member, Array ...
|
||||||
* @param conditions: X121SMCCycleConditions instance ...
|
* @param conditions: X121SMCCycleConditions instance ...
|
||||||
*/
|
*/
|
||||||
void Calculate(
|
void Calculate(
|
||||||
int barIndex,
|
int barIndex,
|
||||||
|
ENUM_X_CYCLE_EVENTS &events[],
|
||||||
X121SMCCycleConditions &conditions //
|
X121SMCCycleConditions &conditions //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
Clean(events);
|
||||||
|
|
||||||
//
|
//
|
||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
@@ -986,7 +1018,14 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
if (isInited)
|
if (isInited)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
isInited = AddSarChange(sarChanged);
|
isInited = AddSarChange(sarChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
SAR_CHANGE_DETECTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1023,7 +1062,14 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
if (isInited)
|
if (isInited)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
isInited = AddPeaksChange(peaksChanged);
|
isInited = AddPeaksChange(peaksChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
NEW_PEAK_DETECTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1060,7 +1106,14 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
if (isInited)
|
if (isInited)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
isInited = AddValesChange(valesChanged);
|
isInited = AddValesChange(valesChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
NEW_VALE_DETECTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1150,7 +1203,14 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
if (isInited)
|
if (isInited)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
isInited = AddVWapOrderChange(vwapOrderChanged);
|
isInited = AddVWapOrderChange(vwapOrderChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
VWAP_ORDER_CHANGE_ETECTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1238,7 +1298,14 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
if (isInited)
|
if (isInited)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
isInited = AddVWapStateChange(vwapStateChanged);
|
isInited = AddVWapStateChange(vwapStateChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
VWAP_STATE_CHANGE_DETCTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,7 +1378,10 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
mActioveConsolidationZone.Clean();
|
mActioveConsolidationZone.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
Print("Breake ...");
|
Add(
|
||||||
|
CONSOLIDATION_BREAKED_DETECTED,
|
||||||
|
events //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1320,7 +1390,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XCBarAnalyser *mBarAnalyser;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Change Holders ...
|
// Change Holders ...
|
||||||
|
|||||||
@@ -271,11 +271,27 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
ENUM_X_DIRECTION mOrderFlowDir;
|
ENUM_X_DIRECTION mOrderFlowDir;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
ENUM_X_CYCLE_EVENTS mTriggerCycleEvents[];
|
||||||
XC121SMCCycleHelper *mTriggerCycleHelper;
|
XC121SMCCycleHelper *mTriggerCycleHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_CYCLE_EVENTS mDecisionCycleEvents[];
|
||||||
XC121SMCCycleHelper *mDecisionCycleHelper;
|
XC121SMCCycleHelper *mDecisionCycleHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_CYCLE_EVENTS mAnalyseCycleEvents[];
|
||||||
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_CYCLE_EVENTS mVerificationCycleEvents[];
|
||||||
XC121SMCCycleHelper *mVerificationCycleHelper;
|
XC121SMCCycleHelper *mVerificationCycleHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_CYCLE_EVENTS mConsolidationCycleEvents[];
|
||||||
XC121SMCCycleHelper *mConsolidationCycleHelper;
|
XC121SMCCycleHelper *mConsolidationCycleHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_CYCLE_EVENTS mVisionCycleEvents[];
|
||||||
XC121SMCCycleHelper *mVisionCycleHelper;
|
XC121SMCCycleHelper *mVisionCycleHelper;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -322,6 +338,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Trigger ...
|
// Trigger ...
|
||||||
result = mTriggerCycleHelper.GetConditions(
|
result = mTriggerCycleHelper.GetConditions(
|
||||||
|
mTriggerCycleEvents,
|
||||||
conditions.triggerConditions,
|
conditions.triggerConditions,
|
||||||
zIndex,
|
zIndex,
|
||||||
conditionsLoopback //
|
conditionsLoopback //
|
||||||
@@ -337,6 +354,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Decision ...
|
// Decision ...
|
||||||
result = mDecisionCycleHelper.GetConditions(
|
result = mDecisionCycleHelper.GetConditions(
|
||||||
|
mDecisionCycleEvents,
|
||||||
conditions.decisionConditions,
|
conditions.decisionConditions,
|
||||||
zIndex,
|
zIndex,
|
||||||
conditionsLoopback //
|
conditionsLoopback //
|
||||||
@@ -352,6 +370,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Analyse ...
|
// Analyse ...
|
||||||
result = mAnalyseCycleHelper.GetConditions(
|
result = mAnalyseCycleHelper.GetConditions(
|
||||||
|
mAnalyseCycleEvents,
|
||||||
conditions.analyseConditions,
|
conditions.analyseConditions,
|
||||||
zIndex,
|
zIndex,
|
||||||
conditionsLoopback //
|
conditionsLoopback //
|
||||||
@@ -367,6 +386,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Verification ...
|
// Verification ...
|
||||||
result = mVerificationCycleHelper.GetConditions(
|
result = mVerificationCycleHelper.GetConditions(
|
||||||
|
mVerificationCycleEvents,
|
||||||
conditions.verificationConditions,
|
conditions.verificationConditions,
|
||||||
zIndex,
|
zIndex,
|
||||||
conditionsLoopback //
|
conditionsLoopback //
|
||||||
@@ -382,6 +402,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Consolidation ...
|
// Consolidation ...
|
||||||
result = mConsolidationCycleHelper.GetConditions(
|
result = mConsolidationCycleHelper.GetConditions(
|
||||||
|
mConsolidationCycleEvents,
|
||||||
conditions.consolidationConditions,
|
conditions.consolidationConditions,
|
||||||
zIndex,
|
zIndex,
|
||||||
conditionsLoopback //
|
conditionsLoopback //
|
||||||
@@ -397,6 +418,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Vision ...
|
// Vision ...
|
||||||
result = mVisionCycleHelper.GetConditions(
|
result = mVisionCycleHelper.GetConditions(
|
||||||
|
mVisionCycleEvents,
|
||||||
conditions.visionConditions,
|
conditions.visionConditions,
|
||||||
zIndex,
|
zIndex,
|
||||||
conditionsLoopback //
|
conditionsLoopback //
|
||||||
@@ -469,118 +491,522 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
//
|
//
|
||||||
int consolidationsCount = mTriggerCycleHelper.CountConsolidationZones();
|
// Here We Select Cycles For Conditions Check ...
|
||||||
result = IsValidSize(consolidationsCount);
|
ENUM_X_CYCLES cycles[5] = {
|
||||||
|
X_CYCLE_TRIGGER,
|
||||||
|
X_CYCLE_DECISION,
|
||||||
|
X_CYCLE_ANALYSE,
|
||||||
|
X_CYCLE_VERIFICATION,
|
||||||
|
X_CYCLE_CONSOLIDATION //
|
||||||
|
};
|
||||||
|
bool hasSamePeaks = DetectSamePeaks(
|
||||||
|
cycles,
|
||||||
|
conditions //
|
||||||
|
);
|
||||||
|
bool hasSameVales = DetectSameVales(
|
||||||
|
cycles,
|
||||||
|
conditions //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
hasSamePeaks ||
|
||||||
|
hasSameVales;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
conditions.Clean();
|
conditions.Clean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
XConsolidationZone consolidations[];
|
|
||||||
mTriggerCycleHelper.FillConsolidationZones(consolidations);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Bid inside Of Zones ...
|
// Check Sar State ...
|
||||||
bool hasSupply = false;
|
ENUM_X_DIRECTION sarDir;
|
||||||
bool hasDemand = false;
|
result = DetectSarState(
|
||||||
XCSupplyZone *supplyZone;
|
sarDir,
|
||||||
XCDemandZone *demandZone;
|
conditions //
|
||||||
bool isBidInsideZone = false;
|
);
|
||||||
XConsolidationZone bidContainsConsolidationZone;
|
if (!result)
|
||||||
for (int i = consolidationsCount - 1; i >= 0; i--)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XConsolidationZone iZone = consolidations[i];
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check VWAP State ...
|
||||||
|
ENUM_X_DIRECTION vwapDir;
|
||||||
|
result = DetectVWapState(
|
||||||
|
vwapDir,
|
||||||
|
conditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Candlestic State ...
|
||||||
|
ENUM_X_DIRECTION candlesticDir;
|
||||||
|
result = DetectCandlestic(
|
||||||
|
candlesticDir,
|
||||||
|
conditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Print("Has Same Peaks or Vales ...");
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Where Cycles has Same Peaks ...
|
||||||
|
*
|
||||||
|
* @param cycles: ENUM_X_CYCLES members, Array ...
|
||||||
|
* @param conditions: X121SMCStrategyConditions instance, Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectSamePeaks(
|
||||||
|
ENUM_X_CYCLES &cycles[],
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(cycles);
|
||||||
|
result = IsValidSize(count);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double value = -1;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_X_CYCLES iCycle = cycles[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Supply or Demand Zone ...
|
double iValue = -1;
|
||||||
hasSupply = iZone.HasSupplyZone(supplyZone);
|
switch (iCycle)
|
||||||
hasDemand = iZone.HasDemandZone(demandZone);
|
{
|
||||||
|
//
|
||||||
|
case X_CYCLE_TRIGGER:
|
||||||
|
iValue = conditions.triggerConditions.x121Conditions.peaksBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = hasSupply ||
|
case X_CYCLE_DECISION:
|
||||||
hasDemand;
|
iValue = conditions.decisionConditions.x121Conditions.peaksBuffer[0];
|
||||||
if (!result)
|
break;
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Bid inside Zone ...
|
case X_CYCLE_ANALYSE:
|
||||||
if (hasSupply)
|
iValue = conditions.analyseConditions.x121Conditions.peaksBuffer[0];
|
||||||
{
|
break;
|
||||||
//
|
|
||||||
result = bid < supplyZone.Upper() &&
|
|
||||||
bid > supplyZone.Lower();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result = bid < demandZone.Upper() &&
|
|
||||||
bid > demandZone.Lower();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if (result)
|
case X_CYCLE_VERIFICATION:
|
||||||
{
|
iValue = conditions.verificationConditions.x121Conditions.peaksBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_CONSOLIDATION:
|
||||||
|
iValue = conditions.consolidationConditions.x121Conditions.peaksBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_VISION:
|
||||||
|
iValue = conditions.visionConditions.x121Conditions.peaksBuffer[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasSupply)
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
supplyZone.To(cTime);
|
if (iValue > 0)
|
||||||
XCSupplyZoneObject *iSupplyZoneObj;
|
|
||||||
result = mPOIDrawer.CreateSupplyZone(
|
|
||||||
supplyZone,
|
|
||||||
iSupplyZoneObj //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
conditions.Clean();
|
if (value <= 0)
|
||||||
return result;
|
{
|
||||||
|
value = iValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = value == iValue;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasDemand)
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Where Cycles has Same Vales ...
|
||||||
|
*
|
||||||
|
* @param cycles: ENUM_X_CYCLES members, Array ...
|
||||||
|
* @param conditions: X121SMCStrategyConditions instance, Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectSameVales(
|
||||||
|
ENUM_X_CYCLES &cycles[],
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(cycles);
|
||||||
|
result = IsValidSize(count);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double value = -1;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
demandZone.To(cTime);
|
ENUM_X_CYCLES iCycle = cycles[i];
|
||||||
XCDemandZoneObject *iDemandZoneObj;
|
|
||||||
result = mPOIDrawer.CreateDemandZone(
|
//
|
||||||
demandZone,
|
double iValue = -1;
|
||||||
iDemandZoneObj //
|
switch (iCycle)
|
||||||
);
|
{
|
||||||
if (!result)
|
//
|
||||||
|
case X_CYCLE_TRIGGER:
|
||||||
|
iValue = conditions.triggerConditions.x121Conditions.valesBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_DECISION:
|
||||||
|
iValue = conditions.decisionConditions.x121Conditions.valesBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_ANALYSE:
|
||||||
|
iValue = conditions.analyseConditions.x121Conditions.valesBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_VERIFICATION:
|
||||||
|
iValue = conditions.verificationConditions.x121Conditions.valesBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_CONSOLIDATION:
|
||||||
|
iValue = conditions.consolidationConditions.x121Conditions.valesBuffer[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_CYCLE_VISION:
|
||||||
|
iValue = conditions.visionConditions.x121Conditions.valesBuffer[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (iValue > 0)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
conditions.Clean();
|
if (value <= 0)
|
||||||
return result;
|
{
|
||||||
|
value = iValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = value == iValue;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Print("BID Inside Zone ...");
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Sar State for Signalling ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION member Reference ...
|
||||||
|
* @param conditions: X121SMCStrategyConditions instance, Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectSarState(
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
// Check One of Verification or Consolidation Cycles Must be Sar Bullish ...
|
||||||
|
(conditions.verificationConditions.x121Conditions.isSarBullish ||
|
||||||
|
conditions.consolidationConditions.x121Conditions.isSarBullish)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// Decision and Analyse Cycles Must be Bullish ...
|
||||||
|
(conditions.decisionConditions.x121Conditions.isSarBullish &&
|
||||||
|
conditions.analyseConditions.x121Conditions.isSarBullish)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// Trigger State Must be Bearish ...
|
||||||
|
conditions.triggerConditions.x121Conditions.isSarBearish
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
// Check One of Verification or Consolidation Cycles Must be Sar Bearish ...
|
||||||
|
(conditions.verificationConditions.x121Conditions.isSarBearish ||
|
||||||
|
conditions.consolidationConditions.x121Conditions.isSarBearish)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// Decision and Analyse Cycles Must be Bearish ...
|
||||||
|
(conditions.decisionConditions.x121Conditions.isSarBearish &&
|
||||||
|
conditions.analyseConditions.x121Conditions.isSarBearish)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// Trigger State Must be Bullish ...
|
||||||
|
conditions.triggerConditions.x121Conditions.isSarBullish
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Sar State for Signalling ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION member Reference ...
|
||||||
|
* @param conditions: X121SMCStrategyConditions instance, Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectVWapState(
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
// Trigger, Decision and Analyse Cycles Must be in Direction Order and State ...
|
||||||
|
//
|
||||||
|
// Orders ...
|
||||||
|
(conditions.triggerConditions.x121Conditions.isVWapBullishOrdered &&
|
||||||
|
conditions.decisionConditions.x121Conditions.isVWapBullishOrdered &&
|
||||||
|
conditions.analyseConditions.x121Conditions.isVWapBullishOrdered)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// State ...
|
||||||
|
(conditions.triggerConditions.x121Conditions.isVWapBullishState &&
|
||||||
|
conditions.decisionConditions.x121Conditions.isVWapBullishState &&
|
||||||
|
conditions.analyseConditions.x121Conditions.isVWapBullishState)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// One of Verification and Consolidation must Be in Direction State ...
|
||||||
|
(conditions.verificationConditions.x121Conditions.isVWapBullishState ||
|
||||||
|
conditions.consolidationConditions.x121Conditions.isVWapBullishState)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
// Trigger, Decision and Analyse Cycles Must be in Direction Order and State ...
|
||||||
|
//
|
||||||
|
// Orders ...
|
||||||
|
(conditions.triggerConditions.x121Conditions.isVWapBearishOrdered &&
|
||||||
|
conditions.decisionConditions.x121Conditions.isVWapBearishOrdered &&
|
||||||
|
conditions.analyseConditions.x121Conditions.isVWapBearishOrdered)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// State ...
|
||||||
|
(conditions.triggerConditions.x121Conditions.isVWapBearishState &&
|
||||||
|
conditions.decisionConditions.x121Conditions.isVWapBearishState &&
|
||||||
|
conditions.analyseConditions.x121Conditions.isVWapBearishState)
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// One of Verification and Consolidation must Be in Direction State ...
|
||||||
|
(conditions.verificationConditions.x121Conditions.isVWapBearishState ||
|
||||||
|
conditions.consolidationConditions.x121Conditions.isVWapBearishState)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DetectCandlestic(
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategyConditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
int cIndex = 1;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
result = cBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
cIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
result = pBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
pIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION cBarMomentumDir;
|
||||||
|
bool isCBarMomentum = mTriggerCycleHelper.mBarAnalyser.
|
||||||
|
IsMomentumBar(
|
||||||
|
cBar,
|
||||||
|
cBarMomentumDir //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION cBarRejectionDir;
|
||||||
|
bool isCBarRejection = mTriggerCycleHelper.mBarAnalyser.
|
||||||
|
IsRejectionBar(
|
||||||
|
cBar,
|
||||||
|
cBarRejectionDir //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
// pBar is Rejection and cBar is Momentum ...
|
||||||
|
// pBar is Momentum and cBar is Rejection ...
|
||||||
|
// cBar is Momentum and Rejection ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
// pBar is Rejection and cBar is Momentum ...
|
||||||
|
// pBar is Momentum and cBar is Rejection ...
|
||||||
|
// cBar is Momentum and Rejection ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user