indicator("My script") plot(close) 在生成默认代码的时候上面还有三句被注释掉的代码,不用管也不要删,记录的是开源软件协议、Pine语言版本号和作者信息。 举一反三(1) 如果我想生成BTC的最高价曲线,并且用醒目的红色粗线显示在副图中,该怎么做? 代码: indicator("high price")plot(high,linewidth=2,color...
Pine Script 语法解析Pine Script 是一种用于在 TradingView 平台上编写交易指标和策略的脚本语言。它专为金融市场分析而设计,允许用户创建自定义的技术分析工具、策略信号以及自动化交易系统。以下是对 Pine Script 基本语法的详细解析:一、基本结构一个完整的 Pine Script 通常包含以下几个部分:声明...
plot character 绘制视觉图形, 官方文档:https://www.tradingview.com/pine-script-reference/#fun_plotcharplotchar(barstate.islast, char=' ', location=location.top, text="Char", textco…
确保你使用的 Pine Script 版本与代码兼容。上面的示例使用的是 Pine Script v5。如果你使用的是不同版本,可能需要调整代码。 逻辑错误: 检查函数的逻辑是否正确。例如,计算 SMA 时,确保循环和求和逻辑正确。 调试技巧 使用plot 函数: 在关键位置使用 plot 函数输出中间结果,帮助调试。例如: 代码语言:text 复制...
在Pine Script中,全局变量是在脚本的顶层声明的变量,可以在整个脚本的任何地方访问。要在Pine Script中创建全局变量,只需在脚本的顶部声明变量,而不需要使用var关键字。以下是如何在Pine Script中创建全局变量的示例: 代码语言:txt 复制 //@version=5 indicator("Global Variables Example", overlay=true) // 声...
零基础学Pine Script:基于TradingView平台的量化分析上QQ阅读看本书 新人免费读10天 领看书特权 12.2 函数plot 后续精彩内容,上QQ阅读APP免费读 上QQ阅读看本书,新人免费读10天 登录订阅本章 > 12.3 plot系列的其他函数 后续精彩内容,上QQ阅读APP免费读 上QQ阅读看本书,新人免费读10天 登录订阅本章 >...
When you create new scripts, you can rename them by changing this text to whatever you like. Line #3 plot(close) Now this is where the fun begins. In this line of code, we are telling Pine Script to plot the close of the current candle onto our chart. The script will run on every...
pinescript语法中没有end if。 不能在局部作用域中使用plot函数,只能在全局范围内使用。 在本地范围内使用security()函数声明变量将产生编译错误Can't call 'security' inside: 'if', 'for' 解决方案是将所有的calc、security调用和plot函数移到全局范围。 如果您想用PP_display输入隐藏绘图,可以直接在plot函数的...
The first thing we’re going to do is add three new variables above the section of Lesson 5’s script that says “// Plot signals to chart”: bullishEC = close>open[1]and close[1]<open[1] bearishEC = close<open[1]and close[1]>open[1] ...
A simple indicator to plot 5 different types of moving averages (SMA, EMA, WMA, HMA, RMA) and VWAP in different colors. Setup Open "Pine Editor" Open the dropdown called "Open" Click "New indicator" Paste the script in and press "Add to chart" ...