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

[amibroker] Re: Calculating No of Bars since Start of Previous Month



PureBytes Links

Trading Reference Links

Here is a zero based example (i.e. does not include current bar in the total). Add one to the result if you want to count the current bar.

Months = Month();
ChangeOfMonth = (Months != Ref(Months, -1));
Indices = BarIndex();

Bars = Indices - ValueWhen(ChangeOfMonth, Indices, 2);

Plot(Bars, "Bars", colorBlue, styleStaircase);
_N(Title = StrFormat("{{DATE}} {{VALUES}}"));

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "chorlton_c_hardy" <chorlton-c-hardy@xxx> wrote:
>
> 
> 
> Hello All,
> 
> 
> I'm working in the Weekly timeframe and would like to calculate how many weekly bars have past since the START of the PREVIOUS MONTH.
> 
> I can easily find out how many bars have occured since the Start of the Current Month using:
> 
> BarsStartCurrentMth = BarsSince(Month()!=Ref(Month(),-1)) + 1 ;
> 
> However, I'm struggling to find how many bars have occured since the Start of the Previous Month. What makes this difficult for me is that not all Months contain 4 weeks.
> 
> Can anyone offer any help with this? 
> 
> Many Thanks in advance....
>




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

**** 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/