here is the code
if (Position.MarketPosition == MarketPosition.Flat) // Only calculate when position is flat
{
if (Bars.FirstBarOfSession)
{
cumprofit = Performance.AllTrades.TradesPerformance.Currency.C umProfit; // Calculate the cumprofit all strategy days
todaysPL = Performance.AllTrades.TradesPerformance.Currency.C umProfit - cumprofit; // Reset todays P&L
PrintWithTimeStamp("FirstBarOfSession!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
// Calculate todays P&L
if (todaysPL != Performance.AllTrades.TradesPerformance.Currency.C umProfit - cumprofit)
{
todaysPL = Performance.AllTrades.TradesPerformance.Currency.C umProfit - cumprofit;
}
// Halts strategy when todays P&L exceeds limits
if (Performance.AllTrades.TradesPerformance.Currency. CumProfit - cumprofit >= maxprofit
|| Performance.AllTrades.TradesPerformance.Currency.C umProfit - cumprofit <= -maxloss)
{
strategyHalt = true;
return;
}
}
Any ideas or can anyone point me in a direction?
Comment