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

Making A Multi Instrument % Spread Indicator

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

    #16
    For example.

    Since Jan 1 SP down 8.44% while Dow down 7.03% I'm interested in that difference. Dow %- SP % so -1.41

    Comment


      #17
      Basically I would do percentage difference between Jan1st close on SP500 to now. Then repeat for Dow. Then the difference between those 2 numbers.

      Comment


        #18
        What would I need to modify in the code so in "percentage difference indicator" it allows me to enter a single number under Input Series? So I can input the SP500 close on Jan1st in there and have the second instrument reading ES 09-10.

        Comment


          #19
          Hello Crmtrade,

          We do not provide custom coding services. We are happy to guide you in the right direction and offer feedback on any attempts you make at coding on your own.

          The following reference sample can help you get an indicator value at a specific date.
          Getting indicator values from a specified time

          You use GetBar to get the bars ago value for a specific date / time. You can then perform calculations off these values.

          User defined input parameters are most easily setup through the indicator wizard. For help on adding these in code, see this link.

          If you would like to hire someone to code this for you, please see the link below for a list of our 3rd party NinjaScript consultants.
          Ryan M.NinjaTrader Customer Service

          Comment


            #20
            I am having a similar issue here...im trying to plot pp1 in NT7, under the bar chart. Can you please help? I think I tried everything I could think of

            double pp1 = ((WMA(BarsArray[1], 20)[0]) - (WMA(BarsArray[2], 20)[0]));
            Last edited by nightriderx; 07-14-2010, 02:20 PM.

            Comment


              #21
              nightriderx, could you please be more specific? How are you trying to plot "pp1"? In an indicator? As an indicator itself? Have you tried with just the two bar arrays: BarsArray[0] and BarsArray[1]? Are there any errors in the logs (right-most tab of Control Center)?
              AustinNinjaTrader Customer Service

              Comment


                #22
                I am trying to plot it in my strategy.
                I tried adding:
                Add(new Plot(Color.Red, PlotStyle.Line, "PercentPlot"));
                in protected override void Initialize()
                and
                PercentPlot.Set(pp1);
                in protected override void OnBarUpdate()

                but just gives me the following errors when i try to compile:

                1) Strategy\x.cs The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.Add(NinjaTrader .Indicator.IndicatorBase)' has some invalid arguments CS1502 - click for info 79 4
                2) Strategy\x.cs Argument '1': cannot convert from 'NinjaTrader.Gui.Chart.Plot' to 'NinjaTrader.Indicator.IndicatorBase' CS1503 - click for info 79 8
                3) Strategy\x.cs The name 'PercentPlot' does not exist in the current context CS0103 - click for info 119 4

                also tried plotting:
                double pp1 = (Closes[1][0] - Closes[2][0]);
                but same errors are produced

                thank you greatly for your help in advance!

                Comment


                  #23
                  nightriderx, it is not possible to plot from within a strategy. You will have to code it out in an indicator and then add that indicator to your strategy.
                  AustinNinjaTrader Customer Service

                  Comment


                    #24
                    spread indicator

                    I´m currently urgent looking for a spread displaying indicator - e.g. cable to euro (using NT 7) - I found this thread but I´ve no experience in coding - has anyone coded this or a better link were to ask.

                    Extra I´ve constantly needs / ideas I would like to´ve coded but I´ve neither the knowledge nor the time to learn it - so if there a any programming gurus which are interested in ninja trader / trading, too and would like to collaborate please contact me - I´m located in Berlin / Germany and Valencia / Spain, also.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by algospoke, Today, 06:40 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post algospoke  
                    Started by maybeimnotrader, Today, 05:46 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post maybeimnotrader  
                    Started by quantismo, Today, 05:13 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post quantismo  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    8 responses
                    168 views
                    0 likes
                    Last Post jeronymite  
                    Started by cre8able, Today, 04:22 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post cre8able  
                    Working...
                    X