Thanks Tomaso,
Hello Rene,
Yes, u are right about the issues you pointed out. I had to bang my head for the limited knowledge i have for coding. Then i wrote the logic down on paper and tried to find a starting point.
The solution i developed works like this.
I will start with a starting point, LookBackBars. Have locked it at 250. Also u r bang on about the timeframe & i too reached the same conclusion about the 1M TF.
So i start at 250 bars behind the current bar on 1M TF. Of that bar, i take the close prie as the anchor price to start with. Taking that anchor price, i look for the fork of the price web, i,e next RN above and below anchor price. Then i start to see if price touched either of the fork prices by checking the high and low of the 1m on every subsequent bar. When that happens, initial trend is established & i reset the anchor point as the RN that was just touched. This is the initial iteration with break call.
Next is the main iteration where the NewAnchorPrice derived from the RN just touched is taken as reference and New Forks of RN are derived and set. Also, this time, the lookback bars are re-set to the bar on which the price touched the RN Fork. So with the new Forks of RN and new value of LookBackBars, i go forward with the same excercise of looking if Low or High of subsquent bars touched either of fork of RN. And when that happens, trend is determined.
Last night when i finished the code and put it on the chart, nothing happened and the chart froze. Today when i did the same, the trend arrow draws on the RHS of the chart but still the chart freezes.
Thus am uploading the code here if you or others want to have a look at it and suggest edits. BTW, the code of finding the RN fork is not mine, rest everything else is. And the Mini Me that i am for code, i was quite delighted by myself that i could actually phantom the logic and put it in the form of code and complie without errors.
Please suggest the edits required. Your guidance and assistance is always valuable to me, and am sure to many others as well.
Cheers & Regards, Max,

You do not have the required permissions to view the files attached to this post.