Using 'Modify Stops' block to risk a fixed amount of cash
-
I would like to use the 'Modify Stops' block to risk a fixed amount of cash.
So, let's say we have a EURUSD position, size 0.01, with no SL or TP. I would like to use the 'Modify Stops' block (or any other block) to add a stop-loss to risk, say, $100.
Can someone help me to work out the formula, please?
Is there any trick or hidden function that I can call?Your help is much appreciated.
-
Fyi, I know how to do the calculation in mt4/mt5 code, i.e. like in this article: https://www.mql5.com/en/forum/123914
My question is whether we have things like tickvalue stored in an FxDreema variable, or whether I need to calculate this using custom code.
-
There is no block doing that AFAIK. I'm afraid you will have to use custom code.
-
Thank you for the reply.
I have ended up using custom code as suggested. Here's the code if it benefits anyone
sl_reliable_tickvalue = sl_tickvalue * sl_point / sl_ticksize;
if ((Digits == 3) || (Digits == 5)) {sl_reliable_tickvalue = sl_reliable_tickvalue * 10;}
sl_value = (sl_capital_to_risk * stop_loss_percentage /100) / (loop_size * sl_reliable_tickvalue ); -
Thank you very much for sharing.