PureBytes Links
Trading Reference Links
|
I do not know, I am not familiar with wealth lab..
----- Original Message -----
Sent: Saturday, March 12, 2005 5:05
PM
Subject: [amibroker] Re: OT: convert
Wealth lab fromula to Amibroker
Anthony,
Does WL support array math or is
everything discreet values? After looking at the source again, It looks
like discreet values... This definately changes
things...
walt
--- In amibroker@xxxxxxxxxxxxxxx,
"Anthony Faragasso" <ajf1111@x...>
wrote: > Walt, > > Thank you, I will take a look at
it....please keep me informed.. > > Anthony >
----- Original Message ----- > From: hairy_mug
> To: amibroker@xxxxxxxxxxxxxxx > Sent:
Saturday, March 12, 2005 4:34 PM > Subject: [amibroker] Re:
OT: convert Wealth lab fromula to Amibroker > > >
> Anthony, > > I took a stab at
conversion... since I know nothing about wealth lab > I
made some deductions... > > It runs, but never exits
the first position... take it as a > starting point... I'll
let U know if it get further... > > Walt >
> /*********************************/ >
> // in AA settings set buy, sell, short, cover to "open"
with 1 day > delay > // set "reverse
signal forces exit" > // also set your stop prefs for the
following two statements: > /* Install AutoStops
*/ > /*InstallStopLoss( 12 ) */ > >
threshold=2; > PtsPctATR=2; /*0=Points, 1=Precent,
2=ATR*/ > tradetrends=1; /*0=trends and reactions, 1=trends
only*/ > inBuy=0; >
outSell=0; > outCover=0; >
inShort=0; > Buy=0; >
Sell=0; > Cover=0; > Short=0; >
> /*State == 0 Uptrend */ > /*State == 1
Dntrend */ > /*State == 2 NatRally*/ >
/*State == 3 SecRally*/ > /*State == 4
NatReact*/ > /*State == 5 SecReact*/ > >
> > > if (PtsPctATR == 0) >
{ >
Thresh=threshold; >
HalfThresh=thresh/2; > } > for (Bar=1 ;
bar<=21;bar++) >
{ > if (Bar ==
1) >
{ >
"Init"; >
SecondaryRally=C; >
NaturalRally=C; >
UpTrend=C; >
SecondaryReaction=C; >
NaturalReaction=C; >
DnTrend=C; >
ResumeUpTrend=False; >
ResumeDnTrend=False; >
UseRule10=False; /*if true try/test futures
only*/ >
} > if (Bar <=
21) > {
/*1*/ >
MA10_Now=MA(Close, 10
); >
MA10_10=MA( Ref(Close, -10 ), 10 ); > >
>
if (Bar ==
21) >
{
/*2*/
>
if
(LastValue(MA10_Now>MA10_10)) >
{ >
"InUpTrend"; >
State=0; >
UpTrend=C; >
} >
else >
{ >
"InDnTrend"; >
DnTrend=C; >
State=1; >
} >
} /*2*/ > }
/*1*/ > } > > /*Main
Loop*/ > for (Bar=22;bar>0; bar--) > {
/*3*/ > > if
(PtsPctATR == 1) >
{ >
Thresh=threshold *
(Ref(C,-1)/100); >
HalfThresh=Thresh/2; >
} > else if (PtsPctATR
== 2) >
{ >
Thresh=threshold *
ATR(14); >
HalfThresh=Thresh/2; >
//"ATR thresh " +
NumToStr(Thresh); >
//"State " +
NumToStr(State); >
//"Price " +
NumToStr(C); >
//"Nat Reaction " +
NumToStr(NaturalReaction); >
} > > if
(state==0) > /* If
InUpTrend */ > {
/*4*/ >
if (LastValue(C > NaturalReaction +
Thresh)) >
NaturalReactionRL=NaturalReaction; /*Rule
4b*/ >
//"InUpTrend"; >
>
if (ResumeUpTrend) /* Rule 10 logic.
*/ >
{
/*6*/ >
if (LastValue(C > UpTrendRL +
HalfThresh)) >
{ >
ResumeUpTrend=False; /*Rule
10a*/ >
State=4;
/*InNatReact*/ >
NaturalReaction=C; >
UpTrend=C; >
} >
else if (LastValue(C < UpTrendRL - >
HalfThresh)) >
{ >
ResumeUpTrend=False; /*Rule
10b*/ >
State=4;
/*InNatReact*/ >
NaturalReaction=C; >
} >
}
/*6*/ >
else if (LastValue(C < UpTrend - Thresh))
/*start >
NaturalReaction*/ >
{ /*Rules 4a,
6a*/ >
State=4;
/*InNatReact*/ >
UpTrendRL=UpTrEnd ;/*pivot point, rule
8*/ >
NaturalReaction=C; >
ResumeUpTrend=False; >
} >
else if (LastValue(C > UpTrend)) /*remain in uptrend
> higher high
price*/ >
UpTrend=C; > } /*4
InUpTrend*/ > if
(state==2) > /*Natural
Rally State*/ > {
/*7*/ >
>
if (LastValue(C > NaturalReaction +
thresh)) >
NaturalReactionRL=NaturalReaction; /*Rule
4b*/ >
if (LastValue(C > UpTrend)) /*resume
UpTrend*/ >
{ /*rules 6d,
6f*/ >
State=0;
/*InUpTrend*/ >
//" Set to
InUpTrend"; >
UpTrend=C; >
if (UseRule10)
ResumeUpTrend=True; >
} >
else if (LastValue(C > NaturalRallyBL +
HalfThresh)) >
{ /*Rules
5a*/ >
//"Set to
InUpTrend"; >
State=0;
/*InUpTrend*/ >
UpTrend=C; >
if (UseRule10)
ResumeUpTrend=True; >
} >
else if (LastValue(C < DnTrend)) /*Start
DnTrend*/ >
{ /*Rule
6b*/ >
//"InNatRally start
dntrend"; >
State=1;
/*InDnTrend*/ >
DnTrend=C; >
NaturalRallyBL=C; /*rule
4D*/ >
} >
else if (LastValue(C < NaturalRally -
Thresh)) >
{ >
if (LastValue(C < NaturalReaction)) /*start >
Natural
Reaction*/ >
{ /*rule 4d,
6b*/ >
State=4;
/*InNatReact*/ >
//"InNatRally start nat
reaction"; >
NaturalReaction=C; >
NaturalRallyBL=C; /*rule 4D*/ /*Pivot >
pt, >
Rule
9b*/ >
} >
else /*start
secondaryreaction*/ >
{ /*rule
6h*/ >
//"InNatRally start sec
reaction"; >
State=5;
/*InSecReact*/ >
SecondaryReaction=C; >
} >
if (LastValue(C >
NaturalRally)) >
NaturalRally=C; >
//" none of the
above"; >
} > } /*7
InNatRally*/ > if
(state==3) /* Secondary Rally
State*/ >
{ >
if (LastValue(C >
UpTrend)) >
{ /*rules 6d,
6f*/ >
//"InSecRally"; >
State=0;
/*InUpTrend*/ >
UpTrend=C; >
if (UseRule10)
ResumeUpTrend=True; >
} >
else if (LastValue(C > NaturalRallyBL +
halfthresh)) >
{ /*rules
5a*/ >
State=0;
/*InUpTrend*/ >
UpTrend=C; >
if (UseRule10)
ResumeUpTrend=True; >
} >
else if (LastValue(C >
NaturalRally)) >
{ /*rule
6g*/ >
State=2;
/*InNatRally*/ >
NaturalRally=C; >
} >
else if (LastValue(C < DnTrend)) /*start
DnTrend*/ >
{ /*rule
6b*/ >
State=1;
/*InDnTrend*/ >
DnTrend=C; >
NaturalRallyBL=C; /*rule 4d, pivot
pt, >
rule
9b*/ >
} >
else if (LastValue(C > SecondaryRally))
/*record >
higher
high*/ >
SecondaryRally=C; /*rule 3,
6g*/ > }
/*InSecRally*/ > /* DOWN
TREND STATE*/ > if
(state==1) > {
/*9*/ >
>
if (LastValue(C < NaturalRally -
Thresh)) >
NaturalRallyBL=NaturalRally; /*rule
4d*/ >
if (ResumeDnTrend) /*Rule 10 logic best works with >
futures*/ >
{ >
if (LastValue(C < DnTrendBL -
HalfThresh)) >
{ >
ResumeDnTrend=False; /*rule
10a*/ >
DnTrend=C; /*rule 2,
6b*/ >
} >
else if (LastValue(C > DnTrendBL + >
HalfThresh)) >
/*DnTrend
Over*/ >
/*return to
NaturalRally*/ >
{ >
//"return to
NaturalRally"; >
ResumeDnTrend=False; >
State=2;
/*InNatRally*/ >
NaturalRally=C; >
} >
} >
else if (LastValue(C > DnTrend +
Thresh)) >
/*Start
NaturalRally*/ >
{ /* rules 4c,
6c*/ >
//"return to
NaturalRally"; >
State=2;
/*InNatRally*/ >
NaturalRally=C; >
DnTrendBL=DnTrend; /*Pivot Pt, Rule
8*/ >
ResumeDnTrend=False; >
} >
else if (LastValue(C < DnTrend)) /*remain in
down >
trend, record lower
lows*/ >
DnTrend=C; /*Rule 2,
6b*/ > } /*9
InDnTrend*/ > if
(state==4) > /* Natural
Reaction State */ > {
/*Nat Reaction
State*/ >
if (LastValue(C < NaturalRally -
Thresh)) >
NaturalRallyBL=NaturalRally; /*Rule
4d*/ >
if (LastValue(C < DnTrend)) /*resume
DnTrend*/ >
{ /*Rule 6b,
6e*/ >
//"InNatReact -
InDnTrend1"; >
State=1;
/*InDnTrend*/ >
DnTrend=C; >
if (UseRule10)
ResumeDnTrend=True; >
} >
else if (LastValue(C < NaturalReactionRL - > halfthresh
)) >
/*resume
DnTrend*/ >
{ /*rules
5b*/ >
//"InNatReact -
InDnTrend2"; >
State=1;
/*InDnTrend*/ >
DnTrend=C; >
if (UseRule10)
ResumeDnTrend=True; >
} >
else if (LastValue(C > UpTrend))
/*start >
UpTrend*/ >
{ /*rule
6d*/ >
//"InNatReact -
InUpTrend1"; >
State=0;
/*InUpTrend*/ >
UpTrend=C; >
NaturalReactionRL=C; /*rule 4b,
pvt >
point, rule
9c*/ >
} >
else if (LastValue(C > NaturalReaction +
Thresh)) >
{ >
if (LastValue(C > NaturalRally)) /*start > Natural
Rally*/ >
{ /*rules 4b,
6d*/ >
State=2; /*In Nat
Rally*/ >
NaturalRally=C; >
NaturalReactionRL=C; /*rule 4b, pvt > point, rule
9c*/ >
} >
else /*start
SecondaryRally*/ >
{ /*rule
6g*/ >
State=3; /*In Sec
Rally*/ >
SecondaryRally=C; >
} >
} >
else if
(LastValue(C<NaturalReaction)) >
/*remain in NaturalReaction , record lower
lows*/ >
NaturalReaction=C; /*rule 3,
6a,6b*/ > }
/*InNatReact*/ > if
(state==5) >
{ >
//"InSecReact"; >
if (LastValue(C<DnTrend)) /*resume
DnTrend*/ >
{ /*rules 6b,
6e*/ >
State=1;
/*InDnTrend*/ >
DnTrend=C; >
if (UseRule10)
ResumeDnTrend=True; >
} >
else if (LastValue(C<NaturalReactionRL -
halfthresh)) >
{ /*rules
5b*/ >
State=1;
/*InDnTrend*/ >
DnTrend=C; >
if (UseRule10)
ResumeDnTrend=True; >
} >
else if (LastValue(C > UpTrend))
/*start >
UpTrend*/ >
{ /*rules
6d*/ >
State=0;
/*InUpTrend*/ >
UpTrend=C; >
NaturalReactionRL=C; /*rule 4b,pivot point, > rule
9c*/ >
} >
else if
(LastValue(C<NaturalReaction)) >
{ /*rules
6h*/ >
State=4;
/*InNatReact*/ >
NaturalReaction=C; >
} >
else if
(LastValue(C<SecondaryReaction)) >
/*record lower
lows*/ >
SecondaryReaction=C; /*rule
6h*/ > }
/*InSecReact*/ >
else >
{ >
//"Never get here! "; >
} > } > /* Paint it */ >
> //if (state==0) >
//{ > // SetBarColor( Bar,
colorBlue ); > //} > //if
(state==1) > //{ >
// SetBarColor( Bar, colorRed ); /*Down
Trend*/ > //} > //if
(state==2) > //{ >
// SetBarColor( Bar, colorBlack
); > //} > //if
(state==3) > //{ >
// SetBarColor( Bar, colorGreen
); > //} > //if
(state==4) > //{ >
// SetBarColor( Bar, colorYellow
); > //} > //if
(state==5) > //{ >
// SetBarColor( Bar, colorpurple
); > //} > //else >
//"!important to show! "; > //} > > >
> if (tradetrends) >
{ > inbuy=(State == 0); > inShort=(State
== 1); >
} > else > { >
inbuy=(State == 0) OR (State == 2) OR (State == 3); >
inShort=(State == 1) OR (State == 4) OR (State == 5); >
} > > Buy=ExRem(inbuy,outsell); >
Sell=ExRem(outsell,inbuy); >
Short=ExRem(inshort,outcover); >
Cover=ExRem(outcover,inshort); > > > >
--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxxx>
> wrote: > > Thank you, I await the
re-run... > > > >
Anthony > > ----- Original Message -----
> > From: duke.jones >
> To: amibroker@xxxxxxxxxxxxxxx >
> Sent: Saturday, March 12, 2005 8:37 PM >
> Subject: Re: [amibroker] Re: OT: convert Wealth lab fromula
to > Amibroker > >
> > > > Anthony,
scratch that second run as it is not exiting properly. I
> need to rework the stop loss. > >
> > -------Original
Message------- > > > From: "duke.jones"
<Duke.Jones@xxxx> > > > Subject: Re:
[amibroker] Re: OT: convert Wealth lab fromula to >
Amibroker > > > Sent: 12 Mar 2005
12:25:42 > > > >
> > Anthony, > >
> > > > Here is the rerun
using the installstops of 10%. The formula >
needs to have the positions rewritten to remove the shorts but there
> is no need as WL already gives you the long only and
short only > position metrics. I have included some
graphs of the plots with > various chart type formations,
big winners, trading range etc so you > can see how it
worked. I also ran this on a list of High RS stocks >
and High EPS ranked stocks and it does very well catching big moves.
> The risk is these induce higher drawdowns when
market corrects but > the outperformance makes it
something to explore in my book. I think > this
might be a good exercise for me to try and convert but it will
> have to go on the back burner as I am already way behind
in my other > conversions. >
> > > > >
Duke Jones, CMT > > >
-------Original Message------- > > >
> From: "Anthony Faragasso" > > >
> Subject: Re: [amibroker] Re: OT: convert Wealth lab fromula
> to Amibroker > >
> > Sent: 12 Mar 2005 19:51:43 >
> > > > >
> > Duke, > > >
> > > > > Thank you for
running the formula....would you be so kind > as to run
the formula for Long only....or does the formula have to be
> edited ? .... > >
> > > > > >
Also, you mention stops....is the maximum stop loss on >
initial purchase set to 10 % ?....if not could you set it to 10
%... > > >
> > > > > Is there any
provision in the formula to plot something on > a chart
? ...if there is could you attach a chart ?.... >
> > > > >
> > Thank you > >
> > Anthony > > >
> > > > > Ps. I
appreciate your time....thank you very much. >
> > > > >
> > ----- Original Message ----- >
> > > FROM:
duke.jones > > > > TO:
amibroker@xxxxxxxxxxxxxxx > > >
> SENT: Saturday, March 12, 2005 7:20
PM > > > > SUBJECT: Re:
[amibroker] Re: OT: convert Wealth lab >
fromula to Amibroker > > >
> > > > > Anthony, I
don't know if I am at the stage of being able >
to convert it to AFL yet but here is what it looks like with 5%
> equity initial positions and the defined
stops in the code. > > >
> > > > > The list is a
random sampling of securities between lg >
cap small cap etc. The data runs from 01 to Nov
04. > > > > >
> > > Regards, >
> > > > >
> > Duke Jones, CMT > >
> > -------Original
Message------- > > > > >
From: "Anthony Faragasso" > > >
> > Subject: Re: [amibroker] Re: OT: convert Wealth
lab > fromula to Amibroker >
> > > > Sent: 12 Mar 2005
18:49:40 > > > >
> > > > > >
Hello Jim, > > > >
> > > > > > It
is not a joke, I am not familiar with Wealth lab
> coding.... > >
> > > > > >
> > This formula is supposed to represent Jesse
Livermore's > trading rules /
style.... > > > >
> > > > > > I
was / am interested in testing it... >
> > > > >
> > > > Thanks >
> > > >
Anthony > > > >
> > > > > >
----- Original Message ----- > >
> > > FROM: jnk1997 >
> > > > TO:
amibroker@xxxxxxxxxxxxxxx > > >
> > SENT: Saturday, March 12, 2005
1:30 PM > > > >
> SUBJECT: [amibroker] Re: OT: convert Wealth
lab > fromula to Amibroker >
> > > > >
> > > > Anthony, >
> > > > >
> > > > That looks like a lot
of work (or is it a joke?). >
> > > > Anyway's perhaps
someone would be willing if you > published the
WL > > > > >
stats, like win rate etc..... > >
> > > If somone does, please post
it here. > >
> > > > > >
> > Regards > > >
> > Jim > > >
> > > > > >
> --- In amibroker@xxxxxxxxxxxxxxx, "Anthony
Faragasso" > > > >
> wrote: > > > >
> > Anyone able to convert this wealth lab
formula to > Amibroker
? > > > >
> > > > >
> > > Thank you > >
> > > > Anthony >
> > > > > var
Bar : integer; > >
> > > > var SecondaryRally,
NaturalRally, > SecondaryReaction,
DnTrend : > > >
> > float; > > >
> > > var ResumeUpTrend,
ResumeDnTrend, UseRule10 : >
boolean; > > > > >
> var Thresh , threshold, >
HalfThresh ,NaturalReaction, > >
> > > NaturalRallyBL,
NaturalReactionRL, UpTrendRL, >
UpTrend, DnTrendBL
: > > > > >
float; > > > > >
> var MA10_10, MA10_Now , State,
> ATRvalue
: integer; > >
> > > > var PtsPctATR,
tradetrends : integer; >
> > > > > { Install
AutoStops } > > >
> > > {InstallStopLoss( 12 );
} > > > >
> > threshold := 2; >
> > > > >
PtsPctATR := 2; {0=Points,
1=Precent, > 2=ATR} >
> > > > >
tradetrends := 1; {0=trends and reactions,
> 1=trends
only} > > > > >
> {State = 0 Uptrend
} > > > > >
> {State = 1 Dntrend
} > > > > >
> {State = 2
NatRally} > > > >
> > {State = 3
SecRally} > > > >
> > {State = 4
NatReact} > > > >
> > {State = 5
SecReact} > > > >
> > if (PtsPctATR = 0)
then > > > > >
> begin > > >
> >
> Thresh :=
threshold; > > > >
> > HalfThresh
:= thresh/2; > > >
> > >
end; > > > > >
> for Bar := 1 to 21 do >
> > > > >
begin > > > > >
> if (Bar = 1) then >
> > > > >
begin > > > >
>
>
AddCommentary('Init'); > > >
> > >
SecondaryRally := PriceClose(bar); >
> > > >
> NaturalRally :=
PriceClose(bar); > > > >
> > UpTrend
:= PriceClose(bar); > >
> > >
> SecondaryReaction
:= PriceClose(bar); >
> > > >
> NaturalReaction :=
PriceClose(bar); > > > >
> > DnTrend
:= PriceClose(bar); >
> > > >
> ResumeUpTrend :=
false; > > > >
> > ResumeDnTrend
:= false; > >
> > > > UseRule10
:= false; {if true try/test futures
> only} > > >
> > >
end; > > > > >
> if (Bar begin
{1} > > > >
> > MA10_Now :=
SMASeries( #Close, 10 ); > >
> > > >
MA10_10 := SMASeries( OffSetSeries( #Close,
- > 10 ), 10 ); > >
> > > > > >
> > > > >
> > > > > if
(Bar = 21) then > >
> > > > begin
{2} > > > >
> > > > >
> > > if @MA10_Now[Bar]
> @MA10_10[Bar] then >
> > > >
> begin >
> > > >
>
AddCommentary('InUpTrend'); > > >
> > >
State := 0; > > >
> > >
UpTrend := PriceClose(bar); >
> > > >
>
end > > > > >
>
else > > > > >
>
begin > > > > >
>
AddCommentary('InDnTrend'); > > >
> >
> DnTrend :=
PriceClose(bar);; > > > >
> >
State := 1; > > >
> > >
end; > > > > >
> end {2} >
> > > >
> end; {1} > >
> > > >
end; > > > > >
> > > > > >
> {Main Loop} > >
> > > > for Bar := 22 to
BarCount - 1 do > >
> > > > begin
{3} > > > > >
> > > > >
> > if (PtsPctATR = 1)
then > > > >
> >
begin > > > >
> > Thresh := threshold
* (PriceClose(bar- >
1)/100); > > > > >
> HalfThresh :=
Thresh/2; > > > >
> > end >
> > > > > else
if (PtsPctATR = 2) then >
> > > >
> begin > >
> > >
> Thresh := threshold *
ATR(Bar, 14); > >
> > > >
HalfThresh := Thresh/2; >
> > > >
> AddCommentary('ATR thresh '
+ FloatToStr > (Thresh)); >
> > > >
> AddCommentary('State
' + IntToStr (State)); >
> > > >
> AddCommentary('Price '
+ FloatToStr >
(PriceClose(bar))); > > > >
> >
AddCommentary('Nat Reaction ' +
FloatToStr > (NaturalReaction)); >
> > > >
> end; > >
> > > > case
State of > > >
> > >
0: > > > > >
> { If InUpTrend
then} > > > >
> >
begin {4} > > >
> >
> if (PriceClose(bar)
> (NaturalReaction + >
Thresh)) then > > >
> >
>
NaturalReactionRL := NaturalReaction; >
{Rule 4b} > > >
> >
>
AddCommentary('InUpTrend'); > > >
> > > > > >
> >
>
if ResumeUpTrend then { Rule 10 >
logic. } > > >
> >
>
begin {6} > > >
> >
>
if (PriceClose(bar) > (UpTrendRL + >
HalfThresh)) then > >
> > >
>
begin > > > >
>
>
ResumeUpTrend := false; {Rule >
10a} > > > >
>
>
State := 4; {InNatReact} > >
> > >
>
NaturalReaction := PriceClose >
(bar); > > > >
>
>
UpTrend := PriceClose(bar); > >
> > >
>
end > > > >
>
>
else if (PriceClose(bar) < > (UpTrendRL -
HalfThresh)) > > > >
> then > > >
> >
>
begin > > > >
>
>
ResumeUpTrend := false; > {Rule
10b} > > > >
>
>
State := 4; {InNatReact} > >
> > >
>
NaturalReaction := PriceClose >
(bar); > > > >
>
>
end; > > > >
>
>
end {6} > > > >
>
>
else if (PriceClose(bar) < (UpTrend - > Thresh))
then > > > >
> {start NaturalReaction} >
> > > >
>
begin {Rules 4a, 6a} > >
> > >
>
State := 4; {InNatReact} > >
> > >
>
UpTrendRL := UpTrend; {pivot > point,
rule 8} > > > >
>
>
NaturalReaction := PriceClose >
(bar); > > > >
>
>
ResumeUpTrend := false; > >
> > >
>
end > > > >
>
>
else if (PriceClose(bar) > UpTrend) > then {remain
in > > > > >
uptrend higher high price} >
> > > >
>
UpTrend := PriceClose(bar); > >
> > >
>
end; {4 InUpTrend} >
> > > >
>
2: > > > >
> > {Natural
Rally State} > >
> > >
>
begin {7} > >
> > > > > >
> > >
>
if (PriceClose(bar) > > (NaturalReaction +
thresh)) then > >
> > >
>
NaturalReactionRL := > NaturalReaction; {Rule
4b} > > > >
>
>
if (PriceClose(bar) > UpTrend) then >
{resume UpTrend} > >
> > >
>
begin {rules 6d, 6f} > >
> > >
>
State := 0; {InUpTrend} > >
> > >
>
AddCommentary(' Set to >
InUpTrend'); > > > >
>
>
UpTrend := PriceClose(bar); > >
> > >
>
if UseRule10 then > ResumeUpTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose(bar) > > (NaturalRallyBL
+ > > > >
> HalfThresh)) then >
> > > >
>
begin {Rules 5a} > > >
> >
>
AddCommentary('Set to >
InUpTrend'); > > > >
>
>
State := 0; {InUpTrend} > >
> > >
>
UpTrend := PriceClose (bar); >
> > > >
>
if UseRule10 then > ResumeUpTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose(bar) < > DnTrend) then
{Start > > > >
> DnTrend} > >
> > >
>
begin {Rule 6b} > > >
> >
>
AddCommentary('InNatRally > start
dntrend'); > > > >
>
>
State := 1; {InDnTrend} > >
> > >
>
DnTrend := PriceClose (bar); >
> > > >
>
NaturalRallyBL := PriceClose > (bar); {rule
4D} > > > >
>
>
end > > > >
>
>
else if (PriceClose(bar) < > (NaturalRally -
Thresh)) > > > >
> then > > >
> >
>
begin > > > >
>
>
if (PriceClose(bar) < > NaturalReaction)
then > > > > >
{start Natural Reaction} >
> > > >
>
begin {rule 4d, 6b} > >
> > >
>
State := 4; {InNatReact} > >
> > >
>
AddCommentary ('InNatRally > start
nat > > > > >
reaction'); > > > >
>
>
NaturalReaction := >
PriceClose(bar); > > > >
>
>
NaturalRallyBL := > PriceClose(bar); {rule
4D} > > > > >
{Pivot pt, Rule 9b} >
> > > >
>
end > > > >
>
>
else {start >
secondaryreaction} > > > >
>
>
begin {rule 6h} > >
> > >
>
AddCommentary ('InNatRally > start
sec > > > > >
reaction'); > > > >
>
>
State := 5; {InSecReact} > >
> > >
>
SecondaryReaction := >
PriceClose(bar); > > > >
>
>
end; > > > >
>
>
if (PriceClose(bar) > > NaturalRally)
then > > > >
>
>
NaturalRally := >
PriceClose(bar); > > > >
>
>
AddCommentary(' none of the >
above'); > > > >
>
>
end; > > > >
>
>
end; {7 InNatRally} > >
> > >
>
3: { Secondary Rally State} >
> > > >
>
begin > > > >
>
>
if (PriceClose(bar) > > UpTrend)
then > > > >
>
>
begin {rules 6d, 6f} > >
> > >
>
AddCommentary > ('InSecRally'); >
> > > >
>
State := 0; {InUpTrend} > >
> > >
>
UpTrend := PriceClose >
(bar); > > > >
>
>
if UseRule10 then > ResumeUpTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose (bar) > > (NaturalRallyBL
+ > > > >
> halfthresh)) then >
> > > >
>
begin {rules 5a} > > >
> >
>
State := 0; {InUpTrend} > >
> > >
>
UpTrend := PriceClose >
(bar); > > > >
>
>
if UseRule10 then > ResumeUpTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose (bar) > >
NaturalRally) then >
> > > >
>
begin {rule 6g} > > >
> >
>
State := 2; > {InNatRally} >
> > > >
>
NaturalRally := >
PriceClose(bar); > > > >
>
>
end > > > >
>
>
else if (PriceClose (bar) > < DnTrend)
then > > > > >
{start DnTrend} > >
> > >
>
begin {rule 6b} > > >
> >
>
State := 1; > {InDnTrend} >
> > > >
>
DnTrend := PriceClose >
(bar); > > > >
>
>
NaturalRallyBL := > PriceClose(bar);
{rule > > > > >
4d, pivot pt, rule 9b} >
> > > >
>
end > > > >
>
>
else if (PriceClose (bar) > >
SecondaryRally) > > > >
> then {record higher
high} > > > >
>
>
SecondaryRally := > PriceClose(bar);
{rule > > > > >
3, 6g} > > >
> >
>
end; {InSecRally} > > >
> >
>
{ DOWN TREND STATE} > >
> > >
>
1: > > > >
>
>
begin {9} > > > >
> > > > > >
>
>
if (PriceClose(bar) < > (NaturalRally -
Thresh)) > > > >
> then > > >
> >
>
NaturalRallyBL := > NaturalRally; {rule
4d} > > > >
>
>
if ResumeDnTrend then {Rule 10 > logic best
works > > > > >
with futures} > >
> > >
>
begin > > > >
>
>
if (PriceClose(bar) < > (DnTrendBL - >
> > > >
HalfThresh)) then > >
> > >
>
begin > > > >
>
>
ResumeDnTrend := false; > {rule
10a} > > > >
>
>
DnTrend := PriceClose > (bar); {rule
2, 6b} > > > >
>
>
end > > > >
>
>
else if (PriceClose (bar) > > (DnTrendBL
+ > > > > >
HalfThresh)) then {DnTrend Over} >
> > > >
>
{return to NaturalRally} > >
> > >
>
begin > > > >
>
>
AddCommentary ('return > to
NaturalRally'); > > > >
>
>
ResumeDnTrend := false; > >
> > >
>
State := 2; > {InNatRally} >
> > > >
>
NaturalRally := >
PriceClose(bar); > > > >
>
>
end; > > > >
>
>
end > > > >
>
>
else if (PriceClose (bar) > > (DnTrend
+ > > > > >
Thresh)) then {Start
NaturalRally} > > > >
>
>
begin { rules 4c, 6c} >
> > > >
>
AddCommentary ('return > to
NaturalRally'); > > > >
>
>
State := 2; > {InNatRally} >
> > > >
>
NaturalRally := >
PriceClose(bar); > > > >
>
>
DnTrendBL := DnTrend; > {Pivot Pt, Rule
8} > > > >
>
>
ResumeDnTrend := false; > >
> > >
>
end > > > >
>
>
else if (PriceClose (bar) > < DnTrend)
then > > > > >
{remain in down trend, record lower
lows} > > > >
>
>
DnTrend := PriceClose > (bar); {Rule 2,
6b} > > > >
>
>
end; {9 InDnTrend} > >
> > >
>
4: > > > >
>
>
{ Natural Reaction State } >
> > > >
>
begin {Nat Reaction State} >
> > > >
>
if (PriceClose(bar) < > (NaturalRally
- > > > > >
Thresh)) then > >
> > >
>
NaturalRallyBL := > NaturalRally; {Rule
4d} > > > >
>
>
if (PriceClose(bar) < > DnTrend) then
{resume > > > >
> DnTrend} > >
> > >
>
begin {Rule 6b, 6e} > >
> > >
>
AddCommentary > ('InNatReact -
InDnTrend1'); > > > >
>
>
State := 1; > {InDnTrend} >
> > > >
>
DnTrend := PriceClose >
(bar); > > > >
>
>
if UseRule10 then > ResumeDnTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose (bar) > < >
> > > > (NaturalReactionRL -
halfthresh )) then >
> > > >
>
{resume DnTrend} > > >
> >
>
begin {rules 5b} > > >
> >
>
AddCommentary > ('InNatReact -
InDnTrend2'); > > > >
>
>
State := 1; > {InDnTrend} >
> > > >
>
DnTrend := >
PriceClose(bar); > > > >
>
>
if UseRule10 then > ResumeDnTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose > (bar) > UpTrend)
then > > > >
> {start UpTrend} >
> > > >
>
begin {rule 6d} > > >
> >
>
AddCommentary > ('InNatReact -
InUpTrend1'); > > > >
>
>
State := 0; > {InUpTrend} >
> > > >
>
UpTrend := >
PriceClose(bar); > > > >
>
>
NaturalReactionRL := >
PriceClose(bar); > > > >
> {rule 4b, pvt point, rule
9c} > > > >
>
>
end > > > >
>
>
else if (PriceClose > (bar) > >
> > > > NaturalReaction
+ Thresh) then > >
> > >
>
begin > > > >
>
>
if (PriceClose > (bar) >
NaturalRally) > > > >
> then {start Natural
Rally} > > > >
>
>
begin {rules > 4b, 6d} >
> > > >
>
State := 2; {In > Nat
Rally} > > > >
>
>
> NaturalRally :=
PriceClose(bar); > > > >
>
>
> NaturalReactionRL := PriceClose >
> > > > (bar); {rule 4b, pvt
point, rule 9c} > >
> > >
>
end > > > >
>
>
else {start >
SecondaryRally} > > > >
>
>
begin {rule > 6g} >
> > > >
>
State := 3; > {In Sec
Rally} > > > >
>
>
> SecondaryRally :=
PriceClose(bar); > > > >
>
>
end; > > > >
>
>
end > > > >
>
>
else if (PriceClose > (bar) < >
> > > > NaturalReaction) then
{remain in NaturalReaction , >
record lower lows} > > >
> >
>
NaturalReaction := >
PriceClose(bar); > > > >
> {rule 3, 6a, 6b} >
> > > >
>
end; {InNatReact} > > >
> >
>
5: > > > >
>
>
begin > > > >
>
>
AddCommentary > ('InSecReact'); >
> > > >
>
if (PriceClose(bar) < > DnTrend)
then > > > > >
{resume DnTrend} > >
> > >
>
begin {rules 6b, 6e} > >
> > >
>
State := 1; > {InDnTrend} >
> > > >
>
DnTrend := >
PriceClose(bar); > > > >
>
>
if UseRule10 then > ResumeDnTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose > (bar) < >
> > > > (NaturalReactionRL
- halfthresh)) then >
> > > >
>
begin {rules 5b} > > >
> >
>
State := 1; > {InDnTrend} >
> > > >
>
DnTrend := >
PriceClose(bar); > > > >
>
>
if UseRule10 then > ResumeDnTrend :=
true; > > > >
>
>
end > > > >
>
>
else if (PriceClose > (bar) > UpTrend)
then > > > > >
{start UpTrend} > >
> > >
>
begin {rules 6d} > >
> > >
>
State := 0; > {InUpTrend} >
> > > >
>
UpTrend := >
PriceClose(bar); > > > >
>
>
> NaturalReactionRL := PriceClose(bar); >
> > > > {rule 4b, pivot
point, rule 9c} > >
> > >
>
end > > > >
>
>
else if (PriceClose > (bar) < >
> > > >
NaturalReaction) then >
> > > >
>
begin {rules 6h} > >
> > >
>
State := 4; > {InNatReact} >
> > > >
>
> NaturalReaction :=
PriceClose(bar); > > > >
>
>
end > > > >
>
>
else if (PriceClose > (bar) < >
> > > > SecondaryReaction) then
{record lower lows} >
> > > >
>
> SecondaryReaction := PriceClose >
> > > > (bar);
{rule 6h} > >
> > >
>
end; {InSecReact} > > >
> >
>
else > > > >
>
>
begin > > > >
>
>
AddCommentary('Never get > here!
'); > > > >
>
>
end; > > > >
>
>
end; > > > > >
> { Paint it } > > >
> > > case
State of > > >
> > >
0: > > > >
> >
begin > > > >
> > SetBarColor(
Bar, #blue ); > >
> > > >
end; > > > >
> >
1: > > > >
> >
begin > > > >
> > SetBarColor(
Bar, #Red ); {Down
Trend} > > > >
> >
end; > > > >
> > 2: >
> > > >
> begin >
> > > >
> SetBarColor( Bar,
#Black ); > >
> > > >
end; > > > >
> >
3: > > > >
> >
begin > > > >
> > SetBarColor(
Bar, #Green ); > >
> > > >
end; > > > >
> >
4: > > > >
> >
begin > > > >
> > SetBarColor(
Bar, #yellow ); > >
> > > >
end; > > > >
> >
5: > > > >
> >
begin > > > >
> > SetBarColor(
Bar, #purple ); > >
> > > >
end > > > >
> >
else > > > >
> >
AddCommentary('not important to show!
'); > > > > >
> end; > > >
> > > if (tradetrends = 1)
then > > > > >
> { Trend Rules } > >
> > > >
begin > > > >
> > if (State = 0)
then {uptrend} >
> > > >
>
begin > > > > >
> if (not
lastpositionactive()) then > >
> > >
>
begin > > > >
>
>
buyAtMarket( Bar+1, 'LE'); > >
> > >
>
end; > > > > >
> if
positionshort(lastposition) then >
> > > >
>
coverAtMarket( > Bar+1,LastPosition,
'SXL'); > > > >
> >
end; > > > > >
> > > > >
> > if (State = 1)
then {downtrend} >
> > > >
>
begin > > > > >
> if (not
lastpositionactive()) then > >
> > >
>
begin > > > >
>
>
shortAtMarket( Bar+1, 'SE'); > >
> > >
>
end; > > > > >
> if
positionlong(lastposition) then >
> > > >
>
SellAtMarket( Bar+1, > Lastposition,
'LXS'); > > > >
> >
end; > > > > >
> > > > >
> > end >
> > > > >
else > > > >
> > { Trend plus Rules = trade trends,
rallies, > reactions} >
> > > > >
begin > > > >
> > if ((State = 0) or (State
= 2) or (State = > 3))
then > > > >
> >
begin > > > >
> > if
(not lastpositionactive())
then > > > >
>
>
begin > > > >
>
>
buyAtMarket( Bar+1, 'LE'); > >
> > >
>
end; > > > > >
> if
positionshort(lastposition) then >
> > > >
>
coverAtMarket( > Bar+1,LastPosition,
'SXL'); > > > >
> >
end; > > > > >
> > > > >
> > if ((State = 1) or (State
= 4) or (State = > 5))
then > > > >
> >
begin > > > >
> > if
(not lastpositionactive())
then > > > >
>
>
begin > > > >
>
>
shortAtMarket( Bar+1, 'SE'); > >
> > >
>
end; > > > > >
> if
positionlong(lastposition) then >
> > > >
>
SellAtMarket( Bar+1, > Lastposition,
'LXS'); > > > >
> >
end; > > > >
> > end; >
> > > > > >
> > > > >
end; > > > > >
> > > > > >
> > > > > >
> No virus found in this outgoing message. >
> > > > > Checked by
AVG Anti-Virus. > > >
> > > Version: 7.0.308 / Virus Database: 266.7.2
- > Release Date:
3/11/2005 > > > >
> > > > > >
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 >
> > > > >
> > > >
------------------------- > > >
> > > > > >
> No virus found in this incoming
message. > > > > >
Checked by AVG Anti-Virus. >
> > > > Version: 7.0.308 / Virus
Database: 266.7.2 - Release >
Date: 3/11/2005 > > >
> > > > > >
> 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
SPONSOR > > > >
> > > > >
> ADVERTISEMENT > >
> > > > > >
> >
------------------------- > > >
> > 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 the Yahoo! > Terms of
Service. > > > >
> > > > >
> ------------------------- >
> > > > No virus found in this
outgoing message. > > >
> > Checked by AVG Anti-Virus. >
> > > > Version: 7.0.308
/ Virus Database: 266.7.2 - Release > Date:
3/11/2005 > > > >
-------Original Message------- >
> > > > >
> > 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 >
> > > > >
> > ------------------------- >
> > > > >
> > No virus found in this incoming
message. > > > > Checked by
AVG Anti-Virus. > > >
> Version: 7.0.308 / Virus Database: 266.7.2 - Release
> Date: 3/11/2005 >
> > > > >
> > 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 SPONSOR >
> > > > >
> > ADVERTISEMENT > >
> > > > > >
------------------------- > > >
> 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 the Yahoo!
Terms of > Service. >
> > > > >
> > ------------------------- >
> > > No virus found in this outgoing
message. > > > > Checked by
AVG Anti-Virus. > > > >
Version: 7.0.308 / Virus Database: 266.7.2 - Release Date:
> 3/11/2005 > > >
-------Original Message------- > > >
> > > 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 SPONSOR > > >
> > >
ADVERTISEMENT > > >
> > >
------------------------- > > >
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 the Yahoo! Terms of
> Service. > >
-------Original Message------- > > >
> > > 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 Sponsor >
>
ADVERTISEMENT >
>
> >
> >
> > > > > >
---------------------------------------------------------------- ---- >
---------- > > 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. > >
> > > > > >
> >
---------------------------------------------------------------- ---- >
---------- > > > >
> > No virus found in this incoming
message. > > Checked by AVG
Anti-Virus. > > Version: 7.0.308 / Virus
Database: 266.7.2 - Release Date: >
3/11/2005 > > > > No virus found in
this outgoing message. > > Checked by AVG
Anti-Virus. > > Version: 7.0.308 / Virus Database:
266.7.2 - Release Date: 3/11/2005 > > > >
> > 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 Sponsor
>
ADVERTISEMENT >
>
> > > >
-------------------------------------------------------------------- ---------- >
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. > > > > >
-------------------------------------------------------------------- ---------- >
> > No virus found in this incoming
message. > Checked by AVG Anti-Virus. >
Version: 7.0.308 / Virus Database: 266.7.2 - Release Date:
3/11/2005 > > No virus found in this outgoing
message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus
Database: 266.7.2 - Release Date:
3/11/2005
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
No virus found in this incoming message. Checked by AVG
Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.2 - Release Date:
3/11/2005
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 Sponsor |
ADVERTISEMENT
| |
|
Yahoo! Groups Links
|
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.2 - Release Date: 3/11/2005
|