last ...
This commit is contained in:
@@ -27,9 +27,6 @@
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// All Available POI(s) ...
|
||||
enum ENUM_XPOIS
|
||||
@@ -76,6 +73,8 @@ enum ENUM_XPOIS
|
||||
// Event Types ...
|
||||
enum ENUM_XPOI_EVENTS
|
||||
{
|
||||
//
|
||||
X_POI_EVENT_NONE,
|
||||
//
|
||||
// Trading Days ...
|
||||
X_TRADE_DAY_FIRST_BAR, // Trading Day First Bar ...
|
||||
@@ -3392,7 +3391,8 @@ class XCSupplyZone : public XCBarZone
|
||||
*/
|
||||
bool Init(
|
||||
XOHCL &bar,
|
||||
int range = 0 //
|
||||
int range = 0,
|
||||
bool useRangeAsStart = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -3427,7 +3427,10 @@ class XCSupplyZone : public XCBarZone
|
||||
int periodSeconds = PeriodSeconds(bar.period);
|
||||
|
||||
//
|
||||
datetime from = (datetime)((int)time - (range * periodSeconds));
|
||||
datetime from =
|
||||
!useRangeAsStart
|
||||
? (datetime)((int)time - (range * periodSeconds))
|
||||
: time;
|
||||
datetime to = (datetime)((int)time + (range * periodSeconds));
|
||||
|
||||
//
|
||||
@@ -3502,7 +3505,8 @@ class XCDemandZone : public XCBarZone
|
||||
*/
|
||||
bool Init(
|
||||
XOHCL &bar,
|
||||
int range = 0 //
|
||||
int range = 0,
|
||||
bool useRangeAsStart = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -3537,7 +3541,10 @@ class XCDemandZone : public XCBarZone
|
||||
int periodSeconds = PeriodSeconds(bar.period);
|
||||
|
||||
//
|
||||
datetime from = (datetime)((int)time - (range * periodSeconds));
|
||||
datetime from =
|
||||
!useRangeAsStart
|
||||
? (datetime)((int)time - (range * periodSeconds))
|
||||
: time;
|
||||
datetime to = (datetime)((int)time + (range * periodSeconds));
|
||||
|
||||
//
|
||||
@@ -5168,633 +5175,6 @@ class XCSession : public XCFromToZone
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
// Model Exists Founded POIs ...
|
||||
struct XPOIState
|
||||
{
|
||||
//
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime time;
|
||||
|
||||
//
|
||||
XCTicksZone *ticksZone; // Ticks Zone ...
|
||||
|
||||
//
|
||||
XCSwing *swingHighs[]; // Holds Founded Swing Highs ...
|
||||
XCSwing *swingLows[]; // Holds Founded Swing Lows ...
|
||||
XCMomentumBar *bullishMomentumBars[]; // Holds Founded Bullish Momentum Bars ...
|
||||
XCMomentumBar *bearishMomentumBars[]; // Holds Founded Bearish Momentum Bars ...
|
||||
XCRejectionBar *bullishRejectionBars[]; // Holds Founded Bullish Rejection Bars ...
|
||||
XCRejectionBar *bearishRejectionBars[]; // 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 *bullishOrderBlocks[]; // Holds Founded Bullish Order Blocks ...
|
||||
XCOrderBlock *bearishOrderBlocks[]; // Holds Founded Bearish Order Blocks ...
|
||||
XCFVG *bullishFairValueGaps[]; // Holds Founded Bullish Fair Value Gaps ...
|
||||
XCFVG *bearishFairValueGaps[]; // Holds Founded Bearish Fair Value Gaps ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
void XPOIState()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
/**
|
||||
* Cleanup all props ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
time = NULL;
|
||||
|
||||
//
|
||||
ticksZone = NULL;
|
||||
|
||||
//
|
||||
Clean(swingHighs);
|
||||
Clean(swingLows);
|
||||
Clean(bullishMomentumBars);
|
||||
Clean(bearishMomentumBars);
|
||||
Clean(bullishRejectionBars);
|
||||
Clean(bearishRejectionBars);
|
||||
Clean(supportZones);
|
||||
Clean(resistanceZones);
|
||||
Clean(supplyZones);
|
||||
Clean(demandZones);
|
||||
Clean(bullishOrderBlocks);
|
||||
Clean(bearishOrderBlocks);
|
||||
Clean(bullishFairValueGaps);
|
||||
Clean(bearishFairValueGaps);
|
||||
|
||||
//
|
||||
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 =
|
||||
//
|
||||
IsValidSize(CountSwingHighs()) ||
|
||||
IsValidSize(CountSwingLows()) ||
|
||||
IsValidSize(CountBullishMomentumBars()) ||
|
||||
IsValidSize(CountBearishMomentumBars()) ||
|
||||
IsValidSize(CountBullishRejectionBars()) ||
|
||||
IsValidSize(CountBearishRejectionBars()) ||
|
||||
IsValidSize(CountSupportZones()) ||
|
||||
IsValidSize(CountResistanceZones()) ||
|
||||
IsValidSize(CountSupplyZones()) ||
|
||||
IsValidSize(CountDemandZones()) ||
|
||||
IsValidSize(CountBullishOrderBlocks()) ||
|
||||
IsValidSize(CountBearishOrderBlocks()) ||
|
||||
IsValidSize(CountBullishFairValueGaps()) ||
|
||||
IsValidSize(CountBearishFairValueGaps())
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill Dest State by Current State's Data ...
|
||||
*
|
||||
* @param dest: XPOIState instance, reference to specified dest ...
|
||||
*
|
||||
*/
|
||||
void Fill(XPOIState &dest)
|
||||
{
|
||||
//
|
||||
if (!IsValid() ||
|
||||
!HasChild())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
dest.symbol = symbol;
|
||||
dest.period = period;
|
||||
dest.time = time;
|
||||
|
||||
//
|
||||
Copy(
|
||||
swingHighs,
|
||||
dest.swingHighs,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
swingLows,
|
||||
dest.swingLows,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bullishMomentumBars,
|
||||
dest.bullishMomentumBars,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bearishMomentumBars,
|
||||
dest.bearishMomentumBars,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bullishRejectionBars,
|
||||
dest.bullishRejectionBars,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bearishRejectionBars,
|
||||
dest.bearishRejectionBars,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
supportZones,
|
||||
dest.supportZones,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
resistanceZones,
|
||||
dest.resistanceZones,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
supplyZones,
|
||||
dest.supplyZones,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
demandZones,
|
||||
dest.demandZones,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bullishOrderBlocks,
|
||||
dest.bullishOrderBlocks,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bearishOrderBlocks,
|
||||
dest.bearishOrderBlocks,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bullishFairValueGaps,
|
||||
dest.bullishFairValueGaps,
|
||||
false //
|
||||
);
|
||||
Copy(
|
||||
bearishFairValueGaps,
|
||||
dest.bearishFairValueGaps,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate Liquidity Percent for Specified Direction ...
|
||||
*
|
||||
* @param forDirection: ENUM_X_DIRECTION member, Specified Liquidity ...
|
||||
* @param price: Double, Specified Price ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double CalculateLiquidityPercent(
|
||||
ENUM_X_DIRECTION forDirection,
|
||||
double price = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid() ||
|
||||
ticksZone == NULL)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Normalize Price for Actions ...
|
||||
if (price <= 0)
|
||||
{
|
||||
//
|
||||
MqlTick mTick;
|
||||
bool isTickRetrieved = GetTick(
|
||||
symbol,
|
||||
mTick //
|
||||
);
|
||||
if (isTickRetrieved)
|
||||
{
|
||||
price = mTick.bid;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ticksZone
|
||||
.CalculateLiquidityPercent(
|
||||
forDirection,
|
||||
price //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Counters ...
|
||||
|
||||
//
|
||||
int CountSwingHighs()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(swingHighs);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasSwingHighs()
|
||||
{
|
||||
return IsValidSize(CountSwingHighs());
|
||||
}
|
||||
|
||||
//
|
||||
int CountSwingLows()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(swingLows);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasSwingLows()
|
||||
{
|
||||
return IsValidSize(CountSwingLows());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBullishMomentumBars()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bullishMomentumBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBullishMomentumBars()
|
||||
{
|
||||
return IsValidSize(CountBullishMomentumBars());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBearishMomentumBars()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bearishMomentumBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBearishMomentumBars()
|
||||
{
|
||||
return IsValidSize(CountBearishMomentumBars());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBullishRejectionBars()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bullishRejectionBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBullishRejectionBars()
|
||||
{
|
||||
return IsValidSize(CountBullishRejectionBars());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBearishRejectionBars()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bearishRejectionBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBearishRejectionBars()
|
||||
{
|
||||
return IsValidSize(CountBearishRejectionBars());
|
||||
}
|
||||
|
||||
//
|
||||
int CountSupportZones()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(supportZones);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasSupportZones()
|
||||
{
|
||||
return IsValidSize(CountSupportZones());
|
||||
}
|
||||
|
||||
//
|
||||
int CountResistanceZones()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(resistanceZones);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasResistanceZones()
|
||||
{
|
||||
return IsValidSize(CountResistanceZones());
|
||||
}
|
||||
|
||||
//
|
||||
int CountSupplyZones()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(supplyZones);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasSupplyZones()
|
||||
{
|
||||
return IsValidSize(CountSupplyZones());
|
||||
}
|
||||
|
||||
//
|
||||
int CountDemandZones()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(demandZones);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasDemandZones()
|
||||
{
|
||||
return IsValidSize(CountDemandZones());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBullishOrderBlocks()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bullishOrderBlocks);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBullishOrderBlocks()
|
||||
{
|
||||
return IsValidSize(CountBullishOrderBlocks());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBearishOrderBlocks()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bearishOrderBlocks);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBearishOrderBlocks()
|
||||
{
|
||||
return IsValidSize(CountBearishOrderBlocks());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBullishFairValueGaps()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bullishFairValueGaps);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBullishFairValueGaps()
|
||||
{
|
||||
return IsValidSize(CountBullishFairValueGaps());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBearishFairValueGaps()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(bearishFairValueGaps);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBearishFairValueGaps()
|
||||
{
|
||||
return IsValidSize(CountBearishFairValueGaps());
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Consolidation Zone ...
|
||||
struct XConsolidationZone
|
||||
|
||||
Reference in New Issue
Block a user