How to access signal position data in indicator?

Questions about MultiCharts .NET and user contributed studies.
Posts: 4
Joined: 03 Jul 2014

How to access signal position data in indicator?

Postby PBJ » 08 Jul 2014


My goal is to access 2 informations in my new indicator:
- the current position's average entry price
- the current position's # of bars since entry

I first thought that I could access these information from the StrategyInfo property in the indicator's code. It seems to be true for the average entry price (StrategyInfo.AvgEntryPrice), but not for # bars since entry.

Then, I found the StrategyInfo.Signals property and was able to retrieve the first signal in the list. However, when the indicator tries to access the signal's AvgEntryPrice property or BarsSinceEntry() method, values returned are erroneous. With more investigation, I found out that while Bars.TimeValue changes for each new bar in the indicator's CalcBar() method, the signal.Bars.TimeValue value was always equal to the last bar displayed on the chart. I think there is therefore a lack of synchronization between the indicator's CalcBar() and the signal's bars. All I want is to be able to retrieve informations from the signal (like BarsSinceEntry), at the current bar in the indicator. Maybe there is a way to synchronize the signal/price chart and indicator's using indices?


User avatar
Henry MultiСharts
Posts: 9047
Joined: 25 Aug 2011
Has thanked: 1250 times
Been thanked: 2905 times

Re: How to access signal position data in indicator?

Postby Henry MultiСharts » 10 Jul 2014

Hello PBJ,

You need to transfer BarsSinceEntry value from the signal into an indicator. Please see this post for more info: MultiCharts .NET FAQ
You can also use the new functionality we have introduced in MultiCharts 9.0 - an indicator can now plot the values received from a signal using IStrategyPerformance.SetPlotValue and IStrategyPerformance.GetPlotValue.

Return to “MultiCharts .NET”