Last Works ...

This commit is contained in:
2024-11-15 15:30:54 +03:30
parent d5ead24335
commit e0b2164515
2 changed files with 247 additions and 39 deletions
@@ -348,18 +348,202 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
return result;
}
/**
* Detect Specified States Market Structure ...
*
* @param dir: ENUM_X_DIRECTION member, Refrence ...
* @param state: XPOIState instance ...
*
* @return ( bool )
*/
bool DetectMarketStructure(
ENUM_X_DIRECTION &dir,
XPOIState &state //
) {
)
{
//
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;