How To Configure Ninjatrader 8 / 7 with Stoxxo Intelligent Trading Bridge

How To Integrate Ninjatrader 8 with Stoxxo Intelligent API Trading Bridge

Integrating With Ninja Is Pretty Simple

NinjaTrader 8 Integration (Works with NinjaTrader 7 also)

Stoxxo Intelligent API Trading Bridge having a native c# plugin specially designed for NinjaTrader ecosystem. Internal communication between Ninja and Stoxxo is way faster than any TCP or file based communication. Stoxxo plugin for Ninja is very fast multi-threaded. This can handle more than 100 calls per second.

Just open NinjaScript Editor, open any file and then start typing IABOrder and then press a dot, all available functions will be in front of you.

Please follow below steps to integrate with the Ninja Trader.

  1. Click Options Button and then Select Settings and Plugin Installation.
  2. Select NinjaTrader8 from the Left Navigation panel, then Tick Enable NinjaTrader 8 Integration.

Ensure that NinjaTrader must be closed to install the plugin successfully.

3. Finally, Click Configure and you will get a confirmation message.

4. Start the NinjaTrader and your plugin is installed and ready to be used.

Ninja Trader 8 Basic Code Example

NinjaTrader Code Basic Example

Calling Stoxxo Intelligent Trading Bridge functions under Ninja Editor is very easy. A very basic example is given below. We will also provide a few basic strategies coded in NinjaScript with IAB integration which will help you to integrate your Ninja Code with IAB.

 

 

if (IB_Ping()) //Check if IAB is working and Trading Started in IAB

{

//We will place orders only for realtime data

            if(State == State.Realtime)

            {

//Now here take a Long Position. Remember order type etc left blank so that IAB will take them from Symbol Mapping

int reqID = IABOrder.IB_MappedOrderMod(0, “LE”, Instrument.MasterInstrument.Name, “”, 0, 0, Quantity, Close[0], StrategyTag);

            }

}

else

{

            // inform the user that Trading Stopped in IAB or IAB is not working.

    Print(“IAB not working or Trading is Stopped!”);

}

 

Sample NinjaScript Code

You can download Sample AFL files from https://algobaba.com

 

 

NinjaTrader Functions Details.

After installing the NinjaTrader Plugin, Below given functions will be accessible from the NinjaScript editor.

 

//Other Functions

  1. bool IB_Ping();
  2. string IB_GetError(int RequestID);

 

//Mapped Order API Functions

  1. int IB_MappedOrderSimple(String SourceSymbol, String TransactionType, double SignalLTP, String StrategyTag)
  2. int IB_MappedOrderMod(int SignalID, String TransactionType, String SourceSymbol, String OrderType, double TriggerPrice, double Price, int Quantity, double SignalLTP, String StrategyTag);
  3. int IB_MappedOrderAdv(int SignalID, String TransactionType, String SourceSymbol, String OrderType, double TriggerPrice, double Price, int Quantity, String Target, String StopLoss, String TrailingStoploss, double SignalLTP, String StrategyTag, String ProductType, String OptionsType);
  4. int IB_MappedOrderSch(int SignalID, String TransactionType, String SourceSymbol, String OrderType, double TriggerPrice, double Price, int Quantity, String Target, String StopLoss, String TrailingStoploss, double SignalLTP, String StrategyTag, String ProductType, String OptionsType, DateTime ScheduleTime);

 

//Place Order Functions

  1. int IB_PlaceOrder(int UniqueID, String StrategyTag, String UserID, String Exchange, String Symbol, String TransactionType, String OrderType, String Validity, String ProductType,int Qty, double Price,double TriggerPrice, String ProfitValue, String StoplossValue, String SLTrailingValue, int DisclosedQuantity, double SignalLTP, String DataProvider);
  2. int IB_PlaceOrderAdv(int UniqueID, String StrategyTag, String UserID, String Exchange, String Symbol, String TransactionType, String OrderType, String Validity, String ProductType, int Qty, double Price, double TriggerPrice, String ProfitValue, String StoplossValue, String SLTrailingValue, int DisclosedQuantity, String DataProvider, String TgtTrailingValue, String BreakEvenPoint, double SignalLTP, String MaxLTPDifference, String PriceSpread, String TriggerSpread, int CancelIfNotCompleteInSeconds);

 

//Order Modification and Cancellation

  1. bool IB_ModifyOrder(int RequestID, int Qty, double Price, double TriggerPrice, String ProfitValue, String StoplossValue, String SLTrailingValue, String TgtTrailingValue, String BreakEvenPoint);
  2. bool IB_CancelOrExitOrder(int RequestID);

 

//Misc Functions

  1. bool IB_SquareOff(string UserID);
  2. bool IB_SquareOffAll();
  3. bool IB_SquareOffStrategy(string StrategyID);
  4. float IB_MTM(string UserID);

 

//Market Data Functions

  1. void IB_Subscribe(string Exchange, string Symbol, string DataProvider);
  2. float IB_LTP(string Exchange, string Symbol, string DataProvider);
  3. float IB_BID(string Exchange, string Symbol, string DataProvider);
  4. float IB_ASK(string Exchange, string Symbol, string DataProvider);
  5. void IB_FeedLTP(string Exchange, string Symbol, string DataProvider, double LTP, double BID, double ASK);

 

//Order Details Functions

  1. string IB_OrderID(int RequestID);
  2. string IB_LastOrderID(string UserID);
  3. string IB_OrderStatus(int RequestID);
  4. int IB_OrderQty(int RequestID);
  5. int IB_OrderFilledQty(int RequestID);
  6. float IB_OrderAvgPrice(int RequestID);
  7. bool IB_IsOrderOpen(int RequestID);
  8. bool IB_IsOrderCompleted(int RequestID);
  9. bool IB_IsOrderRejected(int RequestID);
  10. bool IB_IsOrderCancelled(int RequestID);

 

//Margins

  1. double AvailableMargin(string UserID);
  2. double AvailableMarginCommodity(string UserID);

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *