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

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

    DrawRegion

    Hi, I'm trying to code a simple color region and am having no luck at all. I am sure I am overlooking something simple, but can't see it. What I am trying to do is if the Stochastics is above 80, then shade the Stochastics area one color and if under 20 shade it a different color. So far, I can't get any shading at all. The code I have is below:

    double retvalue = Stochastics(Close, 5, 15,5).K[0];
    if(retvalue > 80) {
    DrawRegion("tag1",CurrentBar,0,Stochastics(5,15,5) .K,20,Color.ForestGreen, Color.ForestGreen, 5);
    }
    if(retvalue < 20) {
    DrawRegion("tag2",CurrentBar,0,Stochastics(5,15,5) .K,20,Color.Red , Color.Red, 5);
    }

    Any help would be greatly appreciated!

    Thanks,
    jrs

    #2
    Any error messages in the log?
    How about just starting off with a simple DrawRegion() call to ensure that this works. Then add some of the conditional logic.
    RayNinjaTrader Customer Service

    Comment


      #3
      No there are not any error messages pertaining to this (DrawRegion).
      As you suggested (good idea), I simplified it down to:

      DrawRegion("XMA Zone", CurrentBar, 0, EMA( High, 10 ), EMA( Low, 10 ), Color.Green, Color.Green, 2);

      And I do get a plot on the top graph (in the candlesticks). So that part does work, however, I think my problem may be it will not show in the subgraphs, in the actual Stochastic plotted area perhaps?

      Thanks!
      Jim

      Comment


        #4
        See the DrawOnPricePanel property.

        RayNinjaTrader Customer Service

        Comment


          #5
          Fixed

          Thanks Ray, works fine now.

          Comment


            #6
            DrawArrowUp and Down

            Question.

            I want to draw arrows on top of indicator bars in a second panel. Will that work if I set 'overlay = false' in the initialize section ?

            Is there a restriction such that only drawing objects can be placed on top of charts, or can they also be drawn on top of indicators bars ?

            Can you point me to any example code ?

            Regards,
            R. C.

            Comment


              #7
              Off the top of my head I believe on default the draw objects will appear in whichever panel your indicator is running on. You can change the draw objects to appear in the price panel by setting DrawOnPricePanel to true.

              If my memory is wrong then set DrawOnPricePanel to false and it will have the draw objects appear in the indicator panel.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ZenCortexCLICK, Today, 04:58 AM
              0 responses
              5 views
              0 likes
              Last Post ZenCortexCLICK  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              172 responses
              2,281 views
              0 likes
              Last Post sidlercom80  
              Started by Irukandji, Yesterday, 02:53 AM
              2 responses
              18 views
              0 likes
              Last Post Irukandji  
              Started by adeelshahzad, Today, 03:54 AM
              0 responses
              8 views
              0 likes
              Last Post adeelshahzad  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X