Hi there,
I noticed that my code will not work well during holidays or short days such as this last Thanksgiving half days.
Is there a command to let the program know to skip half days or vacation days (days taht IG may be still trading on futures but the market is out)
Thanks in advance
You can skip any date of your choice simply by coding it in to your strategy as a condition. The same with time.
DateOK = date <> 201800301 and date <> 20180801
TimeOK = time >= 120000 and time < 220000
if DateOK and TimeOK and (your conditions) then
buy 1 contract at market
endif
Make sure you actually have the candle time in your chosen time frame – for example there is no 233000 candle in an hourly chart.
If it is the same date every year that you want to avoid then you can do something like this:
MMDD = date - (round(date / 10000) * 10000)
DateOK = MMDD <> 0103
ok thanks,
I was kind of hoping there was some Database with vacation dates that can be used so i won’t have to hard coded it anew each year.
Thanks