Hi Guys,
I have a strategy where i may want to buy the emini sp at say the 9th trading day of the month.
Now
DayOfMonth(Date) will give me calendar day, so how can i make a function which does not count weekends, and hence gives me trading day of month
Thanks
Riz
How to obtain trading day of month (not calendar day)
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: How to obtain trading day of month (not calendar day)
Hi Guys,
I have a strategy where i may want to buy the emini sp at say the 9th trading day of the month.
Now
DayOfMonth(Date) will give me calendar day, so how can i make a function which does not count weekends, and hence gives me trading day of month
Thanks
Riz
There are two functions that might help you achieve your goals, LastDateOfMonth and LastWorkDayOfMonth
Re: How to obtain trading day of month (not calendar day)
Arnie,
Thanks for your reply, where can i get help on these functions, because i checked the EasyLanguage reference and these functions are not in that reference guide.
Is there another reference guide which you are using?
Thanks for your reply, where can i get help on these functions, because i checked the EasyLanguage reference and these functions are not in that reference guide.
Is there another reference guide which you are using?
Re: How to obtain trading day of month (not calendar day)
The functions you have listed dont seem to exist,
I've even tried to type them into the code, and they are not recognised, are you using some special library or something?
I've even tried to type them into the code, and they are not recognised, are you using some special library or something?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to obtain trading day of month (not calendar day)
The best way to do it is to set up a counter...Hi Guys,
I have a strategy where i may want to buy the emini sp at say the 9th trading day of the month.
Now
DayOfMonth(Date) will give me calendar day, so how can i make a function which does not count weekends, and hence gives me trading day of month
Thanks
Riz
1. reset the counter to zero (0) when a new month begins.
2. increment the counter on each new day on the chart.
3. when the counter=9, you have found your 9th trading day.
Re: How to obtain trading day of month (not calendar day)
TJ
What your saying can be achieved by just using the dayofmonth(Date) function
What I want is trading days (so excluding weekend).
So although it might be the 9th calendar day of the month this may only be 6th or 7th trading day of month
What your saying can be achieved by just using the dayofmonth(Date) function
What I want is trading days (so excluding weekend).
So although it might be the 9th calendar day of the month this may only be 6th or 7th trading day of month
Re: How to obtain trading day of month (not calendar day)
Rough concept:
Should work for intraday and daily bar charts..
Sessions need to be configured correctly in QuoteManager..
Code: Select all
Var: Counter (0);
If month(date) <> month(date) [1] then Counter= 1;
If sessionlastbar then Counter= Counter +1;
If Counter= 9 then begin
............
............
............
End;
Sessions need to be configured correctly in QuoteManager..
Re: How to obtain trading day of month (not calendar day)
Correction.. previous only works well for intraday..
Concept for daily bars:
Concept for daily bars:
Code: Select all
Var: Counter (0);
If month(date) <> month(date) [1] then Counter= 0;
If date <> date [1] then counter= counter +1;
Re: How to obtain trading day of month (not calendar day)
When counter=9 you are on the ninth trading day of the month with either intraday or daily bars using the following:
Maybe even an easier way.. can easily complete your signal using this though
Code: Select all
Var: Counter (0);
If bartype=1 then begin
If month(date) <> month(date) [1] then Counter= 1;
If sessionlastbar then Counter= Counter +1;
End;
If bartype=2 then begin
If month(date) <> month(date) [1] then Counter= 0;
If date <> date [1] then counter= counter +1;
End;
- furytrader
- Posts: 354
- Joined: 30 Jul 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
Re: How to obtain trading day of month (not calendar day)
RKhan, there is no loop for the counter - or, to put it more accurately, because this code is run for every bar, the "loop" is the number of bars you have on your chart.