last ...
This commit is contained in:
@@ -621,11 +621,12 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
int end = -1;
|
||||
int start = -1;
|
||||
result = CalculateTicksParams(
|
||||
start,
|
||||
start,
|
||||
end,
|
||||
minRequiredTicksVerification //
|
||||
);
|
||||
if (!result) {
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -726,6 +727,61 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
//
|
||||
// Draw Functions ...
|
||||
|
||||
/**
|
||||
* Draw Specified Signal ...
|
||||
*
|
||||
* @param signal: XSignal instance ...
|
||||
*/
|
||||
void DrawSignal(XSignal &signal)
|
||||
{
|
||||
//
|
||||
if (!signal.IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// DrawConditions(conditions);
|
||||
|
||||
//
|
||||
string name = signal.GetTag();
|
||||
RemoveObject(name);
|
||||
|
||||
//
|
||||
XCSignalObject *iObj;
|
||||
iObj = new XCSignalObject();
|
||||
|
||||
//
|
||||
bool isCreated = iObj.Create(
|
||||
ChartIdentification(),
|
||||
name,
|
||||
SubWindowIdentification(),
|
||||
signal //
|
||||
);
|
||||
if (!isCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
iObj.TPWidth(1);
|
||||
iObj.TPColor(clrGreen);
|
||||
iObj.TPWidth(STYLE_DOT);
|
||||
|
||||
//
|
||||
iObj.SLWidth(1);
|
||||
iObj.SLColor(clrRed);
|
||||
iObj.SLWidth(STYLE_DOT);
|
||||
|
||||
//
|
||||
iObj.EntryWidth(1);
|
||||
iObj.EntryColor(clrYellow);
|
||||
iObj.EntryWidth(STYLE_DOT);
|
||||
|
||||
//
|
||||
mDrawnObjects.Add(iObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all Drawn Objects ...
|
||||
*/
|
||||
@@ -785,562 +841,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw Specified Signal ...
|
||||
*
|
||||
* @param signal: XSignal instance ...
|
||||
*/
|
||||
void DrawSignal(XSignal &signal)
|
||||
{
|
||||
//
|
||||
if (!signal.IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// DrawConditions(conditions);
|
||||
|
||||
//
|
||||
string name = signal.GetTag();
|
||||
RemoveObject(name);
|
||||
|
||||
//
|
||||
XCSignalObject *iObj;
|
||||
iObj = new XCSignalObject();
|
||||
|
||||
//
|
||||
bool isCreated = iObj.Create(
|
||||
ChartIdentification(),
|
||||
name,
|
||||
SubWindowIdentification(),
|
||||
signal //
|
||||
);
|
||||
if (!isCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
iObj.TPWidth(1);
|
||||
iObj.TPColor(clrGreen);
|
||||
iObj.TPWidth(STYLE_DOT);
|
||||
|
||||
//
|
||||
iObj.SLWidth(1);
|
||||
iObj.SLColor(clrRed);
|
||||
iObj.SLWidth(STYLE_DOT);
|
||||
|
||||
//
|
||||
iObj.EntryWidth(1);
|
||||
iObj.EntryColor(clrYellow);
|
||||
iObj.EntryWidth(STYLE_DOT);
|
||||
|
||||
//
|
||||
mDrawnObjects.Add(iObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw Specified State on Chart ...
|
||||
*
|
||||
* @param state: XPOIState instance ...
|
||||
*/
|
||||
void DrawState(
|
||||
XPOIState &state,
|
||||
bool forceUpdateTo = false,
|
||||
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,
|
||||
bool drawTicksZone = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
int count = 0;
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
// 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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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];
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
item.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
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 (drawTicksZone &&
|
||||
state.ticksZone != NULL)
|
||||
{
|
||||
//
|
||||
XCTicksZone *iZone = state.ticksZone;
|
||||
|
||||
//
|
||||
if (forceUpdateTo)
|
||||
{
|
||||
iZone.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
XCTicksZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateTicksZone(
|
||||
iZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Specified Object to Drawn Objects if not Exists ...
|
||||
*/
|
||||
@@ -1377,6 +877,25 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Specified Objects to Drawn Objects if not Exists ...
|
||||
*/
|
||||
void AddObjectsIfNotExists(XCBaseObject *&objects[])
|
||||
{
|
||||
//
|
||||
int count = ArraySize(objects);
|
||||
if (!IsValidSize(count))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
AddObjectIfNotExists(objects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user