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

RE: [amibroker] When do my posts show up? --the real help question



PureBytes Links

Trading Reference Links

Dennis,

I copied and pasted. Works for me.
My guess is your AA settings. 
Go into the backtester. 
Pick Settings.
On the tab that comes up change your setting from Long only to Long &
Short.
--
Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Dennis Brown
Sent: Wednesday, August 23, 2006 14:05
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] When do my posts show up? --the real help
question

Since my posts seems to be going out now, I will try this again.

I cut and pasted the following AFL from one of the examples somewhere
--I can't find it again at present, so I will include the AFL with
this post. I have tried to make it run, but it has a problem that I
can not figure out --perhaps I do not understand something.  The AFL
allows you to use the Parameters to manually set buy/sell/short/cover
points on your chart and shows the equity curve.  It works fine for
buy and sell.  However, any short or cover always shows as a redundant
signal no matter what order I put them in.  I have gone over the
syntax and can not find anything that is not symetrical to the
buy/sell cases.  I am not sure if it a problem with the AFL, or with
me.  I would appreciate any help, or just testing to see if it works
for someone else.

Thanks,
Dennis

Here is the AFL --watch for line wraps.

_SECTION_BEGIN("EquityCurve");
Buy = 1;
Sell = Cover = Short = 0;

bh = Equity( 0, 0 );

setbuy = ParamTrigger("Buy", "Buy" );
setsell = ParamTrigger("Sell", "Sell" );
setshort = ParamTrigger("Short", "Short" );
setcover = ParamTrigger("Cover", "Cover" );
clear = ParamTrigger("Clear", "Clear" );
clearall = ParamTrigger("Clear All", "Clear All" );

bi = BarIndex();
sbi = SelectedValue( bi );
qty = LastValue( bi );

Varname = Name() + sbi;

if( setbuy ){ StaticVarSet( Varname, 1 );}
if( setsell ){ StaticVarSet( Varname, -1 );}
if( setshort ){ StaticVarSet( Varname, -2 );}
if( setcover ){ StaticVarSet( Varname, 2 );}
if( clear ){ StaticVarRemove( Varname );}
if( clearall )
{ for( i = 0; i < qty; i++ ) StaticVarRemove( Name() + i);}

Buy = Sell = Short = Cover = 0;

for( i = 0; i < qty; i++ )
{
   sig = StaticVarGet( Name() + i );

   if( sig == 1 ) Buy[ i ] = True;
   if( sig == -1 ) Sell[ i ] = True;
   if( sig == -2 ) Short[ i ] = True;
   if( sig == 2 ) Cover[ i ] = True;
}

Color = IIf( Buy OR Cover, colorGreen, colorRed );

RedundantBuy = Buy;
RedundantSell = Sell;
RedundantShort = Short;
RedundantCover = Cover;

e = Equity( 1, 0 );

Plot( bh, "Buy-and-Hold", colorBlue );
Plot( e, "Equity", colorRed );

PlotShapes( Buy * shapeUpArrow +
             Sell * shapeDownArrow +
             Short * shapeHollowDownArrow +
             Cover * shapeHollowUpArrow,
             Color, 0, e, -12 );

RedundantBuy = RedundantBuy AND NOT Buy;
RedundantSell = RedundantSell AND NOT Sell;
RedundantShort = RedundantShort AND NOT Short;
RedundantCover = RedundantCover AND NOT Cover;

PlotShapes( RedundantBuy * shapeSmallUpTriangle +
             RedundantSell * shapeSmallDownTriangle +
             RedundantShort * shapeHollowSmallDownTriangle +
             RedundantCover * shapeHollowSmallUpTriangle,
             Color, 0, e, -30 );

GraphXSpace = 10;
_SECTION_END();



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