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

[amibroker] Re: Referencing Equity



PureBytes Links

Trading Reference Links


Oh, by the way.  I have been testing the Volume Flow Indicator
Performance found in the members section of the S & C's.  Forgot which
month but it seems to have respectable results.  I was applying the
equity curve filter to the system.  I would appreciate any feedback on
that.  I applied the code to the portfolio's equity curve code.  I
tested on the entire Dow Jones securities list.  For ease I will just
post the entire code to overwrite the existing portfolio equity.

//Begin

eq = Foreign("~~~EQUITY", "C");
cash = Foreign("~~~EQUITY", "L");
dr = eq - Highest(eq);
bslh = HighestBars(eq);
GraphZOrder=1;
Plot(eq, "Portfolio Equity", colorLightBlue, styleArea );
if( ParamToggle("Show Cash", "No|Yes", 1 ) ) Plot(cash, "Cash",
colorGreen, styleArea );
if( ParamToggle("Show Drawdown", "No|Yes", 1 ) ) Plot(dr, "Drawdown",
colorDarkRed, styleArea );
if( ParamToggle("Show #bars since last high", "No|Yes", 0 ) )
Plot(bslh, "#bars since last high", colorDarkYellow, styleLine |
styleOwnScale, 0, 10 * LastValue( Highest( bslh ) )  );
islastbar = Status("lastbarintest");
isfirstbar = Status("firstbarintest");
bar = BarIndex();
firstbar = LastValue( ValueWhen( isfirstbar, bar ) );
lastbar = LastValue( ValueWhen( islastbar, bar ) );
al = LastValue( ValueWhen( islastbar, LinRegSlope( eq, Lastbar -
firstbar + 1 ) ) );
bl = LastValue( ValueWhen( islastbar, LinRegIntercept( eq, Lastbar -
firstbar + 1 ) ) );
Lr = al * ( BarIndex() - firstbar ) + bl;
Lr = IIf( bar >= firstbar AND bar <= lastbar , Lr, Null );
if( ParamToggle("Show lin. reg.", "No|Yes", 0 ) )Plot( Lr , "Linear
Reg", colorRed, styleThick );

_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 10, 200, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color",
colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

perc = Param("percent",.05,.05,.2,.05);

pds=Param("pds",50,10,100,10);
DonchianUpper = HHV(Ref(eq,-1),pds);
DonchianLower = LLV(Ref(eq,-1),pds);
DonchianMiddle = (DonchianUpper+DonchianLower)/2;

Plot(donchianmiddle,"donchian",colorBlue,styleLine);

Buy = eq > MA(P,Periods) AND MA(P,Periods) > donchianmiddle OR eq >
MA(P,Periods) AND eq > donchianmiddle;
Sell = MA(P,Periods) - eq > eq * perc;

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

//buy and sell
PlotShapes(IIf(Buy,shapeUpArrow,0),colorBlue, layer = 0);
PlotShapes(IIf(Sell,shapeHollowDownArrow,0),colorYellow, layer = 0);

PlotForeign("$DJII","Dow Jones Industrial",styleCandle|styleOwnScale);

//End

David

--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
<psytek@xxxx> wrote:
> I am afraid this may not work with the portfolio tester... however the
> portfolio tester creates a composite 'stock' named ~~~Equity, its
OHLC price
> arrays are used and can be retrieved as follows:
> 
> PortEquity=Foreign("~~~EQUITY", "C");
> cash = Foreign("~~~EQUITY", "L");
> LongEquity=Foreign("~~~EQUITY", "O");
> ShortEquity=Foreign("~~~EQUITY", "H")
> 
> You could first run your Portfolio tester and then subsequently run
another
> (a non-portfolio, else you would have to copy the ~~~Equity first
since it
> would overwrite it) system that accesses the ~~~Equity. Kind of
breaking up
> the process into two parts.
> good luck,
> 
> herman.
> 
> 
> 
>  -----Original Message-----
> From: David [mailto:junk@x...]
> Sent: Friday, April 08, 2005 7:32 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Referencing Equity
> 
> 
> 
> 
>   Thanks Herman.  You got me set in the right direction.  I previously
>   tried placing a new signal set after the intermediate equity, as you
>   term it.  But the results did not change.  I tried it again but only
>   backtesting on one security and this time it did actually exit at the
>   right price.  However, on a basket of securities the results weren't
>   correct.  I think I'm accessing inidividual equity curve with equity()
>   instead of the portfolio equity curve.  I looked in the help manual
>   but couldn't find the expression used to get portfolio equity?
> 
>   David
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
>   <psytek@xxxx> wrote:
>   > You can define one set of signals that are used to calculate the
>   equity()
>   > and then define s second set of signals that may be partially based
>   on the
>   > equity derived from the first set of signals. You must be sure
that the
>   > equity is based on preceeding events, so that you don't look ahead.
>   >
>   > Signal set 1
>   > intermediate equity()
>   > signal set 2
>   > final equity
>   >
>   > best regards,
>   > herman
>   >   -----Original Message-----
>   >   From: David [mailto:junk@x...]
>   >   Sent: Friday, April 08, 2005 3:55 PM
>   >   To: amibroker@xxxxxxxxxxxxxxx
>   >   Subject: [amibroker] Referencing Equity
>   >
>   >
>   >
>   >   Okay, thought I would ask this a different way.  The equity()
function
>   >   is an array that stores the equity curve for your systems buy,
sell
>   >   signals, etc.  So equity() must be listed after the BUY and SELL
>   >   variables.  But how would you reference the equity() function to
>   >   influence the BUY and SELL signals if everything listed after the
>   >   equity() function call is ignored?  Such as a simple example like:
>   >
>   >   Buy = IIf(Month() == 1 AND DayOfWeek() == 1 AND Day() < 10 AND
Year()
>   >   == 1995,1,0);
>   >   Sell = E > 100000;
>   >   E = Equity(1);
>   >
>   >   This would just buy on the first week of the first month of
the year
>   >   1995.  But to sell when your equity balance reaches $100,000 would
>   >   reference the uninitialized E variable.
>   >
>   >   Sorry if this is a stupid question but I just bought Amibroker
and my
>   >   knowledge is still limited.  I would appreciate any help.
>   >
>   >   David
>   >
>   >
>   >
>   >
>   >
>   >   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
>   >
>   >     a.. To visit your group on the web, go to:
>   >     http://groups.yahoo.com/group/amibroker/
>   >
>   >     b.. To unsubscribe from this group, send an email to:
>   >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>   >
>   >     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>   Service.
> 
> 
> 
> 
> 
>   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
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
> 
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/