Movable horizontal line to define position size
-
Does anyone know how to go about this?
I want a horizontal line on my charts which I can move around according to where I want my stop loss. On tick, the EA always calculates the distance from the line to the live price. If I then click buy or sell (on created buttons), the position size will automatically be correct to give me a fixed stop loss in money, the size which I define before hand in a constant.
So let's say the constant says 100$. I pull the line to where I want the SL and then click buy. The position size is then automatically calculated and applied to my trade.
-
@sirluk You'll find all you need in here:
https://fxdreema.com/shared/WSCVrJKxc
The same blocks work in MT4 aswell.
-
Thanks @jstap. The solution for what I wanted is actually much easier than I thought. Draw a horizontal line and then use object on the chart as a stop loss mode. I had to create seperate Buy and Sell buttons, since I want to open trades manually with this EA. But I'm really happy with it. I just pull the line to my intended stop and click buy or sell. Position size all automatic.