public void ClosePosition(Symbol s) { OrderPlacementEngine.OrderObject orderObject = _opEngine.prepareParamsFromLoginRules(s.SymbolString); /* * _opEngine.CreateTrueMarketCloseOrder(orderObject.AccountID, orderObject.OfferID, size, * (side.Equals(Position.PositionSide.Long)) ? "Buy" : "Sell"); */ }
public void Execute() { _session.InitializeSession(); Console.WriteLine("Prepping strategy data..."); PrepDataForStrategies(); Console.WriteLine("Done."); while (true) { if (!_session.LoggedIn) { _session.InitializeSession(); } try { List <Tick> ticks = new List <Tick>(); foreach (Symbol s in _symbolList) { OrderPlacementEngine.OrderObject ob = _opEngine.prepareParamsFromLoginRules(s.SymbolString); Tick t = new Tick(); } foreach (var strat in _strategies) { strat.OnTick(ticks.ToArray()); } } catch (Exception e) { Console.WriteLine(e.Message); } //Sleep specified minutes Console.WriteLine(DateTime.Now + ":Sleeping..."); Thread.Sleep(Timeframe.TimeframeToMinutes(TradeTimeframe) * 60 * 1000); } return; }
public void PlaceMarketOrder(Symbol sym, int size, Position.PositionSide side, double stopPips, double LimitPips) { OrderPlacementEngine.OrderObject orderObject = _opEngine.prepareParamsFromLoginRules(sym.SymbolString); _opEngine.CreateTrueMarketOrder(orderObject.AccountID, orderObject.OfferID, size, (side.Equals(Position.PositionSide.Long)) ? "Buy" : "Sell"); }