Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't call indicator

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

    Can't call indicator

    Hello,
    I am having an issue about a simple technical indicator call.
    I simply need to load the value of the RSI in a predefined variable. However it seems I am always getting a constant "10" value, as the Comment() function shows me.
    Here is the
    Code:
    void OnTick()
    {
    double rsi = iRSI(_Symbol,PERIOD_CURRENT,14,PRICE_CLOSE);
    Comment(rsi);
    
    if(iRSI(_Symbol,PERIOD_CURRENT,14,PRICE_CLOSE) > 70){
    Print("up");
    }
    
    }
    Thanks telling me what's wrong.

    #2
    Hello Seb 0,

    Thank you for your post.

    I see in your code snippet you are assigning iRSI() to the double variable 'rsi'. 'iRSI()' is not documented or supported NinjaScript Code and you would need to instead use RSI().

    To accomplish this, you would first need to create a Series<double> variable called 'rsi'. In State.SetDefaults we call AddPlot to add a plot for our indicator and call the plot MyRSI. In State.DataLoaded we instantiate our Series<double> variable called rsi. Then, we assign the RSI indicator value to our 'rsi' variable and set our MyRSI plot to the 'rsi' variable. Finally, we print out the value for the 'rsi' variable.

    Please see the help guide documentation below for more information.

    RSI - https://ninjatrader.com/support/help..._index_rsi.htm
    AddPlot - https://ninjatrader.com/support/help...t8/addplot.htm

    Also, please see the attached example that demonstrates this.

    Let us know if we may assist further.
    Attached Files
    Last edited by NinjaTrader_BrandonH; 12-28-2020, 09:13 AM.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      The code actually was edited on another platform than NT8, that's why the functions are unknown.
      Thank you for the documentation!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      16 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      4 views
      0 likes
      Last Post Creamers  
      Started by Segwin, 05-07-2018, 02:15 PM
      12 responses
      1,786 views
      0 likes
      Last Post Leafcutter  
      Started by poplagelu, Today, 05:00 AM
      0 responses
      3 views
      0 likes
      Last Post poplagelu  
      Started by fx.practic, 10-15-2013, 12:53 AM
      5 responses
      5,407 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Working...
      X