EA shows 6 errors ' OrderSend',' OrderClose',and 'OrderSelect' should be checked. On test the trades are grouped together in one bar when triggered ?

Qhumanani
70

Hi,

Need help my EA opens lots of trades in one bar grouped together? and the warnings on the code how do I correct this ?

Keith Watford
Moderator
32153

Topics concerning MT4 and MQL4 have their own section.

You have been told this before.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

Read my post

Link

Which will give you some clues.

How to avoid order modify error1?
How to avoid order modify error1?
  • 2021.04.08
  • www.mql5.com
Hi, I have already some orders with tp and sl. But I want to scan all orders and modify ONLY tp=0. Here is my code. But there is some issues...
Qhumanani
70
Qhumanani  
Keith Watford:
   Always use
   #property strict
   in your codes.
   When starting a project use the "New" button top left of the editor. #property strict will be included automatically.

   If the compiler issues a warning don't ignore it, fix it.

Following examples not tested.

Thank you a lot that helped my compilation was spot on, but I still encounter a problem in back testing every time trades are executed they pile on top of each other, why is this happening ?

Keith Watford
Moderator
32153
Qhumanani:

Thank you a lot that helped my compilation was spot on, but I still encounter a problem in back testing every time trades are executed they pile on top of each other, why is this happening ?

Because that is how you have coded it.

For this you only need to check when a new bar opens

  static datetime barTime=0;
  datetime thisBarTime=Time[0];
  if(barTime!=thisBarTime)
   {
    barTime=thisBarTime;
    //Code to be executed only once when a new bar opens
   }