Last Works ...
This commit is contained in:
@@ -1418,6 +1418,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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
@@ -1491,6 +1527,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Initialize POIs ...
|
// Initialize POIs ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int poiRequired = 10;
|
||||||
|
|
||||||
//
|
//
|
||||||
// 1D Period ...
|
// 1D Period ...
|
||||||
// POI Detector ...
|
// POI Detector ...
|
||||||
@@ -1499,6 +1538,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_D1 //
|
PERIOD_D1 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m1DPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m1DPOI.Init();
|
m1DPOI.Init();
|
||||||
|
|
||||||
@@ -1510,6 +1552,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_H4 //
|
PERIOD_H4 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m4HPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m4HPOI.Init();
|
m4HPOI.Init();
|
||||||
|
|
||||||
@@ -1521,6 +1566,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_H2 //
|
PERIOD_H2 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m2HPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m2HPOI.Init();
|
m2HPOI.Init();
|
||||||
|
|
||||||
@@ -1532,6 +1580,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_H1 //
|
PERIOD_H1 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m1HPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m1HPOI.Init();
|
m1HPOI.Init();
|
||||||
|
|
||||||
@@ -1543,6 +1594,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_M15 //
|
PERIOD_M15 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m15MPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m15MPOI.Init();
|
m15MPOI.Init();
|
||||||
|
|
||||||
@@ -1554,6 +1608,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_M5 //
|
PERIOD_M5 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m5MPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m5MPOI.Init();
|
m5MPOI.Init();
|
||||||
|
|
||||||
@@ -1565,6 +1622,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
PERIOD_M1 //
|
PERIOD_M1 //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
m1MPOI.MaxNumberOfRequiredPOIs(poiRequired);
|
||||||
|
|
||||||
//
|
//
|
||||||
m1MPOI.Init();
|
m1MPOI.Init();
|
||||||
|
|
||||||
@@ -1682,42 +1742,6 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -348,18 +348,202 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Specified States Market Structure ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION member, Refrence ...
|
||||||
|
* @param state: XPOIState instance ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
bool DetectMarketStructure(
|
bool DetectMarketStructure(
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
XPOIState &state //
|
XPOIState &state //
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
DrawState(state);
|
// DrawState(state);
|
||||||
|
|
||||||
//
|
//
|
||||||
Print("Salam");
|
// Print("Salam");
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filter Untouched Supports ...
|
||||||
|
XCSupportZone *untouchedSupportZones[];
|
||||||
|
count = ArraySize(state.supportZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone *item = state.supportZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Breakout Bar
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = item.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
int iBarUnTouchedCount = 0;
|
||||||
|
for (int j = 0; j < iBarIndex; j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL jBar;
|
||||||
|
bool isInited = jBar.Init(
|
||||||
|
iBar.symbol,
|
||||||
|
iBar.period,
|
||||||
|
j //
|
||||||
|
);
|
||||||
|
if (!isInited)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isUntouched =
|
||||||
|
jBar.low > item.Upper();
|
||||||
|
if (isUntouched)
|
||||||
|
{
|
||||||
|
iBarUnTouchedCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iBarUnTouchedCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (iBarUnTouchedCount > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
item,
|
||||||
|
untouchedSupportZones //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int untouchedSupportsCount = ArraySize(untouchedSupportZones);
|
||||||
|
if (IsValidSize(untouchedSupportsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < untouchedSupportsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone *item = untouchedSupportZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSupportZoneObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateSupportZone(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filter Untouched Resistances ...
|
||||||
|
XCResistanceZone *untouchedResistanceZones[];
|
||||||
|
count = ArraySize(state.resistanceZones);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone *item = state.resistanceZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Breakout Bar
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = item.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
int iBarUnTouchedCount = 0;
|
||||||
|
for (int j = 0; j < iBarIndex; j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL jBar;
|
||||||
|
bool isInited = jBar.Init(
|
||||||
|
iBar.symbol,
|
||||||
|
iBar.period,
|
||||||
|
j //
|
||||||
|
);
|
||||||
|
if (!isInited)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isUntouched =
|
||||||
|
jBar.high < item.Lower();
|
||||||
|
if (isUntouched)
|
||||||
|
{
|
||||||
|
iBarUnTouchedCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iBarUnTouchedCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (iBarUnTouchedCount > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
item,
|
||||||
|
untouchedResistanceZones //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int untouchedResistancesCount = ArraySize(untouchedResistanceZones);
|
||||||
|
if (IsValidSize(untouchedResistancesCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < untouchedResistancesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone *item = untouchedResistanceZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCResistanceZoneObject *iObj;
|
||||||
|
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
||||||
|
item,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user