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

[amibroker] Re: TimeFrames: Is their use flawed?



PureBytes Links

Trading Reference Links

Hi AF,

Sorry, I missed your question earlier! I admit it can be little bit tricky with timeframes and it takes some time to get use to it. 
But your assumptions are not correct. When I use a 1 min chart and I calculate the 5 min timeframe at 9:03 AM, it's a new bar for the 1 min chart, and we are 60% done on the 5 min bar which period started at 9:00 AM.

I am not sure how others do intraday trading, but I don't sit and wait for higher TF bars to close. Another advantage in my specific case is that with 1 min data resolution in the higher TFs- the Buy/Sell signals will not "come and go". I give you an example. Let's say that I have a system which requires signals from 1, 5 and 15 min TF. Both 1 and 5 min fulfill the signal criteria bit not 15 min TF. Then suddenly when 7 min are done of the 15 min bar, this TF give the signal. Later when 13 min of the 15 min bar is complete, it drops down below the signal criteria. Traditionally, now my signal in the chart will completely disappear since only the last close of the 15 min is saved. But in my case, I use a 1 min resolution on the higher TFs, therefore my Buy/Sell signals will remain in my chart during the 7 to 13 min time of the 15 min period and I will have a complete record of what have happened (in 1 min resolution).

For example- throw in the below code in a chart with 1 min interval, and you will see a MA for 1, 5 and 15 minutes. For easier viewing, I usually plot the "staircase" over the actual values. Then add some Buy/Sell signals for the TFs and Experiment with it.

Regards,

Jorgen

_SECTION_BEGIN("MA Timeframe Calculations");
TFMinShort	= Param("Short Timeframe (Minutes)", 1, 1, 60, 1);
TFMinMedium	= Param("Medium Timeframe (Minutes)", 5, 1, 60, 1);
TFMinLong 	= Param("Long Timeframe (Minutes)", 15, 1, 60, 1);
Periods 	= 10;
function BBTFValue( TF, TFNumber )
{
    TFSec = in1Minute * TF;
    TimeFrameSet( TFSec );
    TFBarIndex = BarIndex();
    TimeFrameRestore();
    TFBarIndex = TimeFrameExpand( TFBarIndex, TFSec, expandLast );
    LastTFBar = IIf( TFBarIndex != Ref( TFBarIndex, -1 ), 1, 0 );
    LVB = Status( "lastvisiblebar" );
    FVB = Status( "firstvisiblebar" );
    Bars = Min( LVB - FVB, BarCount - FVB );
    FUB = Bars + Periods * TF;
    BI = BarIndex();
    BI = BI - BI[0];
    END = LastValue( BI );
    START = END - FUB;
    TFCloseArray = TimeFrameCompress( Close, in1Minute * TF );
    SumA = TimeFrameExpand( Sum( TFCloseArray, Periods ), in1Minute * TF );
    SumB = TimeFrameExpand( Sum( TFCloseArray, Periods - 1 ), in1Minute * TF );

    for ( i = Max( 0, START ); i <= END; i++ )
    {
        MAValue[i] = ( SumB[i] + Close[i] ) / Periods;
        if ( LastTFBar[i] )
            MAValue[i] = SumA[i] / Periods;
    }
    VarSet( "MAValue" + TFNumber, MAValue );
}
Plot(Close, "", colorBlack, styleCandle); 
BBTFValue( TFMinShort, 1 );
BBTFValue( TFMinMedium, 2 );
BBTFValue( TFMinLong, 3 );
MAValue1 = VarGet( "MAValue1" ); MAValue2 = VarGet( "MAValue2" );MAValue3 = VarGet( "MAValue3" );
Plot( MAValue1, "", colorBlue );
Plot( MAValue2, "", colorRed );
Plot( MAValue3, "", colorDarkGreen);
SetBarsRequired( sbrAll, 0 );
_SECTION_END();


--- In amibroker@xxxxxxxxxxxxxxx, "af_1000000" <af_1000000@xxx> wrote:
>
> It is not 100% clear. Assume that you are on 1 minute chart and you calculate 5 min timeframe and the current time is 9:03AM. Does it mean that your timeframe boundaries are (going back): 9:03, 8:58, 8:53, .... or traditionally 9:03, 9:00, 8:55 .... (9:03 is incomplete). If the last option is true there is no difference between traditional timeframe and your timeframe with the exception of the last bar (yours takes values from the incomplete last period, traditional from the last complete bar).
> As a curiosity,  what do indicators actually show on charts ? Assume that I have two charts: 1 min and 5min and the current time is  9:03 and RSI(14) is plotted on both charts. On 1 min charts RSI includes Close from the last incomplete 1 min bar and on 5 minute charts RSI includes current close at 9:03 (not at 9:00). So if I want to use one chart (1min interval) and timeframe functions instead of two charts I will not reproduce 5 min chart on 1 min chart (close at 9:00 will be taken instead of 9:03). Is this correct ?
> 
> AF
>




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

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