TradeManager.TradingData.Positions.Items.Length = 0 even if

Questions about MultiCharts .NET and user contributed studies.
gztanwei
Posts: 32
Joined: 15 Aug 2015
Has thanked: 6 times
Been thanked: 5 times

TradeManager.TradingData.Positions.Items.Length = 0 even if

Postby gztanwei » 09 May 2016

Hi I am trying to modify "_ChartToolBar_Trading_" signal, and found in debug (as in picture) that TradeManager.TradingData.Positions.Items.Length = 0 even if I have position opened.

Also making trades does not trigger IPositions.Added() event.

I did not apply any restriction to AccountFltr, ProfileFltr or SymbolFltr. So any position is supposed to make the "Length" not equal to 0, right?

Please advise. Thanks.
Attachments
Image 6.png
(111.71 KiB) Downloaded 1346 times

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

Re: TradeManager.TradingData.Positions.Items.Length = 0 even

Postby Henry MultiСharts » 10 May 2016

Hello gztanwei,

TradeManager receives the information regarding the orders from the Order and Position Tracker only after TradeManager.ProcessEvent() is called. Please make sure you have it in your code.

gztanwei
Posts: 32
Joined: 15 Aug 2015
Has thanked: 6 times
Been thanked: 5 times

Re: TradeManager.TradingData.Positions.Items.Length = 0 even

Postby gztanwei » 10 May 2016

Hello gztanwei,

TradeManager receives the information regarding the orders from the Order and Position Tracker only after TradeManager.ProcessEvent() is called. Please make sure you have it in your code.
Thanks. I called the TradeManager.ProcessEvents();. But the position still not showing up in TradeManager.TradingData.Positions.Items.Length.

Could you further advise?

The broker profile is paper trading. Could it be the problem of paper trading code?
Attachments
Image 2.png
(75.84 KiB) Downloaded 1327 times

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

Re: TradeManager.TradingData.Positions.Items.Length = 0 even

Postby Henry MultiСharts » 11 May 2016

Hello gztanwei,

Please export the study you are having issues with and send it to me for further analysis.

eroleyikan
Posts: 22
Joined: 01 Jun 2016
Has thanked: 4 times
Been thanked: 6 times

Re: TradeManager.TradingData.Positions.Items.Length = 0 even

Postby eroleyikan » 29 Jun 2016

gztanwei,
I don't know if your issue was resolved... I was having a similar issue, where my position would show-up with a delay.

Where you are calling the TradeManager.ProcessEvents() is critical. I was calling it at the end of the calcBar() method and IOG was disabled. So the bar would place an order at the and of the bar, but the position would not get updated until the next bar.

Now I call ProcessEvents in the void ResultCallback(IDataLoaderResult Result) method and I don't have this problem. I hope this helps. If you search for ResultCallback you will find examples on how to do that. I have an example in one of my other posts.
I hope this helps.
Erol


Return to “MultiCharts .NET”