Signal vs. Indicator calculation

Questions about MultiCharts and user contributed studies.
PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Signal vs. Indicator calculation

Postby PD Quig » 11 Jun 2019

When using a two data stream chart (data1 = 3 Point/ data2 = 5-minute), computing a moving average based on data2 returns different results using identical indicator and signal code. The signal code waits to update the 5-minute moving average value until the 5-minute bar closes, while the indicator code (applied to data2) will perform real time calculations while the 5-minute bar is in process. If you're trying to use the data2 value as a filter the computed values will be as much as 5 minutes old.

Any way to beat this and get a real time data2 moving average within the signal code (without resorting to global variables)?

Thanks,

-pdq

Signal Code:

Code: Select all

{************************************************************ Name : $Test_MA_Calc_Issue_Signal Last Modified Date : 06/11/2019 ************************************************************} variables: MA (0, data2); // inputs and variable initialization section MA = round(XAverage(close, 20), 1) data2; once ClearPrintLog; print("MA[0]= ", MA[0]:6:1, " MA[1]= ", MA[1]:6:1);
Indicator Code:

Code: Select all

{************************************************************ Name : $Test_MA_Calc_Issue_Indicator Last Modified Date : 06/11/2019 ************************************************************} variables: MA (0, data2); // inputs and variable initialization section MA = round(XAverage(close, 20), 1) data2; once ClearPrintLog; print("MA[0]= ", MA[0]:6:1, " MA[1]= ", MA[1]:6:1);
Attachments
MA Issue.wsp
(161.3 KiB) Downloaded 196 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Signal vs. Indicator calculation

Postby Henry MultiСharts » 12 Jun 2019

Hello PD Quig,

You need to disable “Real-time history matching” both for the signal and the indicator:
https://www.multicharts.com/trading-sof ... y_Matching

PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Signal vs. Indicator calculation

Postby PD Quig » 14 Jun 2019

Excellent. Thank you, Henry!


Return to “MultiCharts”