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

Re: Coding Okay for a Short Position



PureBytes Links

Trading Reference Links

At 3:44 PM -0800 11/19/01, Mike Kittelson wrote:

>If  (prevtrade=-1) and  XMa(c,25)[1] >  XMa(close,25)
>then CanShort=false; {THIS IS THE PART I CAN'T GET TO
>WORK.  What I want is: If  the last trade was a Short
>trade and exited and the XMa went down on all bars
>since the Exit, then the trade can be triggered. If,
>however, the XMA goes up on any bar since the exit,
>the set up is cancelled and no trade can be taken}

You might look at the MRO function. It finds how far back something
was last true. If you look for the thing that you don't want to find
and it doesn't occur in the interval you test, then it didn't occur.
Something like the following should do it. Check the exact behavior
of the MRO function to see if the limits are correct for what you
want.


XAve = XAverage(Close, 25);
BSE = BarsSinceExit(1);
If prevtrade = -1 and  MRO(XAve > XAve[1], BSE, 1) = -1
   then CanShort = TRUE
   else CanShort = FALSE;

Bob Fulks