I want to make a line that has some text on it and the text would get updated with the distance (ticks or points) from the current price.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Creating a custom draw object that updates itself
Collapse
X
-
Creating a custom draw object that updates itself
Would it be technically possible to create a drawing object that updates itself? I have no experience with drawing objects, so I was just wondering if this can be done.
I want to make a line that has some text on it and the text would get updated with the distance (ticks or points) from the current price.Tags: None
-
can the indicator "adopt' a manually drawn drawing object? I want to be able to draw the lines manually
Comment
-
You can do that by coding a custom drawing tool, then in its OnRender method you'd calculate the distance of the line from the current price, convert to ticks if you want, then draw your text using that value.
To be more efficient you can calculate the price distance inside your drawing tool's AttachedTo.Instrument.MarketData.Update event, which fires less often than OnRender.
But on today's systems the performance hit will be nothing for such a simple calculation, so there is really no need.
I have done something similar with an alert line (see pic). Custom tools appear in the drawing tool menu and can be drawn manually.
The HorizontalLine tool can be found in the DrawingTools folder inside Lines.cs. From there you can take out the code you need and make your own version.
1 Photo
Comment
-
-
I might just go this way, modify this indicator - it seems to have an interesting concept - it reads existing lines and writes text on the chart
Labeled Horizontal Lines | NinjaTrader Ecosystem
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by eduardodipp7, Today, 10:29 AM
|
1 response
4 views
0 likes
|
Last Post Today, 12:35 PM | ||
Started by spottysallrite, Today, 11:31 AM
|
3 responses
9 views
0 likes
|
Last Post Today, 12:32 PM | ||
Started by adeelshahzad, Today, 11:49 AM
|
3 responses
5 views
0 likes
|
Last Post Today, 12:22 PM | ||
Started by johnMoss, 03-04-2024, 01:53 PM
|
2 responses
35 views
0 likes
|
Last Post
by Overnhou
Today, 11:21 AM
|
||
Started by Padan, Today, 02:02 AM
|
5 responses
17 views
0 likes
|
Last Post Today, 11:14 AM |
Comment