last works ...
This commit is contained in:
@@ -362,6 +362,7 @@ int OnInit()
|
||||
eaSignallerRiskInPoint, // Default Risk In Points ...
|
||||
eaSignallerVolume // Defaul Volume ...
|
||||
);
|
||||
fima1Signaller.slAdditionDistance = 15;
|
||||
fima1Signaller.AddOnSignalEventHandler(OnSignalTriggered);
|
||||
|
||||
//
|
||||
@@ -722,7 +723,12 @@ int CheckForGuard(
|
||||
*/
|
||||
void OnStopLossTriggered(const XDeal &deal)
|
||||
{
|
||||
//
|
||||
eaExpert.HandleOnStopLossTriggered(deal);
|
||||
|
||||
//
|
||||
HandleBalanceReport();
|
||||
HandleLoosingPosition(deal.positionId, deal.profit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -732,7 +738,11 @@ void OnStopLossTriggered(const XDeal &deal)
|
||||
*/
|
||||
void OnTakeProfitTriggered(const XDeal &deal)
|
||||
{
|
||||
//
|
||||
eaExpert.HandleOnTakeProfitTriggered(deal);
|
||||
|
||||
//
|
||||
HandleBalanceReport();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -754,6 +764,10 @@ void OnPositionForceClosed(
|
||||
position,
|
||||
comment //
|
||||
);
|
||||
|
||||
//
|
||||
HandleBalanceReport();
|
||||
HandleLoosingPosition(ticket, position.profit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -838,4 +852,44 @@ void OnTradeStateChanged(const XOnTradeHandlerState &state)
|
||||
eaExpert.HandleOnTradeStateChanged(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Resting Signals ...
|
||||
*
|
||||
* @param ticket: ulong, Position Ticket ...
|
||||
*/
|
||||
void HandleLoosingPosition(
|
||||
ulong ticket = 0,
|
||||
double profit = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Check Position Loose ...
|
||||
bool has = ticket > 0 &&
|
||||
profit < 0;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// NOTE: Here we Can Add Restrictions on Signaller based on our Requirements ...
|
||||
// restingSignals: Specified Number of Signals which must to Ignore ...
|
||||
// restUntil: Specified DateTime to Ignore all Signals before it Expiration ...
|
||||
// restingDelay: Specified Bars Delay to Ignore all Signals before it passed ...
|
||||
|
||||
//
|
||||
// Increase Resting Signals of Signallers ...
|
||||
fima1Signaller.restingSignals++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Balance Report ...
|
||||
*/
|
||||
void HandleBalanceReport()
|
||||
{
|
||||
//
|
||||
string message = eaExpert.eaTrader.mAccount.GetBalanceReportMessage();
|
||||
eaExpert.eaAlert.SendAlert(message);
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user