PureBytes Links
Trading Reference Links
|
Hi everybody.
I have recently begun my first attempts coding
(still working through the formula book) and I would like some
help.
I have written a simple indicator that gives me +1
or -1 to go long or short. On the basis of this I have developed a system that
has me open long or short according to the indicator signal (therefore, always
in the market).
I am now attempting to add stops. Now the two
questions:
1. I have been exploring various formulas for
stops, and one which I have found and like is the Trailing Stop by Andrzej
Herman - here's the formula
strata:=10;
If(
C=PREV,
PREV,
If(
((Ref(C,-1)<PREV)AND
(C<PREV)),
Min(PREV,C*(1+strata/100)),
If(
(Ref(C,-1)>PREV) AND
(C>PREV),
Max(PREV,C*(1-strata/100)),
If(
C>PREV,
C*(1-strata/100),
C*(1+strata/100)
)
)
) )
I have visually inspected with various stocks and
like it, but I don't quite understand the formula, as the "strata" command is
unknown to me - can someone explain it?
(and yes, I have looked in the manual without
finding a reference for it :-)
2. I would like to insert in the system an exit
condition, whereby the position is ended when both Trailing Stop
(above) and SAR are hit, so for example for close long I have
(SAR( 0.020,0.2 ) AND Fml( "Trailing
Stop")> L)
problem is, generally the system is still giving
the original signal and therefore it enters the market again in the previous
direction the following day.
What I would like to do, instead, is that once both
stops are hit (on the same day) and the system closes the position, it will wait
for the next enter signal of the opposite direction. To repeat it with different
words, what I<SPAN lang=EN-GB
> want
to try and do is let the system enter into a position once and
<SPAN lang=EN-GB
>if
it gets stopped out, it wont enter another position until it
<SPAN lang=EN-GB
>gets
<SPAN lang=EN-GB
>a
signal to enter a trade going the opposite direction.
<SPAN lang=EN-GB
>
<SPAN lang=EN-GB
>I
hope this is clear.
<SPAN lang=EN-GB
>
<SPAN lang=EN-GB
>I
appreciate any help on this all,
<SPAN lang=EN-GB
>
<SPAN lang=EN-GB
>
<SPAN lang=EN-GB
>Daniele
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|