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

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.
            BertrandNinjaTrader Customer Service

            Comment


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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Rapine Heihei, 04-23-2024, 07:51 PM
              2 responses
              30 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by Shansen, 08-30-2019, 10:18 PM
              24 responses
              943 views
              0 likes
              Last Post spwizard  
              Started by Max238, Today, 01:28 AM
              0 responses
              9 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by rocketman7, Today, 01:00 AM
              0 responses
              5 views
              0 likes
              Last Post rocketman7  
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              28 views
              0 likes
              Last Post wzgy0920  
              Working...
              X