Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create spread/ratio charts.

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

    How to create spread/ratio charts.

    I am trying to create a chart which is a derivative of the original chart i.e. I simply need to subtract,add, divide,... the values of each bar by a certain number to create a new derivative chart.
    Or if that's not possible , I want to create an indicator which shows the last price of a security added, divided,.... by a specific number.
    Is there any codes written for this job in your archives? If not , how do I go about this?
    Thanks.

    #2
    yellowTrader,

    You can search through the File Sharing section to see if you can find anything. If not, you will need to custom program this yourself. Alternatively, you can also try one of the 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

    To program this is just a matter of taking your price and subtracting your value. Please see this tutorial on creating custom indicators: http://www.ninjatrader-support.com/H...tml?Overview23

    Plot0.Set(Close[0] - value); something like that.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I did exactly as you said but it gives me CS0120 error code. I tried looking up the code to find the problem but it says" No Documentation Available" on this error code.
      What is wrong with the code below?
      Plot0.Set(Close[0] - 11);

      Comment


        #4
        You can't copy paste it. It was just an example and you have to make it work with your code. You likely do not have a plot named Plot0. If you create an indicator with the Indicator Wizard you will have Plot0 by default.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I didn't copy paste it. I created an indicator and I have Plot0 by default.
          The file attached shows the entire picture.
          Attached Files

          Comment


            #6
            yellowTrader,

            The orange in the compiler error signifies this is an error in a different file. Please double click on it to see the error in the other file. You will need to address all errors across all NinjaScripts before you can compile.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh. I fixed it.
              Can you send me a link for Mathematical functions like division , multipication, etc...?

              Comment


                #8
                yellowTrader,

                Something like this? http://msdn.microsoft.com/en-us/libr...5d(vs.71).aspx
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                576 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                553 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X