PureBytes Links
Trading Reference Links
|
Hi MG Ferreira:
DR:=(C/Ref(C,-1)-1)*C;
P1:=DR*((T1>0)-(T1<0));
Sample for P1:
04-27-05 -19.9116
04-28-05 70.1324
04-29-05 -0.4502
05-03-05 14.9729
05-04-05 -51.2578
05-05-05 -117.6266
05-06-05 27.6853
05-09-05 0.0000
05-10-05 66.3936
05-11-05 78.9304
P1 is the penalty function, if I redefine the daily return to be
DR:=(C/Ref(C,-1)-1), then
Sample for P1
04-29-05 -0.0000
05-03-05 0.0011
05-04-05 -0.0037
05-05-05 -0.0084
05-06-05 0.0020
05-09-05 0.0000
05-10-05 0.0047
05-11-05 0.0057
which seem solve fit the range, and the W1 is more stable,
Sample for W1
Loading 2000 days for data, current W1 = 1.156153
Loading 1000 days for data, current W1 = 1.055910
Loading 500 days for data, current W1 = 1.023015
Does it what you expect for the result?
Am I on the right track to solve this problem by redefining the daily
return?
Thank you
Eric :>
--- In equismetastock@xxxxxxxxxxxxxxx, mgf_za_1999 <no_reply@xxxx>
wrote:
> Hi Eric,
>
> Please have a look at P1. Just stop the forumal as soon as P1 has
> been calculated, and plot it, and nothing else. It should be small,
> figures like 0.001 and -0.001 should be typical values, with 0.01
and
> 0.01 large and 0.05 and -0.05 about the max. If this is not the
case,
> but in stead 0.1 and -0.1 are typical, 1 and -1 large and 5 and -5
> about the max, then we have to scale it as well. If this is the
case,
> change the formula to
>
> W1:=If(P1=0,If(PREV=0,1,PREV),SM*PREV+(1-SM)*PREV*(1+PC*P1/100));
>
> Regards
> MG Ferreira
> TsaTsa EOD Programmer and trading model builder
> http://www.ferra4models.com
> http://fun.ferra4models.com
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, chichungchoi <no_reply@xxxx>
wrote:
> > Hi MG Ferreira:
> > I just try it by using 1 instead of 1000, but it does not seem
solve
> > the problem of overflow in Mul() Function. Does it the limitation
for
> > Metastock?
> > Thank you
> > Eric
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, mgf_za_1999
<no_reply@xxxx>
> > wrote:
> > > Hi Eric,
> > >
> > > Let's start with 1 in stead of 1,000 as a first try, so
initialise
> > the
> > > weights
> > >
> > > W1:=1;
> > > W2:=1;
> > >
> > > etc. Then try the following update function
> > >
> > > W1:=If(P1=0,If(PREV=0,1,PREV),SM*PREV+(1-SM)*PREV*(1+PC*P1));
> > >
> > > Note the shift in the bracket, I made a mistake in the first
and
> > there
> > > may still be problems in this one. Could you mail me a plot of
P1
> > > please? I need to inspect them, but I think the problem with
this
> > > version is that it will be a bit slow. This depends on the
size of
> > P1
> > > and PC. Maybe try with a large PC, say 90 or 100. I think if
you
> > > enter 100 for PC then you are using the equity line of the
indicator
> > > as weight, which actually makes a lot of sense. So you can
then
> > think
> > > of W1 as 1 (previously 1,000) that you start to trade with
using
> > only
> > > indicator 1. As profits and losses accumulate in the account,
so
> > the
> > > weight changes. The final, combined system thus is diversified
> > > accross n trading indicators.
> > >
> > > Regards
> > > MG Ferreira
> > > TsaTsa EOD Programmer and trading model builder
> > > http://www.ferra4models.com
> > > http://fun.ferra4models.com
> > >
> > >
> > >
> > > --- In equismetastock@xxxxxxxxxxxxxxx, chichungchoi
<no_reply@xxxx>
> > wrote:
> > > > Hi MG Ferreira:
> > > > I am facing with the problem of "Overflow in Mul() Function".
> > > >
> > > > If overflow occurs in W1 as shown below,
> > > > P1:=DR*((T1>0)-(T1<0));
> > > > W1:=If(P1=0,If(PREV=0,1000,PREV),SM*PREV+(1-SM)*PREV*(1+PC)
*P1);
> > > >
> > > > but the problem disappears in W1 as shown below,
> > > > W1:=If(P1=0,If(PREV=0,1000,PREV),SM*PREV+(1-SM)*PREV);
> > > >
> > > > Do you have any suggestion on how to handle this limitation?
> > > > Thank you
> > > > Eric
> > > >
> > > > --- In equismetastock@xxxxxxxxxxxxxxx, mgf_za_1999
> > <no_reply@xxxx>
> > > > wrote:
> > > > > Hi Eric,
> > > > >
> > > > > At the moment, we are adjusting the weights linearly, by
adding
> > or
> > > > > subtracting an amount each time they work or don't work.
So we
> > > > could
> > > > > go negative. If we adjust them by adding a percentage,
then
> > this
> > > > > should not be a problem. Initially we looked at both
methods
> > and I
> > > > > think I mentioned that the weights may go negative, so we
start
> > with
> > > > > big ones initially. Try the following
> > > > >
> > > > > W1 := PREV*(1+PC*P1);
> > > > > W2 := PREV*(1+PC*P2);
> > > > > W3 := PREV*(1+PC*P2);
> > > > >
> > > > > Also, maybe add this input, together with the other, at the
top:
> > > > >
> > > > > PC:=Input("Penalise % : ",0,100,10)/100;
> > > > > SM:=Input("Smooth % : ",0,100,75)/100;
> > > > >
> > > > > and change the weights to
> > > > >
> > > > > W1 := SM*PREV + (1-SM)*PREV*(1+PC*P1);
> > > > > W2 := SM*PREV + (1-SM)*PREV*(1+PC*P2);
> > > > > W3 := SM*PREV + (1-SM)*PREV*(1+PC*P2);
> > > > >
> > > > > Then enter a highish value (even 99 or 99.9 is fine) for
SM.
> > The
> > > > > higher this value, the more smooth the weights will be.
> > > > >
> > > > > As long as the weights increase, it means they are
working! So
> > it
> > > > is
> > > > > good if they keep on increasing. You can 'reset' them
after
> > each
> > > > > round, since we only use the relative ones. I am not sure
how
> > to do
> > > > > this in one variable in MSFL, but it is easy to do by
> > introducing
> > > > yet
> > > > > another bunch of variables.
> > > > >
> > > > > Right at the end, change to the following
> > > > >
> > > > > WA:=W1+W2+W3;
> > > > > {Standard weights}
> > > > > SW1:=W1/WA;
> > > > > SW2:=W2/WA;
> > > > > SW3:=W3/WA;
> > > > > TA:=SW1*T1+SW2*T2+SW3*T3;
> > > > > TA;
> > > > >
> > > > > Now, SW1 ... SW3 will always be between 0 and 1 and will be
the
> > > > > percentage of the total signal that comes from the relevant
> > > > indicator.
> > > > > Thus it does not matter how big W1 becomes, SW1 will be
> > between 0
> > > > and
> > > > > 1. To make it easier on the plotting, you could change the
> > above to
> > > > >
> > > > > WA:=W1+W2+W3;
> > > > > {Standard weights}
> > > > > SW1:=W1/WA*100;
> > > > > SW2:=W2/WA*100;
> > > > > SW3:=W3/WA*100;
> > > > > TA:=(SW1*T1+SW2*T2+SW3*T3)/100;
> > > > > TA;
> > > > >
> > > > > to get SW1 ... SW3 to be between 0 and 100.
> > > > >
> > > > > Finally, even though SW1 is contained, W1 is not and may
run
> > away.
> > > > > Again, using something else you would at the end of each
loop
> > assign
> > > > > SW1 to W1 but I'm not sure this will work in MSFL. If you
get
> > > > numbers
> > > > > that run away, you will pick it up in WA, and we can fix it
if
> > it
> > > > happens.
> > > > >
> > > > > Regards
> > > > > MG Ferreira
> > > > > TsaTsa EOD Programmer and trading model builder
> > > > > http://www.ferra4models.com
> > > > > http://fun.ferra4models.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --- In equismetastock@xxxxxxxxxxxxxxx, chichungchoi
> > <no_reply@xxxx>
> > > > wrote:
> > > > > > Hi MG Ferreira:
> > > > > > Do you receive my email for the results?
> > > > > > I found the error of the negative value for the weighting
> > factor,
> > > > As
> > > > > > I observe each value under the following
> > > > > > formula
> > > > > >
> > > > > > PC = 0.1
> > > > > > DR:=(C/Ref(C,-1)-1)*C;
> > > > > > P3:=DR*((T3>0)-(T3<0));
> > > > > > W3:=If(P3=0,PREV,W3+(P3*(1+PC)));
> > > > > >
> > > > > > [29 Oct 1997]
> > > > > > W3 = 1669.51
> > > > > >
> > > > > > [30 Oct 1997]
> > > > > > C = 9059.9; REF(C,-1) = 10498.2
> > > > > > DR = -1241.25 [OK]
> > > > > > T3 = -1 [OK]
> > > > > > P3 = 1241.25 [OK]
> > > > > > W3 = 2365.37 [ERROR]
> > > > > >
> > > > > > [31 Oct 1997]
> > > > > > C = 10765.3; REF(C,-1) = 9059.9
> > > > > > DR = 2026.42 [OK]
> > > > > > T3 = -0.54499 [OK]
> > > > > > P3 = -2026.42 [OK]
> > > > > > W3 = -1229.06 [ERROR]
> > > > > >
> > > > > > ----------------------------------------------------------
----
> > ----
> > > > ----
> > > > > >
> > > > > > On the other hands, if changing W3 to PREV, then
> > > > > > PC = 0.1
> > > > > > DR:=(C/Ref(C,-1)-1)*C;
> > > > > > P3:=DR*((T3>0)-(T3<0));
> > > > > > W3:=If(P3=0,PREV,PREV+(P3*(1+PC)));
> > > > > >
> > > > > > [29 Oct 1997]
> > > > > > W3 = 28072.17
> > > > > >
> > > > > > [30 Oct 1997]
> > > > > > C = 9059.9; REF(C,-1) = 10498.2
> > > > > > DR = -1241.25 [OK]
> > > > > > T3 = -1 [OK]
> > > > > > P3 = 1241.25 [OK]
> > > > > > W3 = 29437.54 [OK]
> > > > > >
> > > > > > [31 Oct 1997]
> > > > > > C = 10765.3; REF(C,-1) = 9059.9
> > > > > > DR = 2026.42 [OK]
> > > > > > T3 = -0.54499 [OK]
> > > > > > P3 = -2026.42 [OK]
> > > > > > W3 = 27208.48 [OK]
> > > > > >
> > > > > > The result looks completely different, and it seems to
me, the
> > > > > > weighting factors are growing bigger and bigger. Do you
have
> > any
> > > > idea
> > > > > > on how to handle the weight in a huge amount? since the
> > pently
> > > > > > function will be less effective to affect the weight as
it
> > grows
> > > > > > bigger and bigger. How do I know what the maximum level
of
> > > > weighting
> > > > > > factors will be effective in assigning value for
learning?
> > such as
> > > > > > I don't think the pently function [-2026] will be
effective,
> > if
> > > > the
> > > > > > level of weight is 1,000,000,000.
> > > > > > Do you have any suggestion?
> > > > > > Thank you
> > > > > > Eric :>
------------------------ 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/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|