![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
Help please!
I would like to draw a Horizontal Line on the chart that corresponds to the current bar's Opening price + 0.0003 (for 3 pips) . The kicker is that this line must re-draw or update at the start of every hour on the hour. I am using eSignal data feed so historical data is no problem. This will be applied to a 5 min chart. Can someone help me please?!! |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
There are various help guide tutorials on indicator development which is always a good start if you are new to this. If you prefer not to get your hands dirty, you can always consult with one of our NinjaScript consultants.
http://www.ninjatrader.com/webnew/pa...injaScript.htm
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
I am not entirely new to Ninja script coding having written a few indicators myself. I know how to code for a fixed horizontal line at whatever level I want on the chart. The challenge is making it re-draw at the start of the hour. Just throwing it out there to get a dialogue going and for someone to give me a hint. Should I be looking at Session start time for example?
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Assuming you run it on a 5 minute chart, you would need to programatically check on each bar if 12 - 5 minute bars have passed and if yes, recalculate and draw the line at the new value.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks. I am struggling with getting the line to draw at the open price starting on the hour. So if I put up a chart at say 09:07 I need my line to stay at the open price at 09:00 until it reaches 10:00. Can you through me a suggested line of code? Just asking for a jump start.
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
Below is my attempt at coding what I am asking for but has compilation errors. Can you help?
{ if (CurrentBar < 24) return; int H1 = 0; for (int barsAgo = 0; barsAgo < 24; barsAgo++) { H1 = H1 + Input[barsAgo]; } if (ToTime(Time[0]) >= ToTime(H1, 00, 00)) { int bartime = CurrentBar - Bars.GetBar(new DateTime(2007,1,16,H1,0,0)); } DrawHorizontalLine("Hour Open",Open[bartime],Color.Blue); } |
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
I've replied in your other post.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Mar 2008
Posts: 142
Thanks: 0
Thanked 0 times in 0 posts
|
dpanglin,
Any progress with the code? I am also interested in your code so any sharing will be appreciated. Thanks, astra |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to draw a parallel line to a trend line? | tradewiz | Charting | 4 | 12-19-2007 04:42 AM |
| Label the Horizontal Line | mgbloomfield | General Programming | 1 | 10-24-2007 12:02 PM |
| Can a strategy read a horizontal line? | maxpi | Strategy Development | 2 | 10-23-2007 09:03 PM |
| Draw Horizontal Lines | Richard Von | Indicator Development | 11 | 08-02-2007 12:23 PM |
| adding a price value next to the horizontal line | tradingkevin | Suggestions And Feedback | 2 | 05-10-2007 05:40 PM |