Multi Time Frame Bar updates

Questions about MultiCharts and user contributed studies.
User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Multi Time Frame Bar updates

Postby joebone » 01 Dec 2022

Hello,
I think I already know the answer to this question but I wanted to make sure.

This is using a tick chart.
When I design a signal to use the Bid and ask spread and want to make calculations on the bid ask spread. I need to put the Bid or Ask as the first Instrument on the chart cause it updates substantially more on a tick chart than the actual trades right?

And multicharts only updates the parameters of all its calculations based off the frequency of the first instrument on a chart?

Even though I am using C Data2 which is my Ask. I need to put the ask first on the list of instruments otherwise calculation I make on this data wont be accurate?

Thanks very much for any help

User avatar
Polly MultiCharts
Posts: 202
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 55 times

Re: Multi Time Frame Bar updates

Postby Polly MultiCharts » 06 Dec 2022

Hello joebone,

If you’d like your signal to be calculated on every ask or bid change, you will need to plot two 1-tick data series for ask and bid respectively.
You might also try using the InsideAsk and InsideBid keywords for this purpose, but please note that these keywords will work only with real time data.
For more info about how signals are calculated please refer to these articles:

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Multi Time Frame Bar updates

Postby joebone » 07 Dec 2022

Hey Polly,
I am trying to understand a few things about designating Data(X) in a indicator vs in a signal.

In an indicator it appears that I can change the Origin data by selecting it in the properties. Even if I change the Close Data(X) in the code it defaults to the one selected in the properties?

In a signal it appears that its always on data 1? but what if I designate data 2 as my source for a pivot or an average. trying to debug with an indicator doesnt seem to be the best choice here.... should I be using the send plot value to indicator from signal to debug?

User avatar
Polly MultiCharts
Posts: 202
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 55 times

Re: Multi Time Frame Bar updates

Postby Polly MultiCharts » 08 Dec 2022

joebone,

On the chart the data series are enumerated as Data1, Data2, Data3 and so on. Data1 is the main data series and it cannot be deleted.
Both a signal and an indicator are calculated on their base data series. Base data series for a signal is always Data1. Base data series for an indicator can be selected in Format Study->Properties tab->Base Study on.
By default in realtime a signal is calculated on the bar close (if IOG is disabled) of its base data series, and an indicator is calculated on every tick of its base data series (Format Study->Properties tab->Advanced->’Update on Every Tick’ checkbox).
Both an indicator and a signal can reference additional data series in their calculation. Realtime-history matching option allows MultiCharts to synchronize the calculation of studies based on several data series. For more info about the way it works please see this page.

If you plot two 1-tick data series (one with ask and the other with bid), and your Data1 is the ask data series, your signal will be calculated on every new ask. What bid will be used in these calculations depends on Realtime-History matching settings.

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Multi Time Frame Bar updates

Postby joebone » 08 Dec 2022

I just found an old thread about how Real time history matching and bar status work together. That was very helpful as well. Thanks for this!

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Multi Time Frame Bar updates

Postby joebone » 08 Dec 2022

joebone,

On the chart the data series are enumerated as Data1, Data2, Data3 and so on. Data1 is the main data series and it cannot be deleted.
Both a signal and an indicator are calculated on their base data series. Base data series for a signal is always Data1. Base data series for an indicator can be selected in Format Study->Properties tab->Base Study on.
By default in realtime a signal is calculated on the bar close (if IOG is disabled) of its base data series, and an indicator is calculated on every tick of its base data series (Format Study->Properties tab->Advanced->’Update on Every Tick’ checkbox).
Both an indicator and a signal can reference additional data series in their calculation. Realtime-history matching option allows MultiCharts to synchronize the calculation of studies based on several data series. For more info about the way it works please see this page.

If you plot two 1-tick data series (one with ask and the other with bid), and your Data1 is the ask data series, your signal will be calculated on every new ask. What bid will be used in these calculations depends on Realtime-History matching settings.
One last question,
I am reading through documentation on Real-time matching. If I am using 2 time frames from the same Underlying but they are tick charts so they may not always close the bar at the same time like Minute charts.

Will I have an issue with real time matching being on since all time frames will always be active at the same time but they just wont have bars close at the same time.

Sorry this is kinda tricky to grasp in abstract. I will probably have to get my hands dirty with some live trading to know for sure.

User avatar
Polly MultiCharts
Posts: 202
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 55 times

Re: Multi Time Frame Bar updates

Postby Polly MultiCharts » 09 Dec 2022

joebone,

There shouldn’t be any issues with that. But you can add traces in your code (print, fileappend) to monitor the strategy logic printed out in real-time.
A general example is available in our Wiki.
You can also use this code sample for reference:

Code: Select all

if LastBarOnChart_s then begin print (Symbol_CurrentBar:3:0, " (", barstatus:2:0,") " , " " , Symbol_CurrentBar data2:3:0, " (", barstatus data2:2:0,") " , " ", " | " ,c:5:2 , " ", c data2:5:2); end;
We always recommend testing your signal with a demo broker account or with a pre-built Paper Trader before going live.


Return to “MultiCharts”