Questions tagged [pine-script]

Pine Script is a domain-specific language for coding custom technical indicators and strategies on TradingView. Use this tag for questions related to programming in Pine Script. Please do not use the [tradingview-api] tag for Pine-related questions.

Pine Script is a domain-specific language for coding custom technical indicators and strategies on TradingView. Use this tag for questions related to programming in Pine Script.

6637 questions
0
votes
1 answer

Understanding a for loop in Pine Script that seems to exceed the size of an array

I am working with a Pine Script code snippet from KernelFunctions which uses a for loop to iterate through an array. The loop declaration is as follows: for i = 0 to _size + startAtBar Here _size is the size of the input array and startAtBar is an…
aasungh
  • 85
  • 1
  • 5
0
votes
0 answers

add a condition for entry between open and close

helloo friends, can somebody help be with adding a condition where close[len] is between open and close of starpoint. so basically this code draws a divergence line between 2 candles, what I want is that the second candle close is between the first…
0
votes
1 answer

plotshape not plotting on expected candle

I am trying plot circle above candle when SMA50 falls between candle low and a low threashold of 1%. I am using code below. // This source code is subject to the terms of the Mozilla Public License 2.0 at…
dejjub-AIS
  • 1,501
  • 2
  • 24
  • 50
0
votes
1 answer

Why is the script calculating wrong?

I'm writing a script that compares the evolution of % difference between two symbols but I can't figure out why it gets the calculation wrong. Here is the script : //@version=4 study(title="Compare", shorttitle="Compare") rocPeriod = input(1, minval…
FIreRavage
  • 21
  • 1
0
votes
1 answer

How to use custom location for plotshape in TradingView Pine Script

I am coding long short entry exit conditions and trying to plot shapes on TradingView chart based on those conditions, but I need to use custom location rather than the inbuilt location options. I particularly need to move the shapes on the Y axis…
0
votes
0 answers

Higher Timeframe request.security() function issue - RSI based Moving Average

I am trying plotting RSI-based moving average line with length= 4000 with and without request.security() function. I want to plot two lines with and without security that overlaps completely. here's what I did so far. so without security, here is…
0
votes
1 answer

strategy.entry. How to enter inside bar?

How to enter a trade inside the bar, not at the close? I tried to use "magnifier on" but it did not help. strategy.entry("Long", strategy.long) strategy.exit("Sell Stop", "Long", stop=lastOppositeFractalDown) lastStop := lastOppositeFractalDown
0
votes
1 answer

Fixing timeframe in pinecode strategy

I am new to pine code and i want to draw lines (horizontal) on second 5 min candle high and low, however i want to fix this timeframe in strategy. Currently in below code, if i view the chart in 3 min, strategy changes to 3 min high low.. I want it…
0
votes
1 answer

Grid order with multiple take profits

Is it possible to have a grid order with multiple take profits? By grid order I mean, multiple entries with different prices spread within a range. I know I can have multiple take profits and grid orders, but could not find them together. I could…
Jose
  • 1
0
votes
1 answer

Total Shares Outstanding not working any longer in v5 pine script

I have just tried this //@version=5 indicator("MarketCap", overlay=true, timeframe="", timeframe_gaps=true) Outstanding = request.financial(syminfo.tickerid, "TOTAL_SHARES_OUTSTANDING", "FQ") MarketCap = Outstanding*close plotchar(MarketCap,…
AndiAna
  • 854
  • 6
  • 26
0
votes
0 answers

Using series int as series limiter provides unexpected results

I want to be able to get the historic 30-min bars for a ticker, starting at yesterday's bars (ie. I don't want to consider today's bars) to find highs and lows. To do this I (1) detect how many bars I have to go back to when dayofmonth() changes…
glemmestad
  • 11
  • 2
0
votes
0 answers

Pinescript - Alert trigger when trend ends

I want to trigger an alert on the script executed below. An alert should be triggered at the end of the up or down movement. Therefore, when the green up line comes to an end, the alert should be triggered on the next candle. It should be achieved…
0
votes
0 answers

Pinescript array.get ignores starting point when given a computed int var instead of a constant int

I am writing a script that detects the highest highs and lowest lows in the previous N days and plots them as horizontal zones. I want to use the OHLC data from 30-min bars to be able to use the tail size to plot the depth of the zone/box,…
glemmestad
  • 11
  • 2
0
votes
0 answers

How can I specify a date and time range in pinescript

I am curious if there is a way to specify certain date and time ranges , for example Jan 1, 2023 12:00 - 14:30 , the range would be on the same day and only be within a 30 minute fixed distance. Looking at docs and examples I am able to specify…
0
votes
1 answer

Pine Script - Setting up Alerts on TradingView for Trading Bot

I am trying to setup alerts for TradingView with my strategy to use on a trading bot. I want to add alerts for: Buying Long Closing Long Buying Short Closing Short when I try adding alerts I don't get the buy/sell conditions in the "Add Alerts"…
1 2 3
99
100