PureBytes Links
Trading Reference Links
|
Paul,
Based on the information you have supplied, it appears that the
condition being encountered is due to the EntryPrice reference. When
using EntryPrice, it is a good idea to check that you are either in a
position or that the EntryPrice is <> 0. You may want to try using
something like this.
if barssinceentry < stopdays
and entryprice <> 0
and high > (entryprice + ATR_Mult1 * Avgtruerange(ATR)) then
exitshort 10 contracts;
Best of luck,
Sergio Sotolongo
www.TechnicalCentral.com
-----Original Message-----
From: Paul He [mailto:paul.he@xxxxxxxxxxxxx]
Sent: Tuesday, March 18, 2003 1:03 AM
To: 'omega-list@xxxxxxxxxx'
Subject: Trailling stops
Hello all,
Please help me with this stop placement. It works for long trades, when
I merely reversed it for short trades, the stops were exiting at teh
close of evry entrybar, producing zero P/L.I just want to exit at the
entry price plus a multiple of the ATR if the trade is less than a
certain number of days old:
If barrsinceentry <stopdays and high > (entryprice + ATR_Mult1 *
Avgtruerange(ATR))
then exitshort 10 contracts;
stopdays is just an input for the number of days, ATR_Mult1 is just a
certain multiple appplied to the ATR. While ATR in the brackets is just
an input giving the number of days for the Average true Range.
I am very frustrated by this simple piece of programming. I would really
appreciate anyone who is able to shed any light on this.
Cheers
Paul
|