Hi, I want to make an day trade indicator that plot 8 (or more) colored horizontal lines. The formula for every line has to be: (but are not final)
(openings price divide by 2 + 0.25) multiplied by 2 = 1st horizontal line blue
(openings price /2 + 0.50) x2 = 2de horizontal line green
(openings price /2 + 0.75) x2 = 3de horizontal line blue
(openings price /2 + 1 ) x2 = 4th horizontal line yellow
Then the same in minus
(openings price /2 – 0.25) x2 = 1st horizontal line blue
(openings price /2 – 0.50) x2 = 2de horizontal line green
(openings price /2 – 0.75) x2 = 3de horizontal line blue
(openings price /2 – 1 ) x2 = 4th horizontal line yellow
The lines may run over whole chart with the price stated at the end right side. If possible, can I add in the program a small text on every line?
Can someone help me starting so I can adjust it further? Thanks!
Sample code for your first line:
line1 = (dopen(0)/ 2 + 0.25) *2
return line1 coloured(0,0,255)
Thank you for this first line.
Sorry this are my first steps into programming but it looks easy to further make the other lines myself.
Thanks for get me starting.
I have already come this far, but I like to have the price displayed on each horizontal line. So the result of line1 on the horizontal line, result of line2 on line2 etc…..
Maybe also thicker lines.
Is this possible, I have not found this immediately here in the forum.
Thanks
line1 = (dopen(0)/ 2 + 0.25) *2
line2 = (dopen(0)/ 2 + 0.50) *2
//vertical offset to draw text correctly over horizontal lines
Voffset = 1*pipsize
//text on line
DRAWTEXT("text",barindex+10,line1+Voffset,SansSerif,Bold,12)coloured(0,0,255)
DRAWTEXT("text",barindex+10,line2+Voffset,SansSerif,Bold,12)coloured(0,180,25)
//horizontal lines
DRAWLINE(barindex-1,line1,barindex,line1)coloured(0,0,255)
DRAWLINE(barindex-1,line2,barindex,line2)coloured(0,180,25)
RETURN
To use a variable value with DRAWTEXT add # before and after the variable name:
//text on line
DRAWTEXT("#line1#",barindex+10,line1+Voffset,SansSerif,Bold,12)coloured(0,0,255)
DRAWTEXT("#line2#",barindex+10,line2+Voffset,SansSerif,Bold,12)coloured(0,180,25)