Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting the new Price when de HorizontalLine Move

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

    Getting the new Price when de HorizontalLine Move

    Hello.

    I'm developing an indicator. This indicator draw an horizontal line over the chart with the function Draw.HorizontalLine(). I have an object HorizontalLine to save the object retorned.

    Like:

    Horizontal LineLmt = Draw.HorizontalLine(this, IdLimit.ToString(), openOrderMessage.Order.LmtPrice, Brushes.Red);

    I would like to get the new anchor(price) when the line is move on the chart..

    I don't know how to do it.

    Anyone can help me?

    Thanks...

    #2
    Hello brokerbombero,

    Thank you for the post.

    In this situation, there is not a specific event that would be triggered for the lines moving. You could possibly use OnRender to read the value while the chart is being re-rendered.

    It would also depend on when you need to read the value, if this is being used in OnBarUpdate nothing additional would be needed as you have an instance to the object, you may just need to make a class level variable instead if you have not already. If that is the case you could just access the objects anchors to gather their prices when OnBarUpdate is called.

    Can you provide more detail on what the end goal is, that would help me determine what direction you might want to take here.

    I look forward to being of further assistance.

    Comment


      #3
      I found the solution

      Hello.

      I'm developing an indicator, that it send order to another broker. So I wanted to simulate the same functionality that when you place an order on the chart with NinjaTrader8, it draw a line and you can move this line over the chart, and the price of the Stop or Limit change.
      Inside DrawingTools
      The solution it's to Create a new public class PintaOrden : Line, INotifyPropertyChanged
      { ......

      Inside this class I have added some properties necessaries for me, one of the Price.

      I have override OnMouseUp (when the user leave the line on the chart), inside this method a get the new price, and raise the event OnPropertyChange.

      public override void OnMouseUp(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)
      {
      base.OnMouseUp(chartControl, chartPanel, chartScale, dataPoint);
      //Print("Ha terminado de moverse la orden "+IdOrden+"siendo el precio: "+EndAnchor.Price);
      Precio = EndAnchor.Price;

      }

      So inside of the indicator, I know that the price has change, so I can cancel the old order, and I put the new one.

      Inside of the indicator it's necessary to create a new object of PintaOrden and subscribe to the event OnPropertyChange.

      The solution it could be a little complicated, but it's works for me.

      Thanks a lot.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      567 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X