Category "pinescript-v5"

Get & apply setting (e.g. color) from another indicator

I am creating multiple indicators - ideally to be used together. Since many levels share the same coloring, I was wondering if I can get the color a user may sp

Pine Script v5, EMA clouds and alerts

Trying to learn Pine script here to optimize my trading strategy. I have around 1.5 year of experience trading. The trendsystem Im using is the all mighty Ripst

My strategy.cancel does not close my trades, when criteria is met. Why?

I'm trying to hunt down a bug. My strategy wouldn't close, even if the closing criteria is met. I checked multiple point manually, using the Data Window which c

Pinescript "undeclared Identifier"

I am getting an Undeclared identified 'd' error. This was converted from an indicator that had alerts. But when I had them in TV nothing would happen. I can't s

Draw a horizontal line in Pine at trade entry

There is a simple script on Pine. When executing strategy.entry, I try to draw a horizontal line at the level of the trade entry price. The only way I found to

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

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

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

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

Pine Script - ternary operator in "display" parameter in plot call causes invalid argument error

//@version=5 strategy(title='Test',overlay=true) i_hide_eq = input.bool(true, title='Hide Equity Curve') plot(strategy.equity, display=i_hide_eq ? display.none

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 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 convert strategy to study pinescript V5

I need to figure out how to turn my strategy into a study for V5 Pinescript. I cannot seem to find any info about it online. Im pretty sure for v3 you have to c

Price crossing levels in both directions, in realtime bar, not activating subsequent alerts

My code is configured to initiate an alert whenever the current price crosses a predetermined buy/sell level. This part works. However, in certain time frames (

plotting Candles as Seconds Timefame/ Chart(TradingView/Pinescript)

is there a way to plot candles as Seconds Timeframe, without using a timeframe.isseconds. found a calculation but i cant plot candle on it. // calculate bar tim

Multi-TF Volume Table (Pine Script)

I'm making an indicator to calculate two EMAs, compare which one is greater, and then deliver the user a bias of bullish or bearish (by coloring the second row