Advertisement
retesere20

Untitled

Jun 8th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. // look through all all trades to see if this order matches of those trades entry orders
  2.  
  3. ==========================================================================================
  4. if (Performance.AllTrades.Count != tradeCount)
  5. {
  6. tradeCount = Performance.AllTrades.Count;
  7.  
  8. foreach (Trade thisTrade in Performance.AllTrades)
  9. {
  10. // if found, collect the performance, set the IOrder to null and break the loop
  11. if (thisTrade.Entry.Order == entryOrders[i])
  12. {
  13. currentPnL += thisTrade.ProfitCurrency;
  14. Print(string.Format("{0} | tradePnL: {1} | currentPnL: {2}", entryOrders[i].Time, thisTrade.ProfitCurrency, currentPnL));
  15. entryOrders[i] = null;
  16. break;
  17. }
  18.  
  19. // orrrrrrrrrrrrrrrrr
  20.  
  21. if (x.Exit.Time.Date.CompareTo(Time[0].Date) == 0)
  22. {
  23. dailyPnL += x.ProfitCurrency;
  24.  
  25. }
  26.  
  27. }
  28. }
  29. ==========================================================================================
  30. if (Position.MarketPosition != MarketPosition.Flat)
  31. {
  32. dailyPnL += position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. ==========================================================================================
  41.  
  42.  
  43.  
  44. // if (Position.MarketPosition == MarketPosition.Long && (currentPnL+Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)) <= -LossLimit)
  45. if (Position.MarketPosition == MarketPosition.Flat && Performance.AllTrades.Count > 0)
  46. {
  47. Trade tr = Performance.AllTrades[Performance.AllTrades.Count-1];
  48. todayPL += tr.ProfitPoints * tr.Quantity;
  49.  
  50.  
  51. //currentPnL += Performance.AllTrades[Performance.AllTrades.Count-1].ProfitCurrency;
  52.  
  53. // print to output window if the daily limit is hit
  54. //if (currentPnL < -LossLimit)
  55. //{
  56. // Print("daily limit hit, no new orders"+Time[0].ToString());
  57. //}
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement