IOG Order "setexitonclose"

Questions about MultiCharts and user contributed studies.
joshweaver05
Posts: 12
Joined: 09 Jan 2014

IOG Order "setexitonclose"

Postby joshweaver05 » 14 Jan 2014

I have a simple strategy to close positions before the close using IOG:

Code: Select all

if SymbolName = "@BOH14" then begin
if (currenttime_s >= 141230 and currenttime_s <= 141415) and marketposition <> 0 then begin
Buytocover ("EOD_B") next bar at market;
sell ("EOD_S") next bar at market;
end;
end;

RecalcLastBarAfter(5);
how ever every night instead it seems to place the orders at 141455 which is totally outside the bounds? I do have a time sync on the computer that is very accurate. what else could it be?

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

Re: IOG Order "setexitonclose"

Postby TJ » 14 Jan 2014

I have a simple strategy to close positions before the close using IOG:

Code: Select all

if SymbolName = "@BOH14" then begin
if (currenttime_s >= 141230 and currenttime_s <= 141415) and marketposition <> 0 then begin
Buytocover ("EOD_B") next bar at market;
sell ("EOD_S") next bar at market;
end;
end;
RecalcLastBarAfter(5);
how ever every night instead it seems to place the orders at 141455 which is totally outside the bounds? I do have a time sync on the computer that is very accurate. what else could it be?
Where does the title "setexitonclose" fit into this?

joshweaver05
Posts: 12
Joined: 09 Jan 2014

Re: IOG Order "setexitonclose"

Postby joshweaver05 » 14 Jan 2014

because setexitonclose does not work in real time. so this is the code i generated to replace it. i can NOT use the code by goose because that has no time restraints and will send out 1000's orders literally after market hours.

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

Re: IOG Order "setexitonclose"

Postby TJ » 14 Jan 2014

because setexitonclose does not work in real time. so this is the code i generated to replace it. i can NOT use the code by goose because that has no time restraints and will send out 1000's orders literally after market hours.
Do you have the logs?

What time is the last BUY or SELLSHORT order?

How liquid is the instrument? Do you see trades happening at least every second at the above times?

joshweaver05
Posts: 12
Joined: 09 Jan 2014

Re: IOG Order "setexitonclose"

Postby joshweaver05 » 14 Jan 2014

here is a screenshot of the order window
last order was 205
the market was liquid at the time, also i do have the following in the code so even if not liquide:

[/code]
RecalcLastBarAfter(5);
[/code]

you can see when the EOD_B happened in the time stamp and the exact code to execute that order was the code i first posed.
Attachments
SS.png
(206.31 KiB) Downloaded 500 times

joshweaver05
Posts: 12
Joined: 09 Jan 2014

Re: IOG Order "setexitonclose"

Postby joshweaver05 » 14 Jan 2014

i might have a solution to this issue. IMO IOG is total BS in mc and really is a feature that never works proper in real time. so i am using 5min bars, was thinking maybe use data1/data2 and have 1min bars for data1 and 5min bars for data 2. this way i could do what i need to do using normal EL functions. the question i have though is is it possible for limit orders to only be updated based on the 5min chart and not updated every new 1 min bar? for example the strategy moves the limit order high or lower every bar, on a 5 min chart its done correctly. but if i am using a 1 min chart to update orders it would not be correct. i would only want to update the limit order on the hour or any :05 intervale.

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

Re: IOG Order "setexitonclose"

Postby TJ » 14 Jan 2014

here is a screenshot of the order window
last order was 205
The market was liquid at the time, also i do have the following in the code so even if not liquide:

Code: Select all

RecalcLastBarAfter(5);
you can see when the EOD_B happened in the time stamp and the exact code to execute that order was the code i first posed.
No, not the order window... you need to look at the log, to see at what time the order was sent.

What is your chart resolution?

ps. With the little bit of information, I have no way to tell how your order was sent so late. You might have to get the tech support to look at your code. There must be something holding it back.

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

Re: IOG Order "setexitonclose"

Postby TJ » 14 Jan 2014

I just noticed your code is for BOH14,
while your order window is ZLH4.

joshweaver05
Posts: 12
Joined: 09 Jan 2014

Re: IOG Order "setexitonclose"

Postby joshweaver05 » 15 Jan 2014

where would i look for the logs?

BO = soybean oil
CME exchange code for it is ZL

they are properly mapped.


Return to “MultiCharts”