Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator on the Basis of Another Indicator

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

    Indicator on the Basis of Another Indicator

    Hi all

    Maybe I am not the first asking for the following. If so, please excuse me.

    I would like to create an indicator on the basis of another indicator. In the platform adding it to the chart seems quite easy, however in order create a strategy with this custom made indicator seems like I have to code it using the NinjaScript editor. I have basic coding skills and understand the syntax structure, but here i struggle a bit.

    My idea is quite simple, to create SMA of the WiliamsR indicator.
    Could you help with the syntax. I just need a working example to get the logic.
    This will save me a lot of time searching tutorials and forums.

    Thanks!
    Dodo

    Click image for larger version

Name:	WPRsma.PNG
Views:	306
Size:	9.4 KB
ID:	1058882


    #2
    Hello dodo-t,
    Thanks for your post.

    The syntax would be very similar to what you see as the label on your chart, but I suggest using the Strategy Builder to create the strategy logic if you are struggling with the NinjaScript Editor. Please see the following link for more information on the Strategy Builder: https://ninjatrader.com/support/help...gy_builder.htm

    I have attached a sample Strategy Builder strategy that you can import to get you started. You should be able to modify this strategy further to meet your needs. This strategies logic simply takes the Period input for the SMA and the WIlliamsR indicators and give you a value based on that.

    To Import:
    • Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    • From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    • Select the downloaded .zip file
    • NinjaTrader will then confirm if the import has been successful.
    Please let me know if you have any questions.
    Attached Files
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply! It perfectly works works!
      There is one little thing. When I try to set trading condition buy/sell if indicator crosses above/below specified overbought/oversold level I get the following message... (in attachment)
      If I set the condition to 'equal' there is no problem. How to fix that?

      Click image for larger version

Name:	myWPRsma.PNG
Views:	314
Size:	46.8 KB
ID:	1059032

      Comment


        #4
        What is dodo-t,

        What is the input Type of "Overbought"?
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Integer

          Click image for larger version

Name:	inputs.PNG
Views:	311
Size:	31.8 KB
ID:	1059109

          Comment


            #6
            dodo-t,

            The strategy I posted simply stores the value you are after in a double variable. For a crossover condition you will need to use a Series instead of a double. Currently it will not let you create the condition becuase you are comparing a double variable to an int variable.

            You can either use the 'Greater' and 'Less' comparison operators instead of Corssabove/Crossbelow, or you can create a custom Series on the "Additional data" page of the Strategy Builder(this will act as our new variable) to use the crossover condition. Once you create the custom Series you can select it for your crossover condition inside the "Misc" folder>>"Custom series" folder
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Thanks for the hint!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              589 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              342 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              555 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              552 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X