Intra bar realtime order is not triggered with IOG enabled.  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

Intra bar realtime order is not triggered with IOG enabled.

Postby zysmn » 12 Mar 2015

Hi.
When tried to program a simple signal code, I faced with the following issues:
1. Sent managed Buy-Stop-order, for instance on 150 level price. IOG checked and it is in 3 position with "100 entries per bar". Sometimes positions opens immediately when price touched price level 150, but sometimes price touched 150 and moved higher, to 170 for example, without opening position. In this order disappears from chart. The position can opened either on the closing of the bar, or not opened at all. When price back to 149 or lower, order on 150 appears again. Can't understand, why it occurs, the doesn't triggered and the position doesn't opened.
2. Is it possible in any way from study code cancel all placed unmanaged orders, if aren't known how many they is exposed also which IDs their have? Or in some way to get IDs of all active orders, then to use them to cancel?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Intra bar realtime order is not triggered with IOG enabl

Postby JoshM » 15 Mar 2015

1. Sent managed Buy-Stop-order, for instance on 150 level price. IOG checked and it is in 3 position with "100 entries per bar". Sometimes positions opens immediately when price touched price level 150, but sometimes price touched 150 and moved higher, to 170 for example, without opening position. In this order disappears from chart. The position can opened either on the closing of the bar, or not opened at all. When price back to 149 or lower, order on 150 appears again. Can't understand, why it occurs, the doesn't triggered and the position doesn't opened.
Did you resubmit the buy-stop order on every tick to keep it 'alive'? But that's a pure guess without seeing the strategy's code.
2. Is it possible in any way from study code cancel all placed unmanaged orders, if aren't known how many they is exposed also which IDs their have? Or in some way to get IDs of all active orders, then to use them to cancel?
I think you can use the TradeManager for that. There's a TradeManager example here.

zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

Re: Intra bar realtime order is not triggered with IOG enabl

Postby zysmn » 16 Mar 2015

I think you can use the TradeManager for that. There's a TradeManager example here.
resolved this issue through the next code

Code: Select all

foreach (TradeManager.Order ord in TradeManager.TradingData.Orders.Items)
{
if (ord.State == ETM_OrderState.eTM_OS_Submitted) worcProf.CancelOrder(ord.OrderID);
}
Did you resubmit the buy-stop order on every tick to keep it 'alive'? But that's a pure guess without seeing the strategy's code.
yes, resubmit order on every tick

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Intra bar realtime order is not triggered with IOG enabl  [SOLVED]

Postby Henry MultiСharts » 19 Mar 2015

Hi.
When tried to program a simple signal code, I faced with the following issues:
1. Sent managed Buy-Stop-order, for instance on 150 level price. IOG checked and it is in 3 position with "100 entries per bar". Sometimes positions opens immediately when price touched price level 150, but sometimes price touched 150 and moved higher, to 170 for example, without opening position. In this order disappears from chart. The position can opened either on the closing of the bar, or not opened at all. When price back to 149 or lower, order on 150 appears again. Can't understand, why it occurs, the doesn't triggered and the position doesn't opened.
Hello zysmn,

Please validate the order generation conditions in your code.

zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

Re: Intra bar realtime order is not triggered with IOG enabl

Postby zysmn » 19 Mar 2015

I think I found out what the problem was. After incorrect closing MS in memory left hanging process, which I didn't see. Apparently the new process had conflict (or something like that) with the old, and there is a glitch. After rebooting the system study so far is working fine.


Return to “MultiCharts .NET”