Hello,
you can find the Tradingview source code on the attachment. I want an EA that open trades according to below examples. and Positions will close if the signal changes and open new trade with new direction.
Positions are opened at the market price.
Also I found the Pmax indicator for MT4.
Sell position entry example below
Buy position entry example below