• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help developing simple oscillator

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

    Help developing simple oscillator

    Hi,
    I want to develop an oscillator. I have candlesticks on my chart and 2 moving averages. SMA 25 and SMA 300. If a candlestick is above SMA 25 I want a blue colored bar to appear on the oscillator. When a candlestick is above SMA 300 I want the oscillator to have a green colored bar. When a candlestick is below SMA 300 I want the oscillator to have a red bar, and when a candlestick is below SMA 25 I want it to have grey bar.
    I also want this oscillator to be in pane 2 (below the candlesticks on the chart). I'm using 5 minute candles.

    How can this be done, and is it easy to do? Thanks for any help.

    Edit: If this can't be done, then simply the candlestick being below/above SMA 300 producing red/green bars would be sufficient.

    #2
    Yes this can be done and its not that complex at all.

    I suggest starting off looking at the indicator development tutorials in our Help Guide as a starting point to gain experience with developing indicators.

    Once you have reviewed the tutorials the following code will make more sense:

    if (Close[0] > SMA(25)[0]) BarColor = Color.Blue;

    If you do not have the time to invest, you can alway opt to contact one of our qualified NinjaScript Consultants.

    http://www.ninjatrader.com/webnew/pa...injaScript.htm
    RayNinjaTrader Customer Service

    Comment


      #3
      Take this as an inspiration:

      http://www.ninjatrader-support.com/v...ighlight=elder

      Comment


        #4
        Thanks.

        I have another question. Can another time frame be 'called on'? For example, the chart that's open is the 15 minute chart, but in the indicator I want to use another time frame as a reference (like the 30 minute time frame for example). How can that be used?

        The code I use now is this:

        if (Close[0] < SMA(Close, 25)[0])
        do something here;

        But that code only uses the opened time frame as a reference. I want the SMA to be calculated as if it was being calculated on the 30 minute chart, instead of the opened 15 minute chart. How can this be done?

        Comment


          #5
          Multi-series is not supported in indicator development but will be for NT7. However, multi-series is supported currently for strategy development. More information on that in the link below.

          http://www.ninjatrader-support.com/H...struments.html
          RayNinjaTrader Customer Service

          Comment


            #6
            Is there another way to calculate what a 25 SMA is on a 30 minute chart in an indicator while you're using a 15 minute chart?

            Comment


              #7
              Not at this time unfortunately.
              RayNinjaTrader Customer Service

              Comment


                #8
                Is there a mathematical way to do it?

                Comment


                  #9
                  Likely could be done but outside what we provide support for.
                  RayNinjaTrader Customer Service

                  Comment


                    #10
                    Any hint as to where I might look for something like that, or what I could search for?

                    Comment


                      #11
                      Unfortunately I don't have a hint to share.
                      RayNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by chrismcdermut, Yesterday, 01:46 PM
                      3 responses
                      17 views
                      0 likes
                      Last Post MojoJojo  
                      Started by Bricolico, Yesterday, 09:28 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post Bricolico  
                      Started by Tradwell385, Yesterday, 08:51 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post Tradwell385  
                      Started by dvcpro4, Yesterday, 07:08 PM
                      0 responses
                      19 views
                      0 likes
                      Last Post dvcpro4
                      by dvcpro4
                       
                      Started by pennywise, Yesterday, 06:40 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post pennywise  
                      Working...
                      X