last ...
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "../Classes/x-saherelm.x-chart.helper.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-guard.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-signaller.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-target.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-trade-manager.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-volume.class.mq5"
|
||||
|
||||
@@ -121,11 +122,12 @@ class XCBaseExpert : public XCBase
|
||||
|
||||
//
|
||||
XCAlert *eaAlert; // EA Scope Alert Handler ...
|
||||
XCVolume *eaVolume; // EA Scope Voluem Handler ...
|
||||
XCGuard *eaGuard; // EA Scope Guard Handler ...
|
||||
XCTrade *eaTrader; // EA Scope Trade Handler ...
|
||||
XCTradeManager *eaTradeManager; // EA Scope Trade Handler ...
|
||||
XCVolume *eaVolume; // EA Scope Voluem Handler ...
|
||||
XCTarget *eaTarget; // EA Scope Target Handler ...
|
||||
XTimeTracker eaTimeTracker; // EA Scope Time Tracker ...
|
||||
XCTradeManager *eaTradeManager; // EA Scope Trade Manager Handler ...
|
||||
|
||||
//
|
||||
// Specified Event Handlers ...
|
||||
@@ -319,6 +321,19 @@ class XCBaseExpert : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Signal Executed Event Handlers ...
|
||||
count = ArraySize(mOnSignalExecutedEventHandlers);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
eaTrader.AddOnSignalExecutedEventHandler(mOnSignalExecutedEventHandlers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize Guard Handler ...
|
||||
eaGuard = new XCGuard(
|
||||
@@ -330,13 +345,18 @@ class XCBaseExpert : public XCBase
|
||||
// Attach Event Handler ...
|
||||
eaGuard.onGuardEventListener = onGuardedEventHandler;
|
||||
|
||||
//
|
||||
// Initialize Target Handler ...
|
||||
eaTarget = new XCTarget(eaTrader, eaAlert);
|
||||
|
||||
//
|
||||
// Initialize Trae Manager ...
|
||||
eaTradeManager = new XCTradeManager(
|
||||
eaAlert,
|
||||
eaTrader,
|
||||
eaVolume,
|
||||
eaGuard //
|
||||
eaGuard,
|
||||
eaTarget //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -423,6 +443,11 @@ class XCBaseExpert : public XCBase
|
||||
delete eaVolume;
|
||||
ZeroMemory(eaVolume);
|
||||
|
||||
//
|
||||
eaTarget.Destroy();
|
||||
delete eaTarget;
|
||||
ZeroMemory(eaTarget);
|
||||
|
||||
//
|
||||
delete eaTradeManager;
|
||||
ZeroMemory(eaTradeManager);
|
||||
@@ -536,13 +561,29 @@ class XCBaseExpert : public XCBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Check For Guard Event Handler ...
|
||||
* Handle Signal Executed Event ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
* @param signal: XSignal, reference to Executed Signal ...
|
||||
*/
|
||||
void HandleOnSignalExecuted(XSignal &signal)
|
||||
{
|
||||
eaTradeManager.target.AddExecutedSignal(signal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check For Guard ...
|
||||
*
|
||||
* @param guards: XGuard, reference Collection to holds result ...
|
||||
* @param positions: XPosition, refrence collection to Provides Positions ...
|
||||
* @param barIndex: int, Specified Bar index ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int CheckForGuardTriggered(XGuard &guards[])
|
||||
int CheckForGuardTriggered(
|
||||
XGuard &guards[],
|
||||
XPosition &positions[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
@@ -559,7 +600,11 @@ class XCBaseExpert : public XCBase
|
||||
{
|
||||
//
|
||||
XGuard iGuards[];
|
||||
int iGuardsCount = eaSignallers[i].CheckForGuard(iGuards);
|
||||
int iGuardsCount = eaSignallers[i].CheckForGuard(
|
||||
iGuards,
|
||||
positions,
|
||||
barIndex //
|
||||
);
|
||||
if (IsValidSize(iGuardsCount))
|
||||
{
|
||||
//
|
||||
@@ -803,6 +848,23 @@ class XCBaseExpert : public XCBase
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Add New Signal Executed Event Handler ...
|
||||
void AddOnSignalExecutedEventHandler(TOnSignal handler)
|
||||
{
|
||||
//
|
||||
if (handler == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
handler,
|
||||
mOnSignalExecutedEventHandlers //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Trade Event Handlers ...
|
||||
|
||||
@@ -1077,6 +1139,7 @@ class XCBaseExpert : public XCBase
|
||||
TOnSignal mOnSignalEventHandlers[];
|
||||
TOnStopLoss mStopLossEventHandlers[];
|
||||
TOnTakeProfit mTakeProfitEventHandlers[];
|
||||
TOnSignal mOnSignalExecutedEventHandlers[];
|
||||
TOnForceClose mOnForceCloseEventHandlers[];
|
||||
TOnDealsChanged mDealsChangedEventHandlers[];
|
||||
TOnOrdersChanged mOrdersChangedEventHandlers[];
|
||||
|
||||
Reference in New Issue
Block a user