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

[EquisMetaStock Group] RE:help with stop formula



PureBytes Links

Trading Reference Links

------------------------------------------------------------------------
You cannot reply to this message via email because you have chosen not
to disclose your email address to the group.

To reply:  http://groups.yahoo.com/group/equismetastock/post?act=reply&messageNum=6020
------------------------------------------------------------------------

Daniele,

1. "strata" is a custom variable name. It's not a command. You could use any
other name in its place as long as you change all its instances, too. The
formula's result will not change.
The := sign is an assignment. The left part of an assignment holds the
variable's name, which can be almost anything.

2. You re-enter the market because of your binary indicator. If the entry
condition is still valid after the stop, it will give a new entry signal. In
fact, this is the case with your binary indicator: Suppose that +1 is to
last for 10 bars.
If 3 bars after the entry your stop condition is met, then you will have a
temporary exit signal and on the next bar you will get a new enter long
signal (+1) because your binary indicator still reads +1.
The solution would be to make a ternary indicator +1 (long signal on a
single bar) -1(short signal on a single bar) 0(no signal all the other
time). For example instead of long:= c>mov(c,10,s) you could use
cross(c,mov(c,10,s)). This produces only one +1 and then drops to zero.
In this case you would enter on bar #1, then you would exit on stop 3 bars
later and you would not be bothered with +1s again until you encounter
the -1 signal 7 days later.
You could also create a separate "position" formula.

{**** myposition ****}

EnterLongCondition:= blah ;
EnterShortCondition := blah blah;
StopCondition:= blah blah blah;
myPosition:= if(EnterLongCondition,1,
                          if(EnterShortCondition,-1,
		 if(StopCondition,0,
             PREV)));
MyPosition
{********************)

I hope this helps
Spyros

_______________________________
Message: 18
   Date: Sun, 12 Jan 2003 11:14:51 +0100
   From: "Flash Gordon" <daniele.bevilacqua@xxxxxxxxxxxxx>
Subject: help with stop formula

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 want to try and do is let the system enter into a position once and
if it gets stopped out, it wont enter another position until it gets a
signal to enter a trade going the opposite direction.

I hope this is clear.

I appreciate any help on this all,


Daniele


[This message contained attachments]



________________________________________________________________________
________________________________________________________________________



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





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/