Questions tagged [pine-script-v5]

This tag should be used for questions relating to scripts and code built specifically on version 5 of Trading View's Pine Script language.

2372 questions
0
votes
1 answer

Pre-market Open Pine Script Ver5

I 've been starting to dabble in writing some scripts for my day trading. I am currently stuck on how to get the premarket open price to stay as that. Currently what I have it shows the open then it follows the price action to the high side. It end…
0
votes
1 answer

Is there any function compulte the count of the macd histgoram line under the zero line between two indexs?

I have known the index of two top, is there any way to compute count of the macd histgoram line under the zero line between two indexs? I have searched the built-in functions but nothing found. I want a function like filter in js. e.g.…
LLLLLx
  • 5
  • 3
0
votes
1 answer

Session Input Less than 15 minutes

Is there a way to reduce the time units in the input fields. As a standard, only 15-minute steps are possible in the input. I would like to have time selection in discrete minutes. Is that possible
Max
  • 19
  • 1
0
votes
1 answer

How to access an array of UDT

In the Pine script reference manual the is a code snippet on https://www.tradingview.com/pine-script-docs/en/v5/language/Objects.html I want to know how to access the values of the array pivotHighArray. This is because I don't want to draw a line…
0
votes
0 answers

Correct trade direction at market open

How can I read the trade direction Long/Short of the last trade and trigger it when the market opens. Otherwise, with a time unit of 30 minutes, the script has to wait 30 minutes before it can be traded. It would therefore be great if you could read…
Max
  • 19
  • 1
0
votes
1 answer

How to return the strategy pyramiding number in tradingview in pinescript so that I can use it in the code itself?

How to return the strategy pyramiding number in tradingview in pinescript so that I can use it in the code itself? This is the original code: if strategy.opentrades == 2 or entry_long long_stop_level := entry_price - nLoss i intend to do the…
Jimmy
  • 1
  • 4
0
votes
1 answer

how to use request.security correctly for finding the lows in lower timeframes

I can find the lows based on sec_peakLow = ta.pivotlow(1, 1) plotshape(sec_peakLow, style=shape.triangleup, location=location.belowbar, color=color.new(color.red,50), offset = -1 , size=size.auto) now I am wondering if I can use the…
sey eeet
  • 229
  • 2
  • 8
0
votes
1 answer

Strategy not entering trades or exiting based off time format

I'm trying to develop a strategy that will Enter trades at 00:00 Get the previous days price range from 20:00 to 20:45 If difference is negative enter a long position, if difference is positive enter a short position Then exit the recently opened…
0
votes
1 answer

MACD histogram with a finer resolution

I have a strategy that I'm querying on the histogram of the MACD. Unfortunately, the alarms are always executed one time unit later in Tadingview. In many cases, this leads to mistrades. So I try to run the histogram and MACD in a smaller timeframe…
Max
  • 19
  • 1
0
votes
1 answer

Finding Highest Value of float variable

So far I have this code: indicator("Risk", overlay = false) fiftyD = ta.sma(close, 50) fiftyW = ta.sma(close, 350) average = fiftyD/fiftyW * math.pow(bar_index, 0.350) max = ta.max(average) min = ta.min(average) average_normalized = (average -…
RFA_
  • 37
  • 4
0
votes
2 answers

Query the price of a candle in real time

What possibility is there to query the price of a candle in real time and compare it with a variable. I want that when the price of the candle has reached the price of my long or short trade without it being closed, it will be canceled. Is that…
Max
  • 19
  • 1
0
votes
0 answers

Control alarms via session in tradingview

I just want to allow a certain amount of trading time per day and set the time via sessions. It works so far and the strategy.entries are not displayed in Tradingview either, but the alarms in Tradingview continue to run and are not deactivated when…
Max
  • 19
  • 1
0
votes
2 answers

Why strategy function in Pine Script always executes on the next bar instead the current bar?

I´m new in programming on Pine Scritp and I´m doing a strategy for opening long and sell positions. I have defined my conditions to enter to the market, but when i call strategy funtion, it executes on the next bar instead the current one, so, the…
0
votes
1 answer

Pine Script: Problem of alerts with strategy using calc_on_every_tick/On and pyramiding=0

I have a strategy with parameter calc_on_every_tick = ON and Pyramiding = 0 which buy Long with first strategy.order Id="Long0" and then if quote decrease under X% of "Long0", it would buy an other long position with strategy.order with a different…
0
votes
0 answers

Trigger TV alarms with If

Is there a way to trigger Tadingview alerts without going long or short. I want to close the trade at the end of the trading session. I tried that but nothing happens, no alarm is triggered days_close_trade = input.session("1545-1600", "Zeit für…
Max
  • 19
  • 1