Attach CheckForGuard Event Handler for Signallers to Handle Guards ...
This commit is contained in:
@@ -116,6 +116,7 @@ class XCXOM1EAExpert : public XCBase
|
||||
//
|
||||
TOnGuarded onGuardedEventHandler;
|
||||
TCanAnalyse canAnalyseEventHandler;
|
||||
TCheckForGuard checkForGuardEventHandler;
|
||||
|
||||
//
|
||||
// Signal Event Handlers ...
|
||||
@@ -519,6 +520,10 @@ class XCXOM1EAExpert : public XCBase
|
||||
//
|
||||
// Configuring Trade Manager ...
|
||||
|
||||
//
|
||||
// Attache Check For Guard Event Listener ...
|
||||
eaTradeManager.checkForGuardEventListener = checkForGuardEventHandler;
|
||||
|
||||
//
|
||||
eaTradeManager.SaveWins(eaSaveWins);
|
||||
eaTradeManager.SaveLosts(eaSaveLosts);
|
||||
@@ -742,6 +747,52 @@ class XCXOM1EAExpert : public XCBase
|
||||
eaTradeManager.HandleSignal(signal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check For Guard Event Handler ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int CheckForGuardTriggered(XGuard &guards[])
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!HasChild(eaSignallers))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(eaSignallers);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XGuard iGuards[];
|
||||
int iGuardsCount = eaSignallers[i].CheckForGuard(iGuards);
|
||||
if (IsValidSize(iGuardsCount))
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
iGuards,
|
||||
guards,
|
||||
false //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
SpecifiedClean(iGuards);
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(guards);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Guard Events ...
|
||||
*
|
||||
|
||||
@@ -558,6 +558,32 @@ class XCXOM1SignallerBase
|
||||
iConditions.Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Guards Based on MarketConditions ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
* @param barIndex: int
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int CheckForGuard(
|
||||
XGuard &guards[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
SpecifiedClean(guards);
|
||||
|
||||
//
|
||||
result = ArraySize(guards);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Virtuals ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user