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

Colored Support and Resistance Zones

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

    #16
    Hi Dierk

    Thanks for the references and I think these are data series, am I wrong?
    Heres the code.

    protectedoverridevoid Initialize()
    {
    Add(new Plot(Color.Red, PlotStyle.Line, "Line1"));
    Add(new Plot(Color.Red, PlotStyle.Line, "Line2"));

    }
    protectedoverridevoid OnBarUpdate()
    {
    if (Line1Value != 0) Line1.Set(Line1Value);
    if (Line2Value != 0) Line2.Set(Line2Value);

    DrawRegion("First", CurrentBar, 0, Line1, Line2, Color.Black, Color.Khaki, 2);

    }
    #region Properties
    [Browsable(
    false)]
    [XmlIgnore()]
    public DataSeries Line1
    {
    get { return Values[0]; }
    }

    //repeated for Line2

    }

    [Description("Line 1 value")]
    [Category(
    "Parameters")]
    publicdouble Line1Value
    {
    get { return line1Value; }
    set { line1Value = value; }
    }


    Comment


      #17
      If you get an error, double click on the error message to see what's wrong.

      Comment


        #18
        I am having a very difficult time with constructing this, if someone could show me the code for an example, it would be very useful and appreciated.

        What would the code be to color the region between
        y=11656 and
        y=11676

        Comment


          #19
          If what you want is to do a simple rectangle coloring I suggest you use DrawRectangle().

          Code:
          DrawRectangle("tag1", CurrentBar, 11676, 0, 11656, Color.Blue);
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            plotting a rectangle

            What would the correct code be to have a custom rectangle that is plotted across a single day?

            So, the inputs might be:

            dim Topedge as double;
            dim Bottomedge as double;
            dim RectangleDate as ?;

            // and the draw command would be something like:
            // except i don't know how to set the left and right edges...
            DrawRectangle("Rect", CurrentBar, Topedge, 0, Bottomedge, Color.Blue);

            Comment


              #21
              DrawRectangle("Rect", Bars.BarsSinceSession, Topedge, 0, Bottomedge, Color.Blue);
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by WHICKED, Today, 02:02 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by selu72, Today, 02:01 PM
              0 responses
              3 views
              0 likes
              Last Post selu72
              by selu72
               
              Started by f.saeidi, Today, 12:14 PM
              8 responses
              21 views
              0 likes
              Last Post f.saeidi  
              Started by Mikey_, 03-23-2024, 05:59 PM
              3 responses
              49 views
              0 likes
              Last Post Sam2515
              by Sam2515
               
              Started by Russ Moreland, Today, 12:54 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X