NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 01-16-2008, 08:12 AM   #1
dpanglin
Junior Member
 
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default Draw Horizontal line on the hour dynamically

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?!!
dpanglin is offline  
Reply With Quote
Old 01-16-2008, 09:53 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

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
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-16-2008, 10:21 AM   #3
dpanglin
Junior Member
 
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

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?
dpanglin is offline  
Reply With Quote
Old 01-16-2008, 11:06 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

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.
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-16-2008, 01:13 PM   #5
dpanglin
Junior Member
 
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
dpanglin is offline  
Reply With Quote
Old 01-16-2008, 04:34 PM   #6
dpanglin
Junior Member
 
Join Date: Sep 2007
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

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);
}
dpanglin is offline  
Reply With Quote
Old 01-16-2008, 11:01 PM   #7
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

I've replied in your other post.
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-05-2008, 11:25 AM   #8
astra
Senior Member
 
Join Date: Mar 2008
Posts: 142
Thanks: 0
Thanked 0 times in 0 posts
Default

dpanglin,
Any progress with the code? I am also interested in your code so any sharing will be appreciated. Thanks,
astra
astra is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 01:14 AM.