Prepare requirements, add DrwaState in X121SMCBaseStrategy class ...
This commit is contained in:
@@ -442,7 +442,7 @@ class XCSwingLowObject : public XCSwingObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Momentum ...
|
// Momentum ...
|
||||||
class XCMomentumObject : public XCBarArrowObject
|
class XCMomentumBarObject : public XCBarArrowObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
@@ -523,7 +523,7 @@ class XCMomentumObject : public XCBarArrowObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Bullish Momentum Bar ...
|
// Bullish Momentum Bar ...
|
||||||
class XCBullishMomentumObject : public XCMomentumObject
|
class XCBullishMomentumBarObject : public XCMomentumBarObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
@@ -587,7 +587,7 @@ class XCBullishMomentumObject : public XCMomentumObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Bearish Momentum Bar ...
|
// Bearish Momentum Bar ...
|
||||||
class XCBearishMomentumObject : public XCMomentumObject
|
class XCBearishMomentumBarObject : public XCMomentumBarObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
@@ -651,7 +651,7 @@ class XCBearishMomentumObject : public XCMomentumObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Rejection ...
|
// Rejection ...
|
||||||
class XCRejectionObject : public XCBarArrowObject
|
class XCRejectionBarObject : public XCBarArrowObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
@@ -732,7 +732,7 @@ class XCRejectionObject : public XCBarArrowObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Bullish Rejection Bar ...
|
// Bullish Rejection Bar ...
|
||||||
class XCBullishRejectionObject : public XCRejectionObject
|
class XCBullishRejectionBarObject : public XCRejectionBarObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
@@ -796,7 +796,7 @@ class XCBullishRejectionObject : public XCRejectionObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Bearish Rejection Bar ...
|
// Bearish Rejection Bar ...
|
||||||
class XCBearishRejectionObject : public XCRejectionObject
|
class XCBearishRejectionBarObject : public XCRejectionBarObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
|
|||||||
+191
-120
@@ -1356,81 +1356,115 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
while (canContinue)
|
while (canContinue)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Swing Highs ...
|
// Swings ...
|
||||||
swingHighsCount = DetectRequiredSwingHighs(barIndex);
|
int swingRange = SwingRange();
|
||||||
if (swingHighsCount == requiredPOIs)
|
if (swingRange > 0)
|
||||||
{
|
{
|
||||||
ArrayReverse(mSwingHighs);
|
//
|
||||||
|
// Swing Highs ...
|
||||||
|
swingHighsCount = DetectRequiredSwingHighs(barIndex);
|
||||||
|
if (swingHighsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mSwingHighs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Lows ...
|
||||||
|
swingLowsCount = DetectRequiredSwingLows(barIndex);
|
||||||
|
if (swingLowsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mSwingLows);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Swing Lows ...
|
bool canLookupMomentumBars =
|
||||||
swingLowsCount = DetectRequiredSwingLows(barIndex);
|
MomentumBarExtendRange() >= 0 &&
|
||||||
if (swingHighsCount == requiredPOIs)
|
MomentumBarBodyPercent() > 0;
|
||||||
|
if (canLookupMomentumBars)
|
||||||
{
|
{
|
||||||
ArrayReverse(mSwingLows);
|
//
|
||||||
|
//
|
||||||
|
// Bullish Momentum Bars ...
|
||||||
|
bullishMomentumBarsCount = DetectRequiredBullishMomentumBars(barIndex);
|
||||||
|
if (bullishMomentumBarsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mBullishMomentumBars);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Momentum Bars ...
|
||||||
|
bearishMomentumBarsCount = DetectRequiredBearishMomentumBars(barIndex);
|
||||||
|
if (bearishMomentumBarsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mBearishMomentumBars);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bullish Momentum Bars ...
|
bool canLookupRejectionBars =
|
||||||
bullishMomentumBarsCount = DetectRequiredBullishMomentumBars(barIndex);
|
RejectionBarExtendRange() >= 0 &&
|
||||||
if (bullishMomentumBarsCount == requiredPOIs)
|
RejectionBarShadowPercent() > 0;
|
||||||
|
if (canLookupRejectionBars)
|
||||||
{
|
{
|
||||||
ArrayReverse(mBullishMomentumBars);
|
//
|
||||||
|
//
|
||||||
|
// Bullish Rejection Bars ...
|
||||||
|
bullishRejectionBarsCount = DetectRequiredBullishRejectionBars(barIndex);
|
||||||
|
if (bullishRejectionBarsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mBullishRejectionBars);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Rejection Bars ...
|
||||||
|
bearishRejectionBarsCount = DetectRequiredBearishRejectionBars(barIndex);
|
||||||
|
if (bearishRejectionBarsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mBearishRejectionBars);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bearish Momentum Bars ...
|
// Support and Resistance Zones ...
|
||||||
bearishMomentumBarsCount = DetectRequiredBearishMomentumBars(barIndex);
|
int supResRange = SupportAndResistanceRange();
|
||||||
if (bearishMomentumBarsCount == requiredPOIs)
|
if (supResRange > 0)
|
||||||
{
|
{
|
||||||
ArrayReverse(mBearishMomentumBars);
|
//
|
||||||
|
// Support Zone(s) ...
|
||||||
|
supportZonesCount = DetectRequiredSupportZones(barIndex);
|
||||||
|
if (supportZonesCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mSupportZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance Zone(s) ...
|
||||||
|
resistanceZonesCount = DetectRequiredResistanceZones(barIndex);
|
||||||
|
if (resistanceZonesCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mResistanceZones);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bullish Rejection Bars ...
|
// Supply and Demand Zones ...
|
||||||
bullishRejectionBarsCount = DetectRequiredBullishRejectionBars(barIndex);
|
int supDemRange = SupplyAndDemandRange();
|
||||||
if (bullishRejectionBarsCount == requiredPOIs)
|
if (supDemRange > 0)
|
||||||
{
|
{
|
||||||
ArrayReverse(mBullishRejectionBars);
|
//
|
||||||
}
|
supplyZonesCount = DetectRequiredSupplyZones(barIndex);
|
||||||
|
if (supplyZonesCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mSupplyZones);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bearish Rejection Bars ...
|
demandZonesCount = DetectRequiredDemandZones(barIndex);
|
||||||
bearishRejectionBarsCount = DetectRequiredBearishRejectionBars(barIndex);
|
if (demandZonesCount == requiredPOIs)
|
||||||
if (bearishRejectionBarsCount == requiredPOIs)
|
{
|
||||||
{
|
ArrayReverse(mDemandZones);
|
||||||
ArrayReverse(mBearishRejectionBars);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Support Zone(s) ...
|
|
||||||
supportZonesCount = DetectRequiredSupportZones(barIndex);
|
|
||||||
if (supportZonesCount == requiredPOIs)
|
|
||||||
{
|
|
||||||
ArrayReverse(mSupportZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Resistance Zone(s) ...
|
|
||||||
resistanceZonesCount = DetectRequiredResistanceZones(barIndex);
|
|
||||||
if (resistanceZonesCount == requiredPOIs)
|
|
||||||
{
|
|
||||||
ArrayReverse(mResistanceZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
supplyZonesCount = DetectRequiredSupplyZones(barIndex);
|
|
||||||
if (supplyZonesCount == requiredPOIs)
|
|
||||||
{
|
|
||||||
ArrayReverse(mSupplyZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
demandZonesCount = DetectRequiredDemandZones(barIndex);
|
|
||||||
if (demandZonesCount == requiredPOIs)
|
|
||||||
{
|
|
||||||
ArrayReverse(mDemandZones);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1477,76 +1511,113 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swings ...
|
||||||
|
bool canContinueSwingHighs =
|
||||||
|
swingRange > 0
|
||||||
|
? swingHighsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueSwingLows =
|
||||||
|
swingRange > 0
|
||||||
|
? swingLowsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support and Resistance Zones ...
|
||||||
|
bool canContinueSupportZones =
|
||||||
|
supResRange > 0
|
||||||
|
? supportZonesCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueResistanceZones =
|
||||||
|
supResRange > 0
|
||||||
|
? resistanceZonesCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply and Demand Zones ...
|
||||||
|
bool canContinueSupplyZones =
|
||||||
|
supDemRange > 0
|
||||||
|
? supplyZonesCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueDemandZones =
|
||||||
|
supDemRange > 0
|
||||||
|
? demandZonesCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Blocks ...
|
||||||
|
bool canContinueBullishOrderBlocks =
|
||||||
|
obSameBars > 0
|
||||||
|
? bullishOrderBlocksCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueBearishOrderBlocks =
|
||||||
|
obSameBars > 0
|
||||||
|
? bearishOrderBlocksCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gaps ...
|
||||||
|
bool canContinueBullishFairValueGaps =
|
||||||
|
fvgSameBars > 0
|
||||||
|
? bullishFairValueGapsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueBearishFairValueGaps =
|
||||||
|
fvgSameBars > 0
|
||||||
|
? bearishFairValueGapsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rejection Bars ...
|
||||||
|
bool canContinueBullishRejectionBars =
|
||||||
|
canLookupRejectionBars
|
||||||
|
? bullishRejectionBarsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueBearishRejectionBars =
|
||||||
|
canLookupRejectionBars
|
||||||
|
? bearishRejectionBarsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum Bars ...
|
||||||
|
bool canContinueBullishMomentumBars =
|
||||||
|
canLookupMomentumBars
|
||||||
|
? bullishMomentumBarsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
bool canContinueBearishMomentumBars =
|
||||||
|
canLookupMomentumBars
|
||||||
|
? bearishMomentumBarsCount < requiredPOIs
|
||||||
|
: false;
|
||||||
|
|
||||||
//
|
//
|
||||||
canContinue =
|
canContinue =
|
||||||
//
|
//
|
||||||
// Swing Highs ...
|
// Swings ...
|
||||||
swingHighsCount < requiredPOIs
|
canContinueSwingHighs ||
|
||||||
|
canContinueSwingLows ||
|
||||||
//
|
//
|
||||||
||
|
// Support and Resistance Zones ...
|
||||||
|
canContinueSupportZones ||
|
||||||
|
canContinueResistanceZones ||
|
||||||
//
|
//
|
||||||
// Swing Lows ...
|
// Supply and Demand Zones ...
|
||||||
swingLowsCount < requiredPOIs
|
canContinueSupplyZones ||
|
||||||
|
canContinueDemandZones ||
|
||||||
//
|
//
|
||||||
||
|
// Order Blocks ...
|
||||||
|
canContinueBullishOrderBlocks ||
|
||||||
|
canContinueBearishOrderBlocks ||
|
||||||
//
|
//
|
||||||
// Bullish Momentum Bars ...
|
// Fair Value Gaps ...
|
||||||
bullishMomentumBarsCount < requiredPOIs
|
canContinueBullishFairValueGaps ||
|
||||||
|
canContinueBearishFairValueGaps ||
|
||||||
//
|
//
|
||||||
||
|
// Rejection Bars ...
|
||||||
|
canContinueBullishRejectionBars ||
|
||||||
|
canContinueBearishRejectionBars ||
|
||||||
//
|
//
|
||||||
// Bearish Momentum Bars ...
|
// Momentum Bars ...
|
||||||
bearishMomentumBarsCount < requiredPOIs
|
canContinueBullishMomentumBars ||
|
||||||
//
|
canContinueBearishMomentumBars
|
||||||
||
|
|
||||||
//
|
|
||||||
// Bullish Rejection Bars ...
|
|
||||||
bullishRejectionBarsCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Bearish Rejection Bars ...
|
|
||||||
bearishRejectionBarsCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Support Zones ...
|
|
||||||
supportZonesCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Resistance Zones ...
|
|
||||||
resistanceZonesCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Supply Zones ...
|
|
||||||
supplyZonesCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Demand Zones ...
|
|
||||||
demandZonesCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Bullish Order Blocks ...
|
|
||||||
bullishOrderBlocksCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Bearish Order Blocks ...
|
|
||||||
bearishOrderBlocksCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Bullish Fair Value Gaps ...
|
|
||||||
bullishFairValueGapsCount < requiredPOIs
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// Bearish Fair Value Gaps ...
|
|
||||||
bearishFairValueGapsCount < requiredPOIs
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (canContinue)
|
if (canContinue)
|
||||||
@@ -2158,7 +2229,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
swing,
|
swing,
|
||||||
mSwingHighs //
|
mSwingLows //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
// //
|
||||||
@@ -2240,7 +2311,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
DetectSwingLow(bar);
|
DetectSwingLow(bar);
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(mSwingHighs);
|
result = ArraySize(mSwingLows);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1511,7 +1511,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
*/
|
*/
|
||||||
bool CreateBullishMomentumBar(
|
bool CreateBullishMomentumBar(
|
||||||
XCMomentumBar &momentumBar,
|
XCMomentumBar &momentumBar,
|
||||||
XCBullishMomentumObject *&object //
|
XCBullishMomentumBarObject *&object //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1540,7 +1540,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
color crl = BullishMomentumBarColor();
|
color crl = BullishMomentumBarColor();
|
||||||
|
|
||||||
//
|
//
|
||||||
object = new XCBullishMomentumObject();
|
object = new XCBullishMomentumBarObject();
|
||||||
result = object.Create(
|
result = object.Create(
|
||||||
chartID,
|
chartID,
|
||||||
window,
|
window,
|
||||||
@@ -1574,7 +1574,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
*/
|
*/
|
||||||
bool CreateBearishMomentumBar(
|
bool CreateBearishMomentumBar(
|
||||||
XCMomentumBar &momentumBar,
|
XCMomentumBar &momentumBar,
|
||||||
XCBearishMomentumObject *&object //
|
XCBearishMomentumBarObject *&object //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1603,7 +1603,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
color crl = BearishMomentumBarColor();
|
color crl = BearishMomentumBarColor();
|
||||||
|
|
||||||
//
|
//
|
||||||
object = new XCBearishMomentumObject();
|
object = new XCBearishMomentumBarObject();
|
||||||
result = object.Create(
|
result = object.Create(
|
||||||
chartID,
|
chartID,
|
||||||
window,
|
window,
|
||||||
@@ -1640,7 +1640,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
*/
|
*/
|
||||||
bool CreateBullishRejectionBar(
|
bool CreateBullishRejectionBar(
|
||||||
XCRejectionBar &rejectionBar,
|
XCRejectionBar &rejectionBar,
|
||||||
XCBullishRejectionObject *&object //
|
XCBullishRejectionBarObject *&object //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1669,7 +1669,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
color crl = BullishRejectionBarColor();
|
color crl = BullishRejectionBarColor();
|
||||||
|
|
||||||
//
|
//
|
||||||
object = new XCBullishRejectionObject();
|
object = new XCBullishRejectionBarObject();
|
||||||
result = object.Create(
|
result = object.Create(
|
||||||
chartID,
|
chartID,
|
||||||
window,
|
window,
|
||||||
@@ -1703,7 +1703,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
*/
|
*/
|
||||||
bool CreateBearishRejectionBar(
|
bool CreateBearishRejectionBar(
|
||||||
XCRejectionBar &rejectionBar,
|
XCRejectionBar &rejectionBar,
|
||||||
XCBearishRejectionObject *&object //
|
XCBearishRejectionBarObject *&object //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1732,7 +1732,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
color crl = BearishRejectionBarColor();
|
color crl = BearishRejectionBarColor();
|
||||||
|
|
||||||
//
|
//
|
||||||
object = new XCBearishRejectionObject();
|
object = new XCBearishRejectionBarObject();
|
||||||
result = object.Create(
|
result = object.Create(
|
||||||
chartID,
|
chartID,
|
||||||
window,
|
window,
|
||||||
|
|||||||
@@ -972,6 +972,452 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
mDrawnObjects.Add(iObj);
|
mDrawnObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw Specified State on Chart ...
|
||||||
|
*
|
||||||
|
* @param state: XPOIState instance ...
|
||||||
|
*/
|
||||||
|
void DrawState(
|
||||||
|
XPOIState &state,
|
||||||
|
bool drawSwingHighs = true,
|
||||||
|
bool drawSwingLows = true,
|
||||||
|
bool drawSupportZones = true,
|
||||||
|
bool drawResistanceZones = true,
|
||||||
|
bool drawSupplyZones = true,
|
||||||
|
bool drawDemandZones = true,
|
||||||
|
bool drawBullishOrderBlocks = true,
|
||||||
|
bool drawBearishOrderBlocks = true,
|
||||||
|
bool drawBullishFairValueGaps = true,
|
||||||
|
bool drawBearishFairValueGaps = true,
|
||||||
|
bool drawBullishRejectionBars = true,
|
||||||
|
bool drawBearishRejectionBars = true,
|
||||||
|
bool drawBullishMomentumBars = true,
|
||||||
|
bool drawBearishMomentumBars = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swings ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Highs ...
|
||||||
|
if (drawSwingHighs)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.swingHighs);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing item = state.swingHighs[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSwingHighObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateSwingHigh(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Lows ...
|
||||||
|
if (drawSwingLows)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.swingLows);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing item = state.swingLows[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSwingLowObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateSwingLow(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support and Resistance Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support Zones ...
|
||||||
|
if (drawSupportZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.supportZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone item = state.supportZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSupportZoneObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateSupportZone(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance Zones ...
|
||||||
|
if (drawResistanceZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.resistanceZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone item = state.resistanceZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCResistanceZoneObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply and Demand Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply Zones ...
|
||||||
|
if (drawSupplyZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.supplyZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupplyZone item = state.supplyZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSupplyZoneObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateSupplyZone(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Demand Zones ...
|
||||||
|
if (drawDemandZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.demandZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCDemandZone item = state.demandZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCDemandZoneObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateDemandZone(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Blocks ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Order Blocks ...
|
||||||
|
if (drawBullishOrderBlocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishOrderBlocks);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock item = state.bullishOrderBlocks[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBullishOrderBlockObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Order Blocks ...
|
||||||
|
if (drawBearishOrderBlocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishOrderBlocks);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock item = state.bearishOrderBlocks[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBearishOrderBlockObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gaps ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Fair Value Gaps ...
|
||||||
|
if (drawBullishFairValueGaps)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishFairValueGaps);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG item = state.bullishFairValueGaps[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBullishFairValueGapObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBullishFairValueGap(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Fair Value Gaps ...
|
||||||
|
if (drawBearishFairValueGaps)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishFairValueGaps);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG item = state.bearishFairValueGaps[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBearishFairValueGapObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBearishFairValueGap(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rejection Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Rejection Bars ...
|
||||||
|
if (drawBullishRejectionBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishRejectionBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar item = state.bullishRejectionBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBullishRejectionBarObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBullishRejectionBar(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Rejection Bars ...
|
||||||
|
if (drawBearishRejectionBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishRejectionBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar item = state.bearishRejectionBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBearishRejectionBarObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBearishRejectionBar(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Momentum Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Momentum Bars ...
|
||||||
|
if (drawBullishMomentumBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bullishMomentumBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar item = state.bullishMomentumBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBullishMomentumBarObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBullishMomentumBar(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Momentum Bars ...
|
||||||
|
if (drawBearishMomentumBars)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(state.bearishMomentumBars);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar item = state.bearishMomentumBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBearishMomentumBarObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateBearishMomentumBar(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ticks Zone ...
|
||||||
|
if (state.ticksZone != NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
@@ -1236,6 +1682,42 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Specified Object to Drawn Objects if not Exists ...
|
||||||
|
*/
|
||||||
|
void AddObjectIfNotExists(XCBaseObject *object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string name = object.ObjName();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canAdd = true;
|
||||||
|
int count = mDrawnObjects.Total();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string iName = ((XCBaseObject *)mDrawnObjects.At(i)).ObjName();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (name == iName)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
canAdd = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (canAdd)
|
||||||
|
{
|
||||||
|
mDrawnObjects.Add(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -835,6 +835,7 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
strategy.R2R(2);
|
strategy.R2R(2);
|
||||||
strategy.AllowLong(AllowLong());
|
strategy.AllowLong(AllowLong());
|
||||||
strategy.AllowShort(AllowShort());
|
strategy.AllowShort(AllowShort());
|
||||||
|
strategy.MaxAllowedSpread(20);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (Disabled())
|
if (Disabled())
|
||||||
|
|||||||
@@ -176,6 +176,12 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Try to Implement SMC Based Conditions ...
|
// Try to Implement SMC Based Conditions ...
|
||||||
|
ENUM_X_DIRECTION dir = X_DIRECTION_NONE;
|
||||||
|
result = DetectConditions(dir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = hasLong ||
|
result = hasLong ||
|
||||||
@@ -307,6 +313,58 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
X3VWAPInputs x3vwapInputs;
|
X3VWAPInputs x3vwapInputs;
|
||||||
XCX3VWAPHelper *x3vwapHelper;
|
XCX3VWAPHelper *x3vwapHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Actions ...
|
||||||
|
|
||||||
|
bool DetectConditions(ENUM_X_DIRECTION &dir)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
mConditions.Clean();
|
||||||
|
mConditions.symbol = GetSymbol();
|
||||||
|
mConditions.period = GetPeriod();
|
||||||
|
mConditions.time = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TODO: Implement ...
|
||||||
|
ENUM_X_DIRECTION marketStructureDir;
|
||||||
|
result = DetectMarketStructure(
|
||||||
|
marketStructureDir,
|
||||||
|
_5MState //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
mConditions.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DetectMarketStructure(
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
XPOIState &state //
|
||||||
|
) {
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
DrawState(state);
|
||||||
|
|
||||||
|
//
|
||||||
|
Print("Salam");
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user