How to modify CloseW into XAverageCloseW ?

Questions about MultiCharts and user contributed studies.
rc76
Posts: 51
Joined: 14 Oct 2020
Has thanked: 17 times

How to modify CloseW into XAverageCloseW ?

Postby rc76 » 12 Jan 2024

Hi

Does any one have any experience in applying XAverage() to CloseW under a daily chart?

It seems the result of XAverage(CloseW) is very different to XAverage(Close) of Data2 (Data2=Weekly) under a daily chart.

For example:

Image

Code: Select all

Vars: EMA_wk_Data2(0); EMA_wk_Data2 = XAverage( Close, 20 ) data(2); Plot1(EMA_wk_Data2, "EMA_wk_Data", CYAN); SetPlotWidth(1, 4); Vars: EMA_wk_CloseW(0); EMA_wk_CloseW = XAverage( CloseW(0), 20 ); Plot2(EMA_wk_CloseW, "EMA_wk_CloseW", YELLOW); SetPlotWidth(2, 4);
I believe the problem is that:
(1) When XAverage is applied to data2, it is only calculated once per week (As weekly data2 only has 1 value per week at close of Friday)
(2) When XAverage is applied to CloseW, there are 5 values across the 5 weekdays of the week.

Therefore XAverage(CloseW) will perform more frequent calculations, therefore produce this error/difference ? (Is this the case)

If so, how can I modify CloseW so that it will produce XAverageCloseW ? A quick example will be super awesome to get me started.

Thank you!

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

Re: How to modify CloseW into XAverageCloseW ?

Postby TJ » 13 Jan 2024

See post #5
Data2
viewtopic.php?t=6929

rc76
Posts: 51
Joined: 14 Oct 2020
Has thanked: 17 times

Re: How to modify CloseW into XAverageCloseW ?

Postby rc76 » 14 Jan 2024

Hi TJ,

Much thank you for the response. However my issue is not with Data2, but with CloseW.

Data2 is perform as expected when applied with XAverage, however its when applying XAverage to CloseW, it becomes the problem.


Return to “MultiCharts”