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 geddyisodin, Yesterday, 05:20 AM
              8 responses
              49 views
              0 likes
              Last Post geddyisodin  
              Started by DayTradingDEMON, Today, 09:28 AM
              3 responses
              19 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Stanfillirenfro, Today, 07:23 AM
              9 responses
              23 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by George21, Today, 10:07 AM
              0 responses
              8 views
              0 likes
              Last Post George21  
              Started by navyguy06, Today, 09:28 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X