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

Re: [amibroker] Re: Using Param() to analyze system price-sensitivity



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Herman vandenBergen" <psytek@xxxx> 
wrote:
> Hello,
> 
> It took TJ's help to get this little gem going, it allows you to 
place your
> cursor anywhere on your chart and modify/vary, using the Param(), 
the price
> bar at that position. This is very useful when evaluating the 
response of
> systems and indicators.
> 
> Note that the modified price is only available to subsequent code 
in the
> same formula. If you want to test a system you need to either paste 
the code
> ahead of your system's code or copy it into an include file. Or, if 
you need
> the change to apply to many formulas, you could use the 
SaveParameter() and
> GetParameter() OSAKA functions I posted some weeks ago to 
accomplish that.
> 
> In system analysis you may find that in some systems a small price 
change of
> a few cents may make the difference between going Short or Long. In
> Indicator analysis you may find that the effect of a price change 
last much
> longer than you thought. For example the code below shows that a 
price
> change may effect the RSI(4) value as far away 20 bars away.
> 
> have fun!
> herman.
> 
> CursorBar   = SelectedValue(BarIndex()) == BarIndex();
> ParamPrice = SelectedValue(Close) * (1 + 0.01 *Param("Close %
> Change",0,-10,10,0.1));
> Close = IIf(CursorBar,ParamPrice,Close);
> Plot(C,"Close",1,64);
> Plot(RSI(4),"RSI(3)",1,1|styleOwnScale,0,500);
> StoRSI4 = (RSI(4)-HHV(RSI(4),4))/(HHV(RSI(4),4)-LLV(RSI(4),4))*100;
> Plot(StoRSI4,"StoRSI4",1,1|styleOwnScale,0,500);
> for(n=0;n<=100;n=n+10) Plot
(n,"",0,1|styleOwnScale|styleNoLabel,0,500);
> GraphXSpace = 50;

Herman,
The RSI uses EMA.
[see varPER.txt in the Files section]
Due to the recursive EMA character, a step change of C needs 
[theoretically] infinite number of bars to be absorbed. 
[see http://www.amibroker.com/library/detail.php?id=116 ]
In practical use you see a finite number of bars because of the 2-
digit accuracy of your results.
If RSI was using MA, then the adaption time would be finite.
Try to change by 20% a Close value 50 bars ago for MA

R1=MA(C,4);Plot(R1,"R1",1,1);
L1=LastValue(Cum(1)); D=50;
Ic=C;
percentage=20/100;
C[L1-D]=(1+percentage)*Ic[L1-D];
R2=MA(C,4);
Plot(R2,"R2",4,1);
The distortion will disappear in 4 bars, no matter if you use 
percentage 20% or 50% or 100%.
If you try now

R1=EMA(C,4);Plot(R1,"R1",1,1);
L1=LastValue(Cum(1)); D=50;
Ic=C;
percentage=20/100;
C[L1-D]=(1+percentage)*Ic[L1-D];
R2=EMA(C,4);
Plot(R2,"R2",4,1);
the distortion will have much longer impact and it changes as you 
change the percentage.
Dimitris Tsokakis




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/