How to update "MarketPosition" immediately on Day Bar Close?

Questions about MultiCharts .NET and user contributed studies.
Morgan
Posts: 16
Joined: 29 Oct 2014
Has thanked: 1 time
Been thanked: 1 time

How to update "MarketPosition" immediately on Day Bar Close?

Postby Morgan » 07 Sep 2015

Hello:

I would like to write the signals into DB when the daily bar is closed.
Therefore I use "MarketThisBar" orders in signals
and use "StrategyInfo.MarketPosition" to get the signals directions.

However, when the daily bar is closed and not get new data in yet.
It seems the marketposition doesn't update.

Please refer the attached,
Siganls.jpg displays the -2 positions in the last daily bar on chart when the session is end.
result.jpg displays the output result of marketposition = 0 not -2.

What can I do to get the new market position immediately when the daily bar is closed not the opening of tomorrow?

Thanks!
Attachments
issue.zip
(63.19 KiB) Downloaded 245 times

Morgan
Posts: 16
Joined: 29 Oct 2014
Has thanked: 1 time
Been thanked: 1 time

Re: How to update "MarketPosition" immediately on Day Bar Cl

Postby Morgan » 07 Sep 2015

It is strange that even the new bars is opening, the market position is still 0.
I don't know why this happened.
(I tried to remove and create a new chart and applied the signal again but same.)


====================================
int sMP=StrategyInfo.MarketPosition;
Output.WriteLine("MarketPosition: " + sMP.ToString());

"MarketPosition: 0"

====================================
Attachments
siganl_2.JPG
(19.29 KiB) Downloaded 549 times

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

Re: How to update "MarketPosition" immediately on Day Bar Cl

Postby Henry MultiСharts » 24 Sep 2015

Hello Morgan,

Have you tried adding RecalcLastBarAfter to your code?


Return to “MultiCharts .NET”