How to make Bars.Close[0] always return the realtime value though having longer resolution?  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
cwhorton
Posts: 9
Joined: 28 Sep 2016
Has thanked: 2 times
Been thanked: 2 times

How to make Bars.Close[0] always return the realtime value though having longer resolution?

Postby cwhorton » 06 Dec 2016

Using Portfolio Trader, I have a strategy that is configured to trade instrument ABC with per second resolution and it has DEF setup as as Data Series 2 with 5 minute resolution. BarsOfData(2).Close only changes every 5 minutes with BarsOfData(2).Close[0] holding the last 5 minute's closing value even though DEF continues to change market price. Is there a way that BarsOfData(2).Close[0] can always hold the realtime price? This would allow me to pass BarsOfData(2).Close to various indicators and not wait 5 minutes for them to refresh to take an action when the indicator starts quickly moving for / against me.

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 33 times

Re: How to make Bars.Close[0] always return the realtime value though having longer resolution?

Postby darob » 06 Dec 2016

Hi cwharton I'm not clear on why you're using 5 min bars in DEF if you want an immediate response on price. Perhaps BarsOfData(2) should be 1 sec resolution too and then you use a BarsOfData(3) in 5 min for whatever it is you need it for.

cwhorton
Posts: 9
Joined: 28 Sep 2016
Has thanked: 2 times
Been thanked: 2 times

Re: How to make Bars.Close[0] always return the realtime value though having longer resolution?

Postby cwhorton » 07 Dec 2016

Thank you for your reply.

Let's say I want to use the 5 minute RSI values of DEF to influence my immediate trading on ABC. Since I am trading ABC at a per second resolution, CalcBar() is called every second so I would like to see the current RSI value of DEF at a 5 minute resolution with the current price always being in Close[0] so that I know the moment RSI moves from 80 to 79 and not have to wait for the full 5 minutes to end, where by that time it's dropped to 60 and the trade setup is no longer valid.

Sure, I could set DEF to per second resolution too, but now I don't know the RSI values at the 5 minute resolution which is what the trade is based on.

User avatar
Kristina MultiCharts
Posts: 63
Joined: 04 Sep 2014
Has thanked: 5 times
Been thanked: 34 times

Re: How to make Bars.Close[0] always return the realtime value though having longer resolution?  [SOLVED]

Postby Kristina MultiCharts » 07 Dec 2016

Hello,

Is the option "Realtime-history matching" enabled or disabled in Format Signals -> Properties -> Backtesting Tab? If it's enabled, please disable it or vice versa. Here you can check how this option works: https://www.multicharts.com/trading-sof ... y_Matching

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 33 times

Re: How to make Bars.Close[0] always return the realtime value though having longer resolution?

Postby darob » 07 Dec 2016

I see how that works now, thanks. I can see BarsOfData(3) in DEF 1 sec in addition to the 5 min as still offering a potential, obviously more complicated solution. Kristina's sounds much better.

Cheers

cwhorton
Posts: 9
Joined: 28 Sep 2016
Has thanked: 2 times
Been thanked: 2 times

Re: How to make Bars.Close[0] always return the realtime value though having longer resolution?

Postby cwhorton » 07 Dec 2016

Kristina,

Thank you, that worked. Because I wasn't backtesting (which is the name of the tab) I didn't think it had an affect on realtime trading.

Bests,
Carl


Return to “MultiCharts .NET”