[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: First and Last Trading Day in Month



PureBytes Links

Trading Reference Links

The following plots a 1 (TRUE) on the first day of the month.
The last day of the prev month is one bar back from the 1.

FOM = Month() != Ref(Month(),-1);
Plot(Fom,"FirstOfMonth",1,1);
Plot(FOM == 0 AND Ref(First,1) == 1,"LastDayOfMonth",colorRed,1);

The code looksahead ... that shouldn't matter for BT if you use it carefully.

--- In amibroker@xxxxxxxxxxxxxxx, "Patrick" <patsgreatdeals@xxx> wrote:
>
> I want to testing buying and selling based on months. Using the very simple forumla below will not work (month end mainly) if there is no trading day on the 28th. 
> 
> Is there a way to write to code... "Buy on the first trading day of the month, and sell on the last trading day of the month" ??
> 
> 
> MO = 1;
> Buy = (Month() == MO) AND(Day() = 1 );
> Sell = (Month() == MO) AND (Day() = 28);
>




------------------------------------

**** IMPORTANT PLEASE READ ****
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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/