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 Rapine Heihei, Today, 07:51 PM
        0 responses
        3 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        61 views
        0 likes
        Last Post samish18  
        Working...
        X