Daily Profit and Loss Target close logic
-
Hi there,
I'm trying to create a EA to check the closed trades profit or loss along with open trades profit/loss for the trades between the day start and end hour. If the profit or loss reached the specified limit then close the open trades and stop the EA for the day by delay and restart from the trade start hour.Here below the share link for this test
https://fxdreema.com/shared/gbg8inrWd
I tried this in placing it 'On Trade' and it is not working . Also tried by placing it on tick and still not working though profit or loss reached the limit.
Appreciate your help in resolving this. Please note i'm not a techie and new to the EA world.
Thanks to all the posts in this forum and i'm learning a lot from this fxDreema family.
Thanks
KayGee -
@kvinvest You need to create a few variables catching all open and closed trades today and then do this:
https://fxdreema.com/shared/x75d43Fwc
For the EA to work correctly you need to select 'today' on your MT4's History tab. Otherwise the EA will count ALL closed trades there since you created the account.
-
Thanks a lot. let me try this out.
Is there a way to include a logic todays date specific trades , just in case if the history is left without todays date ?Thanks
-
HI there
I tried you suggestion but it is not working.
Here is the project link
https://fxdreema.com/shared/PHLsqZc6ci tried with Pips as well as Money - both not working.
The profit target in the parameter i defined positive value example: 200
The loss limit i set that in negative : -300Appreciate if you could look into and let me know where my mistake is ?
THanks
-
@kvinvest You need to disconnect block called 'Gain Loss calc' from its current position. It need to be separated from the other two trees and then having its own tree. On the other hand, I don't fully understand the logic behind block called 'Enable daily target'. What is it supposed to do?
-
Hi,
Enable daily target block is a feature to enable or disable to close all trades if the Day profit or Loss limit is achieved and then delay the EA not to open any new trades.Idea behind this is EA to run from a defined start time to end time. During this time this function will check how much gain or loss (open and closed trades for the day) then stop the EA.
If you can suggest any other way would be wonderful !
Thanks
-
@kvinvest This is a way to stop all trades once target (positive or negative) is reached. Maybe it helps:
-
Thanks.... you suggested the same before and it looks like i made some mistake while selecting the variable. Fixed and shall retry in the market next week and confirm.
Appreciate your support
-
@kvinvest You're welcome.
-
Hello there... I created as you suggested and it is working fine...
Thanks
-
@l-andorrà Can we make that same as of Equity Percent Gain....?