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

[amibroker] Re: More Mysteries with TimeFrames



PureBytes Links

Trading Reference Links

Ken timeframeset and timeframecompress does not reduce the number of 
bars in an array. The number of bars is exactly the same, what 
happens, in the case of weekly, is that the first 4/5 of the array is 
now filled with NULL, and the last 1/5 is filled with weekly values 
based on your option of compression. When you do cum(1). It will 
count the number of bars which is exactly the same number of bars. 
When you do timeframeexpand, you expand the last 1/5 of the array to 
occupy the full array. 
For an experiment, try this
filter = 1; buy = 0;
bars = cum(1);
bars = timeframeexpand(bars, inmonthly);
You will get the same result as barsM that you wrote before.
Which means timeframeset etc has no effect on cum(1)
What you probably want is something like this

TimeFrameSet(inMonthly);
BarsM = Cum(!isNull(c));
TimeFrameRestore;
BarsM = TimeFrameExpand(BarsM,inMonthly);
that should work.
>From what I understand what you want, you call do all that by going 
to AA setting, change periodicity to monthly. all your exploration 
would be done on monthly, and you dont have to write multitime frame 
codes.
/Paul.

--- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <ken45140@xxx> wrote:
>
> Here is one I cannot figure out.
>  
> I write
>  
> Filter = 1; Buy =0;
> Bars = Cum(1);
> AddColumn(Bars,"Bars",1.0);
>  
> I set the date to the first date of the data, and I get
> Bars
> 1
> 2
> 3
> 4
>  
> Now, I set this
>  
> Filter = 1; Buy =0;
> Bars = Cum(1);
>  
> TimeFrameSet(inMonthly);
> BarsM = Cum(1);
> TimeFrameRestore;
> BarsM = TimeFrameExpand(BarsM,inMonthly);
>  
> AddColumn(Bars,"Bars",1.0);
> AddColumn(BarsM,"BarsM",1.0);
>  
> and I get
>  
> Bars   BarsM
> 1        4763
> 2        4763
> 3        4763
>  
> I expected
> Bars   BarsM
> 1        0    
> 2        0
> etc
> 22        1
>  
> What is going on?  What happened inside the TimeFrameSet section?  
Why did I
> get this result?
> I want to operate on Monthly stats and bars yet need to count the 
number of
> months since a specified start date and I cannot do it.
> Help please.
>  
> Ken
>



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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
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/