Need code for EA: only one trade per signal - event the trade has been close.

 

Dear all.

PLs help me, i need code for: only one trade per signal - event the trade has been close.

For example: when EA send signal BUY, trade only one with SL and TP, when the oder hit SL, EA do not trade and waiting to next other signal: SELL.

Thank for any help.

 

If you are asking us to work for you then are are at wrong place. Post your req at jobs or pm me.

Have you already worked on such.?? What error you got.?? In these forums, we address issues you face while building your code. You can also search the codebase, most of EA works like that only...

 
dineshydv:

If you are asking us to work for you then are are at wrong place. Post your req at jobs or pm me.

Have you already worked on such.?? What error you got.?? In these forums, we address issues you face while building your code. You can also search the codebase, most of EA works like that only...


No one can help me ??????????
 
thuythuyyen:

No one can help me ??????????

Show your code.
 
thuythuyyen: No one can help me ??????????
You're not listening
Since there are no slaves here, there are only two choices: learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you. Show your code.
 

Off the top of my head: create your signal into a indicator then every time you get a signal find the close time of the last trade and the last time the signal changed. If signal change date stamp > last trade date stamp approve trade.

 
static bool currSignal;
bool prevSignal = currSignal; currSignal = GetSignal();
int  openCount  = GetOpenOrderCount();  
if (openCount != 0) return; // One only
if (prevSignal)     return; // Wait for signal to drop
if (!currSignal)    return; // Wait for current signal
// Now we can open.
 
WHRoeder:


ok, thank you very much, this code will be helpfull for me
Reason: