Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing Text on chart

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

    Printing Text on chart

    Hi, with the help of you guys, I created my first strategy. In my strategy, I have a risk management section, where I print the risk of a running trade. Which kind of look like this:

    Code:
    Draw.TextFixed(this, "Risk", "Total Risk: $" + RiskCash.ToString(), TextPosition.BottomRight);
    The problem is that it only shows the last value of "RiskCash" variable. What I want to do is, I want to hover over the chart and want to check the value of "RiskCash" at any point. I could put it inside of databox as a hidden plot, but it would be more helpful if I could put it here. Is this possible?

    #2
    Hello fawzanalim,

    Thank you for your post.

    This would be possible with custom rendering. The attached example subscribes to a mouse hover event and uses ChartBars.GetBarIdxByX to get a BarIndex.

    That BarIndex is then used with a Series<double> and GetValueAt to draw that series value using DrawTextLayout in OnRender. We would recommend this over using Draw.TextFixed in the mouse event for performance reasons.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment

    Latest Posts

    Collapse

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