Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing a line at the Target

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

    Drawing a line at the Target

    Hello,

    I'm writing a strategy to backtest an option strategy.
    Now my question is how to draw a short line above the candle (or below the candle when it's a short position) when a long position is opened that represents the target?

    For example, the strategy opens a long position at a the current price of 1500, my target is set on 2% of the entry price what gives 30, so i want a short line above the candle when the position is opened at the price of 1530.

    I've tried a lot of things but i don't find the solution ...

    #2
    Hi Jimmy73, thanks for your note.

    If you would rather avoid custom rendering in the OnRender method with SharpDX, you can use the Draw.Line method to draw a simple line of any color.

    https://ninjatrader.com/support/help...?draw_line.htm

    For a SharpDX solution, see this example indicator that does a similar task:
    https://ninjatraderecosystem.com/use...ard-indicator/

    Please let me know if you have any questions on this material.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Last edited by NinjaTrader_ChrisL; 03-14-2020, 04:21 PM.

    Comment


      #3
      Hello Chris,

      Thanks for your reaction.
      After a long search i've found the solution and thanks for the example indicator but this sort of code is to difficult for me to understand.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      72 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      39 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X