4681 lines
102 KiB
Plaintext
4681 lines
102 KiB
Plaintext
|
|
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Seriallize Library
|
|
// ---------------------------------------
|
|
// Name: XPOILib
|
|
// Description: All models related to POIs ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright `023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
|
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
|
|
|
//
|
|
enum ENUM_X_OBFVG_FVG_FILTERS
|
|
{
|
|
X_OBFVG_FVG_FILTER_NONE,
|
|
X_OBFVG_FVG_FILTER_INSIDE_OR,
|
|
X_OBFVG_FVG_FILTER_ABOVE_BELOW,
|
|
};
|
|
|
|
//
|
|
enum ENUM_X_OBFVG_FVG_SELECTION
|
|
{
|
|
X_OBFVG_FVG_SELECT_NONE,
|
|
X_OBFVG_FVG_SELECT_OLDEST,
|
|
X_OBFVG_FVG_SELECT_LOWEST,
|
|
X_OBFVG_FVG_SELECT_HIGHEST,
|
|
X_OBFVG_FVG_SELECT_YOUNGEST,
|
|
X_OBFVG_FVG_SELECT_HIGHEST_LOWEST,
|
|
X_OBFVG_FVG_SELECT_LOWEST_HIGHEST,
|
|
};
|
|
|
|
//
|
|
struct XSignalBox
|
|
{
|
|
//
|
|
XBoxZone ob;
|
|
XBoxZone fvg;
|
|
XBoxZone sharp;
|
|
|
|
//
|
|
double sl;
|
|
double tp;
|
|
|
|
//
|
|
// Constructor ...
|
|
XSignalBox()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleanup Model ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
sl = 0;
|
|
tp = 0;
|
|
|
|
//
|
|
ob.Clean();
|
|
fvg.Clean();
|
|
sharp.Clean();
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Validate Model ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
ob.IsValid() &&
|
|
fvg.IsValid() &&
|
|
sharp.IsValid();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Update Structure Models To Date ...
|
|
*
|
|
* @param value: datetime ...
|
|
*/
|
|
void UpdateTo(datetime value = NULL)
|
|
{
|
|
//
|
|
value = NormalizeTime(value);
|
|
|
|
//
|
|
if (ob.IsValid())
|
|
{
|
|
ob.to = value;
|
|
}
|
|
|
|
//
|
|
if (fvg.IsValid())
|
|
{
|
|
fvg.to = value;
|
|
}
|
|
|
|
//
|
|
if (sharp.IsValid())
|
|
{
|
|
sharp.to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
//
|
|
// Model State Parsing ...
|
|
struct XPOIStateEvents
|
|
{
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Swings ...
|
|
bool hasNewSwing;
|
|
bool hasNewSwingLow;
|
|
bool hasNewSwingHigh;
|
|
|
|
//
|
|
// Momentums ...
|
|
bool hasNewMomentum;
|
|
bool hasNewBullishMomentum;
|
|
bool hasNewBearishMomentum;
|
|
|
|
//
|
|
// Rejections ...
|
|
bool hasNewRejection;
|
|
bool hasNewBullishRejection;
|
|
bool hasNewBearishRejection;
|
|
|
|
//
|
|
// Pullbacks ...
|
|
bool hasNewPullback;
|
|
bool hasNewBullishPullback;
|
|
bool hasNewBearishPullback;
|
|
|
|
//
|
|
// Support/Resistance (s) ...
|
|
bool hasNewSupportZone;
|
|
bool hasNewResistanceZone;
|
|
|
|
//
|
|
// Supply/Demand (s) ...
|
|
bool hasNewSupplyZone;
|
|
bool hasNewDemandZone;
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
bool hasNewFairValueGap;
|
|
bool hasNewBullishFairValueGap;
|
|
bool hasNewBearishFairValueGap;
|
|
|
|
//
|
|
// Order Blocks ...
|
|
bool hasNewOrderBlock;
|
|
bool hasNewBullishOrderBlock;
|
|
bool hasNewBearishOrderBlock;
|
|
|
|
//
|
|
// Spikes ...
|
|
bool hasNewSpike;
|
|
bool hasNewBullishSpike;
|
|
bool hasNewBearishSpike;
|
|
|
|
//
|
|
// Sharps ...
|
|
bool hasNewSharp;
|
|
bool hasNewBullishSharp;
|
|
bool hasNewBearishSharp;
|
|
|
|
//
|
|
// Consolidation Zones ...
|
|
bool hasNewConsolidationZone;
|
|
bool hasNewBullishConsolidationZone;
|
|
bool hasNewBearishConsolidationZone;
|
|
|
|
//
|
|
// Constructor ...
|
|
XPOIStateEvents()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleanup Model ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
hasNewSwing = false;
|
|
hasNewSwingLow = false;
|
|
hasNewSwingHigh = false;
|
|
|
|
//
|
|
hasNewMomentum = false;
|
|
hasNewBullishMomentum = false;
|
|
hasNewBearishMomentum = false;
|
|
|
|
//
|
|
hasNewRejection = false;
|
|
hasNewBullishRejection = false;
|
|
hasNewBearishRejection = false;
|
|
|
|
//
|
|
hasNewSupportZone = false;
|
|
hasNewResistanceZone = false;
|
|
|
|
//
|
|
hasNewSupplyZone = false;
|
|
hasNewDemandZone = false;
|
|
|
|
//
|
|
hasNewFairValueGap = false;
|
|
hasNewBullishFairValueGap = false;
|
|
hasNewBearishFairValueGap = false;
|
|
|
|
//
|
|
hasNewOrderBlock = false;
|
|
hasNewBullishOrderBlock = false;
|
|
hasNewBearishOrderBlock = false;
|
|
|
|
//
|
|
hasNewSpike = false;
|
|
hasNewBullishSpike = false;
|
|
hasNewBearishSpike = false;
|
|
|
|
//
|
|
hasNewSharp = false;
|
|
hasNewBullishSharp = false;
|
|
hasNewBearishSharp = false;
|
|
|
|
//
|
|
hasNewConsolidationZone = false;
|
|
hasNewBullishConsolidationZone = false;
|
|
hasNewBearishConsolidationZone = false;
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Initialize Event Parser Model ...
|
|
*
|
|
* @param events: ENUM_XPOI_EVENTS members Collection Reference ...
|
|
*/
|
|
void Init(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
//
|
|
hasNewSwing = HasNewSwing(events);
|
|
hasNewSwingLow = HasNewSwingLow(events);
|
|
hasNewSwingHigh = HasNewSwingHigh(events);
|
|
|
|
//
|
|
hasNewMomentum = HasNewMomentum(events);
|
|
hasNewBullishMomentum = HasNewBullishMomentum(events);
|
|
hasNewBearishMomentum = HasNewBearishMomentum(events);
|
|
|
|
//
|
|
hasNewRejection = HasNewRejection(events);
|
|
hasNewBullishRejection = HasNewBullishRejection(events);
|
|
hasNewBearishRejection = HasNewBearishRejection(events);
|
|
|
|
//
|
|
hasNewPullback = HasNewPullback(events);
|
|
hasNewBullishPullback = HasNewBullishPullback(events);
|
|
hasNewBearishPullback = HasNewBearishPullback(events);
|
|
|
|
//
|
|
hasNewSupportZone = HasNewSupportZone(events);
|
|
hasNewResistanceZone = HasNewResistanceZone(events);
|
|
|
|
//
|
|
hasNewSupplyZone = HasNewSupplyZone(events);
|
|
hasNewDemandZone = HasNewDemandZone(events);
|
|
|
|
//
|
|
hasNewFairValueGap = HasNewFairValueGap(events);
|
|
hasNewBullishFairValueGap = HasNewBullishFairValueGap(events);
|
|
hasNewBearishFairValueGap = HasNewBearishFairValueGap(events);
|
|
|
|
//
|
|
hasNewOrderBlock = HasNewOrderBlock(events);
|
|
hasNewBullishOrderBlock = HasNewBullishOrderBlock(events);
|
|
hasNewBearishOrderBlock = HasNewBearishOrderBlock(events);
|
|
|
|
//
|
|
hasNewSpike = HasNewSpike(events);
|
|
hasNewBullishSpike = HasNewBullishSpike(events);
|
|
hasNewBearishSpike = HasNewBearishSpike(events);
|
|
|
|
//
|
|
hasNewSharp = HasNewSharp(events);
|
|
hasNewBullishSharp = HasNewBullishSharp(events);
|
|
hasNewBearishSharp = HasNewBearishSharp(events);
|
|
|
|
//
|
|
hasNewConsolidationZone = HasNewConsolidationZone(events);
|
|
hasNewBullishConsolidationZone = HasNewBullishConsolidationZone(events);
|
|
hasNewBearishConsolidationZone = HasNewBearishConsolidationZone(events);
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
//
|
|
// Model Exists Founded POIs ...
|
|
struct XPOIState
|
|
{
|
|
//
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
XCSwing *swings[]; // Holds Founded Swing ...
|
|
XCSwing *swingLows[]; // Holds Founded Swing Lows ...
|
|
XCSwing *swingHighs[]; // Holds Founded Swing Highs ...
|
|
|
|
//
|
|
XCMomentumBar *momentums[]; // Holds Founded Momentum Bars ...
|
|
XCMomentumBar *bullishMomentums[]; // Holds Founded Bullish Momentum Bars ...
|
|
XCMomentumBar *bearishMomentums[]; // Holds Founded Bearish Momentum Bars ...
|
|
|
|
//
|
|
XCRejectionBar *rejections[]; // Holds Founded Rejection Bars ...
|
|
XCRejectionBar *bullishRejections[]; // Holds Founded Bullish Rejection Bars ...
|
|
XCRejectionBar *bearishRejections[]; // Holds Founded Bearish Rejection Bars ...
|
|
|
|
//
|
|
XCSupportZone *supportZones[]; // Holds Founded Support Zones ...
|
|
XCResistanceZone *resistanceZones[]; // Holds Founded Resistance Zones ...
|
|
|
|
//
|
|
XCSupplyZone *supplyZones[]; // Holds Founded Supply Zones ...
|
|
XCDemandZone *demandZones[]; // Holds Founded Demand Zones ...
|
|
|
|
//
|
|
XCOrderBlock *orderBlocks[]; // Holds Founded Order Blocks ...
|
|
XCOrderBlock *bullishOrderBlocks[]; // Holds Founded Bullish Order Blocks ...
|
|
XCOrderBlock *bearishOrderBlocks[]; // Holds Founded Bearish Order Blocks ...
|
|
|
|
//
|
|
XCFVG *fairValueGaps[]; // Holds Founded Fair Value Gaps ...
|
|
XCFVG *bullishFairValueGaps[]; // Holds Founded Bullish Fair Value Gaps ...
|
|
XCFVG *bearishFairValueGaps[]; // Holds Founded Bearish Fair Value Gaps ...
|
|
|
|
//
|
|
XConsolidationZone consolidationZones[]; // Holds Founded Consolidation Zones ...
|
|
XConsolidationZone bullishConsolidationZones[]; // Holds Founded Bullish Consolidation Zones ...
|
|
XConsolidationZone bearishConsolidationZones[]; // Holds Founded Bearih Consolidation Zones ...
|
|
|
|
//
|
|
XBoxZone spikes[]; // Holds Founded Spikes ...
|
|
XBoxZone bullishSpikes[]; // Holds Founded Bullish Spikes ...
|
|
XBoxZone bearishSpikes[]; // Holds Founded Bearih Spikes ...
|
|
|
|
//
|
|
XBoxZone sharps[]; // Holds Founded Sharps ...
|
|
XBoxZone bullishSharps[]; // Holds Founded Bullish Sharps ...
|
|
XBoxZone bearishSharps[]; // Holds Founded Bearih Sharps ...
|
|
|
|
//
|
|
XBoxZone pullbacks[]; // Holds Founded Pullbacks ...
|
|
XBoxZone bullishPullbacks[]; // Holds Founded Bullish Pullbacks ...
|
|
XBoxZone bearishPullbacks[]; // Holds Founded Bearish Pullbacks ...
|
|
|
|
//
|
|
// Constructor ...
|
|
void XPOIState()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Actions ...
|
|
|
|
/**
|
|
* Cleanup all props ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
time = NULL;
|
|
symbol = NULL;
|
|
period = NULL;
|
|
|
|
//
|
|
// Swings ...
|
|
Clean(swings);
|
|
Clean(swingLows);
|
|
Clean(swingHighs);
|
|
|
|
//
|
|
// Momentums ...
|
|
Clean(momentums);
|
|
Clean(bullishMomentums);
|
|
Clean(bearishMomentums);
|
|
|
|
//
|
|
// Rejections ...
|
|
Clean(rejections);
|
|
Clean(bullishRejections);
|
|
Clean(bearishRejections);
|
|
|
|
//
|
|
// Support / Resistance Zones ...
|
|
Clean(supportZones);
|
|
Clean(resistanceZones);
|
|
|
|
//
|
|
// Supply / Demand Zones ...
|
|
Clean(supplyZones);
|
|
Clean(demandZones);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
Clean(fairValueGaps);
|
|
Clean(bullishFairValueGaps);
|
|
Clean(bearishFairValueGaps);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
Clean(orderBlocks);
|
|
Clean(bullishOrderBlocks);
|
|
Clean(bearishOrderBlocks);
|
|
|
|
//
|
|
// Spikes ...
|
|
Clean(spikes);
|
|
Clean(bullishSpikes);
|
|
Clean(bearishSpikes);
|
|
|
|
//
|
|
// Sharps ...
|
|
Clean(sharps);
|
|
Clean(bullishSharps);
|
|
Clean(bearishSharps);
|
|
|
|
//
|
|
// Pullbaks ...
|
|
Clean(pullbacks);
|
|
Clean(bullishPullbacks);
|
|
Clean(bearishPullbacks);
|
|
|
|
//
|
|
// Consolidation Zones ...
|
|
Clean(consolidationZones);
|
|
Clean(bullishConsolidationZones);
|
|
Clean(bearishConsolidationZones);
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Validate ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
IsSpecifiedValid(symbol) &&
|
|
IsSpecifiedValid(period) &&
|
|
IsSpecifiedValid(time);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Check State has Childs or not ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool HasChild()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
// Swings ...
|
|
HasSwings() ||
|
|
HasSwingLows() ||
|
|
HasSwingHighs() ||
|
|
//
|
|
// Momentums ...
|
|
HasMomentums() ||
|
|
HasBullishMomentums() ||
|
|
HasBearishMomentums() ||
|
|
//
|
|
// Rejections ...
|
|
HasRejections() ||
|
|
HasBullishRejections() ||
|
|
HasBearishRejections() ||
|
|
//
|
|
// Pullbacks ...
|
|
HasPullbacks() ||
|
|
HasBullishPullbacks() ||
|
|
HasBearishPullbacks() ||
|
|
//
|
|
// Support / Resistance Zones ...
|
|
HasSupportZones() ||
|
|
HasResistanceZones() ||
|
|
//
|
|
// Supply / Demand Zones ...
|
|
HasSupplyZones() ||
|
|
HasDemandZones() ||
|
|
//
|
|
// Fair Value Gaps ...
|
|
HasFairValueGaps() ||
|
|
HasBullishFairValueGaps() ||
|
|
HasBearishFairValueGaps() ||
|
|
//
|
|
// Order Blocks ...
|
|
HasOrderBlocks() ||
|
|
HasBullishOrderBlocks() ||
|
|
HasBearishOrderBlocks() ||
|
|
//
|
|
// Spikes ...
|
|
HasSpikes() ||
|
|
HasBullishSpikes() ||
|
|
HasBearishSpikes() ||
|
|
//
|
|
// Sharps ...
|
|
HasSharps() ||
|
|
HasBullishSharps() ||
|
|
HasBearishSharps() ||
|
|
//
|
|
// Consolidation Zones ...
|
|
HasConsolidationZones() ||
|
|
HasBullishConsolidationZones() ||
|
|
HasBearishConsolidationZones()
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Checkers ...
|
|
|
|
//
|
|
// Swings ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasSwings()
|
|
{
|
|
return HasChild(swings);
|
|
}
|
|
|
|
//
|
|
bool HasSwingLows()
|
|
{
|
|
return HasChild(swingLows);
|
|
}
|
|
|
|
//
|
|
bool HasSwingHighs()
|
|
{
|
|
return HasChild(swingHighs);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountSwings()
|
|
{
|
|
return ArraySize(swings);
|
|
}
|
|
|
|
//
|
|
int CountSwingLows()
|
|
{
|
|
return ArraySize(swingLows);
|
|
}
|
|
|
|
//
|
|
int CountSwingHighs()
|
|
{
|
|
return ArraySize(swingHighs);
|
|
}
|
|
|
|
//
|
|
// Momentums ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasMomentums()
|
|
{
|
|
return HasChild(momentums);
|
|
}
|
|
|
|
//
|
|
bool HasBullishMomentums()
|
|
{
|
|
return HasChild(bullishMomentums);
|
|
}
|
|
|
|
//
|
|
bool HasBearishMomentums()
|
|
{
|
|
return HasChild(bearishMomentums);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountMomentums()
|
|
{
|
|
return ArraySize(momentums);
|
|
}
|
|
|
|
//
|
|
int CountBullishMomentums()
|
|
{
|
|
return ArraySize(bullishMomentums);
|
|
}
|
|
|
|
//
|
|
int CountBearishMomentums()
|
|
{
|
|
return ArraySize(bearishMomentums);
|
|
}
|
|
|
|
//
|
|
// Rejections ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasRejections()
|
|
{
|
|
return HasChild(rejections);
|
|
}
|
|
|
|
//
|
|
bool HasBullishRejections()
|
|
{
|
|
return HasChild(bullishRejections);
|
|
}
|
|
|
|
//
|
|
bool HasBearishRejections()
|
|
{
|
|
return HasChild(bearishRejections);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountRejections()
|
|
{
|
|
return ArraySize(rejections);
|
|
}
|
|
|
|
//
|
|
int CountBullishRejections()
|
|
{
|
|
return ArraySize(bullishRejections);
|
|
}
|
|
|
|
//
|
|
int CountBearishRejections()
|
|
{
|
|
return ArraySize(bearishRejections);
|
|
}
|
|
|
|
//
|
|
// Pullbacks ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasPullbacks()
|
|
{
|
|
return HasChild(pullbacks);
|
|
}
|
|
|
|
//
|
|
bool HasBullishPullbacks()
|
|
{
|
|
return HasChild(bullishPullbacks);
|
|
}
|
|
|
|
//
|
|
bool HasBearishPullbacks()
|
|
{
|
|
return HasChild(bearishPullbacks);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountPullbacks()
|
|
{
|
|
return ArraySize(pullbacks);
|
|
}
|
|
|
|
//
|
|
int CountBullishPullbacks()
|
|
{
|
|
return ArraySize(bullishPullbacks);
|
|
}
|
|
|
|
//
|
|
int CountBearishPullbacks()
|
|
{
|
|
return ArraySize(bearishPullbacks);
|
|
}
|
|
|
|
//
|
|
// Support / Resistance Zones ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasSupportZones()
|
|
{
|
|
return HasChild(supportZones);
|
|
}
|
|
|
|
//
|
|
bool HasResistanceZones()
|
|
{
|
|
return HasChild(resistanceZones);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountSupportZones()
|
|
{
|
|
return ArraySize(supportZones);
|
|
}
|
|
|
|
//
|
|
int CountResistanceZones()
|
|
{
|
|
return ArraySize(resistanceZones);
|
|
}
|
|
|
|
//
|
|
// Supply / Demand Zones ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasSupplyZones()
|
|
{
|
|
return HasChild(supplyZones);
|
|
}
|
|
|
|
//
|
|
bool HasDemandZones()
|
|
{
|
|
return HasChild(demandZones);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountSupplyZones()
|
|
{
|
|
return ArraySize(supplyZones);
|
|
}
|
|
|
|
//
|
|
int CountDemandZones()
|
|
{
|
|
return ArraySize(demandZones);
|
|
}
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasFairValueGaps()
|
|
{
|
|
return HasChild(fairValueGaps);
|
|
}
|
|
|
|
//
|
|
bool HasBullishFairValueGaps()
|
|
{
|
|
return HasChild(bullishFairValueGaps);
|
|
}
|
|
|
|
//
|
|
bool HasBearishFairValueGaps()
|
|
{
|
|
return HasChild(bearishFairValueGaps);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountFairValueGaps()
|
|
{
|
|
return ArraySize(fairValueGaps);
|
|
}
|
|
|
|
//
|
|
int CountBullishFairValueGaps()
|
|
{
|
|
return ArraySize(bullishFairValueGaps);
|
|
}
|
|
|
|
//
|
|
int CountBearishFairValueGaps()
|
|
{
|
|
return ArraySize(bearishFairValueGaps);
|
|
}
|
|
|
|
//
|
|
// Order Blocks ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasOrderBlocks()
|
|
{
|
|
return HasChild(orderBlocks);
|
|
}
|
|
|
|
//
|
|
bool HasBullishOrderBlocks()
|
|
{
|
|
return HasChild(bullishOrderBlocks);
|
|
}
|
|
|
|
//
|
|
bool HasBearishOrderBlocks()
|
|
{
|
|
return HasChild(bearishOrderBlocks);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountOrderBlocks()
|
|
{
|
|
return ArraySize(orderBlocks);
|
|
}
|
|
|
|
//
|
|
int CountBullishOrderBlocks()
|
|
{
|
|
return ArraySize(bullishOrderBlocks);
|
|
}
|
|
|
|
//
|
|
int CountBearishOrderBlocks()
|
|
{
|
|
return ArraySize(bearishOrderBlocks);
|
|
}
|
|
|
|
//
|
|
// Spikes ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasSpikes()
|
|
{
|
|
return HasChild(spikes);
|
|
}
|
|
|
|
//
|
|
bool HasBullishSpikes()
|
|
{
|
|
return HasChild(bullishSpikes);
|
|
}
|
|
|
|
//
|
|
bool HasBearishSpikes()
|
|
{
|
|
return HasChild(bearishSpikes);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountSpikes()
|
|
{
|
|
return ArraySize(spikes);
|
|
}
|
|
|
|
//
|
|
int CountBullishSpikes()
|
|
{
|
|
return ArraySize(bullishSpikes);
|
|
}
|
|
|
|
//
|
|
int CountBearishSpikes()
|
|
{
|
|
return ArraySize(bearishSpikes);
|
|
}
|
|
|
|
//
|
|
// Sharps ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasSharps()
|
|
{
|
|
return HasChild(sharps);
|
|
}
|
|
|
|
//
|
|
bool HasBullishSharps()
|
|
{
|
|
return HasChild(bullishSharps);
|
|
}
|
|
|
|
//
|
|
bool HasBearishSharps()
|
|
{
|
|
return HasChild(bearishSharps);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountSharps()
|
|
{
|
|
return ArraySize(sharps);
|
|
}
|
|
|
|
//
|
|
int CountBullishSharps()
|
|
{
|
|
return ArraySize(bullishSharps);
|
|
}
|
|
|
|
//
|
|
int CountBearishSharps()
|
|
{
|
|
return ArraySize(bearishSharps);
|
|
}
|
|
|
|
//
|
|
// Consolidation Zone ...
|
|
|
|
//
|
|
// Has ...
|
|
|
|
//
|
|
bool HasConsolidationZones()
|
|
{
|
|
return HasChild(consolidationZones);
|
|
}
|
|
|
|
//
|
|
bool HasBullishConsolidationZones()
|
|
{
|
|
return HasChild(bullishConsolidationZones);
|
|
}
|
|
|
|
//
|
|
bool HasBearishConsolidationZones()
|
|
{
|
|
return HasChild(bearishConsolidationZones);
|
|
}
|
|
|
|
//
|
|
// Count ...
|
|
|
|
//
|
|
int CountConsolidationZones()
|
|
{
|
|
return ArraySize(consolidationZones);
|
|
}
|
|
|
|
//
|
|
int CountBullishConsolidationZones()
|
|
{
|
|
return ArraySize(bullishConsolidationZones);
|
|
}
|
|
|
|
//
|
|
int CountBearishConsolidationZones()
|
|
{
|
|
return ArraySize(bearishConsolidationZones);
|
|
}
|
|
|
|
//
|
|
// Box Retrievers ...
|
|
|
|
//
|
|
int SupportResistancesAsBox(XBoxZone &items[])
|
|
{
|
|
//
|
|
XBoxZone tmpBoxes[];
|
|
|
|
//
|
|
ToBox(
|
|
supportZones,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
ToBox(
|
|
resistanceZones,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
int result = ArraySize(items);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int SupplyDemandsAsBox(XBoxZone &items[])
|
|
{
|
|
//
|
|
XBoxZone tmpBoxes[];
|
|
|
|
//
|
|
ToBox(
|
|
supplyZones,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
ToBox(
|
|
demandZones,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
int result = ArraySize(items);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int OrderBlocksAsBox(XBoxZone &items[])
|
|
{
|
|
//
|
|
XBoxZone tmpBoxes[];
|
|
|
|
//
|
|
ToBox(
|
|
bullishOrderBlocks,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
ToBox(
|
|
bearishOrderBlocks,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
int result = ArraySize(items);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int FairValueGapsAsBox(XBoxZone &items[])
|
|
{
|
|
//
|
|
XBoxZone tmpBoxes[];
|
|
|
|
//
|
|
ToBox(
|
|
bullishFairValueGaps,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
ToBox(
|
|
bearishFairValueGaps,
|
|
tmpBoxes //
|
|
);
|
|
Copy(
|
|
tmpBoxes,
|
|
items,
|
|
false //
|
|
);
|
|
Clean(tmpBoxes);
|
|
|
|
//
|
|
int result = ArraySize(items);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int SpikesAsBox(XBoxZone &items[])
|
|
{
|
|
//
|
|
Copy(
|
|
bullishSpikes,
|
|
items,
|
|
false //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
bearishSpikes,
|
|
items,
|
|
false //
|
|
);
|
|
|
|
//
|
|
int result = ArraySize(items);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int SharpsAsBox(XBoxZone &items[])
|
|
{
|
|
//
|
|
Copy(
|
|
bullishSharps,
|
|
items,
|
|
false //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
bearishSharps,
|
|
items,
|
|
false //
|
|
);
|
|
|
|
//
|
|
int result = ArraySize(items);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
void UpdateTo(datetime value = NULL)
|
|
{
|
|
//
|
|
value = NormalizeTime(value);
|
|
|
|
//
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
has = HasMomentums();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountMomentums();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
momentums[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishMomentums();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishMomentums();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishMomentums[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishMomentums();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishMomentums();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishMomentums[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasRejections();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountRejections();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
rejections[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishRejections();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishRejections();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishRejections[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishRejections();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishRejections();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishRejections[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasSupportZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountSupportZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
supportZones[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasResistanceZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountResistanceZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
resistanceZones[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasSupplyZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountSupplyZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
supplyZones[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasDemandZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountDemandZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
demandZones[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasOrderBlocks();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountOrderBlocks();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
orderBlocks[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishOrderBlocks();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishOrderBlocks();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishOrderBlocks[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishOrderBlocks();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishOrderBlocks();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishOrderBlocks[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasFairValueGaps();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountFairValueGaps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
fairValueGaps[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishFairValueGaps();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishFairValueGaps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishFairValueGaps[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishFairValueGaps();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishFairValueGaps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishFairValueGaps[i].To(value);
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasConsolidationZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountConsolidationZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
consolidationZones[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishConsolidationZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishConsolidationZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishConsolidationZones[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishConsolidationZones();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishConsolidationZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishConsolidationZones[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasSpikes();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountSpikes();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
spikes[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishSpikes();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishSpikes();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishSpikes[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishSpikes();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishSpikes();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishSpikes[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasSharps();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountSharps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
sharps[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBullishSharps();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBullishSharps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bullishSharps[i].to = value;
|
|
}
|
|
}
|
|
|
|
//
|
|
has = HasBearishSharps();
|
|
if (has)
|
|
{
|
|
//
|
|
count = CountBearishSharps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
bearishSharps[i].to = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Filter Zones ...
|
|
|
|
//
|
|
// Support ...
|
|
int FilterSupportZones(
|
|
XCSupportZone *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasSupportZones();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BULLISH;
|
|
count = CountSupportZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCSupportZone *iZone = supportZones[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Resistance ...
|
|
int FilterResistanceZones(
|
|
XCResistanceZone *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasResistanceZones();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BEARISH;
|
|
count = CountResistanceZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCResistanceZone *iZone = resistanceZones[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Supply ...
|
|
int FilterSupplyZones(
|
|
XCSupplyZone *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasSupplyZones();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BEARISH;
|
|
count = CountSupplyZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCSupplyZone *iZone = supplyZones[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Demand ...
|
|
int FilterDemandZones(
|
|
XCDemandZone *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasDemandZones();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BULLISH;
|
|
count = CountDemandZones();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCDemandZone *iZone = demandZones[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// OrderBlock ...
|
|
int FilterOrderBlocks(
|
|
XCOrderBlock *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasOrderBlocks();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
count = CountOrderBlocks();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCOrderBlock *iZone = orderBlocks[i];
|
|
passedDir = iZone.GetDirection();
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Bullish OrderBlock ...
|
|
int FilterBullishOrderBlocks(
|
|
XCOrderBlock *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasBullishOrderBlocks();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BULLISH;
|
|
count = CountBullishOrderBlocks();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCOrderBlock *iZone = bullishOrderBlocks[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Bearish OrderBlock ...
|
|
int FilterBearishOrderBlocks(
|
|
XCOrderBlock *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasBearishOrderBlocks();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BEARISH;
|
|
count = CountBearishOrderBlocks();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCOrderBlock *iZone = bearishOrderBlocks[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// FairValueGap ...
|
|
int FilterFairValueGaps(
|
|
XCFVG *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasFairValueGaps();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
count = CountFairValueGaps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCFVG *iZone = fairValueGaps[i];
|
|
passedDir = iZone.GetDirection();
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Bullish FairValueGap ...
|
|
int FilterBullishFairValueGaps(
|
|
XCFVG *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasBullishFairValueGaps();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BULLISH;
|
|
count = CountBullishFairValueGaps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCFVG *iZone = bullishFairValueGaps[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Bearish FairValueGap ...
|
|
int FilterBearishFairValueGaps(
|
|
XCFVG *&dest[],
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int idx = -1;
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
Clean(dest);
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasBearishFairValueGaps();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL passedBar;
|
|
ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE;
|
|
passedDir = X_DIRECTION_BEARISH;
|
|
count = CountBearishFairValueGaps();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCFVG *iZone = bearishFairValueGaps[i];
|
|
|
|
//
|
|
// Check Started State ...
|
|
if (startState == XZONE_STATE_PASSED ||
|
|
startState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isStarted = iZone.IsStarted(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
startState == XZONE_STATE_FAILED
|
|
? !isStarted
|
|
: !forceStartedBodyOut
|
|
? isStarted
|
|
: isStarted &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Activation State ...
|
|
if (activeState == XZONE_STATE_PASSED ||
|
|
activeState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyIn = false;
|
|
bool isActivated = iZone.IsActivated(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyIn,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
activeState == XZONE_STATE_FAILED
|
|
? !isActivated
|
|
: !forceActivatedBodyIn
|
|
? isActivated
|
|
: isActivated &&
|
|
isBodyIn;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Break State ...
|
|
if (breakState == XZONE_STATE_PASSED ||
|
|
breakState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isBreaked = iZone.IsBreaked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
forceStartedBodyOut,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
breakState == XZONE_STATE_FAILED
|
|
? !isBreaked
|
|
: !forceBreakedBodyOut
|
|
? isBreaked
|
|
: isBreaked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Work State ...
|
|
if (workState == XZONE_STATE_PASSED ||
|
|
workState == XZONE_STATE_FAILED)
|
|
{
|
|
//
|
|
bool ignoreActivation = activeState != XZONE_STATE_PASSED;
|
|
|
|
//
|
|
bool isBodyOut = false;
|
|
bool isWorked = iZone.IsWorked(
|
|
passedDir,
|
|
passedBar,
|
|
isBodyOut,
|
|
ignoreActivation,
|
|
forceStartedBodyOut,
|
|
forceActivatedBodyIn,
|
|
forPeriod //
|
|
);
|
|
|
|
//
|
|
bool isPassed =
|
|
workState == XZONE_STATE_FAILED
|
|
? !isWorked
|
|
: !forceWorkedBodyOut
|
|
? isWorked
|
|
: isWorked &&
|
|
isBodyOut;
|
|
|
|
//
|
|
passedBar.Clean();
|
|
if (!isPassed)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Check Filtered Zone Doesn't Exists ...
|
|
has = FindIndex(
|
|
idx,
|
|
iZone,
|
|
dest //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
passedBar.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
Add(
|
|
iZone,
|
|
dest //
|
|
);
|
|
|
|
//
|
|
// End For ...
|
|
}
|
|
|
|
//
|
|
result = ArraySize(dest);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
void Filter(
|
|
XPOIState &dest,
|
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
|
//
|
|
// Start ...
|
|
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
|
|
bool forceStartedBodyOut = false,
|
|
//
|
|
// Activation ...
|
|
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
|
|
bool forceActivatedBodyIn = false,
|
|
//
|
|
// Breaktion ...
|
|
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
|
|
bool forceBreakedBodyOut = false,
|
|
//
|
|
// Works ...
|
|
ENUM_XZONE_STATE workState = XZONE_STATE_FAILED,
|
|
bool forceWorkedBodyOut = false //
|
|
)
|
|
{
|
|
//
|
|
int count = 0;
|
|
bool has = false;
|
|
|
|
//
|
|
dest.Clean();
|
|
|
|
//
|
|
if (!IsValid(forPeriod))
|
|
{
|
|
forPeriod = period;
|
|
}
|
|
|
|
//
|
|
has = IsValid() &&
|
|
HasChild();
|
|
if (!has)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
dest = this;
|
|
|
|
//
|
|
// Support Zones ...
|
|
FilterSupportZones(
|
|
dest.supportZones,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Resistance Zones ...
|
|
FilterResistanceZones(
|
|
dest.resistanceZones,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Supply Zones ...
|
|
FilterSupplyZones(
|
|
dest.supplyZones,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Demand Zones ...
|
|
FilterDemandZones(
|
|
dest.demandZones,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// OrderBlocks ...
|
|
FilterOrderBlocks(
|
|
dest.orderBlocks,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Bullish OrderBlocks ...
|
|
FilterBullishOrderBlocks(
|
|
dest.bullishOrderBlocks,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Bearish OrderBlocks ...
|
|
FilterBearishOrderBlocks(
|
|
dest.bearishOrderBlocks,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// FairValueGaps ...
|
|
FilterFairValueGaps(
|
|
dest.fairValueGaps,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Bullish FairValueGaps ...
|
|
FilterBullishFairValueGaps(
|
|
dest.bullishFairValueGaps,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
// Bearish FairValueGaps ...
|
|
FilterBearishFairValueGaps(
|
|
dest.bearishFairValueGaps,
|
|
forPeriod,
|
|
startState,
|
|
forceStartedBodyOut,
|
|
activeState,
|
|
forceActivatedBodyIn,
|
|
breakState,
|
|
forceBreakedBodyOut,
|
|
workState,
|
|
forceWorkedBodyOut //
|
|
);
|
|
|
|
//
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
//
|
|
// Extensions Functions ...
|
|
//
|
|
|
|
/**
|
|
* Get Oldest Index ...
|
|
*
|
|
* @param source: XSignalBox instance Reference Collection ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int GetOldest(
|
|
XSignalBox &source[] //
|
|
)
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
int count = ArraySize(source);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XSignalBox selected;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XSignalBox iBox = source[i];
|
|
|
|
//
|
|
bool canSet =
|
|
!selected.IsValid()
|
|
? true
|
|
: selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.fvg.from > iBox.fvg.from
|
|
: selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.fvg.from > iBox.ob.from
|
|
: !selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.ob.from > iBox.fvg.from
|
|
: !selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.ob.from > iBox.ob.from
|
|
: false;
|
|
if (canSet)
|
|
{
|
|
//
|
|
result = i;
|
|
selected = iBox;
|
|
}
|
|
}
|
|
|
|
//
|
|
selected.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Youngest Index ...
|
|
*
|
|
* @param source: XSignalBox instance Reference Collection ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int GetYoungest(
|
|
XSignalBox &source[] //
|
|
)
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
int count = ArraySize(source);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XSignalBox selected;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XSignalBox iBox = source[i];
|
|
|
|
//
|
|
bool canSet =
|
|
!selected.IsValid()
|
|
? true
|
|
: selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.fvg.from < iBox.fvg.from
|
|
: selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.fvg.from < iBox.ob.from
|
|
: !selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.ob.from < iBox.fvg.from
|
|
: !selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.ob.from < iBox.ob.from
|
|
: false;
|
|
if (canSet)
|
|
{
|
|
//
|
|
result = i;
|
|
selected = iBox;
|
|
}
|
|
}
|
|
|
|
//
|
|
selected.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Highest Index ...
|
|
*
|
|
* @param source: XSignalBox instance Reference Collection ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int GetHighest(
|
|
XSignalBox &source[] //
|
|
)
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
int count = ArraySize(source);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XSignalBox selected;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XSignalBox iBox = source[i];
|
|
|
|
//
|
|
bool canSet =
|
|
!selected.IsValid()
|
|
? true
|
|
: selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.fvg.upper < iBox.fvg.upper
|
|
: selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.fvg.upper < iBox.ob.upper
|
|
: !selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.ob.upper < iBox.fvg.upper
|
|
: !selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.ob.upper < iBox.ob.upper
|
|
: false;
|
|
if (canSet)
|
|
{
|
|
//
|
|
result = i;
|
|
selected = iBox;
|
|
}
|
|
}
|
|
|
|
//
|
|
selected.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Lowest Index ...
|
|
*
|
|
* @param source: XSignalBox instance Reference Collection ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int GetLowest(
|
|
XSignalBox &source[] //
|
|
)
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
int count = ArraySize(source);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XSignalBox selected;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XSignalBox iBox = source[i];
|
|
|
|
//
|
|
bool canSet =
|
|
!selected.IsValid()
|
|
? true
|
|
: selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.fvg.lower > iBox.fvg.lower
|
|
: selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.fvg.lower > iBox.ob.lower
|
|
: !selected.fvg.IsValid() &&
|
|
iBox.fvg.IsValid()
|
|
? selected.ob.lower > iBox.fvg.lower
|
|
: !selected.fvg.IsValid() &&
|
|
!iBox.fvg.IsValid()
|
|
? selected.ob.lower > iBox.ob.lower
|
|
: false;
|
|
if (canSet)
|
|
{
|
|
//
|
|
result = i;
|
|
selected = iBox;
|
|
}
|
|
}
|
|
|
|
//
|
|
selected.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Find Index of a Signal Box on another ...
|
|
*
|
|
* @param index: int, index of exists ...
|
|
* @param item: XSignal Box ...
|
|
* @param items: XSignal Box Collection ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool FindIndex(
|
|
int &index,
|
|
XSignalBox &item,
|
|
XSignalBox &items[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
index = -1;
|
|
int count = ArraySize(items);
|
|
|
|
//
|
|
result = item.IsValid() &&
|
|
HasChild(items);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
bool isSame = item.ob
|
|
.IsSameAs(items[i].ob);
|
|
if (isSame)
|
|
{
|
|
//
|
|
index = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
//
|
|
result = IsValidIndex(index);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Find Index of a Signal Box on another ...
|
|
*
|
|
* @param index: int, index of exists ...
|
|
* @param item: XSignal Box ...
|
|
* @param items: XSignal Box Collection ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool FindIndex(
|
|
int &index,
|
|
XBoxZone &item,
|
|
XSignalBox &items[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
index = -1;
|
|
int count = ArraySize(items);
|
|
|
|
//
|
|
result = item.IsValid() &&
|
|
HasChild(items);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
bool isSame = item.IsSameAs(items[i].ob);
|
|
if (isSame)
|
|
{
|
|
//
|
|
index = i;
|
|
break;
|
|
}
|
|
|
|
//
|
|
isSame = item.IsSameAs(items[i].fvg);
|
|
if (isSame)
|
|
{
|
|
//
|
|
index = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
//
|
|
result = IsValidIndex(index);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Add a Signal Box in a Collection if not Exists ...
|
|
*
|
|
* @param item: XSignal Box ...
|
|
* @param items: XSignal Box Collection ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool AddIfNotExists(
|
|
XSignalBox &item,
|
|
XSignalBox &items[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = item.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int idx = -1;
|
|
result = !FindIndex(
|
|
idx,
|
|
item,
|
|
items //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
AddRef(
|
|
item,
|
|
items //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XPOI State Event Parsers ...
|
|
|
|
//
|
|
// Swings ...
|
|
|
|
//
|
|
bool HasNewSwing(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewSwingLow(events) ||
|
|
HasNewSwingHigh(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewSwingLow(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_SWING_LOW_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewSwingHigh(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_SWING_HIGH_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Momentums ...
|
|
|
|
//
|
|
bool HasNewMomentum(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishMomentum(events) ||
|
|
HasNewBearishMomentum(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishMomentum(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_MOMENTUM_BAR_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishMomentum(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_MOMENTUM_BAR_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Rejections ...
|
|
|
|
//
|
|
bool HasNewRejection(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishRejection(events) ||
|
|
HasNewBearishRejection(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishRejection(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_REJECTION_BAR_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishRejection(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_REJECTION_BAR_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Support / Resistance Zones ...
|
|
|
|
//
|
|
bool HasNewSupportZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_SUPPORT_ZONE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewResistanceZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_RESISTANCE_ZONE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Supply / Demand Zones ...
|
|
|
|
//
|
|
bool HasNewSupplyZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_SUPPLY_ZONE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewDemandZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_DEMAND_ZONE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
|
|
//
|
|
bool HasNewFairValueGap(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishFairValueGap(events) ||
|
|
HasNewBearishFairValueGap(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishFairValueGap(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_FVG_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishFairValueGap(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_FVG_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Order Blocks ...
|
|
|
|
//
|
|
bool HasNewOrderBlock(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishOrderBlock(events) ||
|
|
HasNewBearishOrderBlock(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishOrderBlock(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_ORDERBLOCK_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishOrderBlock(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_ORDERBLOCK_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Spikes ...
|
|
|
|
//
|
|
bool HasNewSpike(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishSpike(events) ||
|
|
HasNewBearishSpike(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishSpike(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_SPIKE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishSpike(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_SPIKE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Sharps ...
|
|
|
|
//
|
|
bool HasNewSharp(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishSharp(events) ||
|
|
HasNewBearishSharp(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishSharp(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_SHARP_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishSharp(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_SHARP_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Pullbacks ...
|
|
|
|
//
|
|
bool HasNewPullback(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishPullback(events) ||
|
|
HasNewBearishPullback(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishPullback(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_PULLBACK_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishPullback(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_PULLBACK_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Consolidation Zones ...
|
|
|
|
//
|
|
bool HasNewConsolidationZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return HasNewBullishConsolidationZone(events) ||
|
|
HasNewBearishConsolidationZone(events);
|
|
}
|
|
|
|
//
|
|
bool HasNewBullishConsolidationZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BULLISH_CONSOLIDATION_ZONE_DETECTED,
|
|
events //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool HasNewBearishConsolidationZone(ENUM_XPOI_EVENTS &events[])
|
|
{
|
|
return Contains(
|
|
X_BEARISH_CONSOLIDATION_ZONE_DETECTED,
|
|
events //
|
|
);
|
|
}
|