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

[amibroker] B&H Equity != RSI Equity. But why?



PureBytes Links

Trading Reference Links

Can somebody perhaps explain to me why the code below produces a 
different value for the Buy&Hold Equity than the Equity of the 
example-RSI strategy, as soon as I change the commission-setting to 
>0?

Basically, and viewed in a graph, if I set the left-side of a range 
at an RSI-buy signal (="firstvisiblebar"), set View to "Range", I get 
the same value for both the B&H as well as the RSI-equity IF 
commissions = 0. However, if I then increase the commission to, say, 
1% it creates different values for both equities. But both strategies 
have to pay the same amount of commission at that 1st signal, which 
triggers a Buy for both strategies, shouldn't they? Why the 
divergence, with all settings the same?

I'm probably overlooking something very basic, but would appreciate 
some help.

Thanks,

PS


CritRSI=Param("CritRSI",30,5,50,0.05);

FirstVisBar=Status("firstvisiblebarindex");

StartDate=LastValue(ValueWhen(BarIndex()==FirstVisBar,DateNum()));
Enddate=LastValue(DateNum());

EqType=Param("EqType",0,0,1);

StartCap=1000000;

SetOption("InitialEquity",StartCap);

Buy = (DateNum()==StartDate)
//Status("barvisible") 
AND C > 0; Sell = Short = Cover = 0;

AllSigs=ParamToggle("AllSigs","Yes|No");

if (AllSigs==1)
{
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
}

EqBuyHold = Equity(EqType,3,Startdate,Enddate);

BuyC=RSI()<CritRSI; 

SellC=RSI()>100-CritRSI;

ShortC=CoverC=0;

Buy=BuyC; Sell = SellC;
Short = ShortC; Cover =CoverC;

if (AllSigs==1)
{
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
}

EqLine=Equity(EqType,3,Startdate,Enddate);

BHPerf=(EqBuyHold/StartCap-1)*100;
PFPerf=(EqLine/StartCap-1)*100;
RelPerf=PFPerf-BHPerf;
Plot(EqBuyHold,"Buy&Hold",colorGreen,1);
Plot(EqLine,"PF Value",colorRed,1);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorDarkGreen);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorLightOrange);
PlotShapes(IIf(Short,shapeDownArrow,shapeNone),colorRed);
PlotShapes(IIf(Cover,shapeUpArrow,shapeNone),colorLime);
Title="{{VALUES}} \n"+"Perf (%) B&H: "+NumToStr(BHPerf,8.3)+"\nPerf 
(%) Strategy: "+NumToStr(PFPerf,8.3)+"\nRelPerf (%) 
Strategy: "+NumToStr(RelPerf,8.3);






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/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/