Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hosted Script with AddDataSeries()

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

    Hosted Script with AddDataSeries()

    Hello All,
    I use an indicator hosted in a Stretegy. The scheme is as follows:
    -The indicator has 10 AddDataSerires() based on 15 minutes, calculated on bar close. The indicator calculates some parameters from the prices of these 10 series regardless of the Primary (BarsArray[0]) Instrument. This works fine, whenever I load this indicator on a chart produces the expected output.
    -The strategy works at much higher frequency, calculated on each tick from 1 minute bars, and needs some variables from the indicator above as they become accesible. However, the strategy does not need the 10 dataseries at all, but following the Hosted recommendation of the documentation, I added them too.

    The weird thing is (Debugged with VS):
    When I load the Strategy on Strategy Analyzer, this is what happens:
    1) Strategy State.Configure is hitted
    2) Strategy State.DataLoaded is hitted
    3) Indicator State.Configure is hitted
    4) Indicator State.DataLoaded is hitted
    5) Strategy OnBarUpdate is executed for all the ticks and never produces any entry. this is because the indicator never computed anything since its OnBarUpdate Method never was called
    6) When Strategy ends, the indicator starts to compute its bars, inside OnBarUpdate but it is too late because The strategy has already ended.

    What I would like is to have step 5) and 6) in parallel. I can achieve this if I change the referenced Indicator. If the Strategy used for example another indicator that does not call AddDataSerires(), then I can see step 5) and 6) in parallel

    Of course 1 solution would be writting the Indicator's code in the Strategy but I would like to solve it in another way.
    Thanks in advance!

    #2
    Hello Julio,

    Thank you for your post.

    You would use myIndicatorName.Update() in the strategy to force the indicator update. For example:
    Code:
    SMA(14).Update();
    For information on Update() please visit the following link: https://ninjatrader.com/support/help...-us/update.htm

    Please let me know if you have any questions.

    Comment


      #3
      Hello Patrick,
      Yes, problem solved. The documentation is clear about it.
      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NtFan, 03-05-2021, 04:12 PM
      2 responses
      12 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by sushilake, Today, 12:21 PM
      2 responses
      11 views
      0 likes
      Last Post sushilake  
      Started by Gerik, Today, 02:31 PM
      6 responses
      17 views
      0 likes
      Last Post hedgeplay  
      Started by EB Worx, Today, 02:09 PM
      0 responses
      4 views
      0 likes
      Last Post EB Worx
      by EB Worx
       
      Started by Revazi123, Today, 01:01 PM
      0 responses
      11 views
      0 likes
      Last Post Revazi123  
      Working...
      X