Auto Close in Auto Trade
Auto Close in Auto Trade
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.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: Auto Close in Auto Trade
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:
To close the position and do not trade anymore:
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;
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;
Re: Auto Close in Auto Trade
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?
Thanks for your code.
However, if there is no new tick or new trade near the closing time, how can the system close automatically?
Re: Auto Close in Auto Trade
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.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: Auto Close in Auto Trade
Some (most) brokers require the last order to be submitted 3 minutes before close.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?
Please check with your broker for this requirement.