Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Request for new feature: Add Profit Target Price and Stop Price to charts

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

    Request for new feature: Add Profit Target Price and Stop Price to charts

    It would be great if the profit target and the stop value were printed in the backtest result chart for every single bar where there is an order active. Could be a Wingdings 3 Red Up/Down arrow for the stop and a blue one on the other side for the profit target price.

    I have tried to do this but NT grinds to a halt with the number of Draw.Dot or Draw.Text involved. Somehow NT manages to draw a graphic OHLC bar for each bar very quickly, but I cannot get Draw.Dot or Draw.Text to draw fast enough to not end up with task not responding error.

    e.g. I have tried...

    Code:
    const int FontSize = 5;
    NinjaTrader.Gui.Tools.SimpleFont myFont = new NinjaTrader.Gui.Tools.SimpleFont("Wingdings 3", FontSize) { Size = FontSize, Bold = true };
     
    protected override void OnBarUpdate()
    {
          Draw.Text(this, CurrentBar+"Stop",true, ",", Time[0], Close[0], 0, Brushes.Red, myFont, TextAlignment.Center, null, null, 1);
               ...
    It does work, but it is too slow for any reasonably long backtest. The Chart just stops responding an I have to end the NT task.

    I think that this is not something we can do with Ninjascript because the Draw.Text and Daw.Dot is too slow.

    #2
    Hello,

    Thank you for the post.

    If you are running into problems based on the number of objects being drawn, that would generally be a case where you need to instead use OnRender to draw the data for only the currently visible bars.

    There is a sample indicator that shows some different rendering concepts called SampleCustomRender. As a Strategy cannot use OnRender, you would need to pass data from the strategy into an indicator that will draw the data. For example, the strategy could call the indicator from its OnBarUpdate or other order overrides to provide updates. The indicator could then be used to render data on the chart. We do have a sample that shows passing values to a dummy indicator for plotting purposes here: https://ninjatrader.com/support/foru...ead.php?t=6651

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X