last ...
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
// Imports ...
|
||||
#include "../Classes/x-saherelm.base.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||
|
||||
//
|
||||
@@ -57,6 +58,180 @@ class XCMarketPatternDetector : public XCBase
|
||||
//
|
||||
// Actions / Helpers ...
|
||||
|
||||
//
|
||||
// Analysers ...
|
||||
|
||||
/**
|
||||
* Check for Price Touch Support Level ...
|
||||
*
|
||||
* @param bar: XOHCL, Specified Bar ...
|
||||
* @param supportBar: XOHCL, reference to holds Zone Bar ...
|
||||
* @param supportBox: XBoxZone, reference to holds Zone Box ...
|
||||
* @param validationLength: int, Validation Length ...
|
||||
* @param maxAllowedLoopback: int, Max Allowed Loopback to Detection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSupportTouched(
|
||||
XOHCL &bar,
|
||||
XOHCL &supportBar,
|
||||
XBoxZone &supportBox,
|
||||
int validationLength = 21,
|
||||
int maxAllowedLoopback = 1500 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
supportBar.Clean();
|
||||
supportBox.Clean();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Support Exists ...
|
||||
result = HasSupport(
|
||||
bar,
|
||||
supportBar,
|
||||
validationLength,
|
||||
maxAllowedLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
supportBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Support Box ...
|
||||
result = ToSupportBox(
|
||||
supportBar,
|
||||
supportBox //
|
||||
);
|
||||
|
||||
//
|
||||
// Retrieve Previous Bar ...
|
||||
XOHCL pBar;
|
||||
result =
|
||||
result &&
|
||||
bar.GetPreviousBar(pBar);
|
||||
|
||||
//
|
||||
// Chekc Price of Bar ...
|
||||
result =
|
||||
result &&
|
||||
pBar.low < supportBox.upper;
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
supportBar.Clean();
|
||||
supportBox.Clean();
|
||||
}
|
||||
pBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Price Touch Resistance Level ...
|
||||
*
|
||||
* @param bar: XOHCL, Specified Bar ...
|
||||
* @param supportBar: XOHCL, reference to holds Zone Bar ...
|
||||
* @param supportBox: XBoxZone, reference to holds Zone Box ...
|
||||
* @param validationLength: int, Validation Length ...
|
||||
* @param maxAllowedLoopback: int, Max Allowed Loopback to Detection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsResistanceTouched(
|
||||
XOHCL &bar,
|
||||
XOHCL &resistanceBar,
|
||||
XBoxZone &resistanceBox,
|
||||
int validationLength = 21,
|
||||
int maxAllowedLoopback = 1500 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
resistanceBar.Clean();
|
||||
resistanceBox.Clean();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Resistance Exists ...
|
||||
result = HasResistance(
|
||||
bar,
|
||||
resistanceBar,
|
||||
validationLength,
|
||||
maxAllowedLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
resistanceBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Resistance Box ...
|
||||
result = ToResistanceBox(
|
||||
resistanceBar,
|
||||
resistanceBox //
|
||||
);
|
||||
|
||||
//
|
||||
// Retrieve Previous Bar ...
|
||||
XOHCL pBar;
|
||||
result =
|
||||
result &&
|
||||
bar.GetPreviousBar(pBar);
|
||||
|
||||
//
|
||||
// Chekc Price of Bar ...
|
||||
result =
|
||||
result &&
|
||||
pBar.high > resistanceBox.lower;
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
resistanceBar.Clean();
|
||||
resistanceBox.Clean();
|
||||
}
|
||||
pBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detectors ...
|
||||
|
||||
/**
|
||||
* Check Specified Bar is Momentum Bar or not ...
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user