Last Works ...
This commit is contained in:
@@ -1644,4 +1644,71 @@ bool AddIfNotExists(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// State Extensions ...
|
||||
|
||||
/**
|
||||
* Check State has Bullish Trend or not ...
|
||||
*
|
||||
* @param state: XPOIState instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasBullishTrend(XPOIState &state)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// For Bullish Trends ...
|
||||
int count = ArraySize(state.swingLows);
|
||||
result = count >= 2;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL lastSwing = state.swingLows[count - 1];
|
||||
XOHCL prevSwing = state.swingLows[count - 2];
|
||||
|
||||
//
|
||||
result = lastSwing.low > prevSwing.low;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check State has Bearish Trend or not ...
|
||||
*
|
||||
* @param state: XPOIState instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasBearishTrend(XPOIState &state)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// For Bullish Trends ...
|
||||
int count = ArraySize(state.swingHighs);
|
||||
result = count >= 2;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL lastSwing = state.swingHighs[count - 1];
|
||||
XOHCL prevSwing = state.swingHighs[count - 2];
|
||||
|
||||
//
|
||||
result = lastSwing.high < prevSwing.high;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user