
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I am working on a trendlines indicator which use swing highs/lows with a period of 9, but having some issues with some initial break conditions. I have got it to break the trend one it has fully formed, but am having difficulty getting the trend to not draw at all if it is broken in-between the higher swings lows (uptrend)/ lower swing highs (downtrend)
The two conditions that should stop the trend from being drawn are-
1. If a high forms below the uptrend. Or a low forms above the downtrend.
2. if the lines travels less than 15 pips per bar (line speed)
I have a tried using a for loop for point 1 but its doesn't seem to work/makes the indicator buggy. Below is part of the code showing uptrend formation -
attached in the image "bug" its shows is one of the bugs it causes. It seems the drawing of the initial trendline is reversed -
I was also thinking of adding something like this in for breaking if the line speed is too slow -
But this also doesn't work either! Is there something I am missing? Any help would be much appreciated. Attached is an image of the condition for break and full code