if DayofWeek >=1 then
dhp = Dhigh(0) /// Previous Day High
angled = sin(9)
endif
if dhp = dhp then
bdh = barindex /// Trying to locate bar for high (error!!!) Pointer
endif
if Date = Today then
if intradaybarindex then // limiting drawnline to lastbaronly
Drawline(bdh,dhp,angled,dhp+angled) Coloured(161,161,161, 93)
endif
endif
return
Please help,
I am trying to auto draw a slope on previous day high at angle but the origin does not index to highest previous day high.
The barindex does not coordinate to the price when drawn by indicator (Gray line).
The red line is intended out come, drawn form previous day high manually.
Any help is appreciated and thanks in anticipation.
I think that you wrongly trying to found the barindex of the previous day high, this code should work:
if DayofWeek >=1 and date<today then
dhp = Dhigh(0) /// Previous Day High
angled = sin(9)
if high = dhp then
bdh = barindex /// Trying to locate bar for high (error!!!) Pointer
endif
endif
if Date = Today then
if intradaybarindex then // limiting drawnline to lastbaronly
Drawline(bdh,dhp,angled,dhp+angled) Coloured(161,161,161)
endif
endif
return barindex,bdh
I returned the barindex and the founded bdh, try to compare them with the cursor details panel to find if bdh is the correct barindex or not (it should).
You are a saviour, thanks alot. I am very grateful for your time and the effort thanks! 🙂
Is there away to apply this logic to Find PreviousWeekHigh and its Barindex?
Thanks
You can always use the multi-timeframe functionality to perhaps show both.
Perhaps also have a look at my topic here: https://www.prorealcode.com/topic/calculating-diagonal-trend-lines-using-fractals-and-trigonometry/