Prepare requirements, add DrwaState in X121SMCBaseStrategy class ...
This commit is contained in:
@@ -442,7 +442,7 @@ class XCSwingLowObject : public XCSwingObject
|
||||
|
||||
//
|
||||
// Momentum ...
|
||||
class XCMomentumObject : public XCBarArrowObject
|
||||
class XCMomentumBarObject : public XCBarArrowObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -523,7 +523,7 @@ class XCMomentumObject : public XCBarArrowObject
|
||||
|
||||
//
|
||||
// Bullish Momentum Bar ...
|
||||
class XCBullishMomentumObject : public XCMomentumObject
|
||||
class XCBullishMomentumBarObject : public XCMomentumBarObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -587,7 +587,7 @@ class XCBullishMomentumObject : public XCMomentumObject
|
||||
|
||||
//
|
||||
// Bearish Momentum Bar ...
|
||||
class XCBearishMomentumObject : public XCMomentumObject
|
||||
class XCBearishMomentumBarObject : public XCMomentumBarObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -651,7 +651,7 @@ class XCBearishMomentumObject : public XCMomentumObject
|
||||
|
||||
//
|
||||
// Rejection ...
|
||||
class XCRejectionObject : public XCBarArrowObject
|
||||
class XCRejectionBarObject : public XCBarArrowObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -732,7 +732,7 @@ class XCRejectionObject : public XCBarArrowObject
|
||||
|
||||
//
|
||||
// Bullish Rejection Bar ...
|
||||
class XCBullishRejectionObject : public XCRejectionObject
|
||||
class XCBullishRejectionBarObject : public XCRejectionBarObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -796,7 +796,7 @@ class XCBullishRejectionObject : public XCRejectionObject
|
||||
|
||||
//
|
||||
// Bearish Rejection Bar ...
|
||||
class XCBearishRejectionObject : public XCRejectionObject
|
||||
class XCBearishRejectionBarObject : public XCRejectionBarObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
|
||||
@@ -1354,6 +1354,11 @@ class XCPOIDetector : public XCBaseAlert
|
||||
|
||||
//
|
||||
while (canContinue)
|
||||
{
|
||||
//
|
||||
// Swings ...
|
||||
int swingRange = SwingRange();
|
||||
if (swingRange > 0)
|
||||
{
|
||||
//
|
||||
// Swing Highs ...
|
||||
@@ -1366,11 +1371,19 @@ class XCPOIDetector : public XCBaseAlert
|
||||
//
|
||||
// Swing Lows ...
|
||||
swingLowsCount = DetectRequiredSwingLows(barIndex);
|
||||
if (swingHighsCount == requiredPOIs)
|
||||
if (swingLowsCount == requiredPOIs)
|
||||
{
|
||||
ArrayReverse(mSwingLows);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool canLookupMomentumBars =
|
||||
MomentumBarExtendRange() >= 0 &&
|
||||
MomentumBarBodyPercent() > 0;
|
||||
if (canLookupMomentumBars)
|
||||
{
|
||||
//
|
||||
//
|
||||
// Bullish Momentum Bars ...
|
||||
bullishMomentumBarsCount = DetectRequiredBullishMomentumBars(barIndex);
|
||||
@@ -1386,7 +1399,15 @@ class XCPOIDetector : public XCBaseAlert
|
||||
{
|
||||
ArrayReverse(mBearishMomentumBars);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool canLookupRejectionBars =
|
||||
RejectionBarExtendRange() >= 0 &&
|
||||
RejectionBarShadowPercent() > 0;
|
||||
if (canLookupRejectionBars)
|
||||
{
|
||||
//
|
||||
//
|
||||
// Bullish Rejection Bars ...
|
||||
bullishRejectionBarsCount = DetectRequiredBullishRejectionBars(barIndex);
|
||||
@@ -1402,7 +1423,13 @@ class XCPOIDetector : public XCBaseAlert
|
||||
{
|
||||
ArrayReverse(mBearishRejectionBars);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Support and Resistance Zones ...
|
||||
int supResRange = SupportAndResistanceRange();
|
||||
if (supResRange > 0)
|
||||
{
|
||||
//
|
||||
// Support Zone(s) ...
|
||||
supportZonesCount = DetectRequiredSupportZones(barIndex);
|
||||
@@ -1418,7 +1445,13 @@ class XCPOIDetector : public XCBaseAlert
|
||||
{
|
||||
ArrayReverse(mResistanceZones);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Supply and Demand Zones ...
|
||||
int supDemRange = SupplyAndDemandRange();
|
||||
if (supDemRange > 0)
|
||||
{
|
||||
//
|
||||
supplyZonesCount = DetectRequiredSupplyZones(barIndex);
|
||||
if (supplyZonesCount == requiredPOIs)
|
||||
@@ -1432,6 +1465,7 @@ class XCPOIDetector : public XCBaseAlert
|
||||
{
|
||||
ArrayReverse(mDemandZones);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Oder Blocks ...
|
||||
@@ -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 =
|
||||
//
|
||||
// Swing Highs ...
|
||||
swingHighsCount < requiredPOIs
|
||||
// Swings ...
|
||||
canContinueSwingHighs ||
|
||||
canContinueSwingLows ||
|
||||
//
|
||||
||
|
||||
// Support and Resistance Zones ...
|
||||
canContinueSupportZones ||
|
||||
canContinueResistanceZones ||
|
||||
//
|
||||
// Swing Lows ...
|
||||
swingLowsCount < requiredPOIs
|
||||
// Supply and Demand Zones ...
|
||||
canContinueSupplyZones ||
|
||||
canContinueDemandZones ||
|
||||
//
|
||||
||
|
||||
// Order Blocks ...
|
||||
canContinueBullishOrderBlocks ||
|
||||
canContinueBearishOrderBlocks ||
|
||||
//
|
||||
// Bullish Momentum Bars ...
|
||||
bullishMomentumBarsCount < requiredPOIs
|
||||
// Fair Value Gaps ...
|
||||
canContinueBullishFairValueGaps ||
|
||||
canContinueBearishFairValueGaps ||
|
||||
//
|
||||
||
|
||||
// Rejection Bars ...
|
||||
canContinueBullishRejectionBars ||
|
||||
canContinueBearishRejectionBars ||
|
||||
//
|
||||
// Bearish Momentum Bars ...
|
||||
bearishMomentumBarsCount < requiredPOIs
|
||||
//
|
||||
||
|
||||
//
|
||||
// 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
|
||||
// Momentum Bars ...
|
||||
canContinueBullishMomentumBars ||
|
||||
canContinueBearishMomentumBars
|
||||
//
|
||||
;
|
||||
if (canContinue)
|
||||
@@ -2158,7 +2229,7 @@ class XCPOIDetector : public XCBaseAlert
|
||||
//
|
||||
Add(
|
||||
swing,
|
||||
mSwingHighs //
|
||||
mSwingLows //
|
||||
);
|
||||
|
||||
// //
|
||||
@@ -2240,7 +2311,7 @@ class XCPOIDetector : public XCBaseAlert
|
||||
DetectSwingLow(bar);
|
||||
|
||||
//
|
||||
result = ArraySize(mSwingHighs);
|
||||
result = ArraySize(mSwingLows);
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
@@ -1511,7 +1511,7 @@ class XCPOIDrawer : public XCBase
|
||||
*/
|
||||
bool CreateBullishMomentumBar(
|
||||
XCMomentumBar &momentumBar,
|
||||
XCBullishMomentumObject *&object //
|
||||
XCBullishMomentumBarObject *&object //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1540,7 +1540,7 @@ class XCPOIDrawer : public XCBase
|
||||
color crl = BullishMomentumBarColor();
|
||||
|
||||
//
|
||||
object = new XCBullishMomentumObject();
|
||||
object = new XCBullishMomentumBarObject();
|
||||
result = object.Create(
|
||||
chartID,
|
||||
window,
|
||||
@@ -1574,7 +1574,7 @@ class XCPOIDrawer : public XCBase
|
||||
*/
|
||||
bool CreateBearishMomentumBar(
|
||||
XCMomentumBar &momentumBar,
|
||||
XCBearishMomentumObject *&object //
|
||||
XCBearishMomentumBarObject *&object //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1603,7 +1603,7 @@ class XCPOIDrawer : public XCBase
|
||||
color crl = BearishMomentumBarColor();
|
||||
|
||||
//
|
||||
object = new XCBearishMomentumObject();
|
||||
object = new XCBearishMomentumBarObject();
|
||||
result = object.Create(
|
||||
chartID,
|
||||
window,
|
||||
@@ -1640,7 +1640,7 @@ class XCPOIDrawer : public XCBase
|
||||
*/
|
||||
bool CreateBullishRejectionBar(
|
||||
XCRejectionBar &rejectionBar,
|
||||
XCBullishRejectionObject *&object //
|
||||
XCBullishRejectionBarObject *&object //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1669,7 +1669,7 @@ class XCPOIDrawer : public XCBase
|
||||
color crl = BullishRejectionBarColor();
|
||||
|
||||
//
|
||||
object = new XCBullishRejectionObject();
|
||||
object = new XCBullishRejectionBarObject();
|
||||
result = object.Create(
|
||||
chartID,
|
||||
window,
|
||||
@@ -1703,7 +1703,7 @@ class XCPOIDrawer : public XCBase
|
||||
*/
|
||||
bool CreateBearishRejectionBar(
|
||||
XCRejectionBar &rejectionBar,
|
||||
XCBearishRejectionObject *&object //
|
||||
XCBearishRejectionBarObject *&object //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1732,7 +1732,7 @@ class XCPOIDrawer : public XCBase
|
||||
color crl = BearishRejectionBarColor();
|
||||
|
||||
//
|
||||
object = new XCBearishRejectionObject();
|
||||
object = new XCBearishRejectionBarObject();
|
||||
result = object.Create(
|
||||
chartID,
|
||||
window,
|
||||
|
||||
@@ -972,6 +972,452 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
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:
|
||||
@@ -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.AllowLong(AllowLong());
|
||||
strategy.AllowShort(AllowShort());
|
||||
strategy.MaxAllowedSpread(20);
|
||||
|
||||
//
|
||||
if (Disabled())
|
||||
|
||||
@@ -176,6 +176,12 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Try to Implement SMC Based Conditions ...
|
||||
ENUM_X_DIRECTION dir = X_DIRECTION_NONE;
|
||||
result = DetectConditions(dir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = hasLong ||
|
||||
@@ -307,6 +313,58 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
X3VWAPInputs x3vwapInputs;
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user