Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ExitsForFilledOrders()
- {
- //stops-exits for each open position
- foreach(KeyValuePair<string,Order> kv in orders_)
- {
- Order ord= kv.Value;
- if (ord.OrderState == OrderState.Filled)
- {
- string tradeName = ord.Name;
- Brush bColor= ord.OrderAction == OrderAction.Buy ? Brushes.Green : Brushes.Red;
- if ( exit_prices.ContainsKey(tradeName) )
- {
- if ( ord.OrderAction == OrderAction.Buy )
- {
- ExitLongStopMarket(0, true, 1, exit_prices[tradeName], "Exit_"+tradeName, tradeName);
- }
- else if ( ord.OrderAction == OrderAction.SellShort )
- {
- ExitShortStopMarket(0, true, 1, exit_prices[tradeName], "Exit_"+tradeName, tradeName);
- }
- Draw.Dot(this, "dot"+tradeName+CurrentBar, true, 0, exit_prices[tradeName], bColor);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment