Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two TradeStation indicators for translation, please

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

    #16
    Hi xtrender, you are welcome - Happy New Year to you as well from NinjaTrader!

    You miss the correct referencing in the your RSI call so it returns a double value, please use this:

    Code:
    RSI(Close,[SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]14[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000],[/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]3[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000])[0][/COLOR][/SIZE][/SIZE]

    Comment


      #17
      I just discoverd this wonderfull tools, thanks for programing it !!!

      I have a request if possible. Can someone help me to make change the color of the momentum if it is on up tick or downtick

      Great thanks

      Originally posted by NinjaTrader_Bertrand View Post
      Hey jtrade,
      no problem, we all have gone through that at times.

      Please find attached the second part of your conversion request, shorter momentum will display as a line, the longer as a histogram, you can change the width as needed in the properties.

      Good trading,
      Bertrand

      Comment


        #18
        serval,

        Unfortunately we cannot take custom programming requests. You can try one of the 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

        Or hopefully a community member can help you out. Good luck and happy New Years!
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Hello,

          can not pass RSI as input to tRange method. I have tried method with Dataseries inputs , return as double and it compiles.
          double r4 = tRange(RSI(Close,14,3),RSI(Close,14,3),RSI(Close,14,3))[0]; can not convert from NinjaTrader.Indicator.RSI to DataSeries

          public double tRange(DataSeries HPrice, DataSeries LPrice, DataSeries CPrice)
          {

          if (CPrice[1] > HPrice[0])
          THigh = CPrice[
          1];
          else
          THigh = HPrice[0];

          if (CPrice[1] < LPrice[0])
          TLow = CPrice[
          1];
          else
          TLow = LPrice[0];

          double tr = (THigh - TLow);
          return tr;
          }
          This TS function takes RSI(Close,14) as input
          Inputs: HPrice(NumericSeries), LPrice(NumericSeries), CPrice(NumericSeries);
          Var: THigh(0), TLow(0);
          If CPrice[1] > HPrice Then
          THigh = CPrice[1]
          Else
          THigh = HPrice;
          If CPrice[1] < LPrice Then
          TLow = CPrice[1]
          Else
          TLow = LPrice;
          TrueRangeCustom = THigh - TLow;


          Any suggestion ?

          Thank you for help.

          Comment


            #20
            Hi xtrender, please go back to your original posted code in post #15.

            Then use this snippet below -

            Code:
            [COLOR=#0000ff]double[/COLOR][SIZE=2][SIZE=2][COLOR=#000000] part2 = Coefup * SMA(tRange(RSI(Close, [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]14[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000], [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]3[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000])[0], RSI(Close, [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]14[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000], [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]3[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000])[0], RSI(Close, [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]14[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000], [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]3[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000])[0]), [/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]15[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000])[[/COLOR][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][COLOR=#000000]];[/COLOR][/SIZE][/SIZE]

            Comment


              #21
              Hi Bertrand,

              Thank you for help. I did make it work some how. But not with the code you have posted above. SMA does not take double as input. I still not fully understand if what I arive to is the proper translation from original code, but it looks OK.
              I have changed the type of inputs for tRange to IDataSeries from DataSeries as well as this line:
              r2.Set(tRange(RSI(Close,
              14,3),RSI(Close,14,3),RSI(Close,14,3)));
              with r2 of DataSeries type.

              I truly appreciate your feedback.

              Thank you very much.

              Comment


                #22
                Sorry for my mistake and creating confusion xtrender, great you have it gotten to working state - the real test is on live data while checking if the returned values makes sense - if you like post your code as exported zip and I take a look.

                Comment


                  #23
                  Hello Bertrand,

                  Sorry for delay. This is what I came up with.

                  I hope it make sense.
                  Attached Files

                  Comment


                    #24
                    xtrender,

                    Is there any part in particular you are seeking help on? It seems you have it working already?
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #25
                      Bertrand, If you have noticed, I have split the code in parts. The reason for that I was not able to write this as one calculation, in one line.
                      As I mention I still not sure if this is the correct translation of TS code.

                      Thank you.

                      Comment


                        #26
                        Looks good xtrender - have compared the values to your TS version? That will be the ultimate test for it...maybe I hovered over it to quick, but I wasn't spotting where you feed the HLC values from the data into your tRange method....

                        Comment


                          #27
                          Hi Bertrand,
                          I am not sure, but I think that by passing any indicator value without specific bar identifier( such as [0]) to the tRange, the method logic some how takes indicator high and substracts from indicator low. It compares CPrice, which can be any value ( price or indicator value).
                          But again I am not that good with programming.

                          On many occasions I am running into double and dataseries conversion clush. Do you know of a way to explicitely convert type double to type DataSeries? My understanding is that DataSeries type is not C# type?
                          Perhaps NinjaTrader could come up with a way to pass double types to Indicators where it takes DataSeries as input and vc.
                          That is the reason I am breaking my code in parts. For instance SMA takes Dataseries as input, but tRange method returns double.

                          Thank you.

                          Comment


                            #28
                            Hi xtrender, yes there is a 'conversion' from a dataseries to a double: access one dataseries element with the indexing [] you already used in your code.

                            Here's a good overview over the Basic Syntax - http://www.ninjatrader-support.com/H...sicSyntax.html

                            For more info about the DataSeries class - http://www.ninjatrader-support.com/H...iesObject.html

                            Here's also a reference sample dealing with this topic - http://www.ninjatrader-support2.com/...ead.php?t=7299

                            For your indicator, I would suggest comparing all your variable values with the TradeStation counterparts to ensure the calcuation was ported correctly into NinjaScript.

                            Comment


                              #29
                              DSM recode for NT7

                              Originally posted by NinjaTrader_Bertrand View Post
                              Hey jtrade,
                              no problem, we all have gone through that at times.

                              Please find attached the second part of your conversion request, shorter momentum will display as a line, the longer as a histogram, you can change the width as needed in the properties.

                              Good trading,
                              Bertrand
                              'Morning, Bertrand .. taking you back to your most excellent help in 2008, when you coded the DSM for me. I now use this in NT7, but it adds horizontal lines according to the vertical scaling. I like these lines, but would like to be able to set and fix the horizontal level from inputs within the indicator.

                              Would it be possible for you to do this for me, please ?

                              I attach a screenshot showing the lines at +10 & -5 : these levels change as I adjust the vertical axis.
                              Attached Files

                              Comment


                                #30
                                jtrade, you can simply add NT7's ConstantLine indicator to the DSM indicator panel, enter the horizontal line values needed and set AutoScale = true, so the lines are kept in view at all times since they are then part of the AutoScale range.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                596 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                343 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
                                556 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                554 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X