retesere20

---recycler----

Sep 26th, 2018
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. public void ExitsForFilledOrders()
  3. {
  4. //stops-exits for each open position
  5. foreach(KeyValuePair<string,Order> kv in orders_)
  6. {
  7. Order ord= kv.Value;
  8. if (ord.OrderState == OrderState.Filled)
  9. {
  10. string tradeName = ord.Name;
  11. Brush bColor= ord.OrderAction == OrderAction.Buy ? Brushes.Green : Brushes.Red;
  12.  
  13. if ( exit_prices.ContainsKey(tradeName) )
  14. {
  15. if ( ord.OrderAction == OrderAction.Buy )
  16. {
  17. ExitLongStopMarket(0, true, 1, exit_prices[tradeName], "Exit_"+tradeName, tradeName);
  18. }
  19. else if ( ord.OrderAction == OrderAction.SellShort )
  20. {
  21. ExitShortStopMarket(0, true, 1, exit_prices[tradeName], "Exit_"+tradeName, tradeName);
  22. }
  23. Draw.Dot(this, "dot"+tradeName+CurrentBar, true, 0, exit_prices[tradeName], bColor);
  24. }
  25. }
  26. }
  27. }
RAW Paste Data