last works ...
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
#include "../Classes/x-saherelm.base.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-alert.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-chart.helper.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-target.manager.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-guard.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-target.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-trade.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-volume.class.mq5"
|
||||
|
||||
@@ -81,9 +82,9 @@ class XCBackTesterEA : public XCBase
|
||||
double volume; // Default volume Per Trade ...
|
||||
|
||||
//
|
||||
XCAlert *eaAlert; // EA Scope Alert Handler ...
|
||||
XCTrade *eaTrader; // EA Scope Trade Handler ...
|
||||
XCTargetManager *eaTargetManager; // EA Scope Target Manager ...
|
||||
XCAlert *eaAlert; // EA Scope Alert Handler ...
|
||||
XCTrade *eaTrader; // EA Scope Trade Handler ...
|
||||
XCTarget *eaTarget; // EA Scope Target Manager ...
|
||||
|
||||
//
|
||||
XCChartHelper *eaChartHelper; // Chart Helper Class ...
|
||||
@@ -292,7 +293,7 @@ class XCBackTesterEA : public XCBase
|
||||
|
||||
//
|
||||
// Init Target Managers ...
|
||||
eaTargetManager = new XCTargetManager(eaTrader);
|
||||
eaTarget = new XCTarget(eaTrader, eaAlert);
|
||||
|
||||
//
|
||||
// Initial GUI ...
|
||||
@@ -316,9 +317,9 @@ class XCBackTesterEA : public XCBase
|
||||
void HandleOnDeInit()
|
||||
{
|
||||
//
|
||||
eaTargetManager.Destroy();
|
||||
delete eaTargetManager;
|
||||
ZeroMemory(eaTargetManager);
|
||||
eaTarget.Destroy();
|
||||
delete eaTarget;
|
||||
ZeroMemory(eaTarget);
|
||||
|
||||
//
|
||||
delete eaTrader;
|
||||
@@ -357,7 +358,7 @@ class XCBackTesterEA : public XCBase
|
||||
|
||||
//
|
||||
// Managing Targets ...
|
||||
eaTargetManager.Manage();
|
||||
eaTarget.Manage();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -428,7 +429,7 @@ class XCBackTesterEA : public XCBase
|
||||
UpdatePositionButtons();
|
||||
|
||||
//
|
||||
eaTargetManager.HandleOnStopLossTriggered(deal);
|
||||
eaTarget.HandleOnStopLossTriggered(deal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,7 +444,7 @@ class XCBackTesterEA : public XCBase
|
||||
UpdatePositionButtons();
|
||||
|
||||
//
|
||||
eaTargetManager.HandleOnTakeProfitTriggered(deal);
|
||||
eaTarget.HandleOnTakeProfitTriggered(deal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -464,7 +465,7 @@ class XCBackTesterEA : public XCBase
|
||||
UpdatePositionButtons();
|
||||
|
||||
//
|
||||
eaTargetManager.HandleOnPositionForceClosed(
|
||||
eaTarget.HandleOnPositionForceClosed(
|
||||
ticket,
|
||||
position,
|
||||
comment //
|
||||
@@ -571,7 +572,7 @@ class XCBackTesterEA : public XCBase
|
||||
*/
|
||||
void HandleOnSignalExecuted(XSignal &signal)
|
||||
{
|
||||
eaTargetManager.AddExecutedSignal(signal);
|
||||
eaTarget.AddExecutedSignal(signal);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -268,13 +268,15 @@ class XCBaseSignaller : public XCBase
|
||||
/**
|
||||
* Check Guards Based on MarketConditions ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
* @param guards: XGuard, reference collection to holds result ...
|
||||
* @param positions: XPosition, reference collection to provides positions ...
|
||||
* @param barIndex: int
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int virtual CheckForGuard(
|
||||
XGuard &guards[],
|
||||
XPosition &positions[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
|
||||
+21
-5
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// ----------------------------------------------
|
||||
// Name: XCTargetManager
|
||||
// Name: XCTarget
|
||||
// Description: provides all Positions Target requirements ...
|
||||
//
|
||||
//
|
||||
@@ -26,29 +26,34 @@
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
class XCTargetManager : public XCBase
|
||||
class XCTarget : public XCBase
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
XCTrade *trader;
|
||||
XCAlert *alert;
|
||||
XSignal signals[];
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XCTargetManager(
|
||||
XCTrade *_trader //
|
||||
XCTarget(
|
||||
XCTrade *_trader, //
|
||||
XCAlert *_alert //
|
||||
) : XCBase()
|
||||
{
|
||||
//
|
||||
alert = _alert;
|
||||
trader = _trader;
|
||||
|
||||
//
|
||||
XClean(signals);
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
~XCTargetManager()
|
||||
~XCTarget()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@@ -568,6 +573,7 @@ class XCTargetManager : public XCBase
|
||||
//
|
||||
// Apply Target ...
|
||||
string comment = NULL;
|
||||
string message = NULL;
|
||||
|
||||
//
|
||||
// Do Risk Free if Provided ...
|
||||
@@ -581,6 +587,11 @@ class XCTargetManager : public XCBase
|
||||
position.tp, // TP ...
|
||||
comment //
|
||||
);
|
||||
|
||||
//
|
||||
// Handle Alert ...
|
||||
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on: " + ToXString(position.price);
|
||||
alert.SendAlert(message);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -598,6 +609,11 @@ class XCTargetManager : public XCBase
|
||||
volume,
|
||||
comment //
|
||||
);
|
||||
|
||||
//
|
||||
// Handle Alert ...
|
||||
message = "Target Manager do Partial Close " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") by: " + ToXString(volume);
|
||||
alert.SendAlert(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1753,7 +1753,10 @@ class XCTradeManager : public XCBase
|
||||
// Check For Guards ...
|
||||
if (checkForGuardEventListener != NULL)
|
||||
{
|
||||
result = checkForGuardEventListener(dest);
|
||||
//
|
||||
XPosition positions[];
|
||||
trader.GetPositions(positions);
|
||||
result = checkForGuardEventListener(dest, positions, 0);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -612,6 +612,32 @@ void OnSignalExecuted(XSignal &signal)
|
||||
eaExpert.HandleOnSignalExecuted(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 CheckForGuard(
|
||||
XGuard &guards[],
|
||||
XPosition &positions[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = fima1Signaller.CheckForGuard(
|
||||
guards,
|
||||
positions,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Trade Event Handlers ...
|
||||
|
||||
|
||||
@@ -3809,7 +3809,11 @@ typedef void (*TOnGuarded)(
|
||||
XPosition &positions[]);
|
||||
|
||||
//
|
||||
typedef int (*TCheckForGuard)(XGuard &guards[]);
|
||||
typedef int (*TCheckForGuard)(
|
||||
XGuard &guards[],
|
||||
XPosition &positions[],
|
||||
int barIndex = 0 //
|
||||
);
|
||||
|
||||
//
|
||||
typedef void (*TOnDealsChanged)(int count);
|
||||
|
||||
@@ -162,13 +162,15 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
/**
|
||||
* Check Guards Based on MarketConditions ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
* @param guards: XGuard, reference collection to holds result ...
|
||||
* @param positions: XPosition, reference collection to provides positions ...
|
||||
* @param barIndex: int
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int virtual CheckForGuard(
|
||||
XGuard &guards[],
|
||||
XPosition &positions[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
@@ -647,13 +649,15 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
/**
|
||||
* Check Guards Based on MarketConditions ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
* @param guards: XGuard, reference collection to holds result ...
|
||||
* @param positions: XPosition, reference collection to provides positions ...
|
||||
* @param barIndex: int
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int virtual CheckForGuard(
|
||||
XGuard &guards[],
|
||||
XPosition &positions[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user