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

Re: [amibroker] Different daily EMA values when viewed from lower timeframes?



PureBytes Links

Trading Reference Links

--- Alan <firehorse888uk@xxxxxxxxxxx> wrote:

> Hi,
> [Top of message deleted]
> >>>>>>
> >>>>>>P = ParamField("Price field",-1);
> >>>>>>EMA1Per = Param("EMA1 Period", 02, 2, 1000, 1, 10 );
> >>>>>>EMA2Per = Param("EMA2 Period", 28, 2, 1000, 1, 10 );
> >>>>>>EMA1Col = ParamColor( "EMA1 Colour", colorRed);
> >>>>>>EMA2Col = ParamColor( "EMA2 Colour", colorBlue);
> >>>>>>
> >>>>>>Timeframe = inDaily;
> >>>>>>
> >>>>>>TimeFrameSet(Timeframe );
> >>>>>>EMA_Line1 = EMA( P, EMA1Per );
> >>>>>>EMA_Line2 = EMA( P, EMA2Per );
> >>>>>>TimeFrameRestore();
> >>>>>>
> >>>>>>EMALine1= TimeFrameExpand(EMA_Line1, Timeframe );
> >>>>>>EMALine2= TimeFrameExpand(EMA_Line2, Timeframe );
> >>>>>>
> >>>>>>AddColumn(EMALine1,"EMA1",1.4);
> >>>>>>AddColumn(EMALine2,"EMA2",1.4);
> >>>>>>
> >>>>>>Plot( EMALine1 + 0.0000, "EMA1", EMA1Col,styleNoRescale);
> >>>>>>Plot( EMALine2 + 0.0000, "EMA2", EMA2Col,styleNoRescale);
> >>>>>>
> >>>>>>Filter=1;
> >>>>>>

One problem that you have is that the TimeFrameSet function 
replaces current price/volume arrays (i.e. O, H, L, C etc) and not
any variable ("P" in your case) that may contain the values of price/volume.

You will need to convert "P" to the new timeframe, so something like
this should work:

TimeFrameSet(Timeframe );
P_TF = TimeFrameCompress( P, Timeframe );
EMA_Line1 = EMA( P_TF, EMA1Per );
EMA_Line2 = EMA( P_TF, EMA2Per );
TimeFrameRestore();
 
J


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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