Your indicator works nicely!! almost all months is touching the upper or lower line. Excellent!
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 Progressive Weekly Reference Line
Collapse
X
-
Originally posted by aligator View Post
Your indicator works nicely!! almost all months is touching the upper or lower line. Excellent!
- Likes 1
-
Originally posted by joselube001 View PostHi aligator,
If you still need help with this I have posted some useful base code and an indicator base to do this.
Here is the post:
https://ninjatrader.com/support/foru...into-draw-line
Look till the end of the post.
I was searching exactly the same as you!!
As you see I had to use Hash instead of solid line to avoid a solid continuous line. Also, there is an indicator, CurrentDayOHL.cs, on NT that will essentially do the same (can make H&L transparent and show only the Open). However the use of session iterator is the key.
Cheers!
Last edited by aligator; 12-09-2021, 12:24 AM.
- Likes 1
Leave a comment:
-
Hi aligator,
If you still need help with this I have posted some useful base code and an indicator base to do this.
Here is the post:
Hi, I would like to change the "AddPlot" to "Draw.Line" because I don't like Dash, Line due to the noise every new open week, day, etc and I don't like Solid, Hash because there is much noise in the chart. I sent 2 pictures for examples and the indicator code in the CurrentWeekOHL.cs file. Especially I
Look till the end of the post.
I was searching exactly the same as you!!
Leave a comment:
-
Hello aligator,
Are you referring to the Prior Week Ohlc found on the Use App Share?
This is a conversion of the NT7 indicator Prior Week OHLC Added option to turn off any particular plot (Prior weeks Open, High, Low or Close.) Please make sure you have enough data so that the indicator can calculate the OHLC of the previous week(s).
This indicator calculates the new week with:
newWeek = Time[0].Date.AddDays(7 - (int)Time[0].DayOfWeek);
This is taking the time of the current bar and using 7 minus the day of the week as a number (starting with sunday) to add the number of days left until the next week to the current date. (Setting the time the next week starts).
When the current date is now beyond that date, we know the next week has started.
This can be used for deciding when to use a new tag name for new line if you want to use Draw.Line().
For the startTime parameter to Draw.Line use the Time of the current bar minus the day of week (which should give you the most recent sunday) and the Time of the current bar as the endTime parameter.
Time[0].AddDays(-(int)Time[0].DayOfWeek)
- Likes 1
Leave a comment:
-
Originally posted by aligator View PostSimply, I am trying to use the PriorWeek's Close as a constant, and draw a line from the Open of the Monday RTH Session ending on the last bar of the current Friday RTH session close.
I know I can do this similar to PriorWeekOHLC indicator, and I have already done it as a plot. However, when plotted as a solid line, the solid line unlike the Hash and Dash, does continue between session breaks like a zigzag(as is also the case with PriorWeekOHLC indicator).
I want the prior week close plotted as a solid line separately (same as a Hash or Dash lines) for each week. That is why I want to use Draw.Line instead of a plot, if possible.
tried it yet in NT8, but give it a shot, see if it works for your case.
I believe if you call Reset on one plot value (say, the very first one of
the new trading week) this 'invalid' value will cause the default Plot
method to not connect the next plot value back to the previous one,
since the previous one will be an unknown value.
This should achieve the effect you're looking for. That is, I think
you're wanting to remove the 'zig-zag' look created when the Plot
method connects two adjacent (but different) plot values at your
trading week boundary.
Leave a comment:
-
Originally posted by NinjaTrader_ChelseaB View PostHello aligator,
The line would like likely need to be updated on each new bar to extend to the current bar until the desired end date time is reached.
Is the primary series using RTH as the Trading hours template?
If so, are you wanting to draw a line from when Bars.IsFirstBarOfSession is true and the DayOfWeek is Sunday, up to the current bar until Friday?
If not, are you adding a secondary series with a different trading hours template?
Are you wanting to get the time of a session open from a SessionIterator?
Is this an indicator?
Simply, I am trying to use the PriorWeek's Close as a constant, and draw a line from the Open of the Monday RTH Session ending on the last bar of the current Friday RTH session close.
I know I can do this similar to PriorWeekOHLC indicator, and I have already done it as a plot. However, when plotted as a solid line, the solid line unlike the Hash and Dash, does continue between session breaks like a zigzag(as is also the case with PriorWeekOHLC indicator).
I want the prior week close plotted as a solid line separately (same as a Hash or Dash lines) for each week. That is why I want to use Draw.Line instead of a plot, if possible.
Many thanks.
Leave a comment:
-
This also might allow your drawing indicator to be pretty darn simple.
I mean, it could probably just use a simple Plot to draw the line at the
current known Y-value. [Oops, I mean it stores the current Y-value
and the default Plot method draws your plot as a horizontal line, just
like for any other plot where the plot value stays constant.]
If you promise to manually update the date & Y-value at the start of
each week, and if you promise to exit/restart NinjaTrader after you
update this file, then the code to find the correct Y-value can run at
State.DataLoaded, and everything works fine ... until next week,
when you need to manually update the file again.
The manual effort is small, and really doesn't sound all that bad.Last edited by bltdavid; 06-03-2020, 04:36 PM.
Leave a comment:
-
If I understand you right, you're saying the Y-value (aka price) of that
line does not change for an entire week?
Hmm, why not store the dates and Y-values in a file?
The point is:
Your 'drawing' indicator which draws the line can then consult this
file, figure out which date to use, and then draw the line at the
price found from this file.
The task of updating this file, esp if maintained as a text file, is
not that onerous if performed manually once at the start of each
trading week.
As a second phase, I'd recommend a separate indicator to update
the file. Perhaps it could use a BarsRequest for minute data and
wade through this data to get the RTH start time for the beginning
of the week, then update the text file with this value.
The point is:
Separating them might get you started faster.
I mean, write the first indicator to read from a file and get it
up & running now so at least you have your weekly line drawn.
Then work on the 2nd indicator to update this file based upon
BarsRequest data, perhaps also merging the drawing code from
the 1st indicator into this one.
Just my 2˘.
Leave a comment:
-
Hello aligator,
The line would like likely need to be updated on each new bar to extend to the current bar until the desired end date time is reached.
Is the primary series using RTH as the Trading hours template?
If so, are you wanting to draw a line from when Bars.IsFirstBarOfSession is true and the DayOfWeek is Sunday, up to the current bar until Friday?
If not, are you adding a secondary series with a different trading hours template?
Are you wanting to get the time of a session open from a SessionIterator?
Is this an indicator?
Leave a comment:
-
Drawing a Progressive Weekly Reference Line
Dear Support,
I need to draw a simple progressive horizontal line starting on the open (RTH) of the current market week and extending progressively into the close of the current market week and ends there. I do not want to use DateTime in Draw.Line() statement, if possible, since every Friday or Monday may not be a trading day.
I could not find an example in Help section and looking for just the Draw.Line() code that would accomplish that. Any sample snippet or idea would be appreciated?
Many ThanksTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by johnMoss, 03-04-2024, 01:53 PM
|
3 responses
46 views
0 likes
|
Last Post
by AndyM
Today, 06:13 PM
|
||
Started by algospoke, Today, 06:01 PM
|
0 responses
8 views
0 likes
|
Last Post
by algospoke
Today, 06:01 PM
|
||
Started by cre8able, Today, 05:53 PM
|
0 responses
8 views
0 likes
|
Last Post
by cre8able
Today, 05:53 PM
|
||
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
24 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
32 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
Leave a comment: