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

Draw.Region with ScaleJustification other than Right

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

    Draw.Region with ScaleJustification other than Right

    I'm trying to fill an area between two bands. Relevant indicator settings:

    DrawOnPricePanel = true;
    IsOverlay = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Overlay;

    It seems Draw.Region only works when ScaleJustification is set to Right. Is this right?.. No mention of that in the docs. I notice there is no isAutoScale parameter unlike with other Draw methods.

    Any way to get Draw.Region to work with ScaleJustification.Overlay?

    #2
    Hello digibob,
    Thanks for your post.

    Draw.Region does work with ScaleJustification.Overlay and I am able to set Draw.Region to any of the three ScaleJustification options on my end. Are you saying that you set the ScaleJustification in your code and when you apply it to the chart it is being set to something else?

    Are there errors on the logs tab of your Control Center?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh. Thanks for your reply. There are no related errors in the logs tab. Please see the screenshot below. The yellow lines are two Series plots in overlay scale. Draw.Region is supposed to fill between the lines but the operation is performed on the price scale.

      OnBarUpdate:

      Values[0][0] = 26;
      Values[1][0] = 25;

      Draw.Region(this, "Fill", CurrentBar, 0, Values[0], Values[1], null, Brushes.Gray, 40);

      You say you were able to *set* Draw.Region to any of the three ScaleJustification options. I may be missing something here. How do you set Draw.Region to a ScaleJustification? There is no ScaleJustification parameter to the function. Is setting the ScaleJustification in State.SetDefaults not enough to let Draw.Region know which scale to use?

      Comment


        #4
        digibob,

        You are not missing anything there, I was referring to the ScaleJustification inside State.SetDefaults

        Do you have DrawOnPricePanel set to false?
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          As per my first post:

          DrawOnPricePanel = true;
          IsOverlay = true;
          ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Overlay;

          As per my second post with screenshot attached, when I draw on the price panel the ScaleJustification.Overlay is ignored and ScaleJustification.Right is used instead.

          Comment


            #6
            digibob,

            It looks like setting DrawOnPricePanel to false will be what you need for this to scale how you expect.

            As per my second post with screenshot attached, when I draw on the price panel the ScaleJustification.Overlay is ignored and ScaleJustification.Right is used instead.
            Are you printing out the ScaleJustification and seeing that this is actually the case or are you simply seeing this on the chart?
            Last edited by NinjaTrader_JoshG; 05-17-2019, 07:22 AM.
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Yes, you are right. DrawOnPricePanel set to false does the trick. I can't say I get it though. Setting this to false I was expecting the drawing to take place on another panel all together, not just another scale. I suppose that in combination with IsOverlay set to true it means "draw on the price panel but not using the price scale". The name DrawOnPricePanel and having to set it to false in this case is a little misleading. Maybe it's just my English.

              Thanks for your help Josh.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,266 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X