Risk Management Systems Discussion

 

Is there a way to have an EA look at the last trade and see whether or not it was profitable? If it was profitable, I'd like it to take one action, and if it lost money because it hit its stop loss, I'd like it to take another action. Any ideas on how to do this? Perhaps one global variable that contains the balance before the trade, and one global variable that has the balance after the trade? Is there an easy way to do this? Thanks!

 
Calpurnia:

Is there a way to have an EA look at the last trade and see whether or not it was profitable? If it was profitable, I'd like it to take one action, and if it lost money because it hit its stop loss, I'd like it to take another action. Any ideas on how to do this? Perhaps one global variable that contains the balance before the trade, and one global variable that has the balance after the trade? Is there an easy way to do this? Thanks!

Hi,

What I would do totally depends from the choice of my EAs conception. I will search for the last closed order and see wether it was profitable or not according to your selected criterias. For doing that use the MODE_HISTORY in the OrderSelect function. Read carefully how to use this option.

I convinced it will be simpler and more accurate then using a global variable for remembering the balance. And if you are starting your EA, then what?

It all depends on what you really want to achieve.

Good Luck.

 
Calpurnia:

Is there a way to have an EA look at the last trade and see whether or not it was profitable? If it was profitable, I'd like it to take one action, and if it lost money because it hit its stop loss, I'd like it to take another action. Any ideas on how to do this? Perhaps one global variable that contains the balance before the trade, and one global variable that has the balance after the trade? Is there an easy way to do this? Thanks!

You should get what you want from a couple of code snippets I wrote for another user in this thread.

'Need help with coding using history values'


CB

Reason: