Category "pine-script"

Get indicators on 1 hour daily time frame in correlation to daily timeframe

In one hour timeframe I am trying to study the four days of daily candles to know the trend to create an indicator on the 1 hour chart if I should make a sale o

How to delete a version in tradingview pine

I have been changing my tradingview pine code, when I save it, tradingview creates a version. Now I am getting confused with so many version. I want to delete t

Plot stop loss and take profit on chart, pinescript

I have defined the price levels have a way to close trades at that price, but i want to visually show the levels, just to visually verify them. Im new and could

Var flag doesn't seem to be working, it keeps resetting

I'm trying to put together a var cross flag to determine if the price crosses above the previous days' high. This is for a screener so further security requests

how do you store a value when a condition happens in pinescript ? ONLY ONCE

lets say i want the price when 2 EMAs crosses and use that price to create another variable as an stoploss but in realtime the price always changes in realtime

Im trying to move my stop loss when the first take profit is taken to breakeven or the entry price of where i entered from when 1/2 is taken off

im unable to move the stop loss to the entry price when i sell half of the position i have the entry price working and can get the price for the stop loss but i

How to extract a single value from a series?

I want to create a series in which every value is normalized to the value of a particular element in the series, for example the latest value. If you try syntax

Indicator for current price in Pine Script

Is there a way to create an indicator which reflects the current price of a stock in Pine Script? I need this indicator because I need to enter an order before

How pivothigh() and pivotlow() function work on Tradingview Pinescript?

I'm trying to rewrite a script to Python, but I can't figure out how pivothigh() and pivotlow() function work, and I can't find source code, I know how to calcu

Pine Script Strategy - Position Entry directly after Exit

i want to do a strategy that entries a position at the buy-level (blue Line) and sells after reaching the take-profit-Level (green line) or the stop-level (red

How to make the counting of an event's occurrences started from the occurrence of a(nother) certain event? V5

The function to be used in this case is: cnt = math.sum(cond ? 1 : 0, len) In my (defective) example: NumberOfOccurrencesToBeCounted = math.sum(OccurrencesToBe

Possible to call the "Regression Trend" tool in pine script?

TradingView has this convenient Regression Trend tool in its UI, which can generate the trend channel for a specified period of time. I'm trying to create a pin

Pine Script issue with repeated entries after strategy.exit

I've created a trading strategy in PineScript. I'm using strategy.entry to open longs and shorts (only one position at a time). And I am closing the current pos

Tradingview Pine Script help - how to not duplicate trigger alert

I am having issue with the code below. Apparently this code gives buy/sell plotshapes on the chart, but it gives too many duplicate shapes (multiple buy signals

Tradingview - Pinescript and strategy issues

I'm not a coder but doing my best :) I have made some code for tradingview where I use ema's and hoffman strategy to open and close orders. First it was an indi

How can get version@4 of this scripts with same result of version@2

strategy("P&F scalp strat", shorttitle="MEXlongOnly_strat", overlay=true) timeframe = input('1') box = input('Traditional') boxsize = input(1, type=float) r

How to implement a Super trend crossover

I am new to pine script. I am trying to create strategy with below condition. if current price is greater than supertrend(5,1) and current price is greater than

How to make more than 40 security() calls?

I know the maximum number of security() calls in pinescript is 40 but I came across following workaround from pinecoder.com : The limit for security() calls is

Is there a way to plot values from a google sheets workbook to tradingview pinescript?

I am trying to plot values calculated in an GoogleSheets workbook on a tradingview chart. I cannot do the same calculations in Tradingview because the values co

strategy.exit exiting all orders at arbitrary point even with independent pts/stop losses (pyramiding)

So this is a follow-up from my previous question. I've tried to utilize some arrays to create multiple buy, profit taking and stop orders so that trades can be