Do not confuse ma_shift with bar shift
In iMA, ma_shift offsets the moving-average line relative to the chart. The final shift argument selects which calculated bar value the function returns. Using ma_shift to request the previous bar changes the indicator definition instead of selecting history.
The method comes from ENUM_MA_METHOD and the source price comes from ENUM_APPLIED_PRICE. These choices must match the chart indicator used for comparison.
| Argument | Meaning | Typical value |
|---|---|---|
| ma_period | Number of values in the average | 20 |
| ma_shift | Horizontal line offset | 0 |
| ma_method | SMA, EMA, SMMA, or LWMA | MODE_EMA |
| applied_price | Price series used by iMA | PRICE_CLOSE |
| shift | Current or historical returned bar | 1 for latest closed bar |
