Paint Bar on the 4th full trading of the month

Questions about MultiCharts and user contributed studies.
thariman
Posts: 18
Joined: 21 Jul 2006

Paint Bar on the 4th full trading of the month

Postby thariman » 04 Dec 2010

Hi,

I saw there is First Bar of Month indicator.
I'm trying to do paintbar for
4th full trading day of the month and
4th to last full trading day of the month.

Any help appreciated.

Thank you

Tony

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Paint Bar on the 4th full trading of the month

Postby TJ » 04 Dec 2010

Hi,

I saw there is First Bar of Month indicator.
I'm trying to do paintbar for
4th full trading day of the month and
4th to last full trading day of the month.

Any help appreciated.

Thank you

Tony
4th trading day is easy...
just set up a counter,
reset the counter at the beginning of the month,
and increment the counter everyday.
You will have the 4th day when the counter = 4.

The last 4th day is a bit tricky.
You have to know the last trading days to do the math.

thariman
Posts: 18
Joined: 21 Jul 2006

Re: Paint Bar on the 4th full trading of the month

Postby thariman » 05 Dec 2010

This is what I have so far some modification on current code.
Only the 4th from last still no clue yet how to get the total day available on a particular month.

// Still not sure on how to only include full trading day only removing half day trading

//4th bar to last full trading day of the month
if (BarType < 4 and Month( Date ) <> Month( Date[1] ) ) then
begin
Value1=Arw_new_s(Date,Time_s, Low, FALSE); // Need to get 4 day before on the date ?
Value2 = Arw_setstyle( Value1, 3 );
Value2 = Arw_setsize( Value1, 2 );
end ;

// 4th bar full trading day of the month
if (BarType < 4 and Month( Date[3] ) <> Month( Date[2] ) ) then
begin
Value1=Arw_new_s(Date,Time_s, High, True);
Value2 = Arw_setstyle( Value1, 3 );
Value2 = Arw_setsize( Value1, 2 );
end ;

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Paint Bar on the 4th full trading of the month

Postby Dave Masalov » 08 Dec 2010

Dear Tony,

Could you please explain your question in details?

thariman
Posts: 18
Joined: 21 Jul 2006

Re: Paint Bar on the 4th full trading of the month

Postby thariman » 08 Dec 2010

Dave,

I saw there is First Bar of Month indicator.
I'm trying to do arrow/paintbar like in the First Bar of Month indicator for

the 4th full trading day of the month and
the 4th to last full trading day of the month.

It will skip if the trading day is only half day.

For example:
Oct 6th 2010 and Oct 26th 2010
Nov 4th 2010 and Nov 25th 2010

I think to be able to do this I need to read a file that have the calendar information which
include holiday and half day trading.

Thank you

Tony

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Paint Bar on the 4th full trading of the month

Postby Dave Masalov » 09 Dec 2010

I think to be able to do this I need to read a file that have the calendar information which
include holiday and half day trading.
Dear Tony,

Yes, you will need to hardcode it: write it in the script or read it from a file thru external dll. Basically, you should skip holidays by means of your script.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Paint Bar on the 4th full trading of the month

Postby furytrader » 09 Dec 2010

Would this be on a daily chart? The challenge with end-of-day charts is that they'll give you the same timestamp, irrespective of whether it was a holiday-shortened session or not. As Dave mentioned, you may need to hardcode the dates then.


Return to “MultiCharts”