Last ...
This commit is contained in:
@@ -226,3 +226,324 @@
|
||||
// Print("hasShortConditions");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
XZone iBearishOrderBlock;
|
||||
XZone iBearishFVG;
|
||||
|
||||
//
|
||||
bool isPassed = false;
|
||||
int orderBlocksCount = ArraySize(orderBlocksState.bearishOrderBlocks);
|
||||
isPassed = IsValidSize(orderBlocksCount);
|
||||
if (!isPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Related Order Block ...
|
||||
isPassed = false;
|
||||
for (int j = 0; j < orderBlocksCount; j++)
|
||||
{
|
||||
//
|
||||
XZone jOrderBlock = orderBlocksState.bearishOrderBlocks[j];
|
||||
|
||||
//
|
||||
bool isOrderBlockInsideZone = IsSupplyZoneOrderBlock(
|
||||
iSupplyZone,
|
||||
jOrderBlock //
|
||||
);
|
||||
if (isOrderBlockInsideZone)
|
||||
{
|
||||
//
|
||||
isPassed = true;
|
||||
iBearishOrderBlock = jOrderBlock;
|
||||
conditions.bearishOrderBlock = jOrderBlock;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
isPassed = false;
|
||||
int fairValueGapsCount = ArraySize(fvgsState.bearishFVGs);
|
||||
isPassed = IsValidSize(fairValueGapsCount);
|
||||
if (!isPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Related Fair Value Gaps ...
|
||||
isPassed = false;
|
||||
for (int j = 0; j < fairValueGapsCount; j++)
|
||||
{
|
||||
//
|
||||
XZone jFVG = fvgsState.bearishFVGs[j];
|
||||
|
||||
//
|
||||
bool isBelongs = IsBearishOrderBlockFVG(
|
||||
iBearishOrderBlock,
|
||||
jFVG //
|
||||
);
|
||||
if (isBelongs)
|
||||
{
|
||||
//
|
||||
iBearishFVG = jFVG;
|
||||
conditions.bearishFVG = jFVG;
|
||||
|
||||
//
|
||||
isPassed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (!isPassed)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (isPassed)
|
||||
// {
|
||||
// //
|
||||
// DrawSupplyZone(iSupplyZone);
|
||||
// DrawBearishOrderBlock(iBearishOrderBlock);
|
||||
// DrawBearishFVG(iBearishFVG);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//
|
||||
XZone iBullishOrderBlock;
|
||||
XZone iBullishFVG;
|
||||
|
||||
//
|
||||
bool isPassed = false;
|
||||
int orderBlocksCount = ArraySize(orderBlocksState.bullishOrderBlocks);
|
||||
isPassed = IsValidSize(orderBlocksCount);
|
||||
if (!isPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Related Order Block ...
|
||||
isPassed = false;
|
||||
for (int j = 0; j < orderBlocksCount; j++)
|
||||
{
|
||||
//
|
||||
XZone jOrderBlock = orderBlocksState.bullishOrderBlocks[j];
|
||||
|
||||
//
|
||||
bool isOrderBlockInsideZone = IsDemandZoneOrderBlock(
|
||||
iDemandZone,
|
||||
jOrderBlock //
|
||||
);
|
||||
if (isOrderBlockInsideZone)
|
||||
{
|
||||
//
|
||||
isPassed = true;
|
||||
iBullishOrderBlock = jOrderBlock;
|
||||
conditions.bullishOrderBlock = jOrderBlock;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
isPassed = false;
|
||||
int fairValueGapsCount = ArraySize(fvgsState.bullishFVGs);
|
||||
isPassed = IsValidSize(fairValueGapsCount);
|
||||
if (!isPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Related Fair Value Gaps ...
|
||||
isPassed = false;
|
||||
for (int j = 0; j < fairValueGapsCount; j++)
|
||||
{
|
||||
//
|
||||
XZone jFVG = fvgsState.bullishFVGs[j];
|
||||
|
||||
//
|
||||
bool isBelongs = IsBullishOrderBlockFVG(
|
||||
iBullishOrderBlock,
|
||||
jFVG //
|
||||
);
|
||||
if (isBelongs)
|
||||
{
|
||||
//
|
||||
iBullishFVG = jFVG;
|
||||
conditions.bullishFVG = jFVG;
|
||||
|
||||
//
|
||||
isPassed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (!isPassed)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (isPassed)
|
||||
// {
|
||||
// //
|
||||
// DrawDemandZone(iDemandZone);
|
||||
// DrawBullishOrderBlock(iBullishOrderBlock);
|
||||
// DrawBullishFVG(iBullishFVG);
|
||||
// }
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Tools Functions ...
|
||||
|
||||
/**
|
||||
* Check an Order Block belongs to a Supply Zone ...
|
||||
*
|
||||
* @param supply: XZone instance ...
|
||||
* @param orderBlock: XZone instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSupplyZoneOrderBlock(
|
||||
XZone &supply,
|
||||
XZone &orderBlock //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = supply.IsValid() &&
|
||||
orderBlock.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
orderBlock.upper <= supply.upper;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check an Order Block belongs to a Demand Zone ...
|
||||
*
|
||||
* @param demand: XZone instance ...
|
||||
* @param orderBlock: XZone instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsDemandZoneOrderBlock(
|
||||
XZone &demand,
|
||||
XZone &orderBlock //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = demand.IsValid() &&
|
||||
orderBlock.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
orderBlock.lower >= demand.lower;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Bearish FVG belongs to a Bearish Order Block ...
|
||||
*
|
||||
* @param orderBlock: XZone instance ...
|
||||
* @param fvg: XZone instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsBearishOrderBlockFVG(
|
||||
XZone &orderBlock,
|
||||
XZone &fvg //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = fvg.IsValid() &&
|
||||
orderBlock.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
fvg.upper <= orderBlock.upper &&
|
||||
fvg.upper > orderBlock.lower;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Bullish FVG belongs to a Bullish Order Block ...
|
||||
*
|
||||
* @param orderBlock: XZone instance ...
|
||||
* @param fvg: XZone instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsBullishOrderBlockFVG(
|
||||
XZone &orderBlock,
|
||||
XZone &fvg //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = fvg.IsValid() &&
|
||||
orderBlock.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
fvg.lower >= orderBlock.lower &&
|
||||
fvg.lower < orderBlock.upper;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user