Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing region

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

    Drawing region

    Hi,Support and All,

    could you please provide an example on how to draw a region until conditions change.Let`s say,for a channel until upper or lower band breached?

    Thank you

    #2
    Originally posted by outsource View Post
    Hi,Support and All,

    could you please provide an example on how to draw a region until conditions change.Let`s say,for a channel until upper or lower band breached?

    Thank you
    ok-- this now makes more sense with this post here:




    There are plenty of examples in the NT7 indicator forum here.

    Here's one such example:

    Comment


      #3
      Originally posted by sledge View Post
      ok-- this now makes more sense with this post here:




      There are plenty of examples in the NT7 indicator forum here.

      Here's one such example:

      http://ninjatrader.com/support/forum...atid=4&lpage=2
      Hi,Sledge,

      i use exactly the same drawregion command as per example you`ve provided,but it doesn`t shade the bands according to the signal.It does shade for the bar[1] and bar[0] only,and not between signals


      if(drawChannelArea){
      DrawRegion("regionup" + CurrentBar, 1, 0, Upper, Lower, Color.Transparent, upChannelAreaFillColor, 5);
      }

      Comment


        #4
        Hello,

        There is another example on the forum called SMARegions which contains logic for signals.


        This draws a region and is based on a single condition in which sets two bools BreakOut and BreakDn.

        Depending on which bool is activated, the Regions are drawn for the period of bars in which that bool remained active.

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

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello,

          There is another example on the forum called SMARegions which contains logic for signals.


          This draws a region and is based on a single condition in which sets two bools BreakOut and BreakDn.

          Depending on which bool is activated, the Regions are drawn for the period of bars in which that bool remained active.

          I look forward to being of further assistance.
          Thanks,Jesse,

          but it still not shading the area properly,but shading it sort by chunk - randomly.

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello,

            There is another example on the forum called SMARegions which contains logic for signals.


            This draws a region and is based on a single condition in which sets two bools BreakOut and BreakDn.

            Depending on which bool is activated, the Regions are drawn for the period of bars in which that bool remained active.

            I look forward to being of further assistance.
            Hi,Jesse,

            it seems that the drawing region issue resolved,but i have another question.How would you draw arrows or text once,taking the SMARregions example?I`d like to additionally draw arrows or text,but it draws on each and every bar that shaded after xover.

            Could you please provide an example on how to draw arrows or text just once,until conditions change, using SMARregions indicator?

            Thanks in advance

            Comment


              #7
              Hello outsource,

              Attached to this post is a modified SMARegions script that demonstrates how this can be done.

              You will notice a new boolean variable called drawOnce. This will keep track if an event has occurred (CrossAbove or CrossBelow in this case) and will set it to true.

              Once the arrow has been drawn, the boolean is reset back to false.

              I would suggest comparing both the modified and original scripts to compare the changes.

              Please, let us know if we may be of further assistance.
              Attached Files
              Zachary G.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ZacharyG View Post
                Hello outsource,

                Attached to this post is a modified SMARegions script that demonstrates how this can be done.

                You will notice a new boolean variable called drawOnce. This will keep track if an event has occurred (CrossAbove or CrossBelow in this case) and will set it to true.

                Once the arrow has been drawn, the boolean is reset back to false.

                I would suggest comparing both the modified and original scripts to compare the changes.

                Please, let us know if we may be of further assistance.
                Hi Zachary,

                thanks for the example,i tried the same,but it still draws arrows on every bar.Could you please look into the script(attached) and suggest an example,provided the shading logic it has?I use the same diff formula,so it probably could be the reason why it draws on every bar.

                Thank you
                Attached Files

                Comment


                  #9
                  One thing i`d like to add to the diff formula is:

                  if( diff >= ntt && diff <= wtt && Close[0] > Upper[1])

                  And have only one arrow till the opposite signal occurs.How would i do that?

                  Thank you

                  Comment


                    #10
                    Hello outsource,

                    The latest script you have provided me does not have any logic that draws arrows.

                    Can you please clarify what you are asking for?

                    If you would like an arrow to be drawn once, I would suggest using a boolean that will keep track when an arrow is drawn and will change from true to false (or false to true) when the opposite signal comes so you can draw the arrow only once again.

                    Example:
                    Code:
                    private bool signalTracker = true;
                    
                    if (/*signal logic*/ && signalTracker)
                    {
                         DrawArrowUp(....);
                         signalTracker = false;
                    }
                    
                    if (/*signal logic*/ && !signalTracker)
                    {
                         DrawArrowDown(....);
                         signalTracker = true;
                    }
                    Zachary G.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_ZacharyG View Post
                      Hello outsource,

                      The latest script you have provided me does not have any logic that draws arrows.

                      Can you please clarify what you are asking for?

                      If you would like an arrow to be drawn once, I would suggest using a boolean that will keep track when an arrow is drawn and will change from true to false (or false to true) when the opposite signal comes so you can draw the arrow only once again.

                      Example:
                      Code:
                      private bool signalTracker = true;
                      
                      if (/*signal logic*/ && signalTracker)
                      {
                           DrawArrowUp(....);
                           signalTracker = false;
                      }
                      
                      if (/*signal logic*/ && !signalTracker)
                      {
                           DrawArrowDown(....);
                           signalTracker = true;
                      }

                      Hi Zachary,

                      thanks,i think this example did.How would you add bool now to turn arrows on/off?

                      Thx

                      Comment


                        #12
                        Hello outsource,

                        I would suggest reading through this handy tip on how to create your own user defined input parameters: http://ninjatrader.com/support/forum...84&postcount=1

                        Please, let us know if we may be of further assistance.
                        Zachary G.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by algospoke, Today, 06:40 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post algospoke  
                        Started by maybeimnotrader, Today, 05:46 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post maybeimnotrader  
                        Started by quantismo, Today, 05:13 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post quantismo  
                        Started by AttiM, 02-14-2024, 05:20 PM
                        8 responses
                        168 views
                        0 likes
                        Last Post jeronymite  
                        Started by cre8able, Today, 04:22 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post cre8able  
                        Working...
                        X