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

Re: Stop trading for the day: function?



PureBytes Links

Trading Reference Links

When your system signals to take a trade, also set a variable that will be a
flag to some value to know that it is true (like FLAG = 1or FLAG = TRUE).

Also at the top of your code where you decide to take a code or even at the top
of your system, you would check to see two things. If both are true then don't
do the logic to see if a trade should be taken.  The two things are 1. if FLAG
is TRUE and if the date of the current bar = to the date of the prior bar.
There is also an else part of the logic which turns the flag off. That needs to
execute on the first bar of the session.

IF Sess1FirstBarTime = Time the FLAG = FALSE;
{execute this at the top of the system to see if it is the first bar of the day
and turn the flag off to be able to take a trade.


IF (FLAG = FALSE) OR (DATE <> DATE(1) ) THEN BEGIN
....
logic to take a trade
.....
FLAG = TRUE;   {set flag on when you take a trade}
END


Hope this helps.

John

Simon Campbell wrote:

> I'm writing some code to trade once only (1 contract only) a daytrade
> system.
>
> I can't figure out how to tell TS to NOT accept any further trades once the
> first trade of the day, has been closed out.
> I've tried messing with entrydate, barssinceexit, marketposition ..all to
> no avail.
>
> Can someone suggest the right code for ignoring all trades once the first
> trade of the day, has been closed out?
>
> Simon.