How to compare for martingale...

 

Hi I've created an EA that works, but I want to take it to the next level, atm I compare the account balance with the "previous account balance" with a static double...

So I record the account balance, and then after the trade is completed, the EA checks if the account balance got less or more, if it got less it will double the lots, if it got more the lots will change to original lotsize...

Now the problem is, I cant make any other trades on the account as it will affect the account balance which will effect the choice of the next trade for the EA...

So now I guess my question is:

What is another way to determine if the previous trade hit the SL or hit the TP without being effected by any other trades I make on the account?

Thanks

Dan

 
Dohan:
Hi I've created an EA that works, but I want to take it to the next level, atm I compare the account balance with the "previous account balance" with a static double...

When (not if) the OS crashes, terminal is restarted, window is changed or closed, your static is now lost.

EAs must be programed to recover.

You need a order select loop to determine if this EA has open orders.

You need a order select loop on history to find out the status of the last closed trade.

 
Dohan:

Hi I've created an EA that works, but I want to take it to the next level, atm I compare the account balance with the "previous account balance" with a static double...

So I record the account balance, and then after the trade is completed, the EA checks if the account balance got less or more, if it got less it will double the lots, if it got more the lots will change to original lotsize...

Now the problem is, I cant make any other trades on the account as it will affect the account balance which will effect the choice of the next trade for the EA...

So now I guess my question is:

What is another way to determine if the previous trade hit the SL or hit the TP without being effected by any other trades I make on the account?

Thanks

Dan

You are lucky man. I have simple code for you:-) (attached file)
Files:
martingale.zip  14 kb
 

Hi sorry for being so rude, I never said thanks...

It helped alot, I wasnt familiar with the looking up on history trades..

Thanks again

Dan

Reason: