How To Configure Your Amibroker With Stoxxo Intelligent Trading Bridge

How To Configure Your Amibroker With Stoxxo Intelligent Trading Bridge

AmiBroker Integration

 

Stoxxo- Intelligent Trading Bridge plugin for AmIBroker is a very fast multi threaded and asynchronous functions call supportive. This can handle more than 100 calls per seconds. Just start typing IB_ in AFL editor and you can see all the available functions.

 

Please follow below steps to integrate with the AmiBroker any version above 5.27 and preferred would be above 6.0.

 

  1. Click Options Button and then Select Settings and Plugin Installation.
  2. Select AmiBroker from Left Navigation panel, then Tick Enable AmiBroker Integration. In most cases, Bridge will automatically select the AmiBroker path. If you want, you can change this path as per your AmiBroker Installation.Select the AmiBroker database, if you don’t know which to select, then select first option from drop down.

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

4. Restart the AmiBroker and your plugin is installed.

AmiBroker Code Basic Example

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

 

 

if (IB_Ping()) //Check if IAB is working and Trading Started in Stoxxo- Intelligent Trading Bridge

{

            ReqID = IB_MappedOrderSimple(Name(), “LE”, “DEFAULT”, GetRTData(“Last”));

 

            if (ReqID < 90000)

            {

                        err = IB_GetError(ReqID);

 

                        //Show error to user for exact information why declined

                        Printf(err);

            }

            else

            {

                        //wait for 2 sec

                        //Check for Order Status

                        orderStatus = IB_OrderStatus(ReqID);

                        Printf(orderStatus);

            }

}

else

{

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

    Printf(“Stoxxo not working or Trading is Stopped!”);

}

 

Sample Amibroker AFL

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

 

 

AmiBroker Functions Details.

After installing the AmiBroker Plugin, Below given functions will be accessible from the AmiBroker AFL 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, string StrategyTag, float SignalLTP);
  2. int IB_MappedOrderMod(string TransactionType, string SourceSymbol, string OrderType, string StrategyTag, int SignalID, float TriggerPrice, float Price, int Quantity, float SignalLTP);
  3. int IB_MappedOrderAdv(string TransactionType, string SourceSymbol, string OrderType, string Target, string StopLoss, string TrailingStoploss, string StrategyTag, string ProductType, string OptionsType, int SignalID, float TriggerPrice, float Price, int Quantity, float SignalLTP);
  4. int IB_MappedOrderSch(string TransactionType, string SourceSymbol, string OrderType, string Target, string StopLoss, string TrailingStoploss, string StrategyTag, string ProductType, string OptionsType, string ScheduleTime, int SignalID, float TriggerPrice, float Price, int Quantity, float SignalLTP);

 

//Place Order Functions

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

 

//Order Modification and Cancellation

  1. bool IB_ModifyOrder(string ProfitValue, string StoplossValue, string SLTrailingValue, string TgtTrailingValue, string BreakEvenPoint, int RequestID, int Qty, float Price, float TriggerPrice);
  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, float LTP, float BID, float 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. float AvailableMargin(string UserID);
  2. float AvailableMarginCommodity(string UserID);

 

 

 

 

Leave a Reply

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