![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
|
I'm trying to draw lines on the price chart that shows the Min and Max price range of the last (n) bars. Can't quite get it right using the Strategy Wizard or editing existing examples in the forum.
Essentially, the two lines would form a channel that draws from the current bar backward. The boundaries of the channel are defined by the Min and Max prices of the previous (n) bars. In the example attached, it uses a value of 8 for (n) bars back. But I also want the lines to extend back past the 8th bar back just so it is more visually appealing. The idea is to make it apparent when the current bar breaks out of the range of the channel. So an audio alert should be added when price breaks the boundary. As each new bar closes the channel needs to be redrawn. I'd appreciate ideas from anyone that can help with this indicator. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2008
Posts: 527
Thanks: 0
Thanked 9 times in 6 posts
|
Hondo,
this link explains how to draw a line on to the chart without restrictions. Not exactely what you are looking for, but with some modifications it would serve your purpose: http://www.ninjatrader-support2.com/...0&postcount=10 Regards Ralph |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Ralph, that helps. Still having a few issues with it but at least I think I'm on the right track now.
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Oct 2009
Location: Australia
Posts: 108
Thanks: 2
Thanked 14 times in 7 posts
|
Do not go with the PLOT method to solve something as simple as this. Just use OnBarUpdate()
Just use something like :-
Code:
1. Max Function to find the Max High in the past "Period" bars. double HHV = MAX(High, period)[0]; 3. then draw the line, starting "LinePeriods" back. Code:
DrawLine("Rest"+CurrentBar.ToString(), false, LinePeriods, HHV, 0, HHV, Color.LimeGreen, DashStyle.Dot, 2);
Code:
// Plays the wav file mySound.wav PlaySound(@"C:\mySound.wav"); Code:
// Generates an alert
Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);
Code:
if(CurrentBar < LinePeriods ) return. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| max/min vs number of bars | ATI user | Version 7 Beta General Questions & Bug Reports | 8 | 10-16-2009 08:45 AM |
| Max/Min List | nfeldberg | General Programming | 2 | 07-16-2008 01:22 PM |
| How can I draw lines behide the candlestick bars? | clearpicks | General Programming | 4 | 04-22-2008 06:26 PM |
| MAX/MIN limits | Richard Von | Indicator Development | 3 | 07-30-2007 08:29 AM |
| Min / Max | mydet | Indicator Development | 1 | 05-31-2007 04:47 AM |