Auto Close in Auto Trade

Questions about MultiCharts and user contributed studies.
ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Auto Close in Auto Trade

Postby ppan » 21 Dec 2010

The setexitonclose is useless in autotrade because MC will send the order after the exchange is closed. MC should place the close order to the exchange before it is closed. So MC need a "Auto close time setting" to set the auto close time before the exchange is closed.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Auto Close in Auto Trade

Postby Dave Masalov » 21 Dec 2010

Dear ppan,

I will forward your suggestions to the developers. At the moment you can use the following workaround:

Code to close the position at the end of the day:

To trade:

Code: Select all

input: Time_Beg_Close(900), Time_End_Close(1800);

if time >=Time_Beg and time <= Time_End then
begin
// TODO
end;
To close the position and do not trade anymore:

Code: Select all

if time >=Time_Beg_Close and time <= Time_End_Close then
begin
sell next bar at market;
buy to cover next bar at market;
end;

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Re: Auto Close in Auto Trade

Postby SUPER » 21 Dec 2010

ppan,

Code at following link should solve your problem.

viewtopic.php?f=5&t=7834

ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Re: Auto Close in Auto Trade

Postby ppan » 22 Dec 2010

SUPER,

Thanks for your code.
However, if there is no new tick or new trade near the closing time, how can the system close automatically?

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Re: Auto Close in Auto Trade

Postby SUPER » 22 Dec 2010

SUPER,

Thanks for your code.
However, if there is no new tick or new trade near the closing time, how can the system close automatically?

PPAN,

At present time there is no option for low volume markets. I know there were some plans of having code run on time based event-just like new tick, but don't know when that will be implementd.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Auto Close in Auto Trade

Postby TJ » 22 Dec 2010

SUPER,

Thanks for your code.
However, if there is no new tick or new trade near the closing time, how can the system close automatically?
Some (most) brokers require the last order to be submitted 3 minutes before close.
Please check with your broker for this requirement.


Return to “MultiCharts”