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 argusthome, 03-08-2026, 10:06 AM
      0 responses
      85 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      47 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      29 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      32 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      67 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X