PDA

View Full Version : Trade Signal Sequence


sectorbets
3rd December 2003, 02:15 PM
Hi David--

I'm having trouble implementing the concept of forcing trades to alternate between long and short after being stopped out.

For example, if I am long and get stopped out before receiving a new signal to go short, I want the trading system to wait until there is a new short signal. I have been using the following code (on the Long side, and comparble code on the Short side) in MetaStock for years, but it doesn't seem to work within the confines of TradeSim:

(LongSignal
AND
BarsSince(Ref(ShortSignal,-1))<BarsSince(Ref(LongSignal,-1)))

Any ideas woudl be appreciated.

Best wishes,
Rick

sectorbets
3rd December 2003, 07:27 PM
I think I solved my own problem--I needed to define LongSignal as well as ShortSignal before I used them in this construct.

All is well.