Data1 Data2

Questions about MultiCharts and user contributed studies.
enricog
Posts: 11
Joined: 10 Dec 2021
Has thanked: 1 time

Data1 Data2

Postby enricog » 22 Mar 2022

Hello,

I am using 2 Time frame: data1 with 1min, data2 240min.
On data1 run the following script in real time.
Data1 is update correclty on every 1min when bar is close. This is ok!
On Data2, Close of data 2 (CL2 ) remain always the same, because the bar is not changhed yet.
I would to like to update the price of data2 with the effective real time value when the script evaluate the 1min bar (on data1)

I tried to use intrabarpersis in the declaration of the CL1, CL2 but same result.

Is it possible to do this?

Note. This code is used in a signal.
Any help will be appreciated.
Thank you

Code: Select all

Variables: intrabarpersist Cl1(0), intrabarpersist Cl2(0); once cleardebug; if (BarStatus(1) = 2) and (LastBarOnChart_s = true) then begin CL1 = Close data1; CL2 = Close data2; print(datetimetostring(datetime)," ", "Close data1= ",CL1, " Close Data2 ", CL2, " Time ", Time_s); end; //: LastBarOnChart

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

Re: Data1 Data2

Postby TJ » 22 Mar 2022


enricog
Posts: 11
Joined: 10 Dec 2021
Has thanked: 1 time

Re: Data1 Data2

Postby enricog » 23 Mar 2022

See post #5
viewtopic.php?t=6929
Hello TJ!
I try to change my code, but always the same behavior

Code: Select all

Variables: intrabarpersist Cl1(0,data1), intrabarpersist Cl2(0,data2); once cleardebug; if (BarStatus(1) = 2) and (LastBarOnChart_s = true) then begin CL1 = Close data1; CL2 = Close data2; print(datetimetostring(datetime)," ", "Close data1= ",CL1, " Close Data2 ", CL2, " Time ", Time_s); end; //: LastBarOnChart
I send also a screenshot for better comprehension
Attachments
Multichart_problem_data2.png
(334 KiB) Not downloaded yet

User avatar
Kate MultiCharts
Posts: 575
Joined: 21 Oct 2020
Has thanked: 7 times
Been thanked: 144 times

Re: Data1 Data2

Postby Kate MultiCharts » 25 Mar 2022

Hello enricog,

Please try disabling the Realtime-History Matching option in the Format Study -> Format -> Properties tab -> Advanced Section.
More info about it here.

enricog
Posts: 11
Joined: 10 Dec 2021
Has thanked: 1 time

Re: Data1 Data2

Postby enricog » 04 Apr 2022

I have done some test with code below:
1)Intrabarpersist on variable CL1, CL2, AVG1,AVG2, dosen t affect the behavior. The same result with and without.

2)Realtime-History Matching option unchecked (disable) on signal produce real time update data on data2 (average AVG2 and Close Cl2 value) as I wanted.
3) No difference using Realtime-History Matching option unchecked (disable) on Studies (in this case AVG1 and AVG2) with both Checked and unchecked Realtime-History Matching option on signal.

Can explain point 1) and 3) ?
Thanks in advance

Code: Select all

Variables: intrabarpersist Cl1(0,data1), intrabarpersist Cl2(0,data2), intrabarpersist AVG1(0,data1), intrabarpersist AVG2(0,data2); once cleardebug; //if (BarStatus(1) = 2) and (LastBarOnChart_s = true) then begin if (BarStatus(1) = 2) then begin CL1 = Close data1; CL2 = Close data2; AVG1 = AverageFC(CL1, 5) data1; AVG2 = AverageFC(Cl2, 5) data2; if (BarStatus(1) = 2) and (LastBarOnChart_s = true) then begin print(datetimetostring(datetime)," ", "Close data1= ",CL1, " Close Data2 ", CL2, " AVG1 = ",AVG1 ," AVG2 = ", AVG2, " Time ", Time_s); end; end; //: LastBarOnChart

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

Re: Data1 Data2

Postby TJ » 04 Apr 2022

Can you explain, in your view, the function and purpose of "intrabarpersist" ?

enricog
Posts: 11
Joined: 10 Dec 2021
Has thanked: 1 time

Re: Data1 Data2

Postby enricog » 04 Apr 2022

Can you explain, in your view, the function and purpose of "intrabarpersist" ?
Hello,
The above code is only for testing purpose. The goal is to update data2 and indicator AVG2 in real time when data1 is updating. Now I know this can be done with Realtime-History Matching option unchecked on signal.
I used also intrabarpersist to verify if can do the same, but it's not affect the result. I have read that using intrabarpersist variables can be update in tick.


Return to “MultiCharts”