Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Running strategy the most efficient way as possible

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

    Running strategy the most efficient way as possible

    I noticed every time that I enable a strategy, the strategy execution logic uses the active connection and gets the data every time, regardless if the time period does not change. I can see in the Strategies tab within Control Center in the column Connection how the value changes once I enable the strategy using the Enabled column checkbox. It starts by displaying the active connection (I assume that it uses the connection to download the data) and by the time it begins processing the historical data the Connection column changes to Loading... Once it reaches Loading, the strategy execution is fast.

    If the information has been downloaded from running the strategy before, how can I prevent from downloading the information every time I enable the strategy?

    Is the solution to disable the "Get data from server" Market Data Option after I have executed the strategy at least one time?
    Is this the best/most efficient way to execute a strategy once the data is in my system?

    As a different but related question, how can a run strategy and tell it not to process historical information and only execute in real-time only? For this I assume that I have an active life connection.

    Thanks

    #2
    Hello GARZONJ, Thanks for your post.

    NinjaTrader runs your strategy logic for every bar on the chart when enabled, it does not download new historical data every time you enable a strategy. It will download any data that is missing though. If you want to backtest the strategy in the strategy analyzer on historical data, disconnect from your data provider and the historical run will work with the cached historical data

    In a strategy you can add this to the beginning of OnBarUpdate to ignore the historical data run:

    if(State == State.Historical)
    return;

    Kind regards.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Max238, Today, 01:28 AM
    2 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by Shansen, 08-30-2019, 10:18 PM
    25 responses
    949 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    8 responses
    41 views
    0 likes
    Last Post JonesJoker  
    Started by timko, Today, 06:45 AM
    0 responses
    4 views
    0 likes
    Last Post timko
    by timko
     
    Started by Waxavi, 04-19-2024, 02:10 AM
    2 responses
    39 views
    0 likes
    Last Post poeds
    by poeds
     
    Working...
    X