We in India have been looking to find ways to Mark Last Thursday of Month (Futures Expire on this day)
The Latest Beta seems to make life very much easy for this purpose:
1. We may know when Next or Next or Next (etc. etc. ) Expiry will normally fall.
2. Mark correct past Expiries even when Last Thursday happens to be an holiday.
The following is a Quick Try :
Your views and comments are welcome
Regards
Sanjiv Bansal
(A small correction has been made to last line of code)
/*************/
Plot( Close, "Price", colorYellow, styleBar );
Curr_Month_Beg = DateTimeAdd( DateTime(), -(Day() -1), inDaily );
Next_Month_Beg1 = DateTimeAdd( Curr_Month_Beg, 1, inMonthly );
Next_Month_DoW1 = DateTimeConvert( 9, Next_Month_Beg1 );
Month_LstThu1 = DateTimeAdd( Next_Month_Beg1,IIf( Next_Month_DoW1 == 5, -1,
IIf( Next_Month_DoW1 == 6, -2,IIf( Next_Month_DoW1 == 0, -3,
IIf( Next_Month_DoW1 == 1, -4,IIf( Next_Month_DoW1 == 2, -5,
IIf( Next_Month_DoW1 == 3, -6, -7 ) ) ) ) ) ), inDaily );
Next_Month_Beg2 = DateTimeAdd( Curr_Month_Beg, 2, inMonthly );
Next_Month_DoW2 = DateTimeConvert( 9, Next_Month_Beg2 );
Month_LstThu2 = DateTimeAdd( Next_Month_Beg2,IIf( Next_Month_DoW2 == 5, -1,
IIf( Next_Month_DoW2 == 6, -2,IIf( Next_Month_DoW2 == 0, -3,
IIf( Next_Month_DoW2 == 1, -4,IIf( Next_Month_DoW2 == 2, -5,
IIf( Next_Month_DoW2 == 3, -6, -7 ) ) ) ) ) ), inDaily );
Fnl_Thurs = IIf(DateTimeConvert( 0, Month_LstThu1 )>=DateNum(),DateTimeConvert( 0, Month_LstThu1 ),DateTimeConvert( 0, Month_LstThu2 ));
Plot( Fnl_Thurs, "Month_LstThurs", colorRed, styleLeftAxisScale );
Plot( DateNum(), "DateNum()", colorWhite, styleLeftAxisScale );
PlotShapes( shapeUpArrow * Ref(Fnl_Thurs > Ref(Fnl_Thurs,-1),1), colorLime, 0, Low, 0 );
Posted by: sumangalam@vsnl.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon