Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // look through all all trades to see if this order matches of those trades entry orders
- ==========================================================================================
- if (Performance.AllTrades.Count != tradeCount)
- {
- tradeCount = Performance.AllTrades.Count;
- foreach (Trade thisTrade in Performance.AllTrades)
- {
- // if found, collect the performance, set the IOrder to null and break the loop
- if (thisTrade.Entry.Order == entryOrders[i])
- {
- currentPnL += thisTrade.ProfitCurrency;
- Print(string.Format("{0} | tradePnL: {1} | currentPnL: {2}", entryOrders[i].Time, thisTrade.ProfitCurrency, currentPnL));
- entryOrders[i] = null;
- break;
- }
- // orrrrrrrrrrrrrrrrr
- if (x.Exit.Time.Date.CompareTo(Time[0].Date) == 0)
- {
- dailyPnL += x.ProfitCurrency;
- }
- }
- }
- ==========================================================================================
- if (Position.MarketPosition != MarketPosition.Flat)
- {
- dailyPnL += position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
- }
- ==========================================================================================
- // if (Position.MarketPosition == MarketPosition.Long && (currentPnL+Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)) <= -LossLimit)
- if (Position.MarketPosition == MarketPosition.Flat && Performance.AllTrades.Count > 0)
- {
- Trade tr = Performance.AllTrades[Performance.AllTrades.Count-1];
- todayPL += tr.ProfitPoints * tr.Quantity;
- //currentPnL += Performance.AllTrades[Performance.AllTrades.Count-1].ProfitCurrency;
- // print to output window if the daily limit is hit
- //if (currentPnL < -LossLimit)
- //{
- // Print("daily limit hit, no new orders"+Time[0].ToString());
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement