orderclose not working. Can somebody Point to me whats wrong with my code. correct me.( this readable raptorUk)?
Here is my attempt download the EA, check the source code thank you for yo help.
Remember if current price is above OrderOpenPrice (of both orders) close buy and Close sell when the price is below OrderOpen price (of both Orders)
Experts plz make this orderclose work thank yu. any help suggestions are welcome
It's better . . .
In this code, where does the value of ticket come from ? you seem to be using the same value of ticket to try and close a buy and a sell, if you have a Buy and a Sell they will each have unique ticket numbers . . .
while(true) { if(Tip==0 && closebuy==true) { Alert("Closing Buy",ticket,".Waiting For Response..."); RefreshRates(); Cpos=OrderClose(ticket,lots,Bid,3,Yellow); if(Cpos==true) { Alert("Buy Closed",ticket); break; } if(Fun_Error(GetLastError())==1) continue; return; } if(Tip==1 && closesell==true) { Alert("Closing Sell",ticket,".Waiting For Response..."); RefreshRates(); Cpos=OrderClose(ticket,lots,Ask,3); if(Cpos==true) { Alert("Sell Closed",ticket); break; } if(Fun_Error(GetLastError())==1) continue; return; } break; }
You should only check GetLastError() when you need to, so if Cpos = false then GetLastError() and report the error and any relevant variables that you will need to diagnose the issue.
It's better . . .
In this code, where does the value of ticket come from ? you seem to be using the same value of ticket to try and close a buy and a sell, if you have a Buy and a Sell they will each have unique ticket numbers . . .
You should only check GetLastError() when you need to, so if Cpos = false then GetLastError() and report the error and any relevant variables that you will need to diagnose the issue.
THANKS
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Experts plz make this orderclose work thank yu. any help suggestions are welcome