How to program "Close all orders when end of day"  [SOLVED]

Questions about MultiCharts and user contributed studies.
cyjoe
Posts: 2
Joined: 13 Aug 2012

How to program "Close all orders when end of day"

Postby cyjoe » 13 Aug 2012

Hi Everybody,

I have problem for programming MC.
When I want to close all orders when the last bar is reached.

Especially when a half day case occurs!
It made me trouble when a half day case occurs! It makes trouble for backtesting! Because computer don't know when would be the last bar appears!

How can I do? I am a newbie of MC. Thank you for all!

User avatar
TJ
Posts: 6598
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1909 times

Re: How to program "Close all orders when end of day"

Postby TJ » 13 Aug 2012

cyjoe wrote:Hi Everybody,

I have problem for programming MC.
When I want to close all orders when the last bar is reached.


look up SetExitOnClose.

ps.
It is for backtesting only.
For real life trading, you have to code an exit strategy. (eg. exit 3 minutes before close)



Especially when a half day case occurs!
It made me trouble when a half day case occurs! It makes trouble for backtesting! Because computer don't know when would be the last bar appears!

How can I do? I am a newbie of MC. Thank you for all!


Sorry, our computers are not the ALL intelligent being yet. The computer cannot read your mind; the only way the computer knows it is a half day is if you tell it so.

cyjoe
Posts: 2
Joined: 13 Aug 2012

Re: How to program "Close all orders when end of day"  [SOLVED]

Postby cyjoe » 13 Aug 2012

Wow!

You are supra fast!

Thank you for your help! I would try it!

User avatar
TJ
Posts: 6598
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1909 times

Re: How to program "Close all orders when end of day"

Postby TJ » 13 Aug 2012

cyjoe wrote:Wow!

You are supra fast!

Thank you for your help! I would try it!


see also post #7
viewtopic.php?f=16&t=6929

SP
Posts: 444
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 280 times

Re: How to program "Close all orders when end of day"

Postby SP » 14 Aug 2012

goose Eod_Exit code with an EarlyClose function for the US markets.
Attachments
EOD_EXIT_2.ELD
(16.27 KiB) Downloaded 85 times
These users thanked the author SP for the post:
TJ

User avatar
TJ
Posts: 6598
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1909 times

Re: How to program "Close all orders when end of day"

Postby TJ » 14 Aug 2012

SP wrote:goose Eod_Exit code with an EarlyClose function for the US markets.

any difference with this code?
viewtopic.php?f=5&t=7834&p=33125&hilit=eod_exit#p33125

SP
Posts: 444
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 280 times

Re: How to program "Close all orders when end of day"

Postby SP » 14 Aug 2012

TJ,
the code Super posted is the older one from 2005 . The one above is the newer one from 2009. I didnt compare in detail what goose changed except that he deleted the GVSetNamedInt section.
These users thanked the author SP for the post:
TJ


Return to “MultiCharts”