protected override void OnBarUpdate()
{
if ((ToTime(Time[0]) >= ToTime(8, 30, 0))||(ToTime(Time[0]) < ToTime(14, 45, 0))
&& (Performance.AllTrades.TradesPerformance.Currency. CumProfit - priorTradesCumProfit >= PrftGoal)
&& (Position.MarketPosition != MarketPosition.Flat)
&& (Performance.AllTrades.TradesPerformance.MaxConsec Loser < MaxLosers)
)
{
priorTradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.C umProfit - priorTradesCumProfit;
}
// At the start of a new session
if (Bars.FirstBarOfSession)
{
// Store the strategy's prior cumulated realized profit and number of trades
priorTradesCount = Performance.AllTrades.Count;
priorTradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.C umProfit;
/*
NOTE:
Using .AllTrades will include both historical virtual trades
as well as real-time trades.
If you want to only count profits from real-time trades
please use .RealtimeTrades.
*/
}
if (
// ... we have made more than $PrftGoal profit...
(Performance.AllTrades.TradesPerformance.Currency. CumProfit - priorTradesCumProfit >= PrftGoal)
)
{
return;
}
// Condition set 1
Comment