Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ninjatrader, IB, Python integration, backtest and live trading environment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Ninjatrader, IB, Python integration, backtest and live trading environment

    I used MT4/5 as a trading and backtest platform. Besides Fx trading, I would like to connect to Interactive Broker for a wider range of instruments coverage. By searching around the web, I found that Ninjatrader is able to connect to IB. I would like to confirm more details so that I can have a deeper understanding of NT.

    Q: Can NT integrate with python?
    - DLL integration, https://ninjatrader.com/support/help...?functions.htm
    - From the above api list, I cannot find callback functions such as OnBarUpdate()... Is that means I cannot backtest those strategies created by python?

    Q: Can I use different python environment in different strategies?
    - I may need to use virtualenv to create and maintain different python run time environment. In the python integration working scenario, can I select different virtualenv for different strategies?

    Q: Can I backtest and live trading my strategies which is getting price data from multiple instruments and placing orders to multiple instruments?
    - From https://ninjatrader.com/support/help...nstruments.htm
    - I can see that I may be able to get price from different instruments but can I make orders to different instrument during backtest and live trading?

    Q: I would like to trade stocks from different markets through IB. Is it possible for me to do backtest on NT as long as I get those data from other data source?
    - I used to use tick data suite in MT4/5 which provides tick data to the backtest system. Is there any thing similar in NT? Is it possible to do any specific backtest once I get the historical data in csv file?

    Thank you very much.

    #2
    Hi Sulfred, thanks for your post and welcome to the NinjaTrader forum.

    Q: Can NT integrate with python?
    A: The DLL interface allows any external application that can import DLLs to communicate with NinjaTrader through the documented methods. As long as you can find a python library that can import the DLL then it can be used in your program. The methods that belong to the Strategy class are separate from all of this. If you wanted an automated trading system implemented through the DLL interface your python code must manage every aspect of the strategy. We have an example program here that might be helpful:


    Q: Can I use a different python environment in different strategies?
    A: I'm really only an expert with NinjaScript/C#. In my past python experience, the virtualenv was to have a python environment with its own encapsulated dependencies/librarys. It would be up to you to decide this based on how you implement a strategy in python.

    Q: Can I backtest and live trading my strategies which is getting price data from multiple instruments and placing orders to multiple instruments?
    A: If this strategy is written in NinjaScript with a managed/unmanaged strategy then you can use the Strategy Analyzer to backtest your strategy over a large amount of historical data. As far as using the DLL interface, the backtesting code would also need to be implemented.

    Q: I would like to trade stocks from different markets through IB. Is it possible for me to do backtest on NT as long as I get those data from other data source?
    A: Yes, you can backtest multi time frame strategies. If you are enabled for a given instrument with Interactive Brokers, you will be able to pull historical and real time data for that instrument regardless of the exchange its traded on. NinjaTrader figures that out through the Interactive Brokers connection.

    Kind regards,

    -ChrisL




    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by yertle, Yesterday, 08:38 AM
    7 responses
    28 views
    0 likes
    Last Post yertle
    by yertle
     
    Started by bmartz, 03-12-2024, 06:12 AM
    2 responses
    21 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by funk10101, Today, 12:02 AM
    0 responses
    4 views
    0 likes
    Last Post funk10101  
    Started by gravdigaz6, Yesterday, 11:40 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by MarianApalaghiei, Yesterday, 10:49 PM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X