BlackBars 54 posts msg #143239 - Ignore BlackBars |
4/17/2018 9:12:33 AM
Hello all,
So can someone tell me if it is possible to convert the DMA(28,-14) SF format into pinescript?
Obviously I am aware it is "displaced" 14 periods, but.....
"The DMA(N,-P) is computed by taking the MA(N) and effectively "moving it back in time" by P days. Since we don't carry data from the future, it is not possible to compute a N-day average for the remaining P-1 days. For each of these dates, X[i], we compute shorter N-(P-i) day averages; where i=0 ... P-1 (i.e. X[0] is the most recent date and X[P-1] is the point P-1 days ago on the chart.) "
IS SUCH A THING POSSIBLE FOR PINESCRIPT ^
|
Tracks 4 posts msg #143390 - Ignore Tracks |
4/29/2018 11:32:33 AM
If I'm reading this right, DMA is just the value the moving average was at (P) days ago, right?
So for Pinescript that would just be:
x = ma(close[14], 28)
If you specifically need the Daily MA, regardless of what timeframe your chart is in, then it would be:
x = ma(close[14], 28)
dx = security(tickerid, "D", x)
|
BlackBars 54 posts msg #143397 - Ignore BlackBars |
4/29/2018 8:38:54 PM
Aha aright, thanks sport
|