![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Junior Member
Join Date: Jul 2012
Posts: 12
Thanks: 6
Thanked 1 time in 1 post
|
Is it possible to draw a vertical line between 2 indicators. For example, if I have 2 moving averages on the chart and I want to draw a vertical line between them, is it possible?
I'm transitioning from traderstation and they had a feature called Paintbar which would allow me to pass a high value and a low value and it would paint a vertical bar on the chart. Hoping someone can help. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi vsolv,
Yes, you could use DrawLine(), which has startY and endY inputs: http://www.ninjatrader.com/support/h...7/drawline.htm You may want to check out DrawRegion() as well. There's a sample showing how to work it between Bollinger lines here: http://www.ninjatrader.com/support/f...ead.php?t=4331
Ryan M
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_RyanM for this post: |
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2012
Posts: 12
Thanks: 6
Thanked 1 time in 1 post
|
When using the Drawline
startY - The starting y value co-ordinate where the draw object will be drawn EndY - The end y value co-ordinate where the draw object will be drawn Drawline is expecting me to provide the StartY and EndY values. I'm guessing that the coordinate system is in pixels. So question is, how do I take my indicator's High and Low values and convert it to the proper Y coordinate ? Sorry --- newbie here and just learning NScript. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
StartY and EndY are the values of your moving averages. Let's say you have a 5 period and 50 period SMA. You would draw lines between them with something like this:
Code:
DrawLine("Lines" + CurrentBar, 0, SMA(5)[0], 0, SMA(50)[0], Color.Blue);
Ryan M
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_RyanM for this post: |
|
|
|
#5 |
|
Junior Member
Join Date: Jul 2012
Posts: 12
Thanks: 6
Thanked 1 time in 1 post
|
Apologize for these newbie questions.
In my indicator, I have 2 local variables that I'm trying to plot. MyHigh, MyLow - these are double I do my calculations to populate these in the indicator. when I try to plot them as follows: DrawLine("Lines" + CurrentBar, 0, <MyLocalVar_High>, 0, <MyLocalVar_Low>, Color.Blue); I get the following errors: Use of unassigned local variable MyHigh Use of unassigned local variable MyLow What am I doing wrong? Can someone help. |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jul 2012
Posts: 12
Thanks: 6
Thanked 1 time in 1 post
|
Mistyped:
in my indicator I try to plot them as follows: DrawLine("Lines" + CurrentBar, 0, <MyHigh>, 0, <MyLow>, Color.Blue); |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Vertical Bar Indicator | freeway | Indicator Development | 1 | 10-29-2011 10:08 AM |
| TPO and Volume Profile Chart vertical scroll bar | arodrigu | Version 7 Beta General Questions & Bug Reports | 2 | 03-25-2010 07:49 AM |
| Range bar vertical gaps ? | supertrader | Charting | 40 | 12-03-2009 02:38 PM |
| Drawing 2 Vertical Lines on Same Bar | ATLien | Indicator Development | 1 | 07-26-2008 12:02 PM |
| Vertical through all levels | Antraman | Charting | 2 | 04-24-2006 01:10 AM |