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

Questions about CustomPlotSample indicator

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

    Questions about CustomPlotSample indicator

    Hello,

    How to draw a rectangle in CustomPlotSample indicator, that it will have autoscale on X scale, but fixed Y scale value?

    Picture:

    SaveImg позволит вам загрузить фото или картинку бесплатно и без регистрации


    And how to draw a rectangle no on chart exactly, but in separate indicator window (New Panel)?
    Last edited by agafon2; 02-15-2013, 12:31 PM.

    #2
    Hello agafon2,

    This would require overloading the Plot method which we would not be able to support, but you may view the source code of the "CustomPlotSample" Indicators and see how they are drawing the box. There is comments to help understand what is being done as well. To view the source code of the "CustomPlotSample" indicator you may go to Tools -> Edit NinjaScript -> and double click on the "CustomPlotSample".
    JCNinjaTrader Customer Service

    Comment


      #3
      How to draw a rectangle no on chart exactly, but in separate indicator window (New Panel)

      SaveImg позволит вам загрузить фото или картинку бесплатно и без регистрации

      Comment


        #4
        Originally posted by agafon2 View Post
        How to draw a rectangle no on chart exactly, but in separate indicator window (New Panel)

        http://saveimg.ru/show-image.php?id=...0f29879fae27f0
        Look up DrawOnPricePanel() in NT Help.

        Comment


          #5
          This code doesn't work:
          Code:
                  protected override void Initialize()
                  {
                      DrawOnPricePanel = false;
                      Overlay = false;
                      CalculateOnBarClose = false;            
                  }
          
                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                    if(Historical) {
                      DrawRectangle("1"+CurrentBar.ToString(), true, 1, 0, 0, 0.2, Color.Red, Color.Empty, 0);
                    }
                      //DrawRectangle("2"+CurrentBar.ToString(), false, 1, 0.2, 0, 0.4, Color.Red, Color.Empty, 0);
                      //DrawRectangle("3"+CurrentBar.ToString(), false, 1, 0.4, 0, 0.6, Color.Red, Color.Empty, 0);
                      //DrawRectangle("4"+CurrentBar.ToString(), false, 1, 0.4, 0, 0.6, Color.Red, Color.Empty, 0);
                      
                      // Use this method for calculating your indicator values. Assign a value to each
                      // plot below by replacing 'Close[0]' with your own formula.
                  }
          Why?

          Comment


            #6
            Originally posted by agafon2 View Post
            This code doesn't work:
            Code:
                    protected override void Initialize()
                    {
                        DrawOnPricePanel = false;
                        Overlay = false;
                        CalculateOnBarClose = false;            
                    }
             
                    /// <summary>
                    /// Called on each bar update event (incoming tick)
                    /// </summary>
                    protected override void OnBarUpdate()
                    {
                      if(Historical) {
                        DrawRectangle("1"+CurrentBar.ToString(), true, 1, 0, 0, 0.2, Color.Red, Color.Empty, 0);
                      }
                        //DrawRectangle("2"+CurrentBar.ToString(), false, 1, 0.2, 0, 0.4, Color.Red, Color.Empty, 0);
                        //DrawRectangle("3"+CurrentBar.ToString(), false, 1, 0.4, 0, 0.6, Color.Red, Color.Empty, 0);
                        //DrawRectangle("4"+CurrentBar.ToString(), false, 1, 0.4, 0, 0.6, Color.Red, Color.Empty, 0);
             
                        // Use this method for calculating your indicator values. Assign a value to each
                        // plot below by replacing 'Close[0]' with your own formula.
                    }
            Why?
            What is the error in your log?

            Comment


              #7
              Originally posted by koganam View Post
              What is the error in your log?
              Default

              Look at this picture:

              SaveImg &#1087;&#1086;&#1079;&#1074;&#1086;&#1083;&#1080;&#1090; &#1074;&#1072;&#1084; &#1079;&#1072;&#1075;&#1088;&#1091;&#1079;&#1080;&#1090;&#1100; &#1092;&#1086;&#1090;&#1086; &#1080;&#1083;&#1080; &#1082;&#1072;&#1088;&#1090;&#1080;&#1085;&#1082;&#1091; &#1073;&#1077;&#1089;&#1087;&#1083;&#1072;&#1090;&#1085;&#1086; &#1080; &#1073;&#1077;&#1079; &#1088;&#1077;&#1075;&#1080;&#1089;&#1090;&#1088;&#1072;&#1094;&#1080;&#1080;

              Comment


                #8
                Originally posted by agafon2 View Post
                Sorry, that does not tell me anything. Please tell us the text of the error message.

                Comment


                  #9
                  Originally posted by koganam View Post
                  Sorry, that does not tell me anything. Please tell us the text of the error message.
                  How to get this text? Is it in Log window or not?

                  Comment


                    #10
                    Originally posted by agafon2 View Post
                    How to get this text? Is it in Log window or not?
                    The logs show what the issue is, if any. If you have to resize the columns in order to read the text, then that is what you have to do, though actually on my screen, the text of the logged message is already, and has always been, the largest column.
                    Last edited by koganam; 02-19-2013, 11:00 PM. Reason: Corrected punctuation.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by rocketman7, Today, 01:00 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post rocketman7  
                    Started by wzgy0920, 04-20-2024, 06:09 PM
                    2 responses
                    27 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 02-22-2024, 01:11 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 04-23-2024, 09:53 PM
                    2 responses
                    74 views
                    0 likes
                    Last Post wzgy0920  
                    Started by Kensonprib, 04-28-2021, 10:11 AM
                    5 responses
                    193 views
                    0 likes
                    Last Post Hasadafa  
                    Working...
                    X