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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
661 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
375 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
110 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
580 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment