last ...
This commit is contained in:
@@ -4585,6 +4585,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
//
|
//
|
||||||
bool drawOrderBlock = true,
|
bool drawOrderBlock = true,
|
||||||
bool drawFairValueGaps = true,
|
bool drawFairValueGaps = true,
|
||||||
|
bool drawAllFVGs = true,
|
||||||
//
|
//
|
||||||
bool drawOBStartedBar = true,
|
bool drawOBStartedBar = true,
|
||||||
bool drawOBActivatedBar = true,
|
bool drawOBActivatedBar = true,
|
||||||
@@ -4695,87 +4696,93 @@ class XCPOIDrawer : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Fair Value Gap ...
|
// Fair Value Gap ...
|
||||||
XCFVG *fvg;
|
if (!drawAllFVGs)
|
||||||
has = item.GetMainFVG(fvg);
|
|
||||||
if (has)
|
|
||||||
{
|
{
|
||||||
//
|
XCFVG *fvg;
|
||||||
Clean(tmpObjects);
|
has = item.GetMainFVG(fvg);
|
||||||
int fvgsCount = DrawFairValueGap(
|
if (has &&
|
||||||
fvg,
|
drawFairValueGaps)
|
||||||
tmpObjects,
|
|
||||||
drawFVGStartedBar,
|
|
||||||
drawFVGActivatedBar,
|
|
||||||
drawFVGBreakedBar,
|
|
||||||
drawFVGWorkedBar,
|
|
||||||
widthFVGStartedBar,
|
|
||||||
clrFVGStartedBar,
|
|
||||||
styleFVGStartedBar,
|
|
||||||
widthFVGActivatedBar,
|
|
||||||
clrFVGActivatedBar,
|
|
||||||
styleFVGActivatedBar,
|
|
||||||
widthFVGBreakedBar,
|
|
||||||
clrFVGBreakedBar,
|
|
||||||
styleFVGBreakedBar,
|
|
||||||
widthFVGWorkedBar,
|
|
||||||
clrFVGWorkedBar,
|
|
||||||
styleFVGWorkedBar //
|
|
||||||
);
|
|
||||||
has = IsValidSize(fvgsCount);
|
|
||||||
if (has)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Copy(
|
Clean(tmpObjects);
|
||||||
|
int fvgsCount = DrawFairValueGap(
|
||||||
|
fvg,
|
||||||
tmpObjects,
|
tmpObjects,
|
||||||
objects,
|
drawFVGStartedBar,
|
||||||
false //
|
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 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
|
||||||
// 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);
|
Clean(tmpObjects);
|
||||||
|
|||||||
+2992
-2678
File diff suppressed because it is too large
Load Diff
+140
-105
@@ -30,7 +30,7 @@ int OnInit()
|
|||||||
_Symbol,
|
_Symbol,
|
||||||
_Period //
|
_Period //
|
||||||
);
|
);
|
||||||
// mPOIDetector.Init();
|
mPOIDetector.Init();
|
||||||
|
|
||||||
//---
|
//---
|
||||||
mPOIDrawer = new XCPOIDrawer();
|
mPOIDrawer = new XCPOIDrawer();
|
||||||
@@ -79,130 +79,165 @@ void OnTick()
|
|||||||
mPOIDetector.GetState(mPOIState);
|
mPOIDetector.GetState(mPOIState);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool has = mPOIState.HasFairValueGaps();
|
bool has = Contains(
|
||||||
|
X_BULLISH_FVG_DETECTED,
|
||||||
|
mPOIEvents //
|
||||||
|
) ||
|
||||||
|
Contains(
|
||||||
|
X_BEARISH_FVG_DETECTED,
|
||||||
|
mPOIEvents //
|
||||||
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int count = mPOIState.CountFairValueGaps();
|
XCFVG *fvg;
|
||||||
for (int i = 0; i < count; i++)
|
int idx = GetYoungest(mPOIState.fairValueGaps);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
mPOIState.fairValueGaps[i].To(TimeCurrent());
|
fvg = mPOIState.fairValueGaps[idx];
|
||||||
|
|
||||||
//
|
//
|
||||||
XCBaseObject *iObj;
|
XCBaseObject *iObj;
|
||||||
bool isCreated = mPOIDrawer.CreateFairValueGap(
|
has = mPOIDrawer.CreateFairValueGap(
|
||||||
mPOIState.fairValueGaps[i],
|
fvg,
|
||||||
iObj //
|
iObj //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Print("Salam");
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print("New Fair Value Gap ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //
|
||||||
|
// bool has = mPOIState.HasFairValueGaps();
|
||||||
|
// if (has)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// int count = mPOIState.CountFairValueGaps();
|
||||||
|
// for (int i = 0; i < count; i++)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// mPOIState.fairValueGaps[i].To(TimeCurrent());
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XCBaseObject *iObj;
|
||||||
|
// bool isCreated = mPOIDrawer.CreateFairValueGap(
|
||||||
|
// mPOIState.fairValueGaps[i],
|
||||||
|
// iObj //
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print("Salam");
|
||||||
|
|
||||||
//
|
//
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//
|
// //
|
||||||
XOHCL bar;
|
// XOHCL bar;
|
||||||
bool isInited = bar.Init(
|
// bool isInited = bar.Init(
|
||||||
_Symbol,
|
// _Symbol,
|
||||||
_Period,
|
// _Period,
|
||||||
0 //
|
// 0 //
|
||||||
);
|
// );
|
||||||
if (!isInited)
|
// if (!isInited)
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
int index = 0;
|
// int index = 0;
|
||||||
ENUM_X_DIRECTION sameBarDir;
|
// ENUM_X_DIRECTION sameBarDir;
|
||||||
bool hasSameBars = mBarAnalyser.HasSameBars(
|
// bool hasSameBars = mBarAnalyser.HasSameBars(
|
||||||
bar,
|
// bar,
|
||||||
sameBarDir,
|
// sameBarDir,
|
||||||
index,
|
// index,
|
||||||
3 //
|
// 3 //
|
||||||
);
|
// );
|
||||||
if (hasSameBars)
|
// if (hasSameBars)
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Detect Fair Value Gap ...
|
// // Detect Fair Value Gap ...
|
||||||
XOHCL fvgEndBar;
|
// XOHCL fvgEndBar;
|
||||||
XOHCL fvgStartBar;
|
// XOHCL fvgStartBar;
|
||||||
ENUM_X_DIRECTION fvgDir;
|
// ENUM_X_DIRECTION fvgDir;
|
||||||
bool hasFVG = mBarAnalyser.HasFairValueGap(
|
// bool hasFVG = mBarAnalyser.HasFairValueGap(
|
||||||
bar,
|
// bar,
|
||||||
fvgStartBar,
|
// fvgStartBar,
|
||||||
fvgEndBar,
|
// fvgEndBar,
|
||||||
fvgDir,
|
// fvgDir,
|
||||||
3 //
|
// 3 //
|
||||||
);
|
// );
|
||||||
if (hasFVG)
|
// if (hasFVG)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCFVG *fvg;
|
// XCFVG *fvg;
|
||||||
fvg = new XCFVG();
|
// fvg = new XCFVG();
|
||||||
bool isInit = fvg.Init(
|
// bool isInit = fvg.Init(
|
||||||
fvgStartBar,
|
// fvgStartBar,
|
||||||
fvgEndBar,
|
// fvgEndBar,
|
||||||
fvgDir //
|
// fvgDir //
|
||||||
);
|
// );
|
||||||
// if (isInit)
|
// // if (isInit)
|
||||||
// {
|
// // {
|
||||||
// //
|
// // //
|
||||||
// XCBaseObject *iObj;
|
// // XCBaseObject *iObj;
|
||||||
// bool isCreated = mPOIDrawer.CreateFairValueGap(
|
// // bool isCreated = mPOIDrawer.CreateFairValueGap(
|
||||||
// fvg,
|
// // fvg,
|
||||||
// iObj //
|
// // iObj //
|
||||||
// );
|
// // );
|
||||||
//
|
// //
|
||||||
// //
|
// // //
|
||||||
// if (isCreated)
|
// // if (isCreated)
|
||||||
// {
|
// // {
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
XOHCL obBar;
|
// XOHCL obBar;
|
||||||
ENUM_X_DIRECTION obDir;
|
// ENUM_X_DIRECTION obDir;
|
||||||
bool hasOB = mBarAnalyser.HasOrderBlock(
|
// bool hasOB = mBarAnalyser.HasOrderBlock(
|
||||||
bar,
|
// bar,
|
||||||
obBar,
|
// obBar,
|
||||||
obDir,
|
// obDir,
|
||||||
3 //
|
// 3 //
|
||||||
);
|
// );
|
||||||
if (hasOB)
|
// if (hasOB)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCOrderBlock *ob;
|
// XCOrderBlock *ob;
|
||||||
ob = new XCOrderBlock();
|
// ob = new XCOrderBlock();
|
||||||
bool isInit = ob.Init(
|
// bool isInit = ob.Init(
|
||||||
obBar,
|
// obBar,
|
||||||
obDir //
|
// obDir //
|
||||||
);
|
// );
|
||||||
if (isInit)
|
// if (isInit)
|
||||||
{
|
// {
|
||||||
// //
|
// // //
|
||||||
// XCBaseObject *iObj;
|
// // XCBaseObject *iObj;
|
||||||
// bool isCreated = mPOIDrawer.CreateOrderBlock(
|
// // bool isCreated = mPOIDrawer.CreateOrderBlock(
|
||||||
// ob,
|
// // ob,
|
||||||
// iObj //
|
// // iObj //
|
||||||
// );
|
// // );
|
||||||
|
|
||||||
// //
|
// // //
|
||||||
// if (isCreated)
|
// // if (isCreated)
|
||||||
// {
|
// // {
|
||||||
// Print("Order Block ...");
|
// // Print("Order Block ...");
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
|
|||||||
@@ -388,7 +388,6 @@ struct XOBFVG
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool IsValidZone(
|
bool IsValidZone(
|
||||||
XOHCL &invalidBar,
|
|
||||||
int barIndex = 0 //
|
int barIndex = 0 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -401,9 +400,6 @@ struct XOBFVG
|
|||||||
barIndex = 0;
|
barIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
invalidBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = IsValid();
|
result = IsValid();
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -412,101 +408,132 @@ struct XOBFVG
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XCFVG *fvg;
|
XCFVG *tmpFVGs[];
|
||||||
result = GetMainFVG(fvg);
|
Copy(
|
||||||
if (!result)
|
fvgs,
|
||||||
{
|
tmpFVGs //
|
||||||
//
|
|
||||||
ZeroMemory(fvg);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL startedBar;
|
|
||||||
bool isBodyOut = false;
|
|
||||||
result = fvg.IsStarted(
|
|
||||||
fvg.GetDirection(),
|
|
||||||
startedBar,
|
|
||||||
isBodyOut //
|
|
||||||
);
|
);
|
||||||
if (!result)
|
int count = CountFVGs();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ZeroMemory(fvg);
|
XCFVG *iFVG = tmpFVGs[i];
|
||||||
startedBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
XOHCL startedBar;
|
||||||
}
|
bool isBodyOut = false;
|
||||||
|
result = iFVG.IsStarted(
|
||||||
//
|
iFVG.GetDirection(),
|
||||||
XOHCL bar;
|
startedBar,
|
||||||
bool isBullish = fvg.IsBullish();
|
isBodyOut //
|
||||||
|
|
||||||
//
|
|
||||||
int fromIndex = iBarShift(
|
|
||||||
fvg.GetSymbol(),
|
|
||||||
fvg.GetPeriod(),
|
|
||||||
startedBar.NextAt() //
|
|
||||||
);
|
|
||||||
result = IsValidIndex(fromIndex);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bar.Clean();
|
|
||||||
ZeroMemory(fvg);
|
|
||||||
startedBar.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isInited = false;
|
|
||||||
for (int i = barIndex; i < fromIndex; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isInited = bar.Init(
|
|
||||||
fvg.GetSymbol(),
|
|
||||||
fvg.GetPeriod(),
|
|
||||||
i //
|
|
||||||
);
|
);
|
||||||
if (!isInited)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bar.Clean();
|
ZeroMemory(iFVG);
|
||||||
|
startedBar.Clean();
|
||||||
|
ArrayRemove(
|
||||||
|
fvgs,
|
||||||
|
i,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBarAbove =
|
XOHCL bar;
|
||||||
bar.low > fvg.Upper();
|
bool isBullish = iFVG.IsBullish();
|
||||||
bool isBarBelow =
|
datetime fromTime = startedBar.NextAt();
|
||||||
bar.high < fvg.Lower();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
int fromIndex = iBarShift(
|
||||||
isBullish
|
iFVG.GetSymbol(),
|
||||||
? isBarAbove
|
iFVG.GetPeriod(),
|
||||||
: isBarBelow;
|
fromTime //
|
||||||
|
);
|
||||||
|
result = IsValidIndex(fromIndex);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
invalidBar = bar;
|
|
||||||
bar.Clean();
|
bar.Clean();
|
||||||
|
ZeroMemory(iFVG);
|
||||||
|
startedBar.Clean();
|
||||||
|
ArrayRemove(
|
||||||
|
fvgs,
|
||||||
|
i,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
break;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isInited = false;
|
||||||
|
bool isValidFVG = false;
|
||||||
|
for (int j = barIndex; j < fromIndex; j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isInited = bar.Init(
|
||||||
|
iFVG.GetSymbol(),
|
||||||
|
iFVG.GetPeriod(),
|
||||||
|
j //
|
||||||
|
);
|
||||||
|
if (!isInited)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBarAbove =
|
||||||
|
bar.low > iFVG.Upper();
|
||||||
|
bool isBarBelow =
|
||||||
|
bar.high < iFVG.Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
isValidFVG =
|
||||||
|
isBullish
|
||||||
|
? isBarAbove
|
||||||
|
: isBarBelow;
|
||||||
|
if (!isValidFVG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!isValidFVG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
|
fvgs,
|
||||||
|
i,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bar.Clean();
|
bar.Clean();
|
||||||
|
ZeroMemory(iFVG);
|
||||||
|
startedBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bar.Clean();
|
Clean(tmpFVGs);
|
||||||
ZeroMemory(fvg);
|
|
||||||
startedBar.Clean();
|
//
|
||||||
|
result = HasFVGs();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
double targets[];
|
double targets[];
|
||||||
double reward = 0;
|
double reward = 0;
|
||||||
XBoxZone signalBox;
|
XBoxZone signalBox;
|
||||||
XOBFVG activatedZone;
|
int activatedFVGIDX = 0;
|
||||||
|
int activatedZoneIDX = 0;
|
||||||
double amountPercent = 0;
|
double amountPercent = 0;
|
||||||
bool hasPriority = false;
|
bool hasPriority = false;
|
||||||
bool hasSignalBox = false;
|
bool hasSignalBox = false;
|
||||||
@@ -214,16 +215,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
hasWaitingZones = workingZone.DetectZone(
|
hasWaitingZones = workingZone.DetectZone(
|
||||||
drawer,
|
|
||||||
provider //
|
provider //
|
||||||
);
|
);
|
||||||
if (hasWaitingZones)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Validate Waiting Zones ...
|
|
||||||
workingZone.ValidateWaitingZones(zIndex);
|
|
||||||
hasWaitingZones = HasChild(workingZone.waitingZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Checking Working Zone Destory or not ...
|
// Checking Working Zone Destory or not ...
|
||||||
@@ -239,7 +232,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
result = false;
|
result = false;
|
||||||
workingZone.Clean();
|
workingZone.Clean();
|
||||||
activatedZone.Clean();
|
|
||||||
hasWorkingZone = false;
|
hasWorkingZone = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -255,13 +247,41 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Start Draw ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
UpdateTo(cTime);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Working Zone ...
|
||||||
|
if (hasWorkingZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
workingZone.Draw(
|
||||||
|
drawer,
|
||||||
|
//
|
||||||
|
true, // Draw Supply Zone ...
|
||||||
|
true, // Draw Demand Zone ...
|
||||||
|
true, // Draw Waiting Zones ...
|
||||||
|
true // Draw Waiting Zones Box Area ...
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// End Draw ...
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Signal Box ...
|
// Detect Signal Box ...
|
||||||
hasSignalBox =
|
hasSignalBox =
|
||||||
hasWorkingZone &&
|
hasWorkingZone &&
|
||||||
hasWaitingZones &&
|
hasWaitingZones &&
|
||||||
workingZone.IsZoneActivated(
|
workingZone.IsZoneActivated(
|
||||||
activatedZone,
|
activatedZoneIDX,
|
||||||
|
activatedFVGIDX,
|
||||||
provider,
|
provider,
|
||||||
zIndex //
|
zIndex //
|
||||||
);
|
);
|
||||||
@@ -269,7 +289,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
signalBox.Clean();
|
signalBox.Clean();
|
||||||
hasSignalBox = activatedZone.ToZone(signalBox);
|
|
||||||
|
//
|
||||||
|
XOBFVG iOBFVG = workingZone.waitingZones[activatedZoneIDX];
|
||||||
|
XCFVG *activatedFVG = iOBFVG.fvgs[activatedFVGIDX];
|
||||||
|
hasSignalBox = ToBox(
|
||||||
|
signalBox,
|
||||||
|
activatedFVG //
|
||||||
|
);
|
||||||
if (hasSignalBox)
|
if (hasSignalBox)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -278,27 +305,42 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
int idx = FindIndex(
|
ArrayRemove(
|
||||||
activatedZone,
|
workingZone.waitingZones[activatedZoneIDX].fvgs,
|
||||||
workingZone.waitingZones //
|
activatedFVGIDX,
|
||||||
|
1 //
|
||||||
);
|
);
|
||||||
bool has = IsValidIndex(idx);
|
bool isValid = workingZone.waitingZones[activatedZoneIDX].IsValid();
|
||||||
if (has)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ArrayRemove(
|
AddRef(
|
||||||
workingZone.waitingZones,
|
workingZone.waitingZones[activatedZoneIDX],
|
||||||
idx,
|
workingZone.unavailableZones //
|
||||||
1 //
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
ArrayRemove(
|
||||||
activatedZone,
|
workingZone.waitingZones,
|
||||||
workingZone.unavailableZones //
|
activatedZoneIDX,
|
||||||
|
1 //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iOBFVG.Clean();
|
||||||
|
ZeroMemory(activatedFVG);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove Invalidate Zones ...
|
||||||
|
if (hasWaitingZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Waiting Zones ...
|
||||||
|
workingZone.ValidateWaitingZones(zIndex);
|
||||||
|
hasWaitingZones = workingZone.HasWaitingZones();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -314,10 +356,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
signalBoxDir = X_DIRECTION_NONE;
|
signalBoxDir = X_DIRECTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Priority Exists ...
|
// Check Priority Exists ...
|
||||||
hasPriority = workingZone
|
hasPriority = workingZone
|
||||||
@@ -732,37 +770,11 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
mConditions.setupTime = cTime;
|
mConditions.setupTime = cTime;
|
||||||
mConditions.dir = signalBoxDir;
|
mConditions.dir = signalBoxDir;
|
||||||
mConditions.priority = priority;
|
mConditions.priority = priority;
|
||||||
mConditions.provider = signalProvider;
|
|
||||||
mConditions.signalBox = signalBox;
|
mConditions.signalBox = signalBox;
|
||||||
|
mConditions.provider = signalProvider;
|
||||||
mConditions.amountPercent = amountPercent;
|
mConditions.amountPercent = amountPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
UpdateTo(cTime);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Working Zone ...
|
|
||||||
if (hasWorkingZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
workingZone.Draw(
|
|
||||||
drawer,
|
|
||||||
//
|
|
||||||
true, // Draw Supply Zone ...
|
|
||||||
true, // Draw Demand Zone ...
|
|
||||||
true, // Draw Waiting Zones ...
|
|
||||||
true // Draw Waiting Zones Box Area ...
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasSignalBox)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Print("Has Signal Box ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -779,7 +791,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
signalBox.Clean();
|
signalBox.Clean();
|
||||||
activatedZone.Clean();
|
|
||||||
consolidationZBar.Clean();
|
consolidationZBar.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -273,7 +273,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool DetectZone(
|
bool DetectZone(
|
||||||
XCPOIDrawer *drawer,
|
|
||||||
X121SMCStrategySignalProviderData &provider //
|
X121SMCStrategySignalProviderData &provider //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -290,6 +289,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
|
int count = 0;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
@@ -461,15 +461,102 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Detect OB FVG ...
|
// Detect OB FVG ...
|
||||||
result =
|
if (hasNewOrderBlock)
|
||||||
hasNewOrderBlock &&
|
|
||||||
hasNewFairValueGap &&
|
|
||||||
ob.GetDirection() == fvg.GetDirection();
|
|
||||||
if (result)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
obFVG.ob = ob;
|
XOHCL obStartedBar;
|
||||||
obFVG.AddFVG(fvg);
|
bool isOBStartedBodyOut = false;
|
||||||
|
bool isOBStarted = ob.IsStarted(
|
||||||
|
ob.GetDirection(),
|
||||||
|
obStartedBar,
|
||||||
|
isOBStartedBodyOut //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
has = isOBStarted &&
|
||||||
|
isOBStartedBodyOut;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
obFVG.ob = ob;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select FVGs ...
|
||||||
|
count = provider
|
||||||
|
.analyseState
|
||||||
|
.CountFairValueGaps();
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
obFVG.Clean();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Select FVG ...
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *iFVG = provider
|
||||||
|
.analyseState
|
||||||
|
.fairValueGaps[i];
|
||||||
|
bool isBullish = iFVG.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iStartedBar;
|
||||||
|
bool isBodyOut = false;
|
||||||
|
bool isStarted = iFVG.IsStarted(
|
||||||
|
iFVG.GetDirection(),
|
||||||
|
iStartedBar,
|
||||||
|
isBodyOut //
|
||||||
|
);
|
||||||
|
iStartedBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isKindPassed = isStarted &&
|
||||||
|
isBodyOut;
|
||||||
|
bool isSameDir = iFVG.GetDirection() == ob.GetDirection();
|
||||||
|
bool isFromPassed = iFVG.From() >= obStartedBar.time;
|
||||||
|
bool isPlacePassed =
|
||||||
|
//
|
||||||
|
IsInsideOrDiff(
|
||||||
|
iFVG,
|
||||||
|
ob //
|
||||||
|
)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(isBullish
|
||||||
|
? IsAboveDiff(
|
||||||
|
iFVG,
|
||||||
|
ob,
|
||||||
|
true // Ignore Inside ...
|
||||||
|
)
|
||||||
|
: IsBelowDiff(
|
||||||
|
iFVG,
|
||||||
|
ob,
|
||||||
|
true // Ignore Inside ...
|
||||||
|
)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
has = isSameDir &&
|
||||||
|
isKindPassed &&
|
||||||
|
isFromPassed &&
|
||||||
|
isPlacePassed;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
obFVG.AddFVG(iFVG);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(iFVG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
has = obFVG.IsValid();
|
has = obFVG.IsValid();
|
||||||
@@ -503,98 +590,12 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
obFVG.Clean();
|
||||||
|
obStartedBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Detect SupDem FVG ...
|
|
||||||
// if (!result)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// result = hasNewFairValueGap &&
|
|
||||||
// (hasNewSupply ||
|
|
||||||
// hasNewDemand);
|
|
||||||
// if (result)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // Converts Supply or Demand Zone to OrderBlock ...
|
|
||||||
// XOHCL bar;
|
|
||||||
// ob = new XCOrderBlock();
|
|
||||||
// if (hasNewSupply)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// has = supply.FillBar(bar);
|
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// has = ob.Init(
|
|
||||||
// bar,
|
|
||||||
// X_DIRECTION_BEARISH //
|
|
||||||
// );
|
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// ob.Upper(supply.Upper());
|
|
||||||
// ob.Lower(supply.Lower());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if (hasNewDemand)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// has = demand.FillBar(bar);
|
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// has = ob.Init(
|
|
||||||
// bar,
|
|
||||||
// X_DIRECTION_BULLISH //
|
|
||||||
// );
|
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// ob.Upper(demand.Upper());
|
|
||||||
// ob.Lower(demand.Lower());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// obFVG.ob = ob;
|
|
||||||
// obFVG.AddFVG(fvg);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// has = obFVG.IsValid();
|
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // Check Item Is not Exists ...
|
|
||||||
// idx = FindIndex(
|
|
||||||
// obFVG,
|
|
||||||
// waitingZones //
|
|
||||||
// );
|
|
||||||
// has = !IsValidIndex(idx);
|
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // New Waiting Zone ...
|
|
||||||
// AddRef(
|
|
||||||
// obFVG,
|
|
||||||
// waitingZones //
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // Update Exists Waiting Zone ...
|
|
||||||
// waitingZones[idx].AddFVG(fvg);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// bar.Clean();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = HasWaitingZones();
|
result = HasWaitingZones();
|
||||||
|
|
||||||
@@ -635,6 +636,12 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
barIndex = 0;
|
barIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex == 0)
|
||||||
|
{
|
||||||
|
barIndex = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
has = IsValid() &&
|
has = IsValid() &&
|
||||||
HasWaitingZones();
|
HasWaitingZones();
|
||||||
@@ -649,12 +656,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
for (int i = 0; i < result; i++)
|
for (int i = 0; i < result; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOBFVG iOBFVG = waitingZones[i];
|
has = waitingZones[i].IsValidZone(
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL iInvalidBar;
|
|
||||||
has = iOBFVG.IsValidZone(
|
|
||||||
iInvalidBar,
|
|
||||||
barIndex //
|
barIndex //
|
||||||
);
|
);
|
||||||
if (!has)
|
if (!has)
|
||||||
@@ -667,13 +669,10 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
iOBFVG,
|
waitingZones[i],
|
||||||
unavailableZones //
|
unavailableZones //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
iInvalidBar.Clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -697,7 +696,8 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool IsZoneActivated(
|
bool IsZoneActivated(
|
||||||
XOBFVG &zone,
|
int &zoneIDX,
|
||||||
|
int &fvgIDX,
|
||||||
X121SMCStrategySignalProviderData &provider,
|
X121SMCStrategySignalProviderData &provider,
|
||||||
int barIndex = 0 //
|
int barIndex = 0 //
|
||||||
)
|
)
|
||||||
@@ -706,8 +706,10 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Result ...
|
zoneIDX = -1;
|
||||||
zone.Clean();
|
|
||||||
|
//
|
||||||
|
fvgIDX = -1;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Normalize Bar Index ...
|
// Normalize Bar Index ...
|
||||||
@@ -742,7 +744,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
bar.Clean();
|
bar.Clean();
|
||||||
zone.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -752,6 +753,64 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
double peak = provider.decisionXConditions.peaksBuffer[1];
|
double peak = provider.decisionXConditions.peaksBuffer[1];
|
||||||
double vale = provider.decisionXConditions.valesBuffer[1];
|
double vale = provider.decisionXConditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
double analysePeak = provider.analyseXConditions.peaksBuffer[1];
|
||||||
|
double analyseVale = provider.analyseXConditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
double consolidationPeak = provider.consolidationXConditions.peaksBuffer[1];
|
||||||
|
double consolidationVale = provider.consolidationXConditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
double visionPeak = provider.visionXConditions.peaksBuffer[1];
|
||||||
|
double visionVale = provider.visionXConditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPeaksSame =
|
||||||
|
peak == analysePeak &&
|
||||||
|
analysePeak == consolidationPeak;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isValesSame =
|
||||||
|
vale == analyseVale &&
|
||||||
|
analyseVale == consolidationVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDecisionScoreBullish =
|
||||||
|
provider.decisionBullishScore > provider.decisionBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDecisionScoreBearish =
|
||||||
|
provider.decisionBearishScore > provider.decisionBullishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isAnalyseScoreBullish =
|
||||||
|
provider.analyseBullishScore > provider.analyseBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isAnalyseScoreBearish =
|
||||||
|
provider.analyseBearishScore > provider.analyseBullishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isConsolidationScoreBullish =
|
||||||
|
provider.consolidationBullishScore > provider.consolidationBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isConsolidationScoreBearish =
|
||||||
|
provider.consolidationBearishScore > provider.consolidationBullishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVisionScoreBullish =
|
||||||
|
provider.visionBullishScore > provider.visionBearishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVisionScoreBearish =
|
||||||
|
provider.visionBearishScore > provider.visionBullishScore;
|
||||||
|
|
||||||
//
|
//
|
||||||
int count = CountWaitingZones();
|
int count = CountWaitingZones();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
@@ -764,56 +823,112 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
bool isBullish = iOBFVG.IsBullish();
|
bool isBullish = iOBFVG.IsBullish();
|
||||||
|
|
||||||
//
|
//
|
||||||
XBoxZone iBox;
|
int fvgsCount = iOBFVG.CountFVGs();
|
||||||
result = iOBFVG.ToZone(iBox);
|
bool has = IsValidSize(fvgsCount);
|
||||||
if (!result)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
for (int j = 0; j < fvgsCount; j++)
|
||||||
iOBFVG.Clean();
|
{
|
||||||
|
//
|
||||||
|
XCFVG *jFVG = iOBFVG.fvgs[j];
|
||||||
|
|
||||||
//
|
//
|
||||||
continue;
|
XBoxZone iBox;
|
||||||
|
has = ToBox(
|
||||||
|
iBox,
|
||||||
|
jFVG //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double iRange = iBox.lower + ((iBox.upper - iBox.lower) / 2);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Activate Zone Using PV ...
|
||||||
|
bool isPVPassed =
|
||||||
|
isBullish
|
||||||
|
? vale < iBox.upper &&
|
||||||
|
vale > iBox.lower
|
||||||
|
: peak < iBox.upper &&
|
||||||
|
peak > iBox.lower;
|
||||||
|
bool isPV50Passed =
|
||||||
|
isBullish
|
||||||
|
? vale < iBox.upper &&
|
||||||
|
vale < iRange &&
|
||||||
|
vale > iBox.lower
|
||||||
|
: peak < iBox.upper &&
|
||||||
|
peak < iRange &&
|
||||||
|
peak > iBox.lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Activate Zone using Rejection ...
|
||||||
|
bool isRejected =
|
||||||
|
isBullish
|
||||||
|
? bar.low <= iBox.upper &&
|
||||||
|
bar.GetDown() > iBox.upper
|
||||||
|
: bar.high >= iBox.lower &&
|
||||||
|
bar.GetUp() < iBox.lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Combine Result ...
|
||||||
|
result = isPV50Passed;
|
||||||
|
// || isPV50Passed
|
||||||
|
// || isRejected;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
fvgIDX = j;
|
||||||
|
iBox.Clean();
|
||||||
|
zoneIDX = i;
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
ZeroMemory(jFVG);
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XCFVG *fvg;
|
|
||||||
// result = iOBFVG.GetMainFVG(fvg);
|
|
||||||
// if (!result)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// iOBFVG.Clean();
|
|
||||||
// ZeroMemory(fvg);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? vale < iBox.upper &&
|
|
||||||
vale > iBox.lower
|
|
||||||
: peak < iBox.upper &&
|
|
||||||
peak > iBox.lower;
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
zone = iOBFVG;
|
iOBFVG.Clean();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
|
||||||
iOBFVG.Clean();
|
iOBFVG.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = zone.IsValid();
|
result =
|
||||||
|
IsValidIndex(fvgIDX) &&
|
||||||
|
IsValidIndex(zoneIDX);
|
||||||
|
|
||||||
//
|
//
|
||||||
bar.Clean();
|
bar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
bar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1466,6 +1581,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
iObjects,
|
iObjects,
|
||||||
true, // Draw Order Block ...
|
true, // Draw Order Block ...
|
||||||
true, // Draw Fair Value Gaps ...
|
true, // Draw Fair Value Gaps ...
|
||||||
|
true, // Draw All Fair Value Gaps ...
|
||||||
//
|
//
|
||||||
true, // Draw OB StartedBar ...
|
true, // Draw OB StartedBar ...
|
||||||
true, // Draw OB ActivatedBar ...
|
true, // Draw OB ActivatedBar ...
|
||||||
|
|||||||
Reference in New Issue
Block a user