PDA

View Full Version : Line on Chart in Background


ramckay
02-27-2009, 12:35 PM
Hello,

I created a simple plot line on a chart. I used the code:

Line00.Set(Line0);

Line0 is initialized to x. This draws a line on the chart and allows the placement of the line to be changed. After a few tries I got it to work and the line was drawn as expected. It is used in the price panel. On my first attempt the line appears to behind the price bars (in background). I want the line behind the price but cannot duplice what I did. I also managed to delete the original file and am unalbe to find it! At one point in the original attempt I was using the Line method to replace the Plot method. Could this have been the difference?

Thanks

NinjaTrader_Josh
02-27-2009, 12:41 PM
ramckay,

I guess I am not sure what you want. The line to be behind the bars? Plot method lines are always in front of the bars and Lines are behind.

In Initialize() do this:
Add(new Line(Color.Red, 10, "Line at 10"));

ramckay
02-27-2009, 01:15 PM
Thanks Josh.

Guess I wasn't too clear. Your answer helps. I want lines that I can change the values of. They are to be used as references on a NYSE Tick chart. Can I use the input variables from the Indicator wizard in the "Add(new Line ...)" statement to change the line placement?

Also, how did you include the small rectangle in your post with the code in it?

NinjaTrader_Josh
02-27-2009, 01:36 PM
I guess I do not follow. You can already change the values for these lines. When you add the indicator to a chart you can change the line to take on any value you want.

In your code if you wanted to change the line value I believe you can try:
Lines[0].Value = 100;

To get the gray box you can tag your things with {code}something{/code}. Replace the brackets with square brackets [] and it will do it for you.

ramckay
02-27-2009, 01:59 PM
Josh,

Didn't understand that you could just add a line to the code. Thought you had to do it through the Wizard.

Thanks

Got it