Drawing Price targets lines for open positions on chart
Author: Tobey
Creation Date: 10/21/2016 5:15 PM
profile picture

Tobey

#1
Hi Cone & Eugene,

When a position is active I'd like to draw a line at a target price (for example the purchase price +10%) and another line at a stop loss price.I'd like them to be just visual, not tradable like a stop loss order. It could be a rectangle. It shouldn't be a horizontal line because it extends outside the trade area across the entire chart. I'd like it to be visible on both closed and open positions.

I can't find anything similar in the forum or on wealth lab wiki. I'd appreciate your help in trying to figure this out.

As always many thanks
Tobey
profile picture

Eugene

#2
Hi Tobey,

Is this what you're looking for?
CODE:
Please log in to see this code.
profile picture

Tobey

#3
Hi Eugene

Thanks so much!!

Is (1 - 5/100.0d) the same as ( 0.95 ) The .0d is setting the decimal point? Can I set a decimal point using ( 0.95 )

And if I only what the lines on the chart I can // comment out the last two lines?

Thanks so much you made it easy!!
Tobey

CODE:
Please log in to see this code.
profile picture

Eugene

#4
QUOTE:
Is (1 - 5/100.0d) the same as ( 0.95 ) The .0d is setting the decimal point? Can I set a decimal point using ( 0.95 )

It's the "d" not ".0d". It hints the compiler that the number is double vs. integer. Scroll down to I'm trying to divide two numbers and the result is zero in the Wiki FAQ on why it's important. Actually it's superfluous as the number was explictly defined as double by suffixing it with a ".0". Yes you can use 0.95 or whatever.