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

RE: Setting stops in TS2K?



PureBytes Links

Trading Reference Links

Cash,

You can write the whole thing in your EasyLanguage code, and at the
end just build a strategy using the Entries and Exits from that code.
That way you can keep your variables working.  Write this as part of
your current signal or as a separate one that you add in when you
build the strategy:


> For example, I want to set my trailing stop based on a few things:
> Once I'm in a position, I want to initially set my trailing
> stop = (10%
> of the 20 day average true range) + .25.
> Then, for every .25 profit, I want to increment my trailing stop by
> .05.


{Cash's Variable Stop ****************

	created 8/12/2001***************}

Vars: Incr(0),StartPoint(Close);

Incr=IntPortion(OpenPositionProfit*4);
StartPoint=0.10*AvgTrueRange(20)+0.25;

{Long Stop}
If MarketPosition > 0 AND Close < Close[1]-(StartPoint + 0.05*Incr)
then ExitLong at Close;

{Short Stop}
If MarketPosition < 0 AND Close > Close[1]+(StartPoint + 0.05*Incr)
then ExitShort at Close;

SetExitOnClose;

{***************************************}

Do check the logic on this; I'm not sure from where you want your
trailing stop to operate--I've assumed the prior bar's close.  Also
you said the ATR for 20 days--I assumed you meant bars.  Anyway, this
should give you the gist of how to set it up.

================
Dave Nadeau
Fort Collins, CO






> So what I have is an initial stop and then as the position builds
> profit, I want to give it more room to breathe.
> Then I want to check on the last bar of the day if I'm still in the
> position, I won't use the stop, I'll just exit at the close.
>
> The thing I can't figure out is that if I use the signals
> in the strategy
> builder, how do I keep adjusting the stop based on my current
> position's profit?  The only way I can see doing this is by
> incorporating it in my main signal.  Either that, or I don't have a
> good grasp on the strategy builder.
>
> OK, now just a stream of conciousnous thought.
> I build a signal called EnterPosition which eventually gets me in a
> position
> I also build a signal called set trailing stop.  This
> signal looks at my
> current position, the 20 day ATR, the entry price of my current
> position, and the profit of my current position.  It then
> enters a stop
> for the appropriate amount.
>
> Cash