OnTick does not execute

 

Hi,

I'm new to this and I'm stuck. My code does not seem to execute at all. Here my very simple code :

void OnTick()

  {

//---

Print("OnTick");

  }

Nothing appears in the "Experts" log when I run my EA. I don't know where to look or what to look for...
 
Fredyrik:

Hi,

I'm new to this and I'm stuck. My code does not seem to execute at all. Here my very simple code :

Are there any incoming ticks?

Show your complete code and use the code button (Alt+S) when pasting code.

 
Fredyrik: I'm new to this and I'm stuck. My code does not seem to execute at all. Here my very simple code: Nothing appears in the "Experts" log when I run my EA. I don't know where to look or what to look for...
Are you sure that the your code is in the Experts folder and not in the Indicators or Scripts folder?
 

I'm in mql5/mt5. It is in the Experts/Advisors folder in meta editor and in the Expert Advisors/Advisors folder in MetaTrader.

My complete code is:

//+------------------------------------------------------------------+

//|                                                       AutoTP.mq5 |

//|                                                   Copyright 2022 |

//|                                                                  |

//+------------------------------------------------------------------+

#property copyright "Copyright 2022"

#property link      ""

#property version   "1.00"



//--- input parameters

input int      TakeProfit=10;

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {}

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---

   Print("OnTick");

  }

//+------------------------------------------------------------------+

 
Fredyrik #:

It is in the Experts/Advisors folder in meta editor and in the Expert Advisors/Advisors folder in MetaTrader.

My complete code is:


That code does exactly what it is coded to do.

 
Fredyrik #: I'm in mql5/mt5. It is in the Experts/Advisors folder in meta editor and in the Expert Advisors/Advisors folder in MetaTrader. My complete code is:

Is your MetaTrader 5 connected to the broker account?

On what symbol chart are you attaching the EA and is the chart updating quote prices?

Please provide some screenshots.

 

I'm on EUR/USD 1M chart, the EA name is written in the top right so it's active. The chart is updating, I can place trades and all, so the account is connected. 

 
Fredyrik #:I'm on EUR/USD 1M chart, the EA name is written in the top right so it's active. The chart is updating, I can place trades and all, so the account is connected. 

Please note that the Market for EUR/USD is currently closed for the weekend. So, the chart cannot be updating (at least not now).

Either test on a different symbol that has activity during the weekend, or wait for Monday to continue testing.

When that happens please provide a full screenshot that includes the Chart, the Market Window and Journal log that shows something like this ...

2022.11.26 21:01:54.903 Experts expert AutoTP (EURUSD,M1) loaded successfully

And then a second screenshot of the Experts log.

 
Fernando Carreiro #:

Please note that the Market for EUR/USD is currently closed for the weekend. So, the chart cannot be updating (at least not now).

Either test on a different symbol that has activity during the weekend, or wait for Monday to continue testing.

When that happens please provide a full screenshot that includes the Chart, the Market Window and Journal log that shows something like this ...

And then a second screenshot of the Experts log.

I know markets are closed, I was just providing details of my previous testing. I will retest and provide screenshot when markets reopen.
 
Here is the screenshots. My EA is named AutoTP.
Files:
Screenshot1.jpg  254 kb
Screenshot2.jpg  226 kb
 
Fredyrik #:
Here is the screenshots. My EA is named AutoTP.

I find it difficult to believe that you have pasted the complete code in post #3.