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!
How to update "MarketPosition" immediately on Day Bar Close?
Re: How to update "MarketPosition" immediately on Day Bar Cl
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"
====================================
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
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: How to update "MarketPosition" immediately on Day Bar Cl
Hello Morgan,
Have you tried adding RecalcLastBarAfter to your code?
Have you tried adding RecalcLastBarAfter to your code?