last ...
This commit is contained in:
@@ -4630,223 +4630,6 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
int DrawOBFVG(
|
|
||||||
//
|
|
||||||
XOBFVG &item,
|
|
||||||
XCBaseObject *&objects[],
|
|
||||||
//
|
|
||||||
bool drawOrderBlock = true,
|
|
||||||
bool drawFairValueGaps = true,
|
|
||||||
bool drawAllFVGs = true,
|
|
||||||
//
|
|
||||||
bool drawOBStartedBar = true,
|
|
||||||
bool drawOBActivatedBar = true,
|
|
||||||
bool drawOBBreakedBar = true,
|
|
||||||
bool drawOBWorkedBar = true,
|
|
||||||
//
|
|
||||||
bool drawFVGStartedBar = true,
|
|
||||||
bool drawFVGActivatedBar = true,
|
|
||||||
bool drawFVGBreakedBar = true,
|
|
||||||
bool drawFVGWorkedBar = true,
|
|
||||||
//
|
|
||||||
// Order Block Specs ...
|
|
||||||
//
|
|
||||||
int widthOBStartedBar = 1,
|
|
||||||
color clrOBStartedBar = clrYellow,
|
|
||||||
ENUM_LINE_STYLE styleOBStartedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
int widthOBActivatedBar = 1,
|
|
||||||
color clrOBActivatedBar = clrLime,
|
|
||||||
ENUM_LINE_STYLE styleOBActivatedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
int widthOBBreakedBar = 1,
|
|
||||||
color clrOBBreakedBar = clrRed,
|
|
||||||
ENUM_LINE_STYLE styleOBBreakedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
int widthOBWorkedBar = 1,
|
|
||||||
color clrOBWorkedBar = clrAqua,
|
|
||||||
ENUM_LINE_STYLE styleOBWorkedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
// Fair Value Gap Specs ...
|
|
||||||
//
|
|
||||||
int widthFVGStartedBar = 1,
|
|
||||||
color clrFVGStartedBar = clrYellow,
|
|
||||||
ENUM_LINE_STYLE styleFVGStartedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
int widthFVGActivatedBar = 1,
|
|
||||||
color clrFVGActivatedBar = clrLime,
|
|
||||||
ENUM_LINE_STYLE styleFVGActivatedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
int widthFVGBreakedBar = 1,
|
|
||||||
color clrFVGBreakedBar = clrRed,
|
|
||||||
ENUM_LINE_STYLE styleFVGBreakedBar = STYLE_SOLID,
|
|
||||||
//
|
|
||||||
int widthFVGWorkedBar = 1,
|
|
||||||
color clrFVGWorkedBar = clrAqua,
|
|
||||||
ENUM_LINE_STYLE styleFVGWorkedBar = STYLE_SOLID
|
|
||||||
//
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(objects);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isValid = item.IsValid();
|
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = 0;
|
|
||||||
bool has = false;
|
|
||||||
bool isCreated = false;
|
|
||||||
XCBaseObject *tmpObjects[];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Order Block ...
|
|
||||||
has = item.HasOB();
|
|
||||||
if (has &&
|
|
||||||
drawOrderBlock)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(tmpObjects);
|
|
||||||
count = DrawOrderBlock(
|
|
||||||
item.ob,
|
|
||||||
tmpObjects,
|
|
||||||
drawOBStartedBar,
|
|
||||||
drawOBActivatedBar,
|
|
||||||
drawOBBreakedBar,
|
|
||||||
drawOBWorkedBar,
|
|
||||||
widthOBStartedBar,
|
|
||||||
clrOBStartedBar,
|
|
||||||
styleOBStartedBar,
|
|
||||||
widthOBActivatedBar,
|
|
||||||
clrOBActivatedBar,
|
|
||||||
styleOBActivatedBar,
|
|
||||||
widthOBBreakedBar,
|
|
||||||
clrOBBreakedBar,
|
|
||||||
styleOBBreakedBar,
|
|
||||||
widthOBWorkedBar,
|
|
||||||
clrOBWorkedBar,
|
|
||||||
styleOBWorkedBar //
|
|
||||||
);
|
|
||||||
has = IsValidSize(count);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
tmpObjects,
|
|
||||||
objects,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fair Value Gap ...
|
|
||||||
if (!drawAllFVGs)
|
|
||||||
{
|
|
||||||
XCFVG *fvg;
|
|
||||||
has = item.GetMainFVG(fvg);
|
|
||||||
if (has &&
|
|
||||||
drawFairValueGaps)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(tmpObjects);
|
|
||||||
int fvgsCount = DrawFairValueGap(
|
|
||||||
fvg,
|
|
||||||
tmpObjects,
|
|
||||||
drawFVGStartedBar,
|
|
||||||
drawFVGActivatedBar,
|
|
||||||
drawFVGBreakedBar,
|
|
||||||
drawFVGWorkedBar,
|
|
||||||
widthFVGStartedBar,
|
|
||||||
clrFVGStartedBar,
|
|
||||||
styleFVGStartedBar,
|
|
||||||
widthFVGActivatedBar,
|
|
||||||
clrFVGActivatedBar,
|
|
||||||
styleFVGActivatedBar,
|
|
||||||
widthFVGBreakedBar,
|
|
||||||
clrFVGBreakedBar,
|
|
||||||
styleFVGBreakedBar,
|
|
||||||
widthFVGWorkedBar,
|
|
||||||
clrFVGWorkedBar,
|
|
||||||
styleFVGWorkedBar //
|
|
||||||
);
|
|
||||||
has = IsValidSize(fvgsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
tmpObjects,
|
|
||||||
objects,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
has = item.HasFVGs();
|
|
||||||
if (has &&
|
|
||||||
drawFairValueGaps)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
count = item.CountFVGs();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(tmpObjects);
|
|
||||||
int fvgsCount = DrawFairValueGap(
|
|
||||||
item.fvgs[i],
|
|
||||||
tmpObjects,
|
|
||||||
drawFVGStartedBar,
|
|
||||||
drawFVGActivatedBar,
|
|
||||||
drawFVGBreakedBar,
|
|
||||||
drawFVGWorkedBar,
|
|
||||||
widthFVGStartedBar,
|
|
||||||
clrFVGStartedBar,
|
|
||||||
styleFVGStartedBar,
|
|
||||||
widthFVGActivatedBar,
|
|
||||||
clrFVGActivatedBar,
|
|
||||||
styleFVGActivatedBar,
|
|
||||||
widthFVGBreakedBar,
|
|
||||||
clrFVGBreakedBar,
|
|
||||||
styleFVGBreakedBar,
|
|
||||||
widthFVGWorkedBar,
|
|
||||||
clrFVGWorkedBar,
|
|
||||||
styleFVGWorkedBar //
|
|
||||||
);
|
|
||||||
has = IsValidSize(fvgsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
tmpObjects,
|
|
||||||
objects,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(tmpObjects);
|
|
||||||
|
|
||||||
//
|
|
||||||
result = ArraySize(objects);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
protected:
|
protected:
|
||||||
//
|
//
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4134,5 +4134,416 @@ struct X121SMCStrategyConditionParser
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XHKMA ...
|
||||||
|
bool HasSenario4Conditions(
|
||||||
|
ENUM_X_CYCLES cycle,
|
||||||
|
ENUM_X_DIRECTION trend,
|
||||||
|
XBoxZone &box,
|
||||||
|
XBoxZone &holderBox,
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
XSignalBox &waitingBoxes[],
|
||||||
|
X121SMCStrategySignalProviderData &provider,
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
int count = 0;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize Args ...
|
||||||
|
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
holderBox.Clean();
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Trend Exists ...
|
||||||
|
result = HasDirection(trend);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extrand Trend Direction ...
|
||||||
|
bool hasBullishTrend = IsBullish(trend);
|
||||||
|
bool hasBearishTrend = IsBearish(trend);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Waiting Baoxes Exists ...
|
||||||
|
result = HasChild(waitingBoxes);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Current Waiting Box is Directional To Trend ...
|
||||||
|
XSignalBox iSignalBox;
|
||||||
|
idx = GetYoungest(waitingBoxes);
|
||||||
|
result = IsValidIndex(idx);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSignalBox.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
iSignalBox = waitingBoxes[idx];
|
||||||
|
result = iSignalBox.IsValid() &&
|
||||||
|
iSignalBox.ob.dir == trend;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSignalBox.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBullishSignalBox = iSignalBox.IsValid() &&
|
||||||
|
iSignalBox.ob.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBearishSignalBox = iSignalBox.IsValid() &&
|
||||||
|
iSignalBox.ob.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fil Selected Data ...
|
||||||
|
XPOIState cState;
|
||||||
|
X121Conditions cXConditions;
|
||||||
|
XPOIStateEvents cStateEvents;
|
||||||
|
XC121SMCCycleHelper *cHelper;
|
||||||
|
X121SMCCycleConditions cConditions;
|
||||||
|
result = provider.SelectCycle(
|
||||||
|
cycle,
|
||||||
|
cState,
|
||||||
|
cStateEvents,
|
||||||
|
cXConditions,
|
||||||
|
cHelper,
|
||||||
|
cConditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Parse(cXConditions);
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIDX = barIndex;
|
||||||
|
int cIDX = zIDX + 1;
|
||||||
|
int pIDX = cIDX + 1;
|
||||||
|
int ppIDX = pIDX + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
XOHCL cBar;
|
||||||
|
XOHCL pBar;
|
||||||
|
XOHCL pPBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initial Bars ...
|
||||||
|
result = zBar.Init(
|
||||||
|
cState.symbol,
|
||||||
|
cState.period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
zBar.GetPreviousBar(cBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
cBar.GetPreviousBar(pBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
pBar.GetPreviousBar(pPBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
pPBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION iBarPosDir;
|
||||||
|
bool isBarValidForDir = cHelper
|
||||||
|
.mBarAnalyser
|
||||||
|
.IsValidForPosition(
|
||||||
|
cBar,
|
||||||
|
iBarPosDir //
|
||||||
|
);
|
||||||
|
bool isBarValidForBullish =
|
||||||
|
isBarValidForDir &&
|
||||||
|
IsBullish(iBarPosDir);
|
||||||
|
bool isBarValidForBearish =
|
||||||
|
isBarValidForDir &&
|
||||||
|
IsBearish(iBarPosDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Bar Validation for Trend Based Directions ...
|
||||||
|
result =
|
||||||
|
isBarValidForDir &&
|
||||||
|
iBarPosDir == trend &&
|
||||||
|
HasDirection(iBarPosDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
pPBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
iSignalBox.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Here we Have to Check Other Consitions Based On Current
|
||||||
|
// Stuffs ...
|
||||||
|
XBoxZone zoneBox;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Boxes for Zones ...
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
if (hasBullishTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone tmp[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Blocks ...
|
||||||
|
// ToBox(
|
||||||
|
// cState.bullishOrderBlocks,
|
||||||
|
// tmp //
|
||||||
|
// );
|
||||||
|
// Copy(
|
||||||
|
// tmp,
|
||||||
|
// tmpBoxes //
|
||||||
|
// );
|
||||||
|
// Clean(tmp);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gaps ...
|
||||||
|
ToBox(
|
||||||
|
cState.bullishFairValueGaps,
|
||||||
|
tmp //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmp,
|
||||||
|
tmpBoxes,
|
||||||
|
false // Ignore Clean ...
|
||||||
|
);
|
||||||
|
Clean(tmp);
|
||||||
|
}
|
||||||
|
else if (hasBearishTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone tmp[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Blocks ...
|
||||||
|
// ToBox(
|
||||||
|
// cState.bearishOrderBlocks,
|
||||||
|
// tmp //
|
||||||
|
// );
|
||||||
|
// Copy(
|
||||||
|
// tmp,
|
||||||
|
// tmpBoxes //
|
||||||
|
// );
|
||||||
|
// Clean(tmp);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gaps ...
|
||||||
|
ToBox(
|
||||||
|
cState.bearishFairValueGaps,
|
||||||
|
tmp //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmp,
|
||||||
|
tmpBoxes,
|
||||||
|
false // Ignore Clean ...
|
||||||
|
);
|
||||||
|
Clean(tmp);
|
||||||
|
}
|
||||||
|
has = HasChild(tmpBoxes);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
while (HasChild(tmpBoxes))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Select Box based on Trend ...
|
||||||
|
idx = hasBullishTrend
|
||||||
|
? GetLowest(tmpBoxes)
|
||||||
|
: hasBearishTrend
|
||||||
|
? GetHighest(tmpBoxes)
|
||||||
|
: -1;
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
tmpBoxes,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Selected Box ...
|
||||||
|
bool isDirPassed = iBox.dir == trend;
|
||||||
|
bool isFromPassed =
|
||||||
|
iSignalBox.fvg.IsValid()
|
||||||
|
? iBox.from > iSignalBox.fvg.from
|
||||||
|
: iBox.from > iSignalBox.ob.from;
|
||||||
|
bool isPriceInsidePassed =
|
||||||
|
hasBullishTrend
|
||||||
|
? cBar.low < iBox.upper &&
|
||||||
|
cBar.low > iBox.lower
|
||||||
|
: hasBearishTrend
|
||||||
|
? cBar.high > iBox.lower &&
|
||||||
|
cBar.high < iBox.upper
|
||||||
|
: false;
|
||||||
|
has = isDirPassed &&
|
||||||
|
isFromPassed &&
|
||||||
|
isPriceInsidePassed;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zoneBox = iBox;
|
||||||
|
iBox.Clean();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBullishZoneBox = zoneBox.IsValid() &&
|
||||||
|
zoneBox.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBearishZoneBox = zoneBox.IsValid() &&
|
||||||
|
zoneBox.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Summarize Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
isBullish =
|
||||||
|
//
|
||||||
|
// Base Bullish Conditions ...
|
||||||
|
hasBullishTrend &&
|
||||||
|
hasBullishZoneBox &&
|
||||||
|
hasBullishSignalBox &&
|
||||||
|
isBarValidForBullish &&
|
||||||
|
//
|
||||||
|
// Other Additional Conditions ...
|
||||||
|
true
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
isBearish =
|
||||||
|
//
|
||||||
|
// Base Bearish Conditions ...
|
||||||
|
hasBearishTrend &&
|
||||||
|
hasBearishZoneBox &&
|
||||||
|
hasBearishSignalBox &&
|
||||||
|
isBarValidForBearish &&
|
||||||
|
//
|
||||||
|
// Other Additional Conditions ...
|
||||||
|
true
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling Requirements ...
|
||||||
|
result =
|
||||||
|
isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
box = zoneBox;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.to = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print("Found ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
pPBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
iSignalBox.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -173,14 +173,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
double targets[];
|
double targets[];
|
||||||
double reward = 0;
|
double reward = 0;
|
||||||
XBoxZone signalBox;
|
XBoxZone signalBox;
|
||||||
|
bool hasTrend = false;
|
||||||
XBoxZone signalHolderBox;
|
XBoxZone signalHolderBox;
|
||||||
bool hasPriority = false;
|
bool hasPriority = false;
|
||||||
double amountPercent = -1;
|
double amountPercent = -1;
|
||||||
bool hasSignalBox = false;
|
bool hasSignalBox = false;
|
||||||
bool hasWaitingBoxes = false;
|
bool hasWaitingBoxes = false;
|
||||||
bool hasRewardAmount = false;
|
bool hasRewardAmount = false;
|
||||||
bool hasWorkingZoneOveralDirection = false;
|
ENUM_X_DIRECTION trend = X_DIRECTION_NONE;
|
||||||
ENUM_X_DIRECTION wzOveralDir = X_DIRECTION_NONE;
|
|
||||||
ENUM_X_DIRECTION signalBoxDir = X_DIRECTION_NONE;
|
ENUM_X_DIRECTION signalBoxDir = X_DIRECTION_NONE;
|
||||||
ENUM_X121SMC_XWZ_PRIORITY priority = X121SMC_XWZ_PRIORITY_NONE;
|
ENUM_X121SMC_XWZ_PRIORITY priority = X121SMC_XWZ_PRIORITY_NONE;
|
||||||
ENUM_X121SMC_XWZ_PROVIDERS signalProvider = X121SMC_XWZ_PROVIDER_NONE;
|
ENUM_X121SMC_XWZ_PROVIDERS signalProvider = X121SMC_XWZ_PROVIDER_NONE;
|
||||||
@@ -216,14 +216,19 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
provider.MaxAllowedLoopbackForInit(578);
|
provider.MaxAllowedLoopbackForInit(578);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Working Zone Overal Direction ...
|
// Check Working Zone Has Trend ...
|
||||||
hasWorkingZoneOveralDirection = workingZone
|
hasTrend = workingZone.DetectTreand(
|
||||||
.DetectOveralDirection(wzOveralDir);
|
X_CYCLE_CONSOLIDATION,
|
||||||
|
trend,
|
||||||
|
provider,
|
||||||
|
zIndex //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detectiong Signal Boxes ...
|
// Detectiong Signal Boxes ...
|
||||||
hasWaitingBoxes = workingZone
|
hasWaitingBoxes = workingZone
|
||||||
.DetectWaitingBoxes(
|
.DetectWaitingBoxes(
|
||||||
|
X_CYCLE_CONSOLIDATION,
|
||||||
X_CYCLE_ANALYSE,
|
X_CYCLE_ANALYSE,
|
||||||
provider,
|
provider,
|
||||||
zIndex //
|
zIndex //
|
||||||
@@ -282,8 +287,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
true, // Draw Supply Zone ...
|
true, // Draw Supply Zone ...
|
||||||
true, // Draw Demand Zone ...
|
true, // Draw Demand Zone ...
|
||||||
true // Draw Waiting Zones ...
|
true, // Draw Waiting Zones ...
|
||||||
//
|
true // Draw Trend ...
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,6 +476,18 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
iAtr = provider.decisionXConditions.atrBuffer[1];
|
iAtr = provider.decisionXConditions.atrBuffer[1];
|
||||||
iAtr *= 0;
|
iAtr *= 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Box fro SL ...
|
||||||
|
iSL = pivot;
|
||||||
|
Add(
|
||||||
|
iSL,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fix rf Reward ...
|
||||||
|
rfRewar = 2;
|
||||||
}
|
}
|
||||||
else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
|
else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
|
||||||
{
|
{
|
||||||
@@ -491,7 +508,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Fix rf Reward ...
|
// Fix rf Reward ...
|
||||||
rfRewar = 1;
|
rfRewar = 2;
|
||||||
}
|
}
|
||||||
else if (signalProvider == X121SMC_XWZ_PROVIDER_XACTIVATED_BOX)
|
else if (signalProvider == X121SMC_XWZ_PROVIDER_XACTIVATED_BOX)
|
||||||
{
|
{
|
||||||
@@ -512,7 +529,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Fix rf Reward ...
|
// Fix rf Reward ...
|
||||||
rfRewar = 1;
|
rfRewar = 2;
|
||||||
}
|
}
|
||||||
else if (signalProvider == X121SMC_XWZ_PROVIDER_XBREAKED_BOX)
|
else if (signalProvider == X121SMC_XWZ_PROVIDER_XBREAKED_BOX)
|
||||||
{
|
{
|
||||||
@@ -533,7 +550,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Fix rf Reward ...
|
// Fix rf Reward ...
|
||||||
rfRewar = 1;
|
rfRewar = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
XCSupplyZone *supplyZone;
|
XCSupplyZone *supplyZone;
|
||||||
XCDemandZone *demandZone;
|
XCDemandZone *demandZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone support;
|
||||||
|
XBoxZone resistance;
|
||||||
|
ENUM_X_DIRECTION trend;
|
||||||
|
|
||||||
//
|
//
|
||||||
XSignalBox waitingBoxes[];
|
XSignalBox waitingBoxes[];
|
||||||
XSignalBox breakedBoxes[];
|
XSignalBox breakedBoxes[];
|
||||||
@@ -470,7 +475,8 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool DetectWaitingBoxes(
|
bool DetectWaitingBoxes(
|
||||||
ENUM_X_CYCLES cycle,
|
ENUM_X_CYCLES obCycle,
|
||||||
|
ENUM_X_CYCLES fvgCycle,
|
||||||
X121SMCStrategySignalProviderData &provider,
|
X121SMCStrategySignalProviderData &provider,
|
||||||
int barIndex = 0 //
|
int barIndex = 0 //
|
||||||
)
|
)
|
||||||
@@ -490,28 +496,63 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Select Cycle ...
|
// Select OB Cycle ...
|
||||||
XPOIState cState;
|
XPOIState obState;
|
||||||
XPOIStateEvents cStateEvents;
|
XPOIStateEvents obStateEvents;
|
||||||
X121Conditions cXConditions;
|
X121Conditions obXConditions;
|
||||||
XC121SMCCycleHelper *cHelper;
|
XC121SMCCycleHelper *obHelper;
|
||||||
X121SMCCycleConditions cConditions;
|
X121SMCCycleConditions obConditions;
|
||||||
result = provider.SelectCycle(
|
result = provider.SelectCycle(
|
||||||
cycle,
|
obCycle,
|
||||||
cState,
|
obState,
|
||||||
cStateEvents,
|
obStateEvents,
|
||||||
cXConditions,
|
obXConditions,
|
||||||
cHelper,
|
obHelper,
|
||||||
cConditions //
|
obConditions //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
cState.Clean();
|
obState.Clean();
|
||||||
ZeroMemory(cHelper);
|
ZeroMemory(obHelper);
|
||||||
cConditions.Clean();
|
obConditions.Clean();
|
||||||
cStateEvents.Clean();
|
obStateEvents.Clean();
|
||||||
cXConditions.Clean();
|
obXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select FVG Cycle ...
|
||||||
|
XPOIState fvgState;
|
||||||
|
XPOIStateEvents fvgStateEvents;
|
||||||
|
X121Conditions fvgXConditions;
|
||||||
|
XC121SMCCycleHelper *fvgHelper;
|
||||||
|
X121SMCCycleConditions fvgConditions;
|
||||||
|
result = provider.SelectCycle(
|
||||||
|
fvgCycle,
|
||||||
|
fvgState,
|
||||||
|
fvgStateEvents,
|
||||||
|
fvgXConditions,
|
||||||
|
fvgHelper,
|
||||||
|
fvgConditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
obState.Clean();
|
||||||
|
ZeroMemory(obHelper);
|
||||||
|
obConditions.Clean();
|
||||||
|
obStateEvents.Clean();
|
||||||
|
obXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
fvgState.Clean();
|
||||||
|
ZeroMemory(fvgHelper);
|
||||||
|
fvgConditions.Clean();
|
||||||
|
fvgStateEvents.Clean();
|
||||||
|
fvgXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -519,30 +560,30 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Select Order Blocks ...
|
// Select Order Blocks ...
|
||||||
if (cStateEvents.hasNewOrderBlock)
|
if (obStateEvents.hasNewOrderBlock)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
idx = GetYoungest(cState.orderBlocks);
|
idx = GetYoungest(obState.orderBlocks);
|
||||||
has = IsValidIndex(idx);
|
has = IsValidIndex(idx);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCFVG *iFVG = NULL;
|
XCFVG *iFVG = NULL;
|
||||||
XCOrderBlock *iOB = cState.orderBlocks[idx];
|
XCOrderBlock *iOB = obState.orderBlocks[idx];
|
||||||
bool isBullish = iOB.IsBullish();
|
bool isBullish = iOB.IsBullish();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detecting Inside FVG ...
|
// Detecting Inside FVG ...
|
||||||
has = cState.HasFairValueGaps();
|
has = fvgState.HasFairValueGaps();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCFVG *tmpFVGs[];
|
XCFVG *tmpFVGs[];
|
||||||
count = cState.CountFairValueGaps();
|
count = fvgState.CountFairValueGaps();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCFVG *jFVG = cState.fairValueGaps[i];
|
XCFVG *jFVG = fvgState.fairValueGaps[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isDirPassed = jFVG.GetDirection() == iOB.GetDirection();
|
bool isDirPassed = jFVG.GetDirection() == iOB.GetDirection();
|
||||||
@@ -610,7 +651,8 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
has = iOBBox.IsValid();
|
has = iOBBox.IsValid() &&
|
||||||
|
iFVGBox.IsValid();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -646,11 +688,18 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
// Cleanup Resources ...
|
// Cleanup Resources ...
|
||||||
|
|
||||||
//
|
//
|
||||||
cState.Clean();
|
obState.Clean();
|
||||||
ZeroMemory(cHelper);
|
ZeroMemory(obHelper);
|
||||||
cConditions.Clean();
|
obConditions.Clean();
|
||||||
cXConditions.Clean();
|
obStateEvents.Clean();
|
||||||
cStateEvents.Clean();
|
obXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
fvgState.Clean();
|
||||||
|
ZeroMemory(fvgHelper);
|
||||||
|
fvgConditions.Clean();
|
||||||
|
fvgStateEvents.Clean();
|
||||||
|
fvgXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -766,118 +815,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect Overal Trend of Working Zone ...
|
|
||||||
*
|
|
||||||
* @param dir: ENUM_X_DIRECTION member ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool DetectOveralDirection(
|
|
||||||
ENUM_X_DIRECTION &dir //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
dir = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsValid() &&
|
|
||||||
HasSupplyZone() &&
|
|
||||||
HasDemandZone();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XBoxZone demBox;
|
|
||||||
XBoxZone supBox;
|
|
||||||
result = ToBox(
|
|
||||||
demBox,
|
|
||||||
demandZone //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
supBox.Clean();
|
|
||||||
demBox.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = ToBox(
|
|
||||||
supBox,
|
|
||||||
supplyZone //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
supBox.Clean();
|
|
||||||
demBox.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL supPriceOutBar;
|
|
||||||
bool hasSupPriceOutBar = false;
|
|
||||||
result = DetectBoxNearestPriceOut(
|
|
||||||
supBox,
|
|
||||||
supPriceOutBar,
|
|
||||||
supBox.period //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL demPriceOutBar;
|
|
||||||
bool hasDemPriceOutBar = false;
|
|
||||||
result = DetectBoxNearestPriceOut(
|
|
||||||
demBox,
|
|
||||||
demPriceOutBar,
|
|
||||||
demBox.period //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
hasSupPriceOutBar = supPriceOutBar.IsValid();
|
|
||||||
hasDemPriceOutBar = demPriceOutBar.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Specified Direction ...
|
|
||||||
dir =
|
|
||||||
(hasSupPriceOutBar &&
|
|
||||||
hasDemPriceOutBar)
|
|
||||||
? supPriceOutBar.time > demPriceOutBar.time
|
|
||||||
? X_DIRECTION_BEARISH
|
|
||||||
: demPriceOutBar.time > supPriceOutBar.time
|
|
||||||
? X_DIRECTION_BULLISH
|
|
||||||
: X_DIRECTION_NONE
|
|
||||||
: (hasSupPriceOutBar &&
|
|
||||||
!hasDemPriceOutBar)
|
|
||||||
? X_DIRECTION_BEARISH
|
|
||||||
: (!hasSupPriceOutBar &&
|
|
||||||
hasDemPriceOutBar)
|
|
||||||
? X_DIRECTION_BULLISH
|
|
||||||
: X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = HasDirection(dir);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Clean Up Resources ...
|
|
||||||
|
|
||||||
//
|
|
||||||
demBox.Clean();
|
|
||||||
supBox.Clean();
|
|
||||||
supPriceOutBar.Clean();
|
|
||||||
demPriceOutBar.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Trend Based On Boxes ...
|
* Detect Trend Based On Boxes ...
|
||||||
*
|
*
|
||||||
@@ -886,24 +823,218 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool DetectTreand(
|
bool DetectTreand(
|
||||||
ENUM_X_DIRECTION &dir //
|
ENUM_X_CYCLES cycle,
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategySignalProviderData &provider,
|
||||||
|
int barIndex = 0 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
support.Clean();
|
||||||
|
resistance.Clean();
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
|
trend = X_DIRECTION_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overal ...
|
if (barIndex < 0)
|
||||||
ENUM_X_DIRECTION overal;
|
{
|
||||||
bool hasOveral = DetectOveralDirection(overal);
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Waiting Boxes ...
|
result = IsValid(cycle);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Select Cycle ...
|
||||||
|
XPOIState cState;
|
||||||
|
XPOIStateEvents cStateEvents;
|
||||||
|
X121Conditions cXConditions;
|
||||||
|
XC121SMCCycleHelper *cHelper;
|
||||||
|
X121SMCCycleConditions cConditions;
|
||||||
|
result = provider.SelectCycle(
|
||||||
|
cycle,
|
||||||
|
cState,
|
||||||
|
cStateEvents,
|
||||||
|
cXConditions,
|
||||||
|
cHelper,
|
||||||
|
cConditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trend ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmp[];
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Supports ...
|
||||||
|
ToBox(
|
||||||
|
cState.supportZones,
|
||||||
|
tmp //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmp,
|
||||||
|
tmpBoxes,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmp);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Resistances ...
|
||||||
|
ToBox(
|
||||||
|
cState.resistanceZones,
|
||||||
|
tmp //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmp,
|
||||||
|
tmpBoxes,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmp);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = HasChild(tmpBoxes);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Youngest Valid Zone ...
|
||||||
|
while (HasChild(tmpBoxes) ||
|
||||||
|
!(support.IsValid() &&
|
||||||
|
resistance.IsValid()))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Yongest Zone ...
|
||||||
|
idx = GetYoungest(tmpBoxes);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove Extracted Box ...
|
||||||
|
XBoxZone iBox = tmpBoxes[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
tmpBoxes,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Validation of Box ...
|
||||||
|
has = IsBoxValid(
|
||||||
|
iBox,
|
||||||
|
barIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Assign Support or Resistance ...
|
||||||
|
bool isBullish = iBox.IsBullish();
|
||||||
|
if (isBullish &&
|
||||||
|
!support.IsValid())
|
||||||
|
{
|
||||||
|
support = iBox;
|
||||||
|
}
|
||||||
|
else if (!isBullish &&
|
||||||
|
!resistance.IsValid())
|
||||||
|
{
|
||||||
|
resistance = iBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Support and Resistance ...
|
||||||
|
has =
|
||||||
|
support.IsValid() &&
|
||||||
|
resistance.IsValid();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Result ...
|
||||||
|
bool isBullish =
|
||||||
|
support.from > resistance.from;
|
||||||
|
bool isBearish =
|
||||||
|
support.from < resistance.from;
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
trend = dir;
|
||||||
|
|
||||||
|
//
|
||||||
|
support.to = TimeCurrent();
|
||||||
|
resistance.to = TimeCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmp);
|
||||||
|
cState.Clean();
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -1117,7 +1248,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
// Rejected Box ...
|
// Rejected Box ...
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
bool useSenario1 = true;
|
bool useSenario1 = false;
|
||||||
bool isSenario1Happend = false;
|
bool isSenario1Happend = false;
|
||||||
bool isSenario1Bullish = false;
|
bool isSenario1Bullish = false;
|
||||||
bool isSenario1Bearish = false;
|
bool isSenario1Bearish = false;
|
||||||
@@ -1156,7 +1287,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
// Activated Box ...
|
// Activated Box ...
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
bool useSenario2 = true;
|
bool useSenario2 = false;
|
||||||
bool isSenario2Happend = false;
|
bool isSenario2Happend = false;
|
||||||
bool isSenario2Bullish = false;
|
bool isSenario2Bullish = false;
|
||||||
bool isSenario2Bearish = false;
|
bool isSenario2Bearish = false;
|
||||||
@@ -1196,7 +1327,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
// Breaked Box ...
|
// Breaked Box ...
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
bool useSenario3 = true;
|
bool useSenario3 = false;
|
||||||
bool isSenario3Happend = false;
|
bool isSenario3Happend = false;
|
||||||
bool isSenario3Bullish = false;
|
bool isSenario3Bullish = false;
|
||||||
bool isSenario3Bearish = false;
|
bool isSenario3Bearish = false;
|
||||||
@@ -1234,10 +1365,10 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Senario 4:
|
// Senario 4:
|
||||||
// ---------------------------------------------
|
// -----------------------------------------------
|
||||||
// Detect Signal Box Based On Conditions ...
|
// Detect Signal Box Based On XHKMA Conditions ...
|
||||||
// ---------------------------------------------
|
// -----------------------------------------------
|
||||||
bool useSenario4 = false;
|
bool useSenario4 = true;
|
||||||
bool isSenario4Happend = false;
|
bool isSenario4Happend = false;
|
||||||
bool isSenario4Bullish = false;
|
bool isSenario4Bullish = false;
|
||||||
bool isSenario4Bearish = false;
|
bool isSenario4Bearish = false;
|
||||||
@@ -1246,6 +1377,33 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
!isSenario3Happend &&
|
!isSenario3Happend &&
|
||||||
useSenario4)
|
useSenario4)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
isSenario4Happend = cParser.HasSenario4Conditions(
|
||||||
|
X_CYCLE_DECISION,
|
||||||
|
trend,
|
||||||
|
box,
|
||||||
|
holderBox,
|
||||||
|
dir,
|
||||||
|
waitingBoxes,
|
||||||
|
provider,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isSenario4Bullish =
|
||||||
|
isSenario4Happend &&
|
||||||
|
IsBullish(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
isSenario4Bearish =
|
||||||
|
isSenario4Happend &&
|
||||||
|
IsBearish(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSenario4Happend)
|
||||||
|
{
|
||||||
|
signalProvider = X121SMC_XWZ_PROVIDER_XHKMA;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1274,7 +1432,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
isSenario2Bullish ||
|
isSenario2Bullish ||
|
||||||
isSenario3Bullish ||
|
isSenario3Bullish ||
|
||||||
isSenario4Bullish ||
|
isSenario4Bullish ||
|
||||||
isSenario5Bullish
|
isSenario5Bullish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1285,7 +1443,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
isSenario2Bearish ||
|
isSenario2Bearish ||
|
||||||
isSenario3Bearish ||
|
isSenario3Bearish ||
|
||||||
isSenario4Bearish ||
|
isSenario4Bearish ||
|
||||||
isSenario5Bearish
|
isSenario5Bearish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1448,7 +1606,8 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
XCPOIDrawer *drawer,
|
XCPOIDrawer *drawer,
|
||||||
bool drawSupplyZone = false,
|
bool drawSupplyZone = false,
|
||||||
bool drawDemandZone = false,
|
bool drawDemandZone = false,
|
||||||
bool drawWaitingZones = false //
|
bool drawWaitingZones = false,
|
||||||
|
bool drawTrend = false //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1724,6 +1883,44 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Trend if Exists ...
|
||||||
|
if (drawTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Trend Exists ...
|
||||||
|
has =
|
||||||
|
support.IsValid() &&
|
||||||
|
HasDirection(trend) &&
|
||||||
|
resistance.IsValid();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw Support ...
|
||||||
|
XCBoxObject *supportObject;
|
||||||
|
has = drawer.DrawBox(
|
||||||
|
support,
|
||||||
|
supportObject //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
mWorkingZoneObjects.Add(supportObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Resistance ...
|
||||||
|
XCBoxObject *resistanceObject;
|
||||||
|
has = drawer.DrawBox(
|
||||||
|
resistance,
|
||||||
|
resistanceObject //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
mWorkingZoneObjects.Add(resistanceObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user