Relative Content

Tag Archive for pine-script-v5

How to convert series int to const int?

I am new to pine script and I am trying to get nifty 50 index ATM strike price automatically from current market price using the below code.
spot_atm_NF = input.int((50*math.round(spot_close/50)), title = "Ref -Strike" ,group=grpNifty,inline="NF")

How to convert series int to const int?

I am new to pine script and I am trying to get nifty 50 index ATM strike price automatically from current market price using the below code.
spot_atm_NF = input.int((50*math.round(spot_close/50)), title = "Ref -Strike" ,group=grpNifty,inline="NF")

How to convert series int to const int?

I am new to pine script and I am trying to get nifty 50 index ATM strike price automatically from current market price using the below code.
spot_atm_NF = input.int((50*math.round(spot_close/50)), title = "Ref -Strike" ,group=grpNifty,inline="NF")

Pine Script Initial funds cannot be changed according to conditions

var float start_cash = 1000 var int Percen_count = 0 // loss Count // Check the last closed trade for loss and update funds if (strategy.closedtrades > 0) last_trade_exit_price = strategy.closedtrades.exit_price(strategy.closedtrades-1) last_trade_entry_price = strategy.closedtrades.entry_price(strategy.closedtrades-1) // Get the size of the last transaction last_trade_size = strategy.closedtrades.size(strategy.closedtrades-1) // Calculate actual profit or loss trade_profit_loss = (last_trade_exit_price – […]

Trailing stop alerts

Is there a way to have Trading View only trigger an alert after a trailing stop trade fills? The default behavior is to trigger the alert as soon as the strategy.exit is called.

Pinescript trying to draw lines for previous daily ohlc

I try to draw previous daily ( for now once I get it it will be weekly % monthly as well) ohlc starting from beginning of daily bar and extended to the right
the problem I get when I use array.set(pdtime,x, request.security(syminfo.tickerid, ‘D’, time[x])) is I can’t use this in a loop, can’t use a loop with request.security… I need another way to get the ohlc into an array, and to be able to draw lines using the array.get
thank you

Reset a flag after being plotted once

I want to develop an indicator that plots a label when a stock drops by 10% from the recent high.
The code I wrote initially works fine, but I keep plotting a 10% drop label after 10% on all candles.
I changed the code so that when a stock drops 10% from the previous high, the plot 10% drop label only once. If the stock drops an additional 10%, then it plots a 20% label.