When I double click on the rectangle and click data I see I have the end time set correctly. Is this a bug? Is there another way to get this to draw into the future? The only workaround I found was to redraw this rectangle on every bar. This seems to work but it just seems inefficient to redraw it every bar (I have lots of them).
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
Drawing a rectangle into the future
Collapse
X
-
Drawing a rectangle into the future
I want to draw a rectangle for the entire session. In my code I set the end time to be a time into the future (the next day). This draws the rectangle but as time goes on the end of the rectangle appears and it does not extend to the date/time I set.
When I double click on the rectangle and click data I see I have the end time set correctly. Is this a bug? Is there another way to get this to draw into the future? The only workaround I found was to redraw this rectangle on every bar. This seems to work but it just seems inefficient to redraw it every bar (I have lots of them).
Tags: None
-
It depends on what type of chart you are using. If you are not using a fixed time interval chart, then there is no way for the code to determine where the session end time will be, so you will have to redraw the rectangle on each bar, or at least periodically.
Comment
-
Adam, the code is here:
Code:i.DrawRectangle("Zone"+i.ToDay(startTime)+":"+top+":"+bottom, false, startTime, bottom, endTime, top, color, colorArea, opacity);
Originally posted by koganam View PostIt depends on what type of chart you are using. If you are not using a fixed time interval chart, then there is no way for the code to determine where the session end time will be, so you will have to redraw the rectangle on each bar, or at least periodically.
I wonder if I could specify x bars into the future instead of a date/time?
Comment
-
Originally posted by NinjaTrader_Bertrand View PostHi cunparis, correct, this would only work on a timed based chart, where future timestamps are known - unfortunately we could only support drawing into the future by using a future DateTime.
Comment
-
Harry
Can you please explain to an amateur how to enter a negative value on the index?
I want to extend my rectangle into the future
Thanks
Comment
-
Originally posted by [email protected] View PostHarry
Can you please explain to an amateur how to enter a negative value on the index?
I want to extend my rectangle into the future
Thanks
Just use DrawRectangle as described in the NinjaScript reference manual
Code:DrawRectangle(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color) DrawRectangle(string tag, bool autoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color, Color areaColor, int areaOpacity)
Also make sure to select a sufficient value for the right margin under chart properties.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DayTradingDEMON, Today, 09:28 AM
|
0 responses
1 view
0 likes
|
Last Post Today, 09:28 AM | ||
Started by navyguy06, Today, 09:28 AM
|
0 responses
1 view
0 likes
|
Last Post
by navyguy06
Today, 09:28 AM
|
||
Started by rjbtrade1, 11-30-2023, 04:38 PM
|
2 responses
77 views
0 likes
|
Last Post
by DavidHP
Today, 08:12 AM
|
||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
7 responses
31 views
0 likes
|
Last Post Today, 09:26 AM | ||
Started by Stanfillirenfro, Today, 07:23 AM
|
3 responses
13 views
0 likes
|
Last Post Today, 09:14 AM |
Comment