I'm not an expert on this, but I have been following this thread with some interest (because I day trade using multiple timeframes, and currently simply switch all my interval linked charts from one timeframe to another - I have a hunch there may be a better way of operating).
Anyway, if what you have written below is correct, if seems in complete conflict with what AF wrote on this post in reply to TJ, http://finance.groups.yahoo.com/group/amibroker/message/141366 Perhaps the experts (Jorgen & AF - or indeed TJ) could clear this one up...? --- In [email protected], "gunoicb" <guno...@...> wrote: > > Hi guys, > > I want to be sure that I understood correctly the use of higher timeframes in > my backtesting, so here is my question: > > TimeFrameSet( -1);//I'm using for backtesting tick data > //I compute below emas for each time frame > TimeFrameSet( in1Minute); > EMA5_1m= EMA (C,5); > TimeFrameRestore(); > TimeFrameSet( in5Minute); > EMA5_5m= EMA (C,5); > TimeFrameRestore(); > TimeFrameSet( 15*60); > EMA5_15m= EMA (C,5); > TimeFrameRestore(); > > The following will give me the values for each ema updated for each tick, > tick by tick, not waiting for the candle to be completed (1min, 5 min or 15 > min)? > TimeFrameExpand( Ref(EMA5_1m,0),in1Minute) > TimeFrameExpand( Ref(EMA5_5m,0),in5Minute) > TimeFrameExpand( Ref(EMA5_15m,0),in15Minute) > I mean, if I have 200 ticks during a 15 minute candle, I get 200 values for > TimeFrameExpand( Ref(EMA5_15m,0),in15Minute)? > > while the following will give me the emas values based on complete previous > candle (1min candle, 5 min candle and respectively 15 min candle)? > TimeFrameExpand( Ref(EMA5_1m,-1),in1Minute) > TimeFrameExpand( Ref(EMA5_5m,-1),in5Minute) > TimeFrameExpand( Ref(EMA5_15m,-1),in15Minute) > > I'm using the same principle as Jorgen for backtesting, but I'm not sure that > I'm using correctly. I don't want to use the higher emas as staircases, but > rather as "irregular" as Jorgen pointed out that image loaded by him. I don't > want to wait for 15 min candle to be completed, but rather to take a decision > based on its value at each tick. > > Am I right? Or should I read again > http://www.amibroker.com/guide/h_timeframe.html ? :-) > > Thank you > > > --- In [email protected], "af_1000000" <af_1000000@> wrote: > > > > I have not tried more complex indicators for one simple reason. If the > > higher timeframe compressed data contains all values I need (including > > incomplete last bar) I do not have to do anything . Build in indicators and > > my scripts will do everything for me. You calculate indicators on higher > > timeframe and expand them on a lower timeframe. If data compression on > > higher timeframe does not include everything you need you have to combine > > somehow data on higher timeframe with data on lower timeframe and invent > > new implementation of the indicators or create new intelligently combined > > weekly and data array, so build in indicators can use this array. That's > > why my preference is to fix data compression on the higher timeframe first > > before I start thinking about an exotic stuff. > > So far, I have used multiple charts to avoid unnecessary programming. > > I do not understand why you would use "expandFirst". Create two charts > > higher and lower timeframe in a layout and play bar by bar. I believe the > > code is correct. Of course, I did not test every possible case, that's why > > you found few mistakes. The main objective was to prove the concept and > > highlight the differences between "traditional" method and your method. > > Sometimes loops are more efficient than array processing especially when > > you use lastvalue, nested barssince, nested valuewhen,.. etc. Every > > situation is unique, so it is hard to say in advance what is the best > > implementation. Always check "Code check $ Profile" and "Display chart > > timing". > > > > Regards, > > > > AF > > >
