Play sound when order excuted

 

I using hotkey to excuted order, but there are times when the order didn't excuted at all despite pressing the hotkey. I have to when back to check back the expert tab to see any error or if i didn't press the key properly. Hence I thinking of getting a sound played when the order excuted. I tried as per following, but seem like sometime when the order didn't filled, it still play out the sound. Any advise how should i do it? Thanks

OrderSend(Symbol(),OP_SELL,Lots,Bid,4,0,0,"1 MIN",111,0,Red);
PlaySound("sellexcuted.wav");
OrderPrint();

 
georgecheng:

I using hotkey to excuted order, but there are times when the order didn't excuted at all despite pressing the hotkey. I have to when back to check back the expert tab to see any error or if i didn't press the key properly. Hence I thinking of getting a sound played when the order excuted. I tried as per following, but seem like sometime when the order didn't filled, it still play out the sound. Any advise how should i do it? Thanks

OrderSend() returns ticket number or -1 if it fails. Hence u can do something like this:

int ticket = OrderSend(...);
if (ticket>0) PlaySound("sellexcuted.wav");
Reason: