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

Re: Sell next bar at SellPrice limit ;



PureBytes Links

Trading Reference Links

Couple of comments:

The way an order works in TS is like this.  Your statement should read:

if sellcondition then sell sellprice limit;

This will place an order for the next bar.  You will need to have this
statement recurring or it will be cancelled after the next bar.

Here is a sample:

var: SellAlert(FALSE),SellCondition(FALSE);

if x > y then SellCondition = TRUE;    {Initial sell flag}

if SellCondition then SellAlert = TRUE;    {Flag to activate limit order}
if SellAlert then sell sellprice limit;          {Limit order}
if marketposition = -1 then SellAlert = FALSE;    {Once filled, cancels limit
order}

Hope this helps!

JB



Peter Gibson wrote:

> I am entering the following kind of code:
>
> If SellCondition then Sell next bar at SellPrice  limit ;
>
> Can someone clarify exactly how the above order works?  My assumption was
> that it was a limit order which would only be executed on the next bar.
> What appears to be happening is that order is entered on the next bar but
> remains outstanding until a different sell order is entered.  If I want to
> have a sell order in effect on the next bar and cancel the order if not
> executed - how do I do that?