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

Re: [amibroker] Geom.profit



PureBytes Links

Trading Reference Links


Dimitris,
 
Thank you very much for your great help and sorry 
for not having answered before, I was out for some days.
I must admit that the formulations given by the 
author are not very clear and I have some messages exchanged with 
him.
 
The idea of the compound return is the 
following:
The idea is to state that the 
traditional equity curve does not give a real picture of the situation 
since for example a return of $10 on a stock which value is $100 and the same 
$10 return one year later when the stock value is $130 or $70 is not good 
picture. Percentage give a more interesting one.
To calculate the geometric return from twotrades, 
one winner of 10% and one loser of -10%, divide your percentage values with100 
so that 10 becomes 0.10 and -10 becomes -0.10, Now add these values to 1 (see 
the first formula you asked about), so that 0.10 becomes 1.10 and -0.10 becomes 
0.90 (1 + (-0.10)). Multiply these two values for your compounded geometric 
return, which then equals 0.99. To calculate the combined percentage return, do 
the same step as above, but backwards, so that 0.99 becomes -0.01 (0.99 - 
1), and -0.01 becomes -1% (-0.01 * 100). 
Thus, provided that you use all your available 
capital for both your trades, a 10% winner followed by a 10% loser (or vice 
versa) will make you lose 1% of your original available capital in the end. 

 
I will post here the complete script when 
finished.
 
One more question concerning your 
script.
is the jscript portion calculated for eachbar or 
only at the end when the AFL script is ended ?
If yes I'm afraid that the running time will much 
longer !
Bernard Bourée<A 
href="">bernard@xxxx
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Dimitris 
Tsokakis 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, August 16, 2001 8:46 
AM
Subject: [amibroker] Geom.profit

Bernard,
I do not know the use of this Geometric 
profit(call it gp),
but if you suppose 
for example that 
1. you buy when stochd() crosses 30<FONT 
face=Arial size=2> ascending 
2. you sell when stochd() crosses 70 
descending
3. you remove all excess signals
4. you initialize gp==1
then the following gives you the graph of this 
gp,
calculated on close basis (you buy and sell at 
close)
 
<FONT face=Arial 
size=2>s0=cross(stochd(),30);s1=cross(70,stochd());g0=exrem(s0,s1);g1=exrem(s1,s0);buyp=valuewhen(g0==1,c,1);sellp=valuewhen(g1==1,c,1);prr=iif(g1==1,sellp/buyp,1);pr=iif(isempty(prr),1,prr);EnableScript("jscript");<%pr 
= VBArray( AFL( "pr" ) ).toArray();gp=new 
Array();gp[0]=1;for(i=1;i<pr.length;i++){gp[i]=gp[i-1]*pr[i];}AFL.Var("gp") 
=gp ;%>graph0=gp;
 
The scan for buy-sell arrows was
<FONT face=Arial 
size=2>s0=cross(stochd(),30);s1=cross(70,stochd());g0=exrem(s0,s1);g1=exrem(s1,s0);buy=g0;sell=g1;
 
and the functions to test each step I did 
are
 
<FONT face=Arial 
size=2>maxgraph=8;s0=cross(stochd(),30);s1=cross(70,stochd());g0=exrem(s0,s1);g1=exrem(s1,s0);buyp=valuewhen(g0==1,c/5,1);sellp=valuewhen(g1==1,c/5,1);prr=iif(g1==1,sellp/buyp,1);pr=iif(isempty(prr),1,prr);graph0=0.5*g0;graph1=0.5*g1;graph2=buyp;graph2style=1;graph3=sellp;graph4=pr;graph4barcolor=2;
 
graphed at "pi" graph.
 
Now, what is the use of this "gp". ?
What does the author says?
Thank you for the exercise.
 
Dimitris Tsokakis
 
 Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.