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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      41 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      49 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      31 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      90 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      54 views
      0 likes
      Last Post PaulMohn  
      Working...
      X