Complete Detection of Swings ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+298
-213
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
#include "../Classes/x-saherelm.x-alert.class.mq5"
|
#include "../Classes/x-saherelm.x-alert.class.mq5"
|
||||||
|
#include "../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||||
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||||
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||||
|
|
||||||
@@ -239,7 +240,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
int zIndex = 0;
|
int zIndex = 0;
|
||||||
int cIndex = zIndex + 1;
|
int cIndex = zIndex + 1;
|
||||||
int pIndex = cIndex + 1;
|
int pIndex = cIndex + 1;
|
||||||
int ppIndex = pIndex + 1;
|
|
||||||
|
//
|
||||||
|
string symbol = GetSymbol();
|
||||||
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
//
|
//
|
||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
@@ -247,8 +251,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
XOHCL zBar;
|
XOHCL zBar;
|
||||||
bool isInited = zBar.Init(
|
bool isInited = zBar.Init(
|
||||||
mSymbol,
|
symbol,
|
||||||
mPeriod,
|
period,
|
||||||
zIndex //
|
zIndex //
|
||||||
);
|
);
|
||||||
if (!isInited)
|
if (!isInited)
|
||||||
@@ -259,8 +263,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
XOHCL cBar;
|
XOHCL cBar;
|
||||||
isInited = cBar.Init(
|
isInited = cBar.Init(
|
||||||
mSymbol,
|
symbol,
|
||||||
mPeriod,
|
period,
|
||||||
cIndex //
|
cIndex //
|
||||||
);
|
);
|
||||||
if (!isInited)
|
if (!isInited)
|
||||||
@@ -269,39 +273,79 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL pBar;
|
// POI Detecting ...
|
||||||
isInited = pBar.Init(
|
bool isDetect = false;
|
||||||
mSymbol,
|
|
||||||
mPeriod,
|
|
||||||
pIndex //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL ppBar;
|
// Swings ...
|
||||||
isInited = ppBar.Init(
|
int swingRange = SwingRange();
|
||||||
mSymbol,
|
if (swingRange > 0)
|
||||||
mPeriod,
|
|
||||||
ppIndex //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
{
|
||||||
return result;
|
//
|
||||||
}
|
XOHCL swingBar;
|
||||||
|
isInited = swingBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
zIndex + swingRange //
|
||||||
|
);
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Swing High ...
|
||||||
|
isDetect = DetectSwingHigh(swingBar);
|
||||||
|
if (isDetect)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_XPOI_EVENTS event = X_SWING_HIGH_DETECTED;
|
||||||
|
XCSwing *param;
|
||||||
|
bool hasItem = GetLastItem(
|
||||||
|
param,
|
||||||
|
mSwingHighs //
|
||||||
|
);
|
||||||
|
if (hasItem)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
NotifyEventListeners(
|
||||||
|
event,
|
||||||
|
param //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL zDayBar;
|
Add(
|
||||||
isInited = zDayBar.Init(
|
event,
|
||||||
mSymbol,
|
state //
|
||||||
PERIOD_D1,
|
);
|
||||||
zIndex //
|
}
|
||||||
);
|
|
||||||
if (!isInited)
|
//
|
||||||
{
|
// Swing Low ...
|
||||||
return result;
|
isDetect = DetectSwingLow(swingBar);
|
||||||
|
if (isDetect)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_XPOI_EVENTS event = X_SWING_LOW_DETECTED;
|
||||||
|
XCSwing *param;
|
||||||
|
bool hasItem = GetLastItem(
|
||||||
|
param,
|
||||||
|
mSwingLows //
|
||||||
|
);
|
||||||
|
if (hasItem)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
NotifyEventListeners(
|
||||||
|
event,
|
||||||
|
param //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
event,
|
||||||
|
state //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -355,6 +399,20 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Event Listeners ...
|
// Event Listeners ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Event Listener ...
|
||||||
|
*
|
||||||
|
* @param listener: TOnPOIEvent instance ...
|
||||||
|
*/
|
||||||
|
void AddEventListener(TOnPOIEvent listener)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
listener,
|
||||||
|
mEventListeners //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Destroy ...
|
// Destroy ...
|
||||||
|
|
||||||
@@ -363,6 +421,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
*/
|
*/
|
||||||
void DestroyPOIs()
|
void DestroyPOIs()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
Clean(mSwingHighs);
|
||||||
|
Clean(mSwingLows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,6 +438,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
*/
|
*/
|
||||||
void DestroyEventListeners()
|
void DestroyEventListeners()
|
||||||
{
|
{
|
||||||
|
Clean(mEventListeners);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -463,10 +525,18 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Swing Highs ...
|
// Swing Highs ...
|
||||||
swingHighsCount = DetectRequiredSwingHighs(barIndex);
|
swingHighsCount = DetectRequiredSwingHighs(barIndex);
|
||||||
|
if (swingHighsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mSwingHighs);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Swing Lows ...
|
// Swing Lows ...
|
||||||
swingLowsCount = DetectRequiredSwingLows(barIndex);
|
swingLowsCount = DetectRequiredSwingLows(barIndex);
|
||||||
|
if (swingHighsCount == requiredPOIs)
|
||||||
|
{
|
||||||
|
ArrayReverse(mSwingLows);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
canContinue =
|
canContinue =
|
||||||
@@ -486,10 +556,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
swingHighsCount = ArraySize(mSwingHighs);
|
|
||||||
swingLowsCount = ArraySize(mSwingLows);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unlocking Detector ...
|
// Unlocking Detector ...
|
||||||
Unlock();
|
Unlock();
|
||||||
@@ -507,11 +573,11 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
//
|
||||||
|
int swingHighsCount = ArraySize(mSwingHighs);
|
||||||
|
int swingLowsCount = ArraySize(mSwingLows);
|
||||||
// int tradingDaysCount = ArraySize(mTradingDays);
|
// int tradingDaysCount = ArraySize(mTradingDays);
|
||||||
// int marketSessionsCount = ArraySize(mMarketSessions);
|
// int marketSessionsCount = ArraySize(mMarketSessions);
|
||||||
// int swingHighsCount = ArraySize(mSwingHighs);
|
|
||||||
// int swingLowsCount = ArraySize(mSwingLows);
|
|
||||||
// int momentumBarsCount = ArraySize(mMomentumBars);
|
// int momentumBarsCount = ArraySize(mMomentumBars);
|
||||||
// int rejectionBarsCount = ArraySize(mRejectionBars);
|
// int rejectionBarsCount = ArraySize(mRejectionBars);
|
||||||
// int supportZonesCount = ArraySize(mSupportZones);
|
// int supportZonesCount = ArraySize(mSupportZones);
|
||||||
@@ -523,11 +589,38 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
// int bullishFVGsCount = ArraySize(mBullishFVGs);
|
// int bullishFVGsCount = ArraySize(mBullishFVGs);
|
||||||
// int bearishFVGsCount = ArraySize(mBearishFVGs);
|
// int bearishFVGsCount = ArraySize(mBearishFVGs);
|
||||||
|
|
||||||
// //
|
//
|
||||||
// int from = 0;
|
int from = 0;
|
||||||
// int requiredPOIs = MaxNumberOfRequiredPOIs();
|
int requiredPOIs = MaxNumberOfRequiredPOIs();
|
||||||
// int count = maxAllowed - requiredPOIs;
|
int count = maxAllowed - requiredPOIs;
|
||||||
// int to = count - 1;
|
int to = count - 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swings ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Highs ...
|
||||||
|
if (swingHighsCount >= maxAllowed)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
|
mSwingHighs,
|
||||||
|
from,
|
||||||
|
count //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Lows ...
|
||||||
|
if (swingLowsCount >= maxAllowed)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
|
mSwingLows,
|
||||||
|
from,
|
||||||
|
count //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// //
|
// //
|
||||||
// // Trading Days ...
|
// // Trading Days ...
|
||||||
@@ -601,45 +694,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// //
|
|
||||||
// // Swing High and Low (s) ...
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Swing Highs ...
|
|
||||||
// if (swingHighsCount >= maxAllowed)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// ArrayRemove(
|
|
||||||
// mSwingHighs,
|
|
||||||
// from,
|
|
||||||
// count //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// mSwingHighObjects.DeleteRange(
|
|
||||||
// from,
|
|
||||||
// to //
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Swing Lows ...
|
|
||||||
// if (swingLowsCount >= maxAllowed)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// ArrayRemove(
|
|
||||||
// mSwingLows,
|
|
||||||
// from,
|
|
||||||
// count //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// mSwingLowObjects.DeleteRange(
|
|
||||||
// from,
|
|
||||||
// to //
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
// //
|
||||||
// // Support and Resistance Zones ...
|
// // Support and Resistance Zones ...
|
||||||
|
|
||||||
@@ -799,6 +853,35 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify Event Listeners ...
|
||||||
|
*
|
||||||
|
* @param event: ENUM_XPOI_EVENTS member, Specified Occured Event ...
|
||||||
|
* @param param: XCBasePOI implementation, Specified Event Object ...
|
||||||
|
*/
|
||||||
|
void NotifyEventListeners(
|
||||||
|
ENUM_XPOI_EVENTS event,
|
||||||
|
XCBasePOI *param //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = ArraySize(mEventListeners);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mEventListeners[i](
|
||||||
|
event,
|
||||||
|
param //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AddObjectIfNotExists(XCBaseObject *object)
|
void AddObjectIfNotExists(XCBaseObject *object)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -847,8 +930,12 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
int mMaxNumberOfRequiredPOIs; // Max Allowed Number of POI(s) which Must Find at Initializion Time ...
|
int mMaxNumberOfRequiredPOIs; // Max Allowed Number of POI(s) which Must Find at Initializion Time ...
|
||||||
|
|
||||||
//
|
//
|
||||||
CArrayObj mDrawnObjects; // Drawn Objects ...
|
CArrayObj mDrawnObjects; // Drawn Objects ...
|
||||||
XBarTracker mBarTracker; // Market Bar Tracker ...
|
XBarTracker mBarTracker; // Market Bar Tracker ...
|
||||||
|
XCBarAnalyser mBarAnalyser; // Bar Analyser ...
|
||||||
|
|
||||||
|
//
|
||||||
|
TOnPOIEvent mEventListeners[]; // Event Listeners ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// POI Props ...
|
// POI Props ...
|
||||||
@@ -865,8 +952,80 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Swing High ...
|
// Swing High ...
|
||||||
|
|
||||||
|
//
|
||||||
XCSwing *mSwingHighs[]; // Holds Founded Swing Highs ...
|
XCSwing *mSwingHighs[]; // Holds Founded Swing Highs ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Swing High ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectSwingHigh(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int range = SwingRange();
|
||||||
|
int barIndex = bar.Index();
|
||||||
|
result = range > 0 &&
|
||||||
|
barIndex >= range;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mBarAnalyser.IsSwingHigh(
|
||||||
|
bar,
|
||||||
|
range //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *swing;
|
||||||
|
swing = new XCSwing();
|
||||||
|
result = swing.Init(
|
||||||
|
bar,
|
||||||
|
X_POI_SWING_HIGH //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
swing,
|
||||||
|
mSwingHighs //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSwingHighObject *iObj;
|
||||||
|
bool isCreated = mDrawer.CreateSwingHigh(
|
||||||
|
swing,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
AddObjectIfNotExists(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Required Swing Highs ...
|
* Detect Required Swing Highs ...
|
||||||
*
|
*
|
||||||
@@ -926,61 +1085,67 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSwing = true;
|
DetectSwingHigh(bar);
|
||||||
for (int i = 1; i <= range; i++)
|
|
||||||
|
//
|
||||||
|
result = ArraySize(mSwingHighs);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Swing Low ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSwing *mSwingLows[]; // Holds Founded Swing Lows ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Swing Low ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectSwingLow(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
return result;
|
||||||
// Prev Bar ...
|
|
||||||
XOHCL iPrevBar;
|
|
||||||
isInited = iPrevBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
barIndex + i //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isSwing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Next Bar ...
|
|
||||||
XOHCL iNextBar;
|
|
||||||
isInited = iNextBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
barIndex - i //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isSwing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
isSwing = bar.high >= iPrevBar.high &&
|
|
||||||
bar.high >= iNextBar.high;
|
|
||||||
if (!isSwing)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isSwing)
|
int range = SwingRange();
|
||||||
|
int barIndex = bar.Index();
|
||||||
|
result = range > 0 &&
|
||||||
|
barIndex >= range;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mBarAnalyser.IsSwingLow(
|
||||||
|
bar,
|
||||||
|
range //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCSwing *swing;
|
XCSwing *swing;
|
||||||
swing = new XCSwing();
|
swing = new XCSwing();
|
||||||
isInited = swing.Init(
|
result = swing.Init(
|
||||||
bar,
|
bar,
|
||||||
X_POI_SWING_HIGH //
|
X_POI_SWING_LOW //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isInited)
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
@@ -989,8 +1154,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
XCSwingHighObject *iObj;
|
XCSwingLowObject *iObj;
|
||||||
bool isCreated = mDrawer.CreateSwingHigh(
|
bool isCreated = mDrawer.CreateSwingLow(
|
||||||
swing,
|
swing,
|
||||||
iObj //
|
iObj //
|
||||||
);
|
);
|
||||||
@@ -1001,17 +1166,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
result = ArraySize(mSwingHighs);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Swing Low ...
|
|
||||||
XCSwing *mSwingLows[]; // Holds Founded Swing Lows ...
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Required Swing Lows ...
|
* Detect Required Swing Lows ...
|
||||||
*
|
*
|
||||||
@@ -1071,80 +1229,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSwing = true;
|
DetectSwingLow(bar);
|
||||||
for (int i = 1; i <= range; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Prev Bar ...
|
|
||||||
XOHCL iPrevBar;
|
|
||||||
isInited = iPrevBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
barIndex + i //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isSwing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Next Bar ...
|
|
||||||
XOHCL iNextBar;
|
|
||||||
isInited = iNextBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
barIndex - i //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isSwing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
isSwing = bar.low <= iPrevBar.low &&
|
|
||||||
bar.low <= iNextBar.low;
|
|
||||||
if (!isSwing)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isSwing)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSwing *swing;
|
|
||||||
swing = new XCSwing();
|
|
||||||
isInited = swing.Init(
|
|
||||||
bar,
|
|
||||||
X_POI_SWING_LOW //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isInited)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
swing,
|
|
||||||
mSwingLows //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
XCSwingLowObject *iObj;
|
|
||||||
bool isCreated = mDrawer.CreateSwingLow(
|
|
||||||
swing,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(iObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(mSwingHighs);
|
result = ArraySize(mSwingHighs);
|
||||||
|
|||||||
@@ -1411,14 +1411,14 @@ class XCPOIDrawer : public XCBase
|
|||||||
SubWindowIdentification(0);
|
SubWindowIdentification(0);
|
||||||
|
|
||||||
//
|
//
|
||||||
SwingLowWidth(1);
|
SwingLowWidth(2);
|
||||||
SwingLowArrow(108);
|
SwingLowArrow(108);
|
||||||
SwingLowColor(clrLime);
|
SwingLowColor(clrAqua);
|
||||||
|
|
||||||
//
|
//
|
||||||
SwingHighWidth(1);
|
SwingHighWidth(2);
|
||||||
SwingHighArrow(108);
|
SwingHighArrow(108);
|
||||||
SwingHighColor(clrRed);
|
SwingHighColor(clrMagenta);
|
||||||
|
|
||||||
//
|
//
|
||||||
BullishMomentumBarWidth(1);
|
BullishMomentumBarWidth(1);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2555,4 +2555,9 @@ string ToString(ENUM_XPOI_EVENTS value)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
typedef void (*TOnPOIEvent)(ENUM_XPOI_EVENTS event,
|
||||||
|
XCBasePOI *param //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Reference in New Issue
Block a user