Welcome to the Traders Laboratory Forums.
Automated Trading Black box systems, strategy automation, algorithmic trading, etc...

Reply
Old 11-24-2011, 10:08 AM   #1

Join Date: Nov 2011
Posts: 32
Ignore this user

Thanks: 0
Thanked 1 Time in 1 Post

Close Open Positions at Market Close

I want to close out all my open positions before market close. I do not want to hold open postions over night. How do I do this? I am running my easyLanguage strategy. Thnx
lylec305 is offline  
Reply With Quote
Old 11-25-2011, 02:36 AM   #2

Join Date: May 2010
Posts: 180
Ignore this user

Thanks: 0
Thanked 47 Times in 38 Posts

Re: Close Open Positions at Market Close

SetExitOnClose; works for backtesting purposes but doesn't work in realtime. Realtime requires the code below. Replace 1450 with the appropriate time of your choosing while keeping in mind a missing bar will prevent exit if your choice doesn't allow enough time for that possibility.

Code:
if t>=1450 then begin
    sell next bar market;
    buytocover next bar market;
end;
onesmith is offline  
Reply With Quote
Old 11-25-2011, 05:00 AM   #3

Join Date: Nov 2011
Posts: 32
Ignore this user

Thanks: 0
Thanked 1 Time in 1 Post

Re: Close Open Positions at Market Close

Quote:
Originally Posted by onesmith »
SetExitOnClose; works for backtesting purposes but doesn't work in realtime. Realtime requires the code below. Replace 1450 with the appropriate time of your choosing while keeping in mind a missing bar will prevent exit if your choice doesn't allow enough time for that possibility.

Code:
if t>=1450 then begin
    sell next bar market;
    buytocover next bar market;
end;
Thx

I have tried time > 1450, does not work for back testing, because time will always be > 1450. I am currently using lastTickonchart but have not tested realtime,yet. Thnk TS can send trade that fast?
lylec305 is offline  
Reply With Quote
Old 11-25-2011, 06:57 AM   #4

Join Date: Nov 2011
Posts: 32
Ignore this user

Thanks: 0
Thanked 1 Time in 1 Post

Re: Close Open Positions at Market Close

Quote:
Originally Posted by onesmith »
SetExitOnClose; works for backtesting purposes but doesn't work in realtime. Realtime requires the code below. Replace 1450 with the appropriate time of your choosing while keeping in mind a missing bar will prevent exit if your choice doesn't allow enough time for that possibility.

Code:
if t>=1450 then begin
    sell next bar market;
    buytocover next bar market;
end;
I have tried " time > 1450 ". Issue with back testing, time is > 1450. It worked with lastBarOnChart but i have not tried realtime.
lylec305 is offline  
Reply With Quote
Old 11-25-2011, 11:06 AM   #5

Join Date: Nov 2011
Posts: 32
Ignore this user

Thanks: 0
Thanked 1 Time in 1 Post

Re: Close Open Positions at Market Close

Quote:
Originally Posted by onesmith »
SetExitOnClose; works for backtesting purposes but doesn't work in realtime. Realtime requires the code below. Replace 1450 with the appropriate time of your choosing while keeping in mind a missing bar will prevent exit if your choice doesn't allow enough time for that possibility.

Code:
if t>=1450 then begin
    sell next bar market;
    buytocover next bar market;
end;
I tried it but does not work back testing. Neither does lastbaronchart, realtime assumes lastbaronchart literally. Everytime a chart is opened, lastbaronchat is executed.
lylec305 is offline  
Reply With Quote
Old 11-25-2011, 11:55 AM   #6

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,777
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Close Open Positions at Market Close

what is your chart resolution?
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 11-27-2011, 07:57 AM   #7

Join Date: Nov 2011
Posts: 32
Ignore this user

Thanks: 0
Thanked 1 Time in 1 Post

Re: Close Open Positions at Market Close

Quote:
Originally Posted by Tams »
what is your chart resolution?
i am surprised i have not found a working stategy that closes all open positions at market close regarless of time.
lylec305 is offline  
Reply With Quote

Reply

Tags
market close

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Market on Close Order winnie Automated Trading 8 11-27-2011 07:59 AM
Round TWO - Predict the Market Close Contest - Win $$$ MadMarketScientist Market Analysis 39 04-12-2011 01:17 PM
Buy on Open / Sell Close Vs Buy on Close / Sell Open Frank Market Analysis 3 02-18-2010 12:21 AM
Past Open/close Data For ES and TF bond2k Trading and the Markets 6 08-09-2009 11:51 PM
What happened after market close? TinGull General Discussion 4 01-10-2007 08:06 PM

All times are GMT -4. The time now is 05:21 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.