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

Re: TS4 vs TS6



PureBytes Links

Trading Reference Links

This is the exact code regarding   "At$"   copied directly from the Help
Index in TS6:

"At$ (Reserved Word)
Used in trading strategies to anchor exit prices to the bar where the entry
order was placed. At$ must be used in conjunction with an entry order that
has an assigned label.
Example
The following order buys when the 10-bar moving average crosses over the
20-bar moving average, placing a stop loss order 1 point under the Low of
the bar where the cross over occurred by appending At$ to the Sell
statement.

If Average(Close, 10) Crosses Over Average(Close, 20) then
 Buy ("MA Cross Over") next bar at market;
Sell from entry ("MA Cross Over") At$ Low - 1 point stop;"
_______________________________________________________

Here is my code, nothing complicated as you can see.
Copy and Paste into any new Strategy, call it "New Strategy" and Press F3.
Why do I get an error message on the Sell (Exiting the Long position) order
when the wording appears to match that of the Reserved Word example?
What is happening that I keep missing?
Thanks in advance,

HTP

Inputs: BZone(70.0), SZone(30.0), Factor(.5), MML(5), MMS(5);

Vars: MP(0);
Value1 = StochasticKSlow;
MP = MarketPosition(0);

IF CurrentBar > 1 then begin
 IF Time > 830 and Time <= 1500 then begin
{***LONG ENTRY***}
  IF Value1 > BZone then begin
   BUY ("LngEntry") Next Bar at HIGH + Factor Stop;
  END;
{***LONG EXIT***}
  IF MP = 1 then begin
   Sell from Entry ("LngEntry") At$ Low - MML points stop;
  END;
{***SHORT ENTRY***}
  IF Value1 < SZone then begin
   SELL SHORT ("ShtEntry") Next Bar at LOW - Factor Stop;
  END;
{***SHORT EXIT***}
  IF MP = -1 then  begin
   Buy to cover from Entry ("ShtEntry") Next Bar at$ High + MMS points stop;
  END;
 END;
END;




----- Original Message -----
From: "Bob & Florence" <70733.3133@xxxxxxxxxxxxxx>
To: <fritz@xxxxxxxx>
Cc: "H Travis Putney" <tputney@xxxxxxxxxxxxx>
Sent: Monday, May 06, 2002 5:52 PM
Subject: Re: TS4 vs TS6


> The "Set xxx" reserved words will sell on the same bar -- such as
> SetProfitTarget and SetStopLoss, etc.
>
> At 5/6/2002 05:44 PM, Gary Fritz wrote:
> > > I learned to use "at$ Low", to pinpoint the Entry Bar.
> > > But TS6 forces me to include the words "Next Bar" instead of with
> > > TS4 you could just say, "Sell from Entry ("LngEntry") at$ Low - MML
> > > stop;"
> > > Of course, TS6 executes the trade on the "Next Bar" just like
> > > instructed.
> > > Which is exactly what I DON'T want.
> >
> >I don't know why TS6 requires the "Next Bar" syntax when TS4/TS2k
> >didn't.
> >
> >But that doesn't change the behavior.  Stop/limit orders have ALWAYS
> >executed on the next bar.  The "next bar" syntax was just syntactic
> >sugar to make the statement look pretty -- it didn't actually change
> >the statement semantics.
> >
> >If you were trying to get the orders to happen in THIS bar, then you
> >have a problem.  TS doesn't do that, and never has.  System code
> >executes on the CLOSE of the bar.  It's too late to do anything in
> >the current bar, except buy/sell at the close.  Stops and limits
> >apply to the NEXT bar only.
> >
> >Gary
>
>