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 tradingnasdaqprueba, 05-07-2024, 03:42 AM
      12 responses
      48 views
      0 likes
      Last Post tradingnasdaqprueba  
      Started by bill2023, Yesterday, 08:21 AM
      3 responses
      18 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by DawnTreader, Yesterday, 05:58 PM
      4 responses
      19 views
      0 likes
      Last Post DawnTreader  
      Started by lorem, 04-25-2024, 09:18 AM
      10 responses
      47 views
      0 likes
      Last Post lorem
      by lorem
       
      Started by swjake, Today, 12:04 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X