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

Strategy and indicators integration

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

    Strategy and indicators integration

    Hi,

    I have coded a simple indicator that uses an additional timeframe series and then calculates and plots 2 levels, and now I am in the process to code a strategy that make use of these levels to trade.
    Is it a better practice to reference the indicator from within the strategy (myIndicator.mylevel) or is it better to re-implement the indicator inside the strategy OnBarUpdate() method and make use of it locally?

    Thanks, bye
    Andrea

    #2
    Hello afoschini,

    Thank you for the post.

    This would really depend if you want to reuse the indicator in other scripts. Generally isolating parts of your overall logic into indicators can help in reducing the size of the strategy but this all comes down to your goals. If this will not be used anywhere else, it may be easier to just place it in the strategy.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you Jesse

      I was speculating about possible sync problems between calculation in the external indicators OnBarUpdate method and the strategy OnBar... method.If as I undersyand from your answer this is not the case, I will surely go for the flexible approach.

      Bye
      Andrea

      Comment


        #4
        Hello afoschini,

        Yes, the indicator being called should assume the host's properties or the strategy in this case. This should entail that the indicator is in sync with the strategy as it is called by the strategy. In both cases, you should be able to sync the calculation, either in an external indicator or directly in the strategy.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        11 responses
        39 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by FrazMann, Today, 11:21 AM
        0 responses
        5 views
        0 likes
        Last Post FrazMann  
        Started by geddyisodin, Yesterday, 05:20 AM
        8 responses
        52 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        27 views
        0 likes
        Last Post DayTradingDEMON  
        Started by George21, Today, 10:07 AM
        1 response
        22 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X