Finding the most recent candle close high point
-

Hey,
Hopefully someone can help or point me in the right direction.
I want my EA to recognise the most recent candle close high ( as represented on the image as EP). When price crosses the EP it will trigger a buy trade in this example with the SL being set at the latest candle low. This could occur over n number of candles which is why i need it to specifically find the latest ones to enter on.
The yellow line in the image is the 1SMA (based on closed price) which i thought could be used as an aide to get this going but essentially you just end up hitting the same roadblock as if you were just using OHLCs.
Any help or examples appreciated.
Adam
-
I'm not 100% I understood what you are after, but hope this will help you forward.
The logic is just for the last high close: https://fxdreema.com/shared/sQdd6Ilqb

-
Thanks for the work through it is very helpful. However what about if the highest close price was 3,4...10 candles back as oppose to only 1 candle back?
This is to say that Im looking to enter a trade on the last swing high in terms of candle closing prices (as oppose to actual candles highs which would be the norm). The yellow 1SMA shows the swing highs quite well. I need the EA to recognise what the price of the latest swing high is so that I can enter a trade on price crossing that level.
-
Thanks to your example i think ive cracked it. Just had to have the EA recognise the pattern of lower close-higher close-lower close and then remember the value of Candle Shift 2 for the higher close. Once that was stored in the variable I could use that value as an entry point. https://fxdreema.com/shared/uonU4E21e