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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      27 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      283 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      280 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      131 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X