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

[amibroker] Converting from Daily to Weekly


  • Date: Sat, 13 Mar 2010 14:28:52 -0000
  • From: "droskill" <droskill@xxxxxxxxx>
  • Subject: [amibroker] Converting from Daily to Weekly

PureBytes Links

Trading Reference Links

Hey all - I just accidentally destroyed a template that I used all the time.  I used the HACO indicator in the template - but I customized it to show weekly data on a daily chart.  I had previously programmed this, but now I can't get it working again.  I'm hoping someone can point out what I'm doing wrong.

To be clear - what I was doing before was calculating the HACO on the weekly timeframe, then displaying it on the daily timeframe.  I've tried placing the TimeframeRestore() after the final Haco calculation, and then using TimeFrameExpand(Haco,inDaily) - but it isn't working.

Any ideas greatly appreciated.
--------------------------------------------

TimeFrameSet(inWeekly);

_SECTION_BEGIN("HACO");
function ZeroLagTEMA( array, period )
{
 TMA1 = TEMA( array, period );
 TMA2 = TEMA( TMA1, period );
 Diff = TMA1 - TMA2;
 Diff2 = TMA1 + Diff;
 return Diff2 ;

}

/////////////////////
// Heikin-Ashi code


HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );

avp = Param("Up TEMA avg", 34, 1, 100 );
avpdn = Param("Dn TEMA avg", 34, 1, 100 );

// Velvoort is using not original, but modified Heikin-Ashi close
HaClose = ( HaClose + HaOpen + Max( H, HaOpen ) + Min( L, HaOpen ) )/4;

// up average
ZlHa = ZeroLagTEMA( HaClose, avp );
ZlCl = ZeroLagTEMA( ( H + L ) / 2, avp );
ZlDif = ZlCl - ZlHa;

keep1 = Hold( HaClose >= HaOpen, 2 );
keep2 = ZlDif >= 0;
keeping = keep1 OR keep2;
keepall = keeping OR ( Ref( keeping, -1 ) AND ( C > O ) OR C >= Ref( C, -1 ) );
keep3 = abs( C - O ) < ( H - L ) * 0.35 AND H >= Ref( L, -1 );
utr = keepall OR ( Ref( keepall, -1 ) AND keep3 );

// dn average
ZlHa = ZeroLagTEMA( HaClose, avpdn );
ZlCl = ZeroLagTEMA( ( H + L ) / 2, avpdn );
ZlDif = ZlCl - ZlHa;

keep1 = Hold( HaClose < HaOpen, 2 );
keep2 = ZlDif < 0;
keeping = keep1 OR keep2;
keepall = keeping OR ( Ref( keeping, -1 ) AND ( C < O ) OR C < Ref( C, -1 ) );
keep3 = abs( C - O ) < ( H - L ) * 0.35 AND L <= Ref( H, -1 );
dtr = keepall OR ( Ref( keepall, -1 ) AND keep3 );

upw = dtr == 0 AND Ref( dtr, -1 ) AND utr;
dnw = utr == 0 AND Ref( utr, -1 ) AND dtr;

Haco = Flip( upw, dnw );

if( ParamToggle("Chart Type", "Price with color back|HACO wave" ) )
{
 Plot( Haco, "Haco", colorRed );
}
else
{
 Plot( C, "Close", colorBlack, ParamStyle( "Style", styleCandle, maskPrice ) );
 Plot( 1, "", IIf( Haco , colorPaleGreen, colorRose ), styleArea | styleOwnScale, 0, 1 );
}

TimeFrameRestore();



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

**** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/