Skip to content

Wrong calculation for Spread SMA #65

@pegaltier

Description

@pegaltier

I have tried to create a simple spread indicator using the playground and noticed the calculation are strange so I have compared with the same script on Tradingview and confirmed that there is an error in the calculation made by PineTS.

`
//@Version=5
indicator("Spread Moving Average", overlay=false)

length = input.int(20, "Length")
sma = ta.sma(close, length)
ssma = 100 * (close - sma) / sma
plot(ssma, "Spread SMA", color.blue, linewidth=2)

`

PineTS Playground
Image

Tradingview

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions