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

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



PureBytes Links

Trading Reference Links

Hi,

Thank you Graham for trying to shed light this.

I've retested using

Forexite data at 1 min intervals
Base time interval - 1 min
Show 24hrs - no filtering
Filter weekend not ticked
Day session start end 0:00, 0:00
Night session start end 0:00, 0:00
Daily compression uses - Exchange time
Timeshift = 0
Allow mixed eod/intraday not ticked.

eurusd
Last day in data is 3 feb 2006, close is 1.2018
When chart is shown with daily bars ema(c,2) = 1.20399
When chart is shown with hourly bars timeframeset daily ema(c,2) = 
1.20179 (near close value)

A big difference when I expect the two EMAs to be the same.

It appears that even with using timeframeset(indaily), the EMA formula 
in the chart is using hourly bars.
Is that right?

I must be doing something wrong but I don't know what!

Help!
Alan


Graham wrote:

>Have you checked that the daily time settings in your database
>settings match the bar period as far as start and end times, and also
>are the daily close values the same as your end of day database values
>Sometimes intraday can include (or exlcude) the prices that are used
>in your end if data.
>Another thing is if you are using expndlast then the current
>incomplete lower period bar will not be used as only completed
>timeframe bars are used.
>If you use expandfirst then the current incomplete timeframe bar will
>be used in the calculation.
>
>sorry I find this hard to explain so i hope this at least gets you
>looking at what values are being inputted to the calculations, rather
>than just accept that the values being used are what you expect them
>to be
>
>--
>Cheers
>Graham
>AB-Write >< Professional AFL Writing Service
>Yes, I write AFL code to your requirements
>http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
>On 2/7/06, Alan <firehorse888uk@xxxxxxxxxxx> wrote:
>  
>
>>Hello,
>>
>>Thank you for your explanation.
>>
>>I thought that because I used
>>
>>Timeframe = inDaily;
>>TimeFrameSet(Timeframe );
>>EMA_Line1 = EMA( P, EMA1Per );
>>TimeFrameRestore();
>>
>>EMALine1= TimeFrameExpand(EMA_Line1, Timeframe );
>>
>>Plot( EMALine1 + 0.0000, "EMA1", EMA1Col,styleNoRescale);
>>
>>
>>I thought I could change the mode to "daily", get AB to work out the EMA
>>on a daily, then timeframerestore it back to whatever timeframe the
>>current indicator display is and when I plotted the line, it would be as
>>if it was plotted on a daily basis. I understand I will get a stepped
>>line in a lower time frame but I expected 'daily' ema values to stay
>>constant in all lower timeframes.
>>
>>I'm puzzled it works for single values like H,L,C that I use for pivot
>>points, but doesn't work for EMA.
>>
>>It appears that the even though I'm specifying timeframe daily, the EMA
>>is being calculated on the lower time frame close as the daily close
>>value is 1.2018 and as I go to the 15min timeframe or lower, the 'daily'
>>ema(C,2)  gets to 1.2018.
>>
>>It's very puzzling to me.
>>
>>In the Multiple Time Frame support in help, it clearly uses EMA of a
>>higher timeframe from a lower timeframe. I can't see that I'm doing
>>anything different.
>>
>>Or does AFL in indicator code work differently??
>>
>>Help!
>>
>>Alan
>>
>>Tomasz Janeczko wrote:
>>
>>    
>>
>>>Hello,
>>>
>>>EMA has recursive formulation. It means that ALL bars influence the final value
>>>(not only N-most recent bars as in the case of SIMPLE moving average).
>>>The side effect of it is that value of EMA depends on NUMBER OF BARS
>>>included in the calculation. If it changes - you will get different results.
>>>If you change base time frame and the number of bars included in the calculation
>>>may change (especially when we consider INDICATOR code) because
>>>number of VISIBLE bar changes and indicators use not all but visible bars
>>>(plus some more) - i.e use QuickAFL feature.
>>>See this how to disable quick afl
>>>http://www.amibroker.com/f?setbarsrequired
>>>
>>>Best regards,
>>>Tomasz Janeczko
>>>amibroker.com
>>>----- Original Message -----
>>>From: "Alan" <firehorse888uk@xxxxxxxxxxx>
>>>To: <amibroker@xxxxxxxxxxxxxxx>
>>>Sent: Monday, February 06, 2006 9:45 PM
>>>Subject: Re: [amibroker] Different daily EMA values when viewed from lower timeframes?
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>Hi Ara,
>>>>
>>>>I've tried putting in expand first.
>>>>Now I get
>>>>
>>>>daily - 1.2040
>>>>4hr - 1.20199
>>>>1hr - 1.20179
>>>>15min - 1.2018
>>>>5 min - 1.2018
>>>>1 min - 1.2018
>>>>
>>>>I've got pivot formulas using the close at the end of the day expanded
>>>>with expandfirst and they seem to work fine because they stay constant
>>>>when you go to a lower timeframe.
>>>>
>>>>I don't understand why when it it is an EMA it changes, and how do I
>>>>make it constant?
>>>>
>>>>Thanks
>>>>Alan
>>>>
>>>>
>>>>Ara Kaloustian wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>When you create longer timeframe indicators, you use either "expandfirst" or
>>>>>"expand last" parameters.
>>>>>
>>>>>"Expandfirst" will "look forward" to the end of the period. For example if
>>>>>you are doing a 5 period expansion, then if the 1st regular period is
>>>>>higher, the entire expanded 5 period bar will be high ... which can changes
>>>>>in the next 4 bars.
>>>>>
>>>>>
>>>>>----- Original Message -----
>>>>>From: "firehorse888uk" <firehorse888uk@xxxxxxxxxxx>
>>>>>To: <amibroker@xxxxxxxxxxxxxxx>
>>>>>Sent: Monday, February 06, 2006 8:55 AM
>>>>>Subject: [amibroker] Different daily EMA values when viewed from lower
>>>>>timeframes?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>Could someone explain why when viewed from a lower timeframe, why my
>>>>>>daily ema values keep changing?
>>>>>>
>>>>>>I'm using forexite minute data.
>>>>>>
>>>>>>At the end of friday 21:00
>>>>>>Daily EMA(C,2) = 1.20836
>>>>>>When I change the intervals I'm viewing it at it changes.
>>>>>>4hr - 1.20224
>>>>>>1hr - 1.20178
>>>>>>15min - 1.2018
>>>>>>5min - 1.20181
>>>>>>1min - 1.2018
>>>>>>
>>>>>>By using the timeframeset and restore to get the daily ema(c,2) value,
>>>>>>I would have expected it to remain constant. I've attached the code
>>>>>>I'm using.
>>>>>>
>>>>>>Has anyone got a better understanding to explain?
>>>>>>
>>>>>>Thanks
>>>>>>Alan
>>>>>>
>>>>>>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;
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>



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