Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I translate this TS code in NT language?

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

    How do I translate this TS code in NT language?

    Hi. A fellow TTM member posted this code in the forum: it takes RSI values from 4 different time frames, and plots colored dots (4 rows of them) on the same chart. Can anybody please tell me how I could do this on Ninja? Any help is REALLY REALLY appreciated, thank you.


    Inputs: UpperRSILevel(55), LowerRSILevel(45);

    Variables: RSI1(0), RSI2(0), RSI3(0), RSI4(0);

    RSI1 = RSI(Close of Data1, 14);
    RSI2 = RSI(Close of Data2, 14);
    RSI3 = RSI(Close of Data3, 14);
    RSI4 = RSI(Close of Data4, 14);

    Plot1(4, "RSI1", yellow);
    Plot2(3, "RSI2", yellow);
    Plot3(2, "RSI3", yellow);
    Plot4(1, "RSI4", yellow);

    If RSI1 > UpperRSILevel then Plot1(4, "RSI1", cyan);
    If RSI1 < LowerRSILevel then Plot1(4, "RSI1", red);
    If RSI2 > UpperRSILevel then Plot2(3, "RSI2", cyan);
    If RSI2 < LowerRSILevel then Plot2(3, "RSI2", red);
    If RSI3 > UpperRSILevel then Plot3(2, "RSI3", cyan);
    If RSI3 < LowerRSILevel then Plot3(2, "RSI3", red);
    If RSI4 > UpperRSILevel then Plot4(1, "RSI4", cyan);
    If RSI4 < LowerRSILevel then Plot4(1, "RSI4", red);

    #2
    donatella,

    I suggest you start with the tutorials on how to make your own custom indicator here: http://www.ninjatrader-support.com/H...tml?Overview23
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Translating Code

      Donatella

      That's a nice bit of code from the Forum. It can be easy adjusted to look at other indicators as well. I cannot translate it for you into C# but if you look at the indicator file sharing section, there is an indicator there that gives you coloured dashes based on different time frames, which may give you a clue.

      IMHO to use Ninja and to get the most out of it you have to learn at least some C#. However since Ninja is based on C# you can extend its features almost endlessly. If you are completely new to C# I would certaintly recommend you have a look at the MSDN beginner training videos.

      For the moderators - It would be nice in an example such as this to be able to point the prospective customer/subscriber to a few hours of basic Ninja programming videos. I know you do excellent online seminars but there is really not much on Ninjascript programming.

      Comment


        #4
        thanks, microal, i was actually able to write a strategy based on that code. i need to adjust a few things, i'm trying to figure out how to tell it that i don't want to reverse my position, but only enter if i'm flat. i never got to the point of actually plotting the colored rows, but i'll take a look at your suggestion, thanks so much

        Comment


          #5
          donatella, that easylanguage code is looking at different datastreams of data - usually its different timeframes such as 1 minute and 3 minutes and 5 minutes. I didn't think multiple simultaneous timeframes are available in NT.

          Comment


            #6
            donatella, you can work with Position.MarketPosition to check if you're flat - http://www.ninjatrader-support.com/H...tPosition.html

            This kind of MultiTime code is supported in a MultiTime strategy - http://www.ninjatrader-support.com/H...struments.html

            For indicators this will be possible with NinjaTrader 7 since it will add MultiSeries charting features.

            Comment


              #7
              that's it, bertrand, thank you, now it's making sense

              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