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

Re: Question Re a TS2000i Coding Problem



PureBytes Links

Trading Reference Links

Hello Adrian,

Thursday, May 8, 2003, 4:02:04 AM, you wrote:

AP> Would someone be able to suggest a possible path to take to prevent a
AP> position being re-entered when stopped out via a stop order?  For
AP> example, if a system bought when an oscillator became oversold, and then
AP> was stopped out via a money management stop of some sort.  TS2000i would
AP> automatically re-enter you the next day with the original position.  How
AP> does one prevent this so that another long trade won't occur until a new
AP> short trade has occurred or when the oscillator moves out of oversold
AP> and re-enters oversold again?  I can imagine this is a very typical
AP> problem that comes up in coding. I'm hoping that someone can generously
AP> point me in the right direction :-)

AP> Regards,
AP> Adrian

Use  a  variable OKL for ok to enter a long position and OKS for OK to
enter a short position.
Start with both variables set to 1 .
Then when a long position is taken use the following:
If Marketposition = 1 then begin
OKL = 0;  OKS = 1; End;
Signal to enter a trade long should only enter if OKL = 1.
Then when a short position is entered do the reverse.
This  method  only  works  when positions always reverse from short to
long  and  back.  It  will  not  work  in a system that should allow 2
consecutive entries in the same direction.


-- 
Best regards,
 Roger                            mailto:mailrs@xxxxxxxxxx