Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.TextFixed() in Drawing Tool Script Throws an Exception

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

    Draw.TextFixed() in Drawing Tool Script Throws an Exception

    I am modifying a script for the drawing tool RiskReward that was posted on the forum. The modification displays the number of shares needed to satisfy the risk selected by the drawing tool. That works correctly. To more readily view the drawing tool text I want to to display the calculated number on the chart. I used Draw.TextFixed() to do this.
    Code:
    Draw.TextFixed(this, "tag1", "Text to draw", TextPosition.TopRight);
    This line of code causes an exception:
    class NinjaTrader.NinjaScript.DrawingTools.RiskRewardAB3
    Represents an interface that exposes information regarding a Risk Reward IDrawingTool.

    CS1503:Argument 1: cannot convert from 'NinjaTrader.NinjaScript.DrawingTools.RiskRewardAB 3' to 'NinjaScript.NinjaScript.NinjaScriptBase'
    Any suggestions?

    Thanks

    ​​
    Attached Files
    Last edited by ramckay; 07-02-2024, 06:42 PM.

    #2
    Hello ramckay,

    Thank you for your post.

    Unfortunately, Draw objects can only be called from indicators or strategies.

    If you would like to achieve the same effect as calling Draw.TextFixed(), I recommend taking a look at the code in OnRender() for Draw.TextFixed (within the Text DrawingTools script).

    You could extract the OnRender code for Draw.TextFixed and reuse it to draw text in the same way.

    Please let us know if you have any further questions.

    Comment


      #3
      NinjaTrader_Gaby,
      Thanks for the heads up. It's back to the books.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 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
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X