Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("Gain/StopLoss Percentage Lines", overlay=true)
- toadd = 0.
- incval = 0.
- selectedprice = 0.
- selectedprice := input(title="Type Your Start Price Here", type=input.float, defval=7.50)
- incval := input(title="Percentage Stops", type=input.float, defval=5.0)
- toadd := incval/100
- line.new(bar_index, selectedprice, bar_index[100], selectedprice, width = 1, color=color.yellow)
- for i = 1 to 2
- line.new(bar_index, selectedprice+(selectedprice*toadd*i), bar_index[100], selectedprice+(selectedprice*toadd*i), width = 1, color=color.green, style=line.style_solid)
- line.new(bar_index, selectedprice-(selectedprice*toadd*i), bar_index[100], selectedprice-(selectedprice*toadd*i), width = 1, color=color.red, style=line.style_solid)
- myLabel = label.new(x=bar_index, y=high,
- color=color.yellow, textcolor=color.black,
- style=label.style_labeldown)
- label.set_text(id=myLabel, text="Entry - "+ tostring(selectedprice))
- label.set_xy(myLabel,bar_index[45],selectedprice)
- label.delete(myLabel[1])
- myLabel2 = label.new(x=bar_index, y=high,
- color=color.green, textcolor=color.black,
- style=label.style_labeldown)
- label.set_text(id=myLabel2, text="5%Gain - "+ tostring(selectedprice+(selectedprice*toadd)))
- label.set_xy(myLabel2,bar_index[45],selectedprice+(selectedprice*toadd))
- label.delete(myLabel2[1])
- myLabel3 = label.new(x=bar_index, y=high,
- color=color.red, textcolor=color.black,
- style=label.style_labeldown)
- label.set_text(id=myLabel3, text="5%Loss - "+ tostring(selectedprice-(selectedprice*toadd)))
- label.set_xy(myLabel3,bar_index[45],selectedprice-(selectedprice*toadd))
- label.delete(myLabel3[1])
- plot(close)
Advertisement
Add Comment
Please, Sign In to add comment