Why does this script sometimes open positions with MAX lot size?
-
https://fxdreema.com/shared/pmD96sI2d
This script works fine most of the time. Sometimes however it ignores the risk settings and just opens a position with the max allowed lot size with the broker.
I've already lost quite a bit of money through this bug, since it just opened 40 lots instead of around 0.2.
Anyone know why this is happening?
The script is suppose to open a trade with the correct risk %, SL and TP (based on ATR and RR).
-
Hola, estoy ejecutando pruebas con el script y realmente no encuentro fallas en su logica, en mis pruebas esta trabajando correctamente segun su configuracion

-
Tu estas colocando un valor de % de riesgo de acuerdo a un volumen, pero despues de cada SL estas aplicando un multiplicador que incrementa este valor de % en riesgo, es algo similar a aplicar un martingala, por lo tanto es logico que en algunas operaciones se vea incrementado el %

-
@DragonZueloTrends No no, it isn't martingale. Risk should be consistent (0.25% in this example)
I'm not able to re-produce the issue either, it just happens sometimes.
The risk is suppose to be consistently 0.25%, the stop-loss is calculated based on volatility using the average true range indicator. The multiplier is to calculate stop-loss position, not risk.
-
try put RR only instead of RR*100
-
@Mitchp What is the 'entry_price' variable used for? I see it is not used anywhere once calculated.
-
@l-andorrà That was for a previous version where I used limit order. I wanted limit order 0.25ATR under the open of the candle.
-
Ok. Did you try byens' suggestion.