Shorter vertical line with DrawLine - NinjaTrader Programming | futures io social day trading
futures io futures trading


Shorter vertical line with DrawLine
Updated: Views / Replies:1,337 / 3
Created: by Randwulf Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Thread Tools Search this Thread

Shorter vertical line with DrawLine

  #1 (permalink)
Elite Member
Colorado Springs, CO
Futures Experience: Beginner
Platform: NinjaTrader
Posts: 20 since Oct 2009
Thanks: 15 given, 0 received

Shorter vertical line with DrawLine

I'm currently using DrawRegion() from the top to the bottom of a Keltner Channel to highlight a bar.
I like this approach except for the fact that it offsets by half a bar.

I could be just as happy with a vertical line that runs from top to bottom of the channel but,
I can't seem to get DrawLine() to work...
At present, if the bool for autoscale is "false", the lines don't show and if "true", they do show but, run considerably higher and lower than the channel.

protected override void OnBarUpdate()
// Condition set 1
if (High[0] > KeltnerChannel(4, 50).Midline[0]
&& Low[0] < KeltnerChannel(4, 50).Midline[0])
DrawLine("My line" + CurrentBar, false, 0, KeltnerChannel(4, 50).Upper[0], 0, KeltnerChannel(4, 50).Lower[0] , Color.White, DashStyle.Solid, 2);

Here's the point where you smile and shake your head...
Go ahead, please show me the error of my ways...

Thanks in advance

Reply With Quote
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

  #3 (permalink)
Elite Member
San Jose, CA
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: all
anachronist's Avatar
Posts: 27 since Apr 2012
Thanks: 0 given, 16 received

Regarding your statement:
DrawLine("My line" + CurrentBar, false, 0, KeltnerChannel(4, 50).Upper[0], 0, KeltnerChannel(4, 50).Lower[0] , Color.White, DashStyle.Solid, 2);

I don't know if this will fix your problem, but I'd do a couple things differently.

1. The line ID "My line"+CurrentBar should be "My line" + CurrentBar.ToString().

2. You are needlessly recalculating the KeltnerChannel multiple times. To avoid this, here's what I do (and it becomes critical to speed up very complex code).

In variables, declare
private KeltnerChannel kc
Add an OnStartUp() to initialize kc (don't put this in Initialize()):
protected override void OnStartUp() {
kc KelternChannel(450);

Then in OnBarUpdate() do this:
protected override void OnBarUpdate() {
double k kc[0]; // calculate KeltnerChannel ONCE
   // now access all the properties you want
DrawLine("Myline"+CurrentBar.ToString(), false0kc.Upper[0], 0kc.Lower[0] , Color.WhiteDashStyle.Solid2);


Reply With Quote
The following user says Thank You to anachronist for this post:
  #4 (permalink)
Elite Member
Colorado Springs, CO
Futures Experience: Beginner
Platform: NinjaTrader
Posts: 20 since Oct 2009
Thanks: 15 given, 0 received


Thank you for the response.
I wanted to let you know that I appreciate it but, can't validate it just yet.
I am in the process of re-imaging windows and reloading NinjaTrader as NT support can't duplicate the issue.
I especially appreciate the speed up suggestions & will follow up ASAP..

Reply With Quote


futures io > > > > > Shorter vertical line with DrawLine

Upcoming Webinars and Events (4:30PM ET unless noted)

Fundraiser: Feeding Families in Need (ends Dec 17)


Battlestations! Show us your trading desks w/GFF Brokers ($750 in Prizes)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Daily Vertical line indicator deandavis NinjaTrader 22 October 15th, 2017 08:49 AM
DrawLine kaywai NinjaTrader Programming 4 December 5th, 2012 12:22 AM
Global Vertical Line Indicator EDGE NinjaTrader Programming 1 October 12th, 2010 12:09 AM
Vertical line for Jeff Castille AkLio The Elite Circle 32 May 1st, 2010 04:50 PM
vertical lines Jeff Castille NinjaTrader Programming 6 October 20th, 2009 06:15 PM

code, drawline, information, ninjascript, ninjatrader, onstartup, think or swim, tos, white

All times are GMT -4. The time now is 07:01 PM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2018-12-14 in 0.11 seconds with 14 queries on phoenix