Pine Script 中 First Candle 的高低点之间的点数 [英] Number of pips between high and low of First Candle in Pine Script

查看:147
本文介绍了Pine Script 中 First Candle 的高低点之间的点数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 pine 脚本编写一个代码,使我能够计算当天第一根蜡烛的最高价和最低价之间的点数.我也想以变量的形式使用这个值来设置止损和目标.

I want to write a code in pine script that enables me to calculate the number of pips between the high and low of only the First candle of the day. I also want to use this value in the form of a variable to set stop losses and targets.

我在网上得到了这个,但不知道它是如何工作的.我们可以修改它以满足上述标准吗?

I got this on the web but don't know how it works. Can we modify this to meet the above criteria?

getHighLowNumPips() =>(高 - 低)/syminfo.mintick

plot(getHighLowNumPips())

我是 pine 脚本的新手,我不会编写代码.任何帮助将不胜感激:)

I am a newbie in pine script and I am not able to write the code. Any help will be greatly appreciated :)

谢谢,

推荐答案

在下面的示例中,脚本将根据您的 getHighLowNumPips 函数计算当天第一根蜡烛上的点数并忽略其他蜡烛.

In the example below the script will calculate the number of pips according to your getHighLowNumPips function on the first candle of the day and ignore other candles.

getHighLowNumPips() => (high - low) / syminfo.mintick 

bool isNewDay = dayofmonth != dayofmonth[1]

var float highLowPips = na
if isNewDay
    highLowPips := getHighLowNumPips()

plot(highLowPips)

请注意,内置的 dayofmonth 使用交易所的时区.

Note that built-in dayofmonth use the exchange's timezone.

这篇关于Pine Script 中 First Candle 的高低点之间的点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆