I want to trigger an audible alert x minutes before a time.... such as NY cash Open/Close, DAX cash Open/Close, Gold/CL etc.
Context - I'm in Europe so have to contend with DST (hats off to Harry for his expertise in cracking this one)
I believe I have a problem relating to Tick bars and time stamp if using Time[0] - either the time stamp of a tick bar may not equal the Open/Close precisely, or maybe, not at all.
This is what I've got:
using OnBarUpdate, and CalculateOnBarClose = False....
if(Time[0] == newyorkStartTimeLocal.AddMinutes(-15))
{
PlaySound(newyorkOpenAlert);
}
where newyorkOpenAlert is a texttospeech .wav file 'New York Opening in 15 minutes'
Ditto for Dax etc.
'Local' sets to relevant Time Zone
It seems it works sometimes.
If that is so, is it something to do with the tick bar timestamp?
If so, what is it? I was wondering if to do with Seconds? NTYStartTimeLocal is hh:mm:ss and to be == Time[0] tick bar's time stamp also have to be :00 seconds (unlikely)
What to do?
I'm not a programmer - so near yet so far.
I believe I can't use ToTime with ==, has to be <=, so no good for a fixed Open time
I believe I could use DateTimeNow to use my pc clock, but not sure of DST implications
The only time-based charts I use are 30 and 60 mins so that doesn't give me 'granularity' for 15 or 5 mins warning alerts.
Any ideas?
TIA
Comment