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

Re: coding a stop



PureBytes Links

Trading Reference Links

Phillip,
After reading Robert Bianchi's post I see what your after.
This will only set the stop level if the NewStop is higher than the old
StopLevel value.
Thanks to Robert for his input and code, which I've just tacked onto.

Regards,
Bruce

==============================================
Input: FxdAmnt(2),Muddy(1);
Vars: NewStop(0),StopLevel(0);

{Determine if StopLevel should be raised to new stop level}
If Marketposition=1 then begin
If (Close-Open)>FxdAmnt then NewStop = Low-Muddy;
If NewStop > StopLevel then StopLevel = NewStop;
end;

{Set the below stop only if StopLevel has been set to above zero}
If StopLevel > 0 then begin
ExitLong at StopLevel Stop;
end;

{Reset StopLevel back to zero when you have no position in the market}
If Marketposition=0 then StopLevel =0;

=================================
Hi Phil,
I hope I have figured out what you are trying to do. It is quite simple.
To recap, the following TS code will do as follows:-
* Determine if you are long
*  If the close > the open by a fixed amount then run the stop
* The long exit stop is to get out at Low-0.1
* Your problem is that your stop works only on the first bar and then it
becomes invalid. To solve this, you need a "switch" that stays on until you
are stopped out.

Phil, you definition of "0.1" is as muddy as a blues vinyl LP. Phil, what I
have done is set the "0.1" as an input so that you can change it if you
want:

Inputs:FixedAmount(2),Muddy(0.1);

Var:Switch(0);

{Determine that you are long}
If Marketposition=1 then begin
{Determine if C-O>"Fixed Amount")
If (Close-Open)>FixedAmount then Switch=1;
end;

{Set the below stop only if the switch is set to 1}
If Switch=1 then begin
ExitLong at Low-Muddy Stop;
end;

{Reset switch back to zero when you have no position in the market}
If Marketposition=0 then Switch=0;

HTH,

Best Regards,

Robert Bianchi
r.bianchi@xxxxxxxxx


> ----- Original Message -----
> From: "Philip Arnstein" <shraga@xxxxxxxxxxxx>
> To: <omega-list@xxxxxxxxxx>
> Sent: Friday, May 11, 2001 4:46 AM
> Subject: coding a stop
>
>
> > Hi all,
> >
> > I`m trying to create a stop where if I`m long, and this bar`s close is >
> > "amount" than open (meaning it`s an up bar) then a stop should be placed
> > 0.1 under the low. The problem is, that it on works for the next bar,
> > but if the next bar is not > "amount" (and therefore the stop will not
> > move to under its low) and then the NEXT bar will go lower than the low
> > of two bars ago - 0.1, the stop won`t work...
> > Here`s the code so far:
> >
> > var: stoppl(0);
> > input: num(2);
> > stoppl=low of this bar-0.1;
> > if   close-open > num  then exitlong at stoppl stop;
> >
> > Any help would be greatly appreciated!
> > Philip
> >
>