Download MetaTrader 5

My EA doesnt trade, help me!

To add comments, please log in or register
Proximus
762
Proximus  

Hi guys, i have an EA which i coded myself entirely, and apparently it doesnt put on trades for i dont know what reason.I wont tell you what the algorithm does but i can tell that no matter what the market conditions are it should trade atleast 1 trade/day, since in backtest it traded in average 20 trades/day.But 1 trade atleast/day NO MATTER WHAT, yet i left the MT4 on yesterday the entire day, and it didnt took any trades.Please help me sort out why it didnt.

Here is what i already know are NOT the problem:

  • There is enough capital in the demo account, i started with 100 €, and the start lot size will be 0.01 LOT which is supported by my 200:1 leverage
  • The lot size is calculated by an algorithm,but its truncated by NormalizeDouble, to 2 decimals so it should work fine
  • MT4 works fine in general, and i am logged in into my demo account
  • In the Experts and Journal tab there was no error reported
  • For simplicity, and to not confuse the magic numbers (which was an issue in the past though) at the moment my EA only runs on only 1 chart, specifically EUR/USD
  • Expert advisor trading enabled in options, and in the expert advisor menu


  • The smiley in the top-right corner, also suggests that there is no problem
  • In backtesting the EA worked very well
  • The EA has a spread filter it only lets us trade when the spread is smaller than 15 pip (5 digit broker), but on the EUR/USD my broker has a targed spread of 10 pip so that should also work
  • The maximum slippage for entry is set to 30 pips, which should also not be a problem,since the maximum slippage i saw was 5 pips (again i have 5 digits)
  • The STOPLOSS & TAKEPROFIT are above the STOPLEVEL always.
  • The EA in the EA folder is imported as .ex4, not .mql4 (i dont know if that makes a difference though)

Thats all that i can remember that can be a problem, but none of the stuff i listed here is causing the problem, so it must be something else, PLEASE HELP!!


Ubzen
5390
Ubzen  
Proximus: .......

Without showing the codes, you're asking to play the guessing game. Tell you what ... do some debugging. Put a Print statement after every condition. Example:

start(){

Print("Here=========1");

       if(condition == true){

                Print( "Here=========2" );

                for(int i=0; i<Total; i++){

                             Print( "Here=========3" );

                } 

       }

      if()  Print( "Here=========4" );

      ..........And So On.................... 

} 
You might be able to substitute Print with Comment. That'll probably be easier to look at. You're just looking for the last Print Statement where it Stopped. Or the ones which wasn't executed. Then you go to where it Stopped and Think why didn't this Condition execute.
Simon Gniadkowski
Moderator
18021
Simon Gniadkowski  
Proximus:

Hi guys, i have an EA which i coded myself entirely, and apparently it doesnt put on trades for i dont know what reason.I wont tell you what the algorithm does but i can tell that no matter what the market conditions are it should trade atleast 1 trade/day, since in backtest it traded in average 20 trades/day.But 1 trade atleast/day NO MATTER WHAT, yet i left the MT4 on yesterday the entire day, and it didnt took any trades.Please help me sort out why it didnt.

Here is what i already know are NOT the problem:

  • There is enough capital in the demo account, i started with 100 €, and the start lot size will be 0.01 LOT which is supported by my 200:1 leverage
  • The lot size is calculated by an algorithm,but its truncated by NormalizeDouble, to 2 decimals so it should work fine

That isn't the correct way of sorting your position size, it must be a multiple of LotStep . . . this has been discussed many times on the Forum. If you are reporting errors this would produce an error 131

Proximus:

  • In the Experts and Journal tab there was no error reported

Do you check return values from all your trading functions and report any errors ?


Proximus:


  • The EA has a spread filter it only lets us trade when the spread is smaller than 15 pip (5 digit broker), but on the EUR/USD my broker has a targed spread of 10 pip so that should also work
I guess you mean 15 points not 15 pips ? and 10 points ?

How do you know that you have the correct conditions for a trade to be placed ? are you printing this fact to the log ? do you have debugging in your EA so you can trace issues like this ?

To add comments, please log in or register