Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Percent

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

    Percent

    Hi I am new to NT and I trying to build my first indicator. The first two definition of indicator below work fine (gap vs SMA). The third one however produces the same result of the second, while I would expect to get a % difference. what am I doing wrong? thanks


    Plot0.Set(Close[0] - SMA(Period)[0])

    Plot0.Set((Close[0] - SMA(Period)[0]) / SMA(Period)[0])

    Plot0.Set((Close[0] - SMA(Period)[0]) / SMA(Period)[0] * 100)

    #2
    Hello kalkanis,

    Thank you for your post.

    Add additional '(' and ')' as in the following example:

    Plot0.Set(((Close[0] - SMA(Period)[0]) / SMA(Period)[0]) * 100)

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank you. It worked. another question if I may. I would like to build an indicator which provides the rank of an instrument based on another indicator. for instance a rank of all instruments based on ROC of the instrument itself (with 1 being the one with higher ROC, etc). I would like to keep the indicator based on which the ranking is done flexible, i.e. sometimes it could be ROC, other times SMA, etc

      is there anything similar ready for downloading? thanks

      Comment


        #4
        Hello kalkanis,

        Thank you for your response.

        I am not aware of such an item. Please visit our file sharing section to see if there are any items available to download that fit your interest: http://www.ninjatrader.com/support/f...splay.php?f=37

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X