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

Ninja Script Indicator help (TSF + AddOns)

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

    Ninja Script Indicator help (TSF + AddOns)

    I am actually trying to do this with the time series forecast (TSF) indicator.

    I am using 2 TSF indicators, both with different Periods, one with 20 and the other is 18. I am trying to create a bracket for the TSF indicator with the 18 period. The 18 period will have it's value, so I'm trying to be able to have the option to that value to calculate +300 amd -300 points and show it on the chart. I am using tick data. Would really appreciate any help. thanks!

    #2
    Hello skywalkers,

    The easiest way to do this would be to create two plots for those values. Each plot could then be set to the original indicator value plus or minus 300.
    https://ninjatrader.com/support/help...ghtsub=addplot

    Plots have the same number of slots as the bars on the chart so you could make a consistent plot by setting the value for each OnBarUpdate call.



    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse,

      Since I have no coding experience at all, given I looked over the link you had included above, I am not sure where to begin. Additional help if you can. Thanks very much

      Comment


        #4
        Hello skywalkers,

        The easiest way to get a script set up with plots would be to use the NinjaScript editor and generate a new indicator, in the dialog that comes up you can set up plots which will generate the code from the page I linked.

        To set a plot you can then use the plots name like this:

        Code:
        PlotName[0] = your value;
        To get the code for any indicator you want to use you can use the Strategy Builder to generate that code. To do that you would need to make a condition that uses the indicator and then click View Code. That will show the code which is structured very similar to an indicator. You would only need to copy the parts of the code related to using the custom indicator.

        After doing that you would have a indicator that can plot and the code to use your custom indicator to get values. The next step would be to use math to add or subtract from that value.

        The TSF looks like the following to get its value:

        Code:
        double tsfValue= TSF(3, 20)[0];
        To offset that you can make another variable like this:

        Code:
        double offsetTsfValueMinus = tsfValue - 300 * TickSize;
        double offsetTsfValuePlus = tsfValue -+300 * TickSize;
        Then all that is needed is to set those values to the plot:

        Code:
        PlotName[0] = offsetTsfValueMinus;
        ​​​​​​​OtherPlotName[0] = offsetTsfValuePlus;
        ​​​​​​​
        JesseNinjaTrader Customer Service

        Comment


          #5
          Possible to DM you?

          Comment


            #6
            Hello skywalkers,

            We don't use the messages feature on the forum as we don't get notifications for that in our service desk, if you had any follow up questions on this or needed clarification we can continue the thread here.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello Jesse,

              Looks more like I will need help writing the code, I have tried and cannot get it to work. Can you provide a template, would be greatly appreciated. Thanks.

              Comment


                #8
                Hello skywalkers,

                Could you attach what you tried so I can see where you are having trouble?

                You can find the file in the folder: documents/NinjaTrader 8/bin/Custom/Indicators
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by cryfgg, Today, 11:15 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by trdninstyle, Yesterday, 09:32 AM
                27 responses
                167 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by sambathraj, 09-26-2022, 07:28 PM
                2 responses
                55 views
                0 likes
                Last Post sambathraj  
                Started by WalterSkinner, 02-07-2022, 09:22 AM
                21 responses
                120 views
                0 likes
                Last Post Lance El Camino  
                Started by JollyWizard, 10-02-2022, 07:37 AM
                3 responses
                62 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X