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

DrawRegion on the price action

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

    DrawRegion on the price action

    Hi
    I have an indicator I created, I just took the DM indicator that comes with Ninja and added
    DrawRegion to it to shade between the +DI and -DI. I used the call DM(IDataSeries input, int period) to call the function/indicator when I made the indicator. Also I used DrawOnPricePanel = false so the shading
    would show up in the indicator panel. I also have a version that I am trying to overlay right on
    the price action itself so I have change DrawOnPricePanel = true and Overlay = true but the shading
    does not show up when I place this indicator on top of price.
    Any ideas what I am doing wrong?

    Here is the code for the for the one that lays on top of price.
    HTML Code:
    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "DMplusplot"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "DMminusplot"));
    Add(new Plot(new Pen(Color.Purple, 3), "ADXplot"));
    Add(new Line(Color.FromKnownColor(KnownColor.YellowGreen), 75, "Upperline"));
    Add(new Line(Color.FromKnownColor(KnownColor.DarkViolet), 25, "Lowerline"));
    Overlay = true;
    CalculateOnBarClose = false;
    DrawOnPricePanel = true;
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    DMplusplot.Set(DM(Period).DiPlus[0]);
    DMminusplot.Set(DM(Period).DiMinus[0]);
    ADXplot.Set(DM(Period)[0]);
     
    /*DrawRegion("Rontag", CurrentBar, 0, DMplusplot, DMminusplot, Color.Empty, Color.Green, 2);*/
     
    if (DM(Period).DiPlus[0] > DM(Period).DiMinus[0])
    {
    DrawRegion("Rontag" + CurrentBar, 1, 0, DMplusplot, DMminusplot, Color.Empty, Color.Green, 2);
    }
    else if (DM(Period).DiPlus[0] < DM(Period).DiMinus[0])
    {
    DrawRegion("Rontag" + CurrentBar, 1, 0, DMplusplot, DMminusplot, Color.Empty, Color.Red, 2);

    #2
    Hi Blash,

    DM won't calculate values similar to price, so it's likely a difference in scale. You have it set to draw on price, but the values of the indicator may not be anywhere near price levels.

    Make sure the ScaleJustification for the indicator is set to either Left or Overlay through the Right Click > Indicators screen.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Oh yeah I did that it is left justified I should of said that I'm sorry. Here is a pic. Hopefully this pic along with my code and we might be able to find an answer to why there is no shading in the DM on top of price.
      Attached Files

      Comment


        #4
        I think I found a bug regarding DrawRegion. In this case I have the indicator plotted on top of the price action with the left scale while the price is on the right scale. The lines of the indicator plot just fine using the left scale but the DrawRegion part of the indicator filling in between, shading, the +DI and -DI is plotted with the right scale so it is way way down at the bottom because it is plotted on the ES and it's 1300ish right now. Please see the attached pic to better understand. Remember to look at the right scale and understand where it is and why you will not see price, it's because on the ES it will be located way up and out of view.
        Thanks
        Attached Files

        Comment


          #5
          Thanks for the follow up, Blash. There does seem to be a difference with DrawRegion() and other draw objects. We are currently looking into this.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Unfortunately you are running into a current limitation with DrawRegion(). It is on our suggestion list, assigned ID #793. Thank you for reporting this.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mmckinnm, Today, 01:34 PM
            3 responses
            5 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by f.saeidi, Today, 01:32 PM
            2 responses
            5 views
            0 likes
            Last Post f.saeidi  
            Started by alifarahani, 04-19-2024, 09:40 AM
            9 responses
            55 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Conceptzx, 10-11-2022, 06:38 AM
            3 responses
            60 views
            0 likes
            Last Post NinjaTrader_SeanH  
            Started by traderqz, Today, 12:06 AM
            9 responses
            16 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X