pine-script

Plotting a horizontal ray at the daily open on tradingview

丶灬走出姿态 提交于 2021-02-08 07:28:35
问题 Trying to plot a horizontal ray at the daily open, my code doesn't plot anything for some reason //@version=4 study("Opens +", overlay=true) higherTF1 = input("D", type=input.resolution) dailyopen = security(syminfo.tickerid, higherTF1, open) var line1 = line.new(bar_index, dailyopen,bar_index, dailyopen, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right) line.set_color(line1, color.black) line.set_width(line1, 1) 回答1: // mrtuanvn //@version=4 study("Open Ray to right", overlay

Angle of Line in Pine Script

99封情书 提交于 2021-02-07 03:08:40
问题 I would like to find price trend for last 200 bars in TradingView Pine Script language. I want to draw a line from latest bar (close) to 200 bars older one. Then I want to calculate the angle of the line in degrees to see how much bullish or bearish the trend. I can do this by Regression Trend tool in TradingView drawing screen easily. I want to do the same thing programmatically. I guess the angle can be found by this formula (Java): double rads = Math.Atan((line.Y2 - line.Y1) / (line.X2 -

Angle of Line in Pine Script

泪湿孤枕 提交于 2021-02-07 03:06:04
问题 I would like to find price trend for last 200 bars in TradingView Pine Script language. I want to draw a line from latest bar (close) to 200 bars older one. Then I want to calculate the angle of the line in degrees to see how much bullish or bearish the trend. I can do this by Regression Trend tool in TradingView drawing screen easily. I want to do the same thing programmatically. I guess the angle can be found by this formula (Java): double rads = Math.Atan((line.Y2 - line.Y1) / (line.X2 -

“alertcondition” fails when the condition comes from a security function

萝らか妹 提交于 2021-02-05 11:12:31
问题 I'm trying to create alerts based on conditions that derive from security functions. Below, the relevant piece of the code, and here is the entire code. s01 = input('BINANCE:BTCUSDT', type=input.symbol) screenerFunc() => triggerA and triggerB c01 = security(s01, res, screenerFunc()) alertcondition(condition=c01, title="Alert", message="Alert!") But I'm getting the following error for the last line: Cannot use a mutable variable as an argument of the security function. Appreciate the help! 回答1

Pinescript: Use text variable in Alerts

爷,独闯天下 提交于 2021-02-05 09:28:45
问题 I wish to include a text variable in the alertcondition. I am using alertcondition(scr_label!="" ,title="1.Screener ALert",message="Screener Alert:"+scr_label) Here scr_label is a dynamic text variable and I want the alert to give me that as the alert message. However if fires an alert without any message. How can I achieve this? 回答1: Detailed description in the documentation Help Center•Alerts•Alerts settings• How to use a variable value in alert The ability to generate variable text in

Pinescript: Use text variable in Alerts

旧街凉风 提交于 2021-02-05 09:28:31
问题 I wish to include a text variable in the alertcondition. I am using alertcondition(scr_label!="" ,title="1.Screener ALert",message="Screener Alert:"+scr_label) Here scr_label is a dynamic text variable and I want the alert to give me that as the alert message. However if fires an alert without any message. How can I achieve this? 回答1: Detailed description in the documentation Help Center•Alerts•Alerts settings• How to use a variable value in alert The ability to generate variable text in

Requests too many securities at PineScript

三世轮回 提交于 2021-01-29 20:10:52
问题 I am trying to make this script by adding all Binance pairs which are over 250 pairs but I am getting this message: "Script requests too many securities: 48. The limit is 40" is there any idea to add all Binance pairs? I found this solution but I didn't know how to use it on my code this the solution link: https://kodify.net/tradingview/errors/request-too-many-securities/ and here is my sample code : //@version=4 study("Custom Screener", overlay = false) customFunc() => close > open s1 =

How to detect if in ANY candle in the past 'n' candles meet a certain requirement?

人盡茶涼 提交于 2021-01-29 20:01:36
问题 I'd like to check if ANY candle in the past 'n' candles meet a certain condition. E.g. let's check if any close in the latest 20 candles was higher than 'x': x = 2 n = 20 condition = [ANY of n] > x 回答1: See barssince() and an example showing how to use it here. You can also count the number of occurrences of a condition in the last n bars using: sum(cond ? 1 : 0, len) Disclosure : the link in this answer points to a PineCoders FAQ entry. I am a member of the PineCoders community and I most

Plot STD Dev in Pinescript with custom parameters

好久不见. 提交于 2021-01-29 19:03:36
问题 Can anyone let me know how to plot STD Dev in Pinescript using custom parameters as mentioned below Period : 20 Multiplier : 4 Source : Close IS this correct x = 4 * stdev(close, 20) 回答1: Your code looks correct. You could also make input() variables for those variables. It'll be more convenient to change them, rather than hard-code them. For more information, see the answer to this question: Calculating standard deviation of last N elements of in a pine series It contains a custom

How to get high and low for a specific time period

99封情书 提交于 2021-01-29 17:23:29
问题 I am trying to write a strategy in Pinescript for trading view and I have to get the high and low values during a certain time period. Like 10:00 to 10:30 AM. In the documentation I can see the time range but not sure how to get high and low for that particular time period. 回答1: Good afternoon Vignesh, I am interested in your question and if you get an answer I would be grateful if you could share. I am not sure if the below might assist you. It captures the high and low of the first 60 mins