• 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

Plot with custom DashPattern

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

    Plot with custom DashPattern

    In NT7 I have an indicator which plots lines with different custom DashPatterns, how to convert this in NT8? I tried the following code but doesn't work.

    Variable:
    privateDoubleCollectionDashTestValues = newDoubleCollection() { 7, 3, 7, 3 };

    protectedoverridevoidOnStateChange()
    {
    if (State == State.SetDefaults) {
    AddPlot(Brushes.RoyalBlue, "Line1"); //Value[0]
    PencustPen1 = newPen(Brushes.Black, 1); //create a custom Pen
    //Define own DashStyle object for custPen passing a collection of double that defines the dash pattern //(DashTestValues)
    custPen1.DashStyle = newDashStyle(DashTestValues,0);
    Plots[0].Pen = custPen1; //set plot[0] Pen
    Plots[0].PlotStyle = PlotStyle.Hash;

    }
    }
    //Plot value is updated in OnBarUpdate

    protectedoverridevoidOnBarUpdate()
    {
    Value[0] = PriceL+ARge/2; //Plot Line1
    }
    I only get a plot in the style defined by PlotStyle but I don't see the custom dash pattern. What is wrong? Any snippet code to get on track?
    Also for this custom brush do we need to do something State == State.Terminated to free memory, what is the code for this?

    #2
    Hello jpraema,

    What is the NT7 code you are trying to port over?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      The code is the one I tried in NT8 beta 13

      Comment


        #4
        Hello jpraema,

        I'm afraid I do not understand.

        The code you have posted is the code you have written for NinjaTrader 8 Beta.

        I have asked what the NT7 code is you are trying to port over. (The original code)

        So that I can see what is you are trying to make.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          The NT7 code is:
          In variable zone define an array of float to define the pattern of dashes
          private float[] myDash1Values = { 5.0F, 3.0F, 5.0F, 3.0F };


          in Initialize():
          Add(new Plot(Color.Aqua, PlotStyle.Line, "Line1")); //Plot[0]


          OnStartUp()
          Plots[0].Pen.DashPattern = myDash1Values;
          Plots[0].Pen.Width = 1;


          In OnBarUpdate()
          Line1.Set(PriceL+ARge/2);



          I have several plots with different DashPatterns and it works in NT7.

          In NT8 Pen.DashPattern no longer exist and I replaced it by DashStyle Pen property but this doesn't work.
          The question is how to creates a plot with a custom dash pattern in NT8.

          Comment


            #6
            Hi jpraema,

            I'm not too sure on this one and I've asked our development.

            Once I have more information I'll update in this thread.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Any progress on how to implement this in NT8?

              Comment


                #8
                Hi jpraema,

                I've sent the question to our development, however, I have not yet received a response back.

                Currently, I'm waiting to see if there is an existing equivalent or if a feature request needs to be submitted.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  I wanted to provide an update on this item.

                  It appears the specific implementation for the custom dash pattern was removed from the UI going forward, but this still can be accomplished with using OnRender.

                  There is some documentation on this topic here: http://ninjatrader.com/support/helpG...trokestyle.htm

                  There was a sample also provided with this from product management, this sample demonstrates utilizing a Plot and SharpDX to set Plot with a custom Stroke.

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

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Zoomy55, Today, 08:20 AM
                  2 responses
                  15 views
                  0 likes
                  Last Post Zoomy55
                  by Zoomy55
                   
                  Started by SOFI777, Today, 08:02 AM
                  1 response
                  2 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by U0000999, Today, 08:12 AM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_PatrickG  
                  Started by U0000999, Today, 08:07 AM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by SOFI777, Today, 07:50 AM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Working...
                  X