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 cmoran13, 04-16-2026, 01:02 PM
      0 responses
      43 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      25 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      157 views
      2 likes
      Last Post CaptainJack  
      Working...
      X