Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't get drawregion working

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

    Can't get drawregion working

    Hello,
    i've troubles with that "drawregion" thing.
    Here is my code:
    Code:
    double kelL = KeltnerChannel(numStdDev,period).Lower[0];
    double kelU = KeltnerChannel(numStdDev,period).Upper[0];
    DrawRegion("Fill_Band", CurrentBar,0, kelL, kelU,upColor, Color.Green, opacity);
    
    or this one:
    
    DrawRegion("Fill_Band", CurrentBar,0, KeltnerChannel(numStdDev,period).Upper[0], KeltnerChannel(numStdDev,period).Lower[0], dnColor, Color.Red, opacity);
    Attached the errors.
    Attached Files

    #2
    Argument 4 is looking for a data series and you cannot directly use a double value for this argument. Rather than specify a double, please just use the Keltner.Lower data series.

    Code:
    DrawRegion("Fill_Band", CurrentBar,0, KeltnerChannel(numStdDev,period).Lower, kelU,upColor, Color.Green, opacity);
    For your section example, you will want to specify the data series object, rather than include the BarsAgo:

    Code:
    DrawRegion("Fill_Band", CurrentBar,0, KeltnerChannel(numStdDev,period).Upper, KeltnerChannel(numStdDev,period).Lower[0], dnColor, Color.Red, opacity);
    MatthewNinjaTrader Product Management

    Comment


      #3
      Ok Matthew,
      i've changed and added the data series.
      But now everything is filled with the filled color when the CurrentBar goes down and up.(green or red)
      Code:
      DrawRegion("Fill_Band", CurrentBar,0,KeltnerChannel(numStdDev,period).Upper, KeltnerChannel(numStdDev,period).Lower, upColor, Color.Green, opacity);

      Comment


        #4
        Can you please clarify what you are attempting to accomplish with this function?

        Are you looking to color the lower channel red and upper channel green? Or something different?
        MatthewNinjaTrader Product Management

        Comment


          #5
          I want to color the keltner lines and filling the region between them; red if down and green when up.
          Last edited by mate41; 03-12-2012, 03:34 PM.

          Comment


            #6
            Originally posted by mate41 View Post
            Ok Matthew,
            i've changed and added the data series.
            But now everything is filled with the filled color when the CurrentBar goes down and up.(green or red)
            Code:
            DrawRegion("Fill_Band", CurrentBar,0,KeltnerChannel(numStdDev,period).Upper, KeltnerChannel(numStdDev,period).Lower, upColor, Color.Green, opacity);
            You are starting from CurrentBar ago. That is all the bars on the chart.

            Comment


              #7
              It must be done "bar by bar". If i set 0 or any other number there is no fill at all nor channel lines.

              Comment


                #8
                Originally posted by mate41 View Post
                It must be done "bar by bar". If i set 0 or any other number there is no fill at all nor channel lines.
                To do it from bar to bar, you start from one bar ago, and end at the current bar (0 bars ago), so replace CurrentBar with 1.

                Comment


                  #9
                  Thanks Konogam,
                  i did so what everything replacing CurrentBar by 1 also but can't get it working.
                  That's the second indicator where i want using that drawregion thing without success.
                  Code:
                  DrawRegion("Fill_Band" ,1,0,KeltnerChannel(numStdDev,period).Upper, KeltnerChannel(numStdDev,period).Lower, upColor, Color.Green, opacity);

                  Comment


                    #10
                    Originally posted by mate41 View Post
                    Thanks Konogam,
                    i did so what everything replacing CurrentBar by 1 also but can't get it working.
                    That's the second indicator where i want using that drawregion thing without success.
                    Code:
                    DrawRegion("Fill_Band" ,1,0,KeltnerChannel(numStdDev,period).Upper, KeltnerChannel(numStdDev,period).Lower, upColor, Color.Green, opacity);
                    Code:
                    DrawRegion("Fill_Band"+CurrentBar.ToString() ,1,0,KeltnerChannel(numStdDev,period).Upper, KeltnerChannel(numStdDev,period).Lower, upColor, Color.Green, opacity);
                    is a crude and resource intensive way to do it: crude because you are drawing one region bar for each candle. Better is to use a starting bar number when the condition is true, then use that as an indexed number to be your startBarsAgo.

                    Comment


                      #11
                      Thanks konogam for your patience, i give up. Can't get it working. Maybe later.

                      Comment


                        #12
                        Originally posted by mate41 View Post
                        Thanks konogam for your patience, i give up. Can't get it working. Maybe later.
                        Any errors in your log? They are probably unrelated to the DrawRegion() semantics, but could still prevent the indicator from showing any output.

                        Comment


                          #13
                          Hello koganam,
                          here is the source; can't export it , "NbarsDown does not exist in the current context."
                          Attached Files

                          Comment


                            #14
                            Originally posted by mate41 View Post
                            Hello koganam,
                            here is the source; can't export it , "NbarsDown does not exist in the current context."
                            When I examine your source code, I see that you have commented out all the DrawRegion() code. Are you saying that this will not compile or export even as is right now?

                            Comment


                              #15
                              1. I commented out the drawregion code because it don't work as it is.
                              2. I submitted the source of my code because i can't export it (compressed); compile is ok. An error occured that the "nbarsdown does not ........ ". And of course nbarsdown or *up don't really work as it have to do.
                              Last edited by mate41; 03-19-2012, 07:26 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by georgeinharmony, Today, 12:06 AM
                              3 responses
                              13 views
                              0 likes
                              Last Post georgeinharmony  
                              Started by Prisalice, Yesterday, 07:07 AM
                              2 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Futurestrader00, Yesterday, 12:04 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Blairski, Yesterday, 11:26 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post Blairski  
                              Started by aligator, Yesterday, 02:38 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post aligator  
                              Working...
                              X