How to close all trade and stop trading for the day when profit / loss target is reached?
-
I am creating an ea but I would like to add an equity protection to it so that it close all trades and stop trading for the day whenever the equity limit is reached (lets say 2% of the account) and start trading again the following. And same for the profit target. It would close all trades and stop trading for the day whenever the profit target is hit.
-
@ONEILLEWIS You can find some inspiration here. I'm using this structure for that exact same purpose:
-
@l-andorrà Sorry first I am entering in the thread for my similar query.
your solution solved my query partially, I want to ask if our daily target will be achieved by n number of trades then how can we complete this task ? I will appreciate your effort if you can show a sample of it. -
@forexbob-0 What do you exactly mean by 'n number of trades'?
-
@l-andorrà I mean, as my target is achieve 1% daily and I achieved that target in any number of trades like 10,15 or any number.
-
Then you don0t need to count the trades, you just need to select the 1% target as the condition to close all current trades and stop the bot until tomorrow regardless how many trades are necessary to hit it.
-
@l-andorrà can you share a sample please
-
You can use my shared structure but substituting block ID 9 by a condition block with the required profit % and a 'close trades' block.
-
@l-andorrà Thank You, Let me try that
-
You're welcome.