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

Offset of zero line for bar oscilator

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

    Offset of zero line for bar oscilator

    Hello,

    I am creating an oscilator based on other oscilator. I want to overlay a bar plot on top of the original line oscilator, so that it shows a status (the bars possible values are either 0,1,-1).

    Since the oscilator ranges 0-100 with signals generated from crosses around 50, I want the 0 value of the bars to match the 50 value of the line plot. Is this possible?

    Is there any other option to do this?

    #2
    Hello,

    If these are both being plotted from the same indicator, the axis used would be shared for the plots. Unfortunately there would not be a way to offset the value of a plot just visually as the visual is a direct representation of the data.

    I believe you would need to instead use 0, 50 and 100 for the values of the indicator that is currently -1, 0, 1.

    If these are two separate indicators, you may be able to overlay them in the same panel to achieve a similar effect.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesee,

      The issue of using 0,50,100 instead of -1,0,1 is that it will not look simetrical around the centerline. I was trying to get the bars up and down like the MACD, with an overlaying line indicator.

      I am attaching a pic of what I am trying to accomplish... but that is done with 2 indicators put one on top of the other and the scales are not connected in this way. The bars are actually two values , one that can be 0 or 1 and another one 0 or -1.

      Could this be done by shading the area in some way behind the line oscilator?
      Attached Files

      Comment


        #4
        Hello User1986,

        To accomplish what you have displayed in your attachment you could build a strategy which plots two other indicators in the same panel, setting the Scale Justification to Left for 1 indicator and to the right for the other indicator. Since the mid-point of both indicators would fall in the middle, 0 should match 50.

        I’ve demonstrated an example below using a Simple Moving Average but you’d replace SMA with the names and parameters of your indicators.

        else if (State == State.Configure)
        {
        AddChartIndicator(SMA(10));
        SMA(10).Panel=2;
        SMA(10).ScaleJustification = ScaleJustification.Left;
        AddChartIndicator(SMA(20));
        SMA(20).Panel=2;
        SMA(20).ScaleJustification = ScaleJustification.Right ;
        }

        You could use Custom Plotting to draw the plot you want. You can find information on custom plotting under Tools > Edit NinjaScript > Indicator > CustomPlotSample.

        Please let us know if you have any questions.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by daniel_weber8, Today, 01:21 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by jungsoohuh, Today, 12:07 PM
        1 response
        19 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by SharonSS, Today, 11:54 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by crystalet, Today, 11:20 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by SuperDude123, Today, 09:23 AM
        1 response
        34 views
        0 likes
        Last Post NinjaTrader_JustinD  
        Working...
        X