簡體   English   中英

Pine Script:腳本 SMA 與主圖表上的等價物不匹配

[英]Pine Script: Script SMAs Don't Match the Equivalent on the Main Chart

我編寫了一個簡單的 Pine Script 圖表,它只是模仿了我已經在 TradingView 中使用的圖表。

但是,當我疊加我的時,我注意到 Pine Script SMA 的行為與現有圖表上的相同 SMA 不同。

它們的創建方式相同:

松腳本:

sma250 = sma(close,250)
plot(sma250, color=color.red)

TVK線走勢圖:sma250采用收盤來源,時間范圍與圖表相同。

但是當我疊加它的時候,我的SMA在一個完全不同的地方,角度也和現有的SMA不同。 它們似乎都更具反應性。 我錯過了什么嗎?

謝謝。

晚上好,先生,

下面是內置平滑移動平均線腳本和您的代碼行。 正如你所看到的,它們是不同的,所以輸出也會不同。 在右側添加內置腳本時,會出現一個 (?),它將進一步解釋該腳本。

在此處輸入圖像描述

//@version=4
study(title="Smoothed Moving Average", shorttitle="SMMA", overlay=true, resolution="")

////Trading View In-Built code
len = input(250, minval=1, title="Length")
src = input(close, title="Source")
smma = 0.0
smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
plot(smma, color=color.red)
//Link from Trading View Code -> The (?) to the right when you add the script to your chart
//https://uk.tradingview.com/chart/?solution=43000591343

///Your Code
sma250 = sma(close,250)
plot(sma250, color=color.blue)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM