Replace N/A bars with last known price?

Questions about MultiCharts and user contributed studies.
SysInv
Posts: 28
Joined: 25 Nov 2012
Has thanked: 1 time
Been thanked: 1 time

Replace N/A bars with last known price?

Postby SysInv » 05 Dec 2012

I'm doing a lot of correlation/spread trading, and use data series overlapping in one chart to spot these. The problem is that in very calm markets, on lower timeframes, there might not be a tick at that certain bar. Multicharts show this as an N/A bar in that case, which messes up the indicators as well. And if the indicator is attached to one symbol, it will show gaps in the indicator just as in the market it is attached to (where the gap is simply no ticks traded that bar even if the market is open). I've been looking for solutions to this but not yet found one - I can understand the gap if the market is closed, but it must be possible somehow to get a plot for every bar when the market is open?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Replace N/A bars with last known price?

Postby TJ » 05 Dec 2012

I'm doing a lot of correlation/spread trading, and use data series overlapping in one chart to spot these. The problem is that in very calm markets, on lower timeframes, there might not be a tick at that certain bar. Multicharts show this as an N/A bar in that case, which messes up the indicators as well. And if the indicator is attached to one symbol, it will show gaps in the indicator just as in the market it is attached to (where the gap is simply no ticks traded that bar even if the market is open). I've been looking for solutions to this but not yet found one - I can understand the gap if the market is closed, but it must be possible somehow to get a plot for every bar when the market is open?
You can plot anything you want on the chart.

You can create an indicator to plot the last known close if there is none.

SysInv
Posts: 28
Joined: 25 Nov 2012
Has thanked: 1 time
Been thanked: 1 time

Re: Replace N/A bars with last known price?

Postby SysInv » 05 Dec 2012

It seems like you misunderstood my question. Let's say you plot two instruments on one chart, such as SPI and Aussie Dollar. During low volume times, it might be that no ticks are made in one of them, and on a 1m chart it will leave this bar as a whole, instead of making a print of the old price. Applying an indicator to this means the indicator will show a gap for this bar as well, which is what I'm trying to avoid.

Cheers.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Replace N/A bars with last known price?

Postby TJ » 05 Dec 2012

It seems like you misunderstood my question. Let's say you plot two instruments on one chart, such as SPI and Aussie Dollar. During low volume times, it might be that no ticks are made in one of them, and on a 1m chart it will leave this bar as a whole, instead of making a print of the old price. Applying an indicator to this means the indicator will show a gap for this bar as well, which is what I'm trying to avoid.

Cheers.
Sure, you can plot the last known price in the gap; that's exactly what I meant. Unless you want something else, please make a mock up chart to illustrate your vision.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Replace N/A bars with last known price?

Postby arjfca » 06 Dec 2012

I'm doing a lot of correlation/spread trading, and use data series overlapping in one chart to spot these. The problem is that in very calm markets, on lower timeframes, there might not be a tick at that certain bar. Multicharts show this as an N/A bar in that case, which messes up the indicators as well. And if the indicator is attached to one symbol, it will show gaps in the indicator just as in the market it is attached to (where the gap is simply no ticks traded that bar even if the market is open). I've been looking for solutions to this but not yet found one - I can understand the gap if the market is closed, but it must be possible somehow to get a plot for every bar when the market is open?
To better understand your need, and to emphasis TG response, I suggest you to take a screen picture, and explain what is your problem and what you want to achieved.

If you want to have a value other than N/A, your plot value should not be attached to a calculation but to a variable relate to it

If condition = True then Variable = indicator computation;
Plot variable;

Variable will have a new value each time your indicator is valid and it will remain the same when Indicator is not valid

Don't forget to define your variable as Intrabarpersist. This way the value will be persistent for each bar

Martin

SysInv
Posts: 28
Joined: 25 Nov 2012
Has thanked: 1 time
Been thanked: 1 time

Re: Replace N/A bars with last known price?

Postby SysInv » 10 Dec 2012

Thanks for the ideas, I solved it by overlaying the data with an indicator keeping track of the last value instead and referred to this to get the price instead of the instrument. Not the best solution but will do for now.

SysInv
Posts: 28
Joined: 25 Nov 2012
Has thanked: 1 time
Been thanked: 1 time

Re: Replace N/A bars with last known price?

Postby SysInv » 30 Dec 2012

I'm now back to this problem since I'm past the first solution and it doesn't do what I now need to do now.

Again, the problem is to plot an indicator when a bar (or more) is missing in a datafeed. Please take a look at the attached image showing Aussiedollar future and the spot market. The aussie dollar is closed for one hour, but I still need to show information in this chart. However attaching an indicator to the Aussie dollar (top) chart means I get N/A values when the Aussie dollar future bars are missing.

I could use the spot market (bottom)to plot the data for the Aussie dollar instead, since this market still trades when Aussie dollar is close, but this generates a scaling problem if I want to plot the indicator in the top chart. If I chose "same as symbol" it uses the spot market scale since the indicator is attached to this data series to plot all the time, even if I use another data series inside the indicator.

I've added two indicators (close price and moving average) of the Aussie dollar to show that it looks like it's plotting, but the data window show that it's a N/A value for both.

Any ideas of how this can be solved? I can base it on the spot market if there is a way to control the price scale better...

In short - I need to have an indicator plot during N/A bars with the correct price scale..
Attachments
Screenshot.png
(83.63 KiB) Downloaded 451 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Replace N/A bars with last known price?

Postby TJ » 30 Dec 2012

you can capture the premium/discount of the future/cash at the time the future closed,
then use the prem/disc to fudge the indicator.


Return to “MultiCharts”