What is the righ way to check if free margin is enough for a trade?
I'm trying with a condition like this

but is not working.
Any help is appreciated.
What is the righ way to check if free margin is enough for a trade?
I'm trying with a condition like this

but is not working.
Any help is appreciated.
I noticed when a project is changed several times there are code lines that remain even not used.
Is there a way to create a .mql4 from scratch to get ride of those non used code lines?
@roar Many Thanks, crazy thing
I'm trying ti use an external indicator using the My Indicator functionality, I only have the .ex4 file
Chandelier-Exit.ex4. This indicator works well in MT4.
I've entered all parameters manually in FXDreema.

The issue is when moving the EA to MT4 its not running due to compilation errors.

Any idea on what to change?
It seems a order created directly in MT4 is not handled by the running EA. Is there any way to create an order directly in MT4 that can be handled by the running EA?
Spread Meter info shows on screen three values ; Max, Avg and Min like this

How the average field is calculated? is it available on some variable that can be used?
@l-andorrà The case is, if a open trade has a money profit of 10$, what is the value used to calculate it?
@l-andorrà The question is not about money to trade but how much was invested in a open trade?
@l-andorrà As far as I understand the solution provided is to assign a specific amount for a new trade, but the question is how much money was invested in a open trade?