public static bool MarketOrder(this IStrategyBase Strategy, StringBuilder sb, TradeType?direction, double price, long size, double?sl, double?tp, string comment = "") { TradeResult result = Strategy.Robot.ExecuteMarketOrder(direction.Value, Strategy.Symbol, size, Strategy.GetLabel(), sl, tp, Strategy.Symbol.PipSize * 2, comment); if (result.IsSuccessful) { sb.AppendLine("Created: {0} {1} {2} {3}", direction.Value, Strategy.Symbol.Code, size, price); } else { sb.AppendLine("Market order failed {0}", result.Error); } return(result.IsSuccessful); }
public static bool CreateStopOrder(this IStrategyBase Strategy, StringBuilder sb, TradeType?direction, double price, long size, double?sl, double?tp, string comment, out PendingOrder po) { TradeResult result = Strategy.Robot.PlaceStopOrder(direction.Value, Strategy.Symbol, size, price, Strategy.GetLabel(), sl, tp, null, comment); if (result.IsSuccessful) { po = result.PendingOrder; sb.AppendLine("Created Stop: {0} {1} {2} {3}", direction.Value, Strategy.Symbol.Code, size, price); } else { po = null; sb.AppendLine("Stop Limit order failed {0}", result.Error); } return(result.IsSuccessful); }