Last Works ...
This commit is contained in:
@@ -176,8 +176,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Try to Implement SMC Based Conditions ...
|
||||
ENUM_X_DIRECTION dir = X_DIRECTION_NONE;
|
||||
result = DetectConditions(dir);
|
||||
result = DetectConditions();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -316,7 +315,12 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
bool DetectConditions(ENUM_X_DIRECTION &dir)
|
||||
/**
|
||||
* Detect and Parse Market Conditions ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectConditions()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
@@ -327,9 +331,6 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.period = GetPeriod();
|
||||
mConditions.time = TimeCurrent();
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
// Detect Market Structures ...
|
||||
|
||||
@@ -338,6 +339,8 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.d1State = _1DState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.d1MarketDirection,
|
||||
mConditions.d1SupportZones,
|
||||
mConditions.d1ResistanceZones,
|
||||
_1DState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -346,14 +349,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is1DBullish = IsBullish(mConditions.d1MarketDirection);
|
||||
bool is1DBearish = IsBearish(mConditions.d1MarketDirection);
|
||||
|
||||
//
|
||||
// 4H ...
|
||||
mConditions.h4State = _4HState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.h4MarketDirection,
|
||||
mConditions.h4SupportZones,
|
||||
mConditions.h4ResistanceZones,
|
||||
_4HState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -362,14 +365,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is4HBullish = IsBullish(mConditions.h4MarketDirection);
|
||||
bool is4HBearish = IsBearish(mConditions.h4MarketDirection);
|
||||
|
||||
//
|
||||
// 2H ...
|
||||
mConditions.h2State = _2HState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.h2MarketDirection,
|
||||
mConditions.h2SupportZones,
|
||||
mConditions.h2ResistanceZones,
|
||||
_2HState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -378,14 +381,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is2HBullish = IsBullish(mConditions.h2MarketDirection);
|
||||
bool is2HBearish = IsBearish(mConditions.h2MarketDirection);
|
||||
|
||||
//
|
||||
// 1H ...
|
||||
mConditions.h1State = _1HState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.h1MarketDirection,
|
||||
mConditions.h1SupportZones,
|
||||
mConditions.h1ResistanceZones,
|
||||
_1HState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -394,14 +397,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is1HBullish = IsBullish(mConditions.h1MarketDirection);
|
||||
bool is1HBearish = IsBearish(mConditions.h1MarketDirection);
|
||||
|
||||
//
|
||||
// 15M ...
|
||||
mConditions.m15State = _15MState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.m15MarketDirection,
|
||||
mConditions.m15SupportZones,
|
||||
mConditions.m15ResistanceZones,
|
||||
_15MState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -410,14 +413,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is15MBullish = IsBullish(mConditions.m15MarketDirection);
|
||||
bool is15MBearish = IsBearish(mConditions.m15MarketDirection);
|
||||
|
||||
//
|
||||
// 5M ...
|
||||
mConditions.m5State = _5MState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.m5MarketDirection,
|
||||
mConditions.m5SupportZones,
|
||||
mConditions.m5ResistanceZones,
|
||||
_5MState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -426,14 +429,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is5MBullish = IsBullish(mConditions.m5MarketDirection);
|
||||
bool is5MBearish = IsBearish(mConditions.m5MarketDirection);
|
||||
|
||||
//
|
||||
// 1M ...
|
||||
mConditions.m1State = _1MState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.m1MarketDirection,
|
||||
mConditions.m1SupportZones,
|
||||
mConditions.m1ResistanceZones,
|
||||
_1MState //
|
||||
);
|
||||
if (!result)
|
||||
@@ -442,10 +445,9 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
bool is1MBullish = IsBullish(mConditions.m1MarketDirection);
|
||||
bool is1MBearish = IsBearish(mConditions.m1MarketDirection);
|
||||
|
||||
//
|
||||
// 1H-15M-5M ...
|
||||
ENUM_X_DIRECTION marketStructure = X_DIRECTION_NONE;
|
||||
result = mConditions.HasMarketStructure(marketStructure);
|
||||
if (!result)
|
||||
@@ -456,7 +458,339 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
}
|
||||
|
||||
//
|
||||
DrawState(_5MState);
|
||||
// Detect Swing High and Swing Low ...
|
||||
// 1H-15M-5M ...
|
||||
int count = 0;
|
||||
|
||||
//
|
||||
// 1H ...
|
||||
|
||||
//
|
||||
XCSwing *h1SwingLows[];
|
||||
XCSwing *h1SwingHighs[];
|
||||
XCSupportZone *h1SupportZone = NULL;
|
||||
XCResistanceZone *h1ResistanceZone = NULL;
|
||||
|
||||
//
|
||||
count = ArraySize(mConditions.h1SupportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *item = mConditions.h1SupportZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
h1SupportZone == NULL ||
|
||||
h1SupportZone.Lower() < item.Lower();
|
||||
if (canSelect)
|
||||
{
|
||||
h1SupportZone = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (h1SupportZone != NULL)
|
||||
{
|
||||
//
|
||||
// Detect Swings ...
|
||||
count = ArraySize(mConditions.h1State.swingLows);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
double upper = h1SupportZone.Upper();
|
||||
double lower = h1SupportZone.Lower();
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *item = mConditions.h1State.swingLows[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = item.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool canSelect = (iBar.high <= upper &&
|
||||
iBar.low >= lower) ||
|
||||
(iBar.high >= upper &&
|
||||
iBar.low <= lower);
|
||||
if (canSelect)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
item,
|
||||
h1SwingLows //
|
||||
);
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
XCSwingLowObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSwingLow(
|
||||
item,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSupportZone(
|
||||
h1SupportZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
count = ArraySize(mConditions.h1ResistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *item = mConditions.h1ResistanceZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
h1ResistanceZone == NULL ||
|
||||
h1ResistanceZone.Upper() > item.Upper();
|
||||
if (canSelect)
|
||||
{
|
||||
h1ResistanceZone = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (h1ResistanceZone != NULL)
|
||||
{
|
||||
//
|
||||
// Detect Swings ...
|
||||
count = ArraySize(mConditions.h1State.swingHighs);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
double upper = h1ResistanceZone.Upper();
|
||||
double lower = h1ResistanceZone.Lower();
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *item = mConditions.h1State.swingHighs[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isFilled = item.FillBar(iBar);
|
||||
if (!isFilled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool canSelect = (iBar.high <= upper &&
|
||||
iBar.low >= lower) ||
|
||||
(iBar.high >= upper &&
|
||||
iBar.low <= lower);
|
||||
if (canSelect)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
item,
|
||||
h1SwingHighs //
|
||||
);
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
XCSwingHighObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSwingHigh(
|
||||
item,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw ...
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
||||
h1ResistanceZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 15M ...
|
||||
|
||||
//
|
||||
XCSupportZone *m15SupportZone = NULL;
|
||||
count = ArraySize(mConditions.m15SupportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *item = mConditions.m15SupportZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
m15SupportZone == NULL ||
|
||||
m15SupportZone.Lower() < item.Lower();
|
||||
if (canSelect)
|
||||
{
|
||||
m15SupportZone = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m15SupportZone != NULL)
|
||||
{
|
||||
//
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSupportZone(
|
||||
m15SupportZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
XCResistanceZone *m15ResistanceZone = NULL;
|
||||
count = ArraySize(mConditions.m15ResistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *item = mConditions.m15ResistanceZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
m15ResistanceZone == NULL ||
|
||||
m15ResistanceZone.Upper() > item.Upper();
|
||||
if (canSelect)
|
||||
{
|
||||
m15ResistanceZone = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m15ResistanceZone != NULL)
|
||||
{
|
||||
//
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
||||
m15ResistanceZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 5M ...
|
||||
|
||||
//
|
||||
XCSupportZone *m5SupportZone = NULL;
|
||||
count = ArraySize(mConditions.m5SupportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *item = mConditions.m5SupportZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
m5SupportZone == NULL ||
|
||||
m5SupportZone.Lower() < item.Lower();
|
||||
if (canSelect)
|
||||
{
|
||||
m5SupportZone = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m5SupportZone != NULL)
|
||||
{
|
||||
//
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSupportZone(
|
||||
m5SupportZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
XCResistanceZone *m5ResistanceZone = NULL;
|
||||
count = ArraySize(mConditions.m5ResistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *item = mConditions.m5ResistanceZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
m5ResistanceZone == NULL ||
|
||||
m5ResistanceZone.Upper() > item.Upper();
|
||||
if (canSelect)
|
||||
{
|
||||
m5ResistanceZone = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m5ResistanceZone != NULL)
|
||||
{
|
||||
//
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
||||
m5ResistanceZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// DrawState(_5MState);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -472,6 +806,8 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
*/
|
||||
bool DetectMarketStructure(
|
||||
ENUM_X_DIRECTION &dir,
|
||||
XCSupportZone *&supportZones[],
|
||||
XCResistanceZone *&resistanceZones[],
|
||||
XPOIState &state //
|
||||
)
|
||||
{
|
||||
@@ -483,8 +819,8 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Filter Untouched Supports ...
|
||||
Clean(supportZones);
|
||||
int untouchedSupportsCount = 0;
|
||||
XCSupportZone *untouchedSupportZones[];
|
||||
count = ArraySize(state.supportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
@@ -539,13 +875,13 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
Add(
|
||||
item,
|
||||
untouchedSupportZones //
|
||||
supportZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
untouchedSupportsCount = ArraySize(untouchedSupportZones);
|
||||
untouchedSupportsCount = ArraySize(supportZones);
|
||||
if (IsValidSize(untouchedSupportsCount))
|
||||
{
|
||||
//
|
||||
@@ -553,7 +889,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
// for (int i = 0; i < untouchedSupportsCount; i++)
|
||||
// {
|
||||
// //
|
||||
// XCSupportZone *item = untouchedSupportZones[i];
|
||||
// XCSupportZone *item = supportZones[i];
|
||||
|
||||
// //
|
||||
// XCSupportZoneObject *iObj;
|
||||
@@ -571,8 +907,8 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Filter Untouched Resistances ...
|
||||
Clean(resistanceZones);
|
||||
int untouchedResistancesCount = 0;
|
||||
XCResistanceZone *untouchedResistanceZones[];
|
||||
count = ArraySize(state.resistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
@@ -627,13 +963,13 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
Add(
|
||||
item,
|
||||
untouchedResistanceZones //
|
||||
resistanceZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
untouchedResistancesCount = ArraySize(untouchedResistanceZones);
|
||||
untouchedResistancesCount = ArraySize(resistanceZones);
|
||||
if (IsValidSize(untouchedResistancesCount))
|
||||
{
|
||||
//
|
||||
@@ -641,7 +977,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
// for (int i = 0; i < untouchedResistancesCount; i++)
|
||||
// {
|
||||
// //
|
||||
// XCResistanceZone *item = untouchedResistanceZones[i];
|
||||
// XCResistanceZone *item = resistanceZones[i];
|
||||
|
||||
// //
|
||||
// XCResistanceZoneObject *iObj;
|
||||
|
||||
Reference in New Issue
Block a user