• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to draw a line on top of RSI (second panel ) in an automated strategy

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

    How to draw a line on top of RSI (second panel ) in an automated strategy

    Hello,
    I have an automated strategy where I am working mostly with RSI.

    I want to be able to draw lines that are tilted and to connect the highest values of two or more consecutive RSI peaks.

    In this regard, I managed to get the number of bar of the first tip and its respective peak RSI value, and the number of bar and peak value of the second RSI tip.

    For example I have

    1st High:
    Session Bar 293
    RSI 73.5

    2nd High
    Session Bar 385
    RSI 69.5


    I want to use the above data to draw a line and connect the two dots, while charting it on the panel where the RSI is being drawn.

    Any help will be much appreciated.

    Thanks.
    Last edited by nikolaalx; 09-07-2015, 08:33 AM.

    #2
    Originally posted by nikolaalx View Post
    Hello,
    I have an automated strategy where I am working mostly with RSI.

    I want to be able to draw lines that are tilted and to connect the highest values of two or more consecutive RSI peaks.

    In this regard, I managed to get the number of bar of the first tip and its respective peak RSI value, and the number of bar and peak value of the second RSI tip.

    For example I have

    1st High:
    Session Bar 293
    RSI 73.5

    2nd High
    Session Bar 385
    RSI 69.5


    I want to use the above data to draw a line and connect the two dots, while charting it on the panel where the RSI is being drawn.

    Any help will be much appreciated.

    Thanks.
    Put
    Code:
    DrawOnPricePanel = false;
    in the Initialize() method, then use DrawLine() to draw the line where needed.

    ref: http://ninjatrader.com/support/helpG...pricepanel.htm
    http://ninjatrader.com/support/helpG...7/drawline.htm

    Comment


      #3
      I am trying to use the following code:

      protected override void Initialize()
      {
      Add(RSI(RSIPeriod, 3));
      CalculateOnBarClose = true;
      RSI(RSIPeriod, 3).Panel = 2;
      RSI(RSIPeriod, 3).DrawOnPricePanel = false;
      }


      And then to draw the line:

      RSI(RSIPeriod, 3).DrawLine("LowPivot"+lowcnt, (CurrentBar - BarOfFirstLow), RSIFirstLow, 0, RSIThirdLow, Color.Green);


      However when I do the backtest, there are no drawn objects on my chart...?

      Any idea why this might be happening?

      Thanks.

      Comment


        #4
        Originally posted by nikolaalx View Post
        I am trying to use the following code:

        protected override void Initialize()
        {
        Add(RSI(RSIPeriod, 3));
        CalculateOnBarClose = true;
        RSI(RSIPeriod, 3).Panel = 2;
        RSI(RSIPeriod, 3).DrawOnPricePanel = false;
        }


        And then to draw the line:

        RSI(RSIPeriod, 3).DrawLine("LowPivot"+lowcnt, (CurrentBar - BarOfFirstLow), RSIFirstLow, 0, RSIThirdLow, Color.Green);


        However when I do the backtest, there are no drawn objects on my chart...?

        Any idea why this might be happening?

        Thanks.
        What is the error in your log?

        Comment


          #5
          Hi,
          I don't get any errors. I don't see any drawn lines on my screen either.

          I want to emphasize that I am trying on backresting

          Comment


            #6
            Since no one hasn't responded, I decided to bump the thread again with a specific question :

            Is it normal for lines not to be drawn on the indicator panel, when doing backresting? Or it makes no difference?

            I assume it is not normal, but still decided to specifically ask, since I don't get any errors and I don't see any drawn lines.

            I added Print outputs which verify the event trigger is taking place successfully.

            Comment


              #7
              Originally posted by nikolaalx View Post
              Since no one hasn't responded, I decided to bump the thread again with a specific question :

              Is it normal for lines not to be drawn on the indicator panel, when doing backresting? Or it makes no difference?

              I assume it is not normal, but still decided to specifically ask, since I don't get any errors and I don't see any drawn lines.

              I added Print outputs which verify the event trigger is taking place successfully.
              I honestly do not remember if drawings show up on Backtest. I would have to get back into test mode to find out. sorry.

              Comment


                #8
                Thanks, we'll once you do, please let me know.

                In the meantime it would be very helpful to see the input of a staff member on this question..

                Comment


                  #9
                  Hello,

                  Originally posted by nikolaalx View Post
                  I am trying to use the following code:

                  RSI(RSIPeriod, 3).DrawLine("LowPivot"+lowcnt, (CurrentBar - BarOfFirstLow), RSIFirstLow, 0, RSIThirdLow, Color.Green);
                  I tested the code and do see this specific usage does not work in the backtest.

                  You can use Drawing tools, for example in a strategy if you used something like:
                  Code:
                  protected override void OnBarUpdate()
                  {
                  	if(CurrentBar < 10) return;
                  	DrawLine("LowPivot"+1, 0, Close[0], 10, Close[0], Color.Green);
                  }
                  You would see the resulting line in the backtest chart however, the way you are trying to draw the line I believe is not working regarding the reference being used.

                  Instead the correct way would be to create a duplicate of the RSI indicator that draws this line from the indicator its self. The strategy would add the indicator which draws the line and no extra code would be needed in the strategy regarding the line. So long as you add the DrawOnPricePanel = false; into the duplicate, the object should appear in the correct panel.

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

                  Comment


                    #10
                    I just double tested the code by running the strategy while in real time mode and it seems to draw the lines.

                    Strange that it does not draw them in backtest.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bomanpbm, Today, 09:27 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post bomanpbm  
                    Started by tgn55, Today, 08:47 AM
                    0 responses
                    8 views
                    0 likes
                    Last Post tgn55
                    by tgn55
                     
                    Started by ballboy11, 05-04-2019, 10:26 AM
                    6 responses
                    58 views
                    0 likes
                    Last Post Kermit
                    by Kermit
                     
                    Started by mrlucky1x, Yesterday, 10:01 PM
                    0 responses
                    15 views
                    0 likes
                    Last Post mrlucky1x  
                    Started by roger556, Yesterday, 09:22 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post roger556  
                    Working...
                    X