I am calculating an SMA on an hourly chart. I tried adding the Draw.Line to an existing script (which calculates and plots the values I want on the hourly chart), and at first it seemed to work. But then the global line failed to update as the SMA updated for the next hour, even though the Draw.Line command was in OnBarUpdate. Can you provide some guidance?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Global lines and rectangles with RenderTarget?
Collapse
X
-
Global lines and rectangles with RenderTarget?
I am looking for the optimal way to draw a line via script and assign it globally to all charts for the instrument. I currently use RenderTarget for some lines, but do not see a way to make those lines global using the SharpDX toolset. Do I need to use the drawing tool for Draw.Line then? And if so, does that need to go in OnBarUpdate, instead of OnRender?
I am calculating an SMA on an hourly chart. I tried adding the Draw.Line to an existing script (which calculates and plots the values I want on the hourly chart), and at first it seemed to work. But then the global line failed to update as the SMA updated for the next hour, even though the Draw.Line command was in OnBarUpdate. Can you provide some guidance?Tags: None
-
Hello jculp,
Thanks for your post.
Yes, you would need to use the Draw methods, in OnBarUpDate() using the overloads that provide the IsGlobal parameter. Note that you will likely want to do that in conjunction with templates that will allow you to configure the draw object characteristics that the methods using IsGlobal will not allow.
If a template is not available when the script runs, it will then use the defaults for the particular draw object.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
68 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
151 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
100 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
288 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment