Why doesnt my EA show any text when put on my normal chart?

Ask your basic questions confidently here. Flaming is not allowed. Sympathetic help is the order of the day.
Post Reply
chiefkeef
Trader
Posts: 13
Joined: Mon Sep 07, 2020 8:09 pm

Why doesnt my EA show any text when put on my normal chart?

Post by chiefkeef »

Hi,

My EA works perfectly on strategy tester, but on the Chart, there is no labels or nothing that comes up. I check ed the error box or journal box, it seems to be all working fine, my EA has a smiley face. Is it because the markets are closed?

Here are the message box:
2020.11.07 18:06:03.141 te3 XAUAUD,M1: initialized
2020.11.07 18:06:01.203 Expert te3 XAUAUD,M1: loaded successfully
2020.11.07 18:06:01.197 Expert te3 XAUAUD,M1: removed
2020.11.07 18:06:01.194 te3 XAUAUD,M1: uninit reason 1
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Why doesnt my EA show any text when put on my normal chart?

Post by tomele »

This is a bit diificult to tell without seeing your code. But I could imagine that your main loop is located in the OnTick() function, which means it runs only if triggered by a tick. There are no ticks over the weekend, so yes to your answer in this case. If so, you might consider using the OnTimer() function instead, which in most cases is the better way to implement an EA anyway.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
chiefkeef
Trader
Posts: 13
Joined: Mon Sep 07, 2020 8:09 pm

Why doesnt my EA show any text when put on my normal chart?

Post by chiefkeef »

This made it works thanks.
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Why doesnt my EA show any text when put on my normal chart?

Post by tomele »

Well done.

As a side note, I recommend using my SecureSetTimer() function instead of EventSetTimer(), which can be unreliable under certain conditions on VPS systems.

Code: Select all

bool SecureSetTimer(int seconds) 
{
   int error=-1;
   int counter=1;
   
   do
   {
      EventKillTimer();
      ResetLastError();
      EventSetTimer(seconds);
      error=GetLastError();
      Print("SecureSetTimer, attempt=",counter,", error=",error);
      if(error!=0) Sleep(1000);
      counter++;
   }
   while(error!=0 && !IsStopped() && counter<100);
   
   return(error==0);
}
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
chiefkeef
Trader
Posts: 13
Joined: Mon Sep 07, 2020 8:09 pm

Why doesnt my EA show any text when put on my normal chart?

Post by chiefkeef »

tomele » Sat Nov 07, 2020 9:09 pm wrote:Well done.

As a side note, I recommend using my SecureSetTimer() function instead of EventSetTimer(), which can be unreliable under certain conditions on VPS systems.

Code: Select all

bool SecureSetTimer(int seconds) 
{
   int error=-1;
   int counter=1;
   
   do
   {
      EventKillTimer();
      ResetLastError();
      EventSetTimer(seconds);
      error=GetLastError();
      Print("SecureSetTimer, attempt=",counter,", error=",error);
      if(error!=0) Sleep(1000);
      counter++;
   }
   while(error!=0 && !IsStopped() && counter<100);
   
   return(error==0);
}
Why doesn't it work on backtesting though?
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Why doesnt my EA show any text when put on my normal chart?

Post by tomele »

OnTimer() can't work in backtesting, as backtesting doesn't run in realtime. One could get around this very easily by calling OnTimer() from OnTick() like this:

Code: Select all

void OnTick()
{
   if(IsTesting()) OnTimer();
}
BUT

Among professionals, Empty4 backtesting is despised. In this forum, it is banned. Do yourself a favour and read this thread over and over until you understand it before doing anything else: viewtopic.php?f=28&t=4020.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
chiefkeef
Trader
Posts: 13
Joined: Mon Sep 07, 2020 8:09 pm

Why doesnt my EA show any text when put on my normal chart?

Post by chiefkeef »

thanks a lot. thankfully this ea im making doesnt send orders just finds divergences.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Why doesnt my EA show any text when put on my normal chart?

Post by SteveHopwood »

tomele » Sat Nov 07, 2020 9:09 pm wrote:Well done.

As a side note, I recommend using my SecureSetTimer() function instead of EventSetTimer(), which can be unreliable under certain conditions on VPS systems.

Code: Select all

bool SecureSetTimer(int seconds) 
{
   int error=-1;
   int counter=1;
   
   do
   {
      EventKillTimer();
      ResetLastError();
      EventSetTimer(seconds);
      error=GetLastError();
      Print("SecureSetTimer, attempt=",counter,", error=",error);
      if(error!=0) Sleep(1000);
      counter++;
   }
   while(error!=0 && !IsStopped() && counter<100);
   
   return(error==0);
}
I second this. I have used it every time since Thomas first published it. Never fails.

:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “EA's for Dummies.”