Using OnTimer to send an email
Using OnTimer to send an email
18 Nov 2018, 01:34
Hi, i wish to have a method in my code that sends an email to me an the same time each day. i have the code to send the actual email and ive set the correct setting in cTrader. However currectly ive put the code into the OnStart method but this obviously only sends once. I thought that using the onTimer method would work but i dont know how to use it.
P.s. Does anyone have a list of all of the OnTimer, OnStart, OnStop ect API method and in adition is there a propper guide of all the parts of the cAlgo API.
Replies
willd7781
19 Nov 2018, 17:53
RE:
Panagiotis Charalampous said:
Hi William,
There is an example here on how to use a Timer in cAlgo. Let me know if you need any clarifications.
Best Regards,
Panagiotis
Hi that helped but im still having prolems.
ive got to here....
protected override void OnStart() } Timer.Start(1); } protected override void OnTimer() { if (Time.Equals("23:00:00")) { Print("yay it worked") } }
I thought that this code would print the message at the time 23:00:00 but it didnt work.
An thoughts
Thank your help.
WIlliam
@willd7781
PanagiotisCharalampous
20 Nov 2018, 09:26
Hi William,
Try the following condition
if(Time.Hour == 23 && Time.Minute == 0 && Time.Second == 0) { }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Nov 2018, 12:28
Hi William,
There is an example here on how to use a Timer in cAlgo. Let me know if you need any clarifications.
Best Regards,
Panagiotis
@PanagiotisCharalampous