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
2
votes
3 answers

Calculating position size and stop based on account value?

Going to be a slightly tricky one to explain. I'm in the process of writing my very first Pine script, its a very simple system using RSI, I'm not expecting it to be successful necessarily I'm just trying to get my head around writing a system using…
Matt
  • 21
  • 2
2
votes
1 answer

Pine script input menu

I'm making an indicator with a built in menu with long and short signals ( crossover, crossunder) how do i use different values for the crossover and crossunder for each crypto pair to change long and short signal for each coin when selected from…
trkk
  • 21
  • 1
2
votes
1 answer

Drawing horizontal rays on highest closing price of a group of consecutive Heikin ashi candles using pinescript

I'm trying to code an indicator using the heikin ashi open and close prices. I want the program to draw a horizontal ray on the highest close price of a group of consecutive green or red heikin ashi candles. For example, if the heikin ashi trend…
Mike
  • 23
  • 3
2
votes
0 answers

Combined Multi-Indicator Pine Script Strategy with Input Options

Im new to pine script but have been working on an indicator/strategy that combines multiple indicators to generate a more complex trading strategy. For the most part I have worked through and succeeded with most of that stuff but looking for ideas…
Johnny
  • 21
  • 2
2
votes
1 answer

Pine Script: How to check if current time is 3:00 PM in GMT+5:30 timezone

In the PineScript v5, I am trying to develop a strategy where I don't intent to take any trade after 3:00 pm (in GMT+5:30 timezone). So if the current time is less than 3:00 pm, then only I will "entry"/"exit" the trades. Otherwise at 3:00 PM, I…
Pradip
  • 509
  • 1
  • 5
  • 22
2
votes
1 answer

Need help converting Tradingview pine script from version 1 to version 4

I am seeking for help with a pine script which is on version 2 right now but I am trying convert it into Version 5 and is having so many compilation errors. Below is the complete script I am trying to convert from V2 to V5 and error I am facing. so…
salem A
  • 21
  • 4
2
votes
1 answer

Find position entry price from ID

In Pine, if I made some strategy.order on a previous bar, with id "order ID", is there a function to retreive the entry price of that order on a later bar?
Tuor
  • 875
  • 1
  • 8
  • 32
2
votes
1 answer

Is there a way to hide the choice of color in the "Style" section?

I'm using this code to display a price line and a table. //@version=5 indicator('MyIndicator') ticker = input.symbol(defval='NSE:NIFTY', title='Ticker') ticker_col = input.color(color.new(color.blue, 0), title='Color') tickertext_col =…
Richard D.
  • 79
  • 5
2
votes
0 answers

How do I get this barssince to work in python?

I'm trying to convert indicator Top Bottom by ceyhun from tradingview to python. I am stuck converting the barssince lines. One of them is like this per = input(14, title="Bottom Period") loc = low < lowest(low[1], per) and low <= lowest(low[per],…
bia.migueis
  • 1,996
  • 2
  • 15
  • 23
2
votes
1 answer

Pine script alarm

I am having problem with setting up alerts on an indicator with buy, sell, short, cover lables. The condition for the signals is a when in trend. But at the moment I get a new alert for every candle my script is in trend. And obviously I only want…
2
votes
0 answers

Buy and exit orders on a specific price

I have made a strategy that works well except the important bit which is buying and selling. This is the relevant snippets of the code // Variables var float varEma20 = 0.0 //Signal Candle's 20 EMA which is gonna be used as the exit loss var…
omar
  • 293
  • 3
  • 13
2
votes
2 answers

Consecutive Red Candles then Consecutive green candles

I want to mark (plotshape) two consecutive red candles. Then two Consecutive green candles, after that again two consecutive red candles then two consecutive green candles. please see the picture, I need a pattern like this in pine script. …
faris
  • 82
  • 2
  • 8
2
votes
1 answer

"Highest value offset for a given number of bars back" meaning?

I'm new to Pine script, please, anyone explain me exactly what this high[abs(highestbars(amplitude))] statement returns, specially in highestbars(2) definition what it mean Highest value offset?? FYI this statement is from Tradingview.com HalfTrend…
2
votes
1 answer

PineScript order entry, stop loss and take profit

I am just getting to grips with PineScript and more specifically writing strategies to place orders/trades however, have a quick question. I want to create a basic template strategy that will enter a trade, set its stop loss and take profit, and…
2
votes
2 answers

How to set up a Strategy properly? V5

Being a beginner, I'm still confused; too many questions, to many options, it's a labyrinth for me yet, sorry for perhaps blunt questions… Here's the header: strategy(title="Testing Strategy Testing", initial_capital = 100000, default_qty_type =…
Vendrel
  • 865
  • 9
  • 19