![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Aug 2008
Posts: 44
Thanks: 1
Thanked 0 times in 0 posts
|
Go ahead & smile then, show me the error of my ways...
![]() I'm trying to draw a short vertical line from a strategy using: DrawLine("Line" + CurrentBar, false, 0, High[0] + 5*TickSize, 0, Low[0] - 5*TickSize, Color.Cyan, DashStyle.Dot, 2) If I set the bool to "true" it shows the vertical lines but, they are way too long. If I then hold the Ctrl key and move the chart up and down, the lines stay put (As expected since I set autoscale to "true" However, setting autoscale to false causes the lines to disappear.... ? Thx in advance |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Randwulf,
I would suggest changing the size of High[0] + 5*TickSize and Low[0] - 5*TickSize You have your "bars ago" settings both to 0 so it should be a vertical line. In this case, the Low and High code above sets the lengths of the line. Right now you would have High - Low + 10 ticks, so if you reduce the number of ticks it should make a smaller line. As far as your other issue, I am unable to replicate currently. Do you possibly have a simple toy strategy that does this I may test?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2008
Posts: 44
Thanks: 1
Thanked 0 times in 0 posts
|
Thx 4 the reply AdamP,
I don't understand how I would have High - Low + 10 Ticks... ? I read that as drawing a line from "0" on the X axis & High + 5 Ticks on the Y axis to "0" on the X axis & Low - 5 Ticks on the Y axis. Is this incorrect ? protected override void OnBarUpdate() { // Condition set 1 if (High[0] > KeltnerChannel(3.5, 50).Midline[0] && Low[0] < KeltnerChannel(3.5, 50).Midline[0]) { DrawLine("My line" + CurrentBar, 0, High[0] + 5 * TickSize, 0, Low[0] + -5 * TickSize, Color.White); } } |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Randwulf,
The length of the line would be the top point : High[0] + 5*TickSize Minus the low point, which is : Low[0] - 5*TickSize So the length would be : ( High[0] + 5*TickSize ) - ( Low[0] - 5*TickSize ) which is equal to : High[0] + 5*TickSize - Low[0] + 5*TickSize which finally is : High[0] - Low[0] + 10*TickSize This only works because you have a vertical line. It may be you have this number set too high, which is why the line looks bigger than you expect. Are you trying to draw this indicator between the two parts of the keltner channel? What is the purpose of this line?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Aug 2008
Posts: 44
Thanks: 1
Thanked 0 times in 0 posts
|
Thx again AdamP,
I was just wanting a line to accentuate the straddle bar but, running from KeltnerChannel(3.5, 50).Upper[0] to KeltnerChannel(3.5, 50).Lower[0] would certainly work.... Just tried substituting those points instead but, lines still not appearing.. |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Randwulf,
Could you possibly post your code for review?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Aug 2008
Posts: 44
Thanks: 1
Thanked 0 times in 0 posts
|
AdamP,
I created a test strategy with the wizard using only the 1 condition and 1 output.. The code below is the only code it created when I "View Code". protected override void OnBarUpdate() { // Condition set 1 if (High[0] > KeltnerChannel(3.5, 50).Midline[0] && Low[0] < KeltnerChannel(3.5, 50).Midline[0]) { DrawLine("My line" + CurrentBar, false, 0, KeltnerChannel(3.5, 50).Lower[0], 0, KeltnerChannel(3.5, 50).Upper[0], Color.White, DashStyle.Solid, 2); } } |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Randwulf,
I am currently unable to replicate the disappearing lines. I would suggest upgrading your ninjatrader to the latest version perhaps and trying again. If you run this on a brand new chart without any extra indicators / strategies, does it still have the same behavior? http://www.ninjatrader.com/download-registration.php
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: Aug 2008
Posts: 44
Thanks: 1
Thanked 0 times in 0 posts
|
AdamP,
If you were able to create a vertical line from top to bottom of a channel then, it's obviously something on my end. I will try fresh and report back. Thank you again for the support & great product. |
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Randwulf,
Thanks for your kind words. If you happen to come across some replication steps, please let me know.
Adam P.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Vertical Line | ryebank | General Programming | 3 | 02-23-2011 01:17 AM |
| draw vertical line | pulla | General Programming | 14 | 01-14-2011 09:57 AM |
| DrawLine line disappearing | TAJTrades | Indicator Development | 3 | 10-01-2010 09:46 AM |
| Draw vertical line | hegh2000 | Indicator Development | 4 | 03-11-2009 07:03 AM |
| Vertical line across all panels | snaphook | Suggestions And Feedback | 1 | 12-08-2008 08:30 AM |