Thank you @miro1360 . I have made some changes to your suggestion to get the level that I want. Of course I know have some further queries/questions.
- The trend line shows on the screen when the EA is first added to a chart.
- If amendments are made to the EA inputs the trend line doesn't move to where the new inputs say it should.
- I wonder if that's because of how the EA is initialized? I have (hopefully) added a screenshot to show what I mean. When the EA is first loaded the inputs are shown on the next line with the next line showing it as being initialized. However when changing inputs the initialized line comes before the inputs line. Does this mean that in the second instance the blocks in the oninit tab don't actually do anything? Because MT4 doesn't know they exist at the time of initialization?
You can see in the screen shot the LongValue was initially 1.1868 and with the 2 pip adjustment the trend line is at 1.1870. When the inputs are amended to LongValue 1.1862 the trend line should be at 1.1864 but it has stayed at 1.1870.
Hope that makes sense?
A further question that I thinks has a similar issue is that when first loading and initializing the EA, if the level that needs to be broken i.e. bid < longvalue is valid then the trade is actioned. If however the condition is valid after changing the longvalue but not deleting and loading again the EA then the trade is not actioned.
Does this have to do with the set flag to false on initialization working when the EA is first loaded but not working when the inputs are amended?
The trendline EA can be found here https://fxdreema.com/shared/KuXrTD1Id
The reason I have used the flag is because if a long trade is closed but price is below the LongValue I don't want a new trade to be automatically opened.
