Indicator not updating in realtime  [SOLVED]

Questions about MultiCharts and user contributed studies.
brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Indicator not updating in realtime

Postby brunor » 02 May 2016

This indicator does not update intrabar. The value for the indicator is held until the bar is closed, and the value changes only on the next bar. I would appreciate any hints to enable relatime updates.

Code: Select all

Var:
IndicatorTotal(0);
IndicatorTotal = (Value19+Value20+Value21+Value22);

//----------------------------------------------------------------
Condition19 = Average(Close,10) > Average(Close,20);
Condition20 = Average(Close,10) < Average(Close,20);
IF Condition19 then
Value19 = 1
Else Value19 = 0;
IF Condition20 then
Value20 = -1
Else Value20 = 0;

//----------------------------------------------------------------
Condition21 = MACD( Close,12,26) > XAverage( MACD( Close,12,26) ,9);
Condition22 = MACD( Close,12,26) < XAverage( MACD( Close,12,26) ,9);
IF Condition21 then
Value21 = 1
Else Value21 = 0;
IF Condition22 then
Value22 = -1
Else Value22 = 0;

//----------------------------------------------------------------

Plot5(IndicatorTotal,"1",blue);
Thank You.
Bruno

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

Re: Indicator not updating in realtime

Postby TJ » 02 May 2016

This indicator does not update intrabar. The value for the indicator is held until the bar is closed, and the value changes only on the next bar. I would appreciate any hints to enable relatime updates.

Code: Select all

Var:
IndicatorTotal(0);
IndicatorTotal = (Value19+Value20+Value21+Value22);

//----------------------------------------------------------------
Condition19 = Average(Close,10) > Average(Close,20);
Condition20 = Average(Close,10) < Average(Close,20);
IF Condition19 then
Value19 = 1
Else Value19 = 0;
IF Condition20 then
Value20 = -1
Else Value20 = 0;

//----------------------------------------------------------------
Condition21 = MACD( Close,12,26) > XAverage( MACD( Close,12,26) ,9);
Condition22 = MACD( Close,12,26) < XAverage( MACD( Close,12,26) ,9);
IF Condition21 then
Value21 = 1
Else Value21 = 0;
IF Condition22 then
Value22 = -1
Else Value22 = 0;

//----------------------------------------------------------------

Plot5(IndicatorTotal,"1",blue);
Thank You.
Bruno
Easylanguage is a procedural language.
That means your code instructions are executed line by line, from top to bottom.

You have to move this line to the end of all the calculations, and before the PLOT statement.

Code: Select all

IndicatorTotal = (Value19+Value20+Value21+Value22);

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Indicator not updating in realtime  [SOLVED]

Postby brunor » 02 May 2016

Thank you very much TJ. Worked perfectly.

Bruno

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

Re: Indicator not updating in realtime

Postby TJ » 02 May 2016

Thank you very much TJ. Worked perfectly.

Bruno

Good to know it is working. Thanks for reporting back.


Return to “MultiCharts”