For money management purposes, I consider important to have a simple tool that stops and disables an Algo whenever a daily limit is reached. The following sub-routine was to do this job:
if (l==true) // L is a variable where this limit is actived ON ( True) or OFF ( False )
{
if((GetAccountValue(AccountItem.RealizedProfitLoss )+Position.GetProfitLoss(Close[0],PerformanceUnit.Currency)> g || (GetAccountValue(AccountItem.RealizedProfitLoss)+ Position.GetProfitLoss(Close[0],PerformanceUnit.Currency))< -g);
{
ExitLong();
ExitShort();
SendMail ("Email1", "Email2", "DAILY LIMIT REACHED", "P&L RLZD " + GetAccountValue(AccountItem.RealizedProfitLoss).To String() + " "+ "P&L UNRLZD " + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency).ToString());
Disable();
}
}
The problem is that whenever I attempt to put it ON when the Algo was going to be activated, this one appears to stay OFF, as it never the Algo was put to work.
I think that maybe is the method CalculateOnBarClose=true that has sort kind of "interference", preventing the Algo correctly to work.
Any ideas, suggestions or reasons to address this issue ?
Thanks
Comment