Hi Guys,
Does anyone know how to do this?
I want a vertical line to represent when I personally start trading and another when I finish trading.
So simply how to plot a vertical line in any colour at any time that repeats each day.
I have the MT4 code Time_vLines.mq4 if required
Many Thanks
Not possible until version 10.3 to plot vertical line. But maybe this code snippet would do the trick: (didn’t test it)
plottime = 093000 //exact time to plot the vertical line
if time=plottime then
value = close*100
else
value = 0
endif
return value
Make the value plot as a line or an histogram .. tell us if it’s good for you!
Hi Nicolas,
Thanks for your reply. I have tried multiple variations on your code snippet, but was unhappy with the distortion on the price chart, due to the histogram referencing zero. I then realised that I don’t actually need it for live trading at all it’s actually only whilst reviewing past activity. So I opted for a tape indicator beneath my price chart.
This will serve my purpose very well until 10.3 and I thank you you for your prompt assistance.
Please find the code below
// Session Indicator
// t1 start of my shift (set variable hhmmss)
// t2 end of my shift (set variable hhmmss)
starttime = t1
endtime = t2
if time > starttime and time < endtime then
value = 1
else
value = 0
endif
return value
I suppose if anyone had a mind to they could quite easily adjust the variables for Asia, Euro and US Time zones if required
Thanks again Nicolas