I used DarthSidious original code, and modified to fit TS8.
Might also be interesting to note that a basic stop-loss of say 3pts enhances the results and caps the risk (per trade)...trailing stop not as useful. True, since the system inherently brackets the price range, a stop loss is built in, BUT those days when the market trades above the initial stop-entry point, you could have a larger gap down to your exit...
let's see if it stops working in 2005....
Might also be interesting to note that a basic stop-loss of say 3pts enhances the results and caps the risk (per trade)...trailing stop not as useful. True, since the system inherently brackets the price range, a stop loss is built in, BUT those days when the market trades above the initial stop-entry point, you could have a larger gap down to your exit...
let's see if it stops working in 2005....
Code:
{********************************************************************************
* Tested working with ts2000i. Modified for use with TS8
* Use on 1 min bars (Not necessary - I just coded this on 1 min bar
* Source credits: DarthSidious
********************************************************************************}
input:
{All times in CST}
ETime(1300),
CtxToTrade(1),
MaxEntriesInADay(1), LastEntryTime(1459), EODExitTime(1500);
var:
BuyStop(0), SellStop(0);
{*******************************************************************************}
if(Date <> Date[1]) then
begin
BuyStop = 0;
SellStop = 0;
end;
{***Entry***********************************************************************}
if(Time = ETime) then
begin
{Round down to nearest valid tick - this needs to be changed for
contracts that doesn't trade in 0.1 tick interval, of course}
BuyStop = floor((OpenD(0) * 1.0033) / 0.1 + 0.5) * 0.1;
SellStop = floor((OpenD(0) * 0.9967) / 0.1 + 0.5) * 0.1;
end;
if(MarketPosition = 0 and Time <= LastEntryTime
and EntriesToday(Date) < MaxEntriesInADay and BuyStop <> 0
and SellStop <> 0) then
begin
Buy ("LE") CtxToTrade contracts next bar at BuyStop stop;
SellShort ("SE") CtxToTrade contracts next bar at SellStop stop;
end;
{***Stop************************************************************************}
if(MarketPosition = 1) then
Sell("LX") CtxToTrade contracts total next bar at SellStop stop
else if(MarketPosition = -1) then
BuyToCover("SX") CtxToTrade contracts total next bar at BuyStop stop;
{***EOD Exit********************************************************************}
if(Time = EODExitTime) then
begin
if(marketposition = 1) then
Sell ("EODLX") next bar at market
else if(marketposition = -1) then
BuyToCover ("EODSX") next bar at market;
end;
SetExitOnClose;