kartallkrall
Pine Script Rookie
Pine Script Rookie
Posts: 2
Joined: January 20th, 2022

Kesişim fiyatını gösterme

I did a scan on the chart page in TradingView, but where I got stuck,
Example: I want to get the price that ema50 cuts ema 200 and the instant price of the asset in the frame.
I have the intersecting ones brought, but I could not print the prices. I can't send the samples as photos, I'm attaching them as links.
I made the translation with the translet, sorry for the mistakes

i want to do: https://www.hizliresim.com/o78v4ol
what i can do: https://www.hizliresim.com/ncd7yps

//@version=4
study("tarama")

sure='1'

ema5 =ema(close, 5)
ema10 =ema(close, 10)


long = crossover(ema5,ema10)
short = crossunder(ema5,ema10)

customFuncl() =>long
customFuncs() =>short

t1=input('BTCUSDTPERP', title='Symbol 01',type=input.symbol)
t2=input('ADAUSDTPERP', title='Symbol 02',type=input.symbol)
s1 = security(t1, timeframe.period, customFuncl())
s2 = security(t2, timeframe.period, customFuncl())
s01 = security(t1, timeframe.period, customFuncs())
s02 = security(t2, timeframe.period, customFuncs())


scr_label = 'Long Gir: \n---------\n'

scr_label := s1 ? scr_label + 'BTCUSDTPERP\n' : scr_label
scr_label := s2 ? scr_label + 'ADAUSDTPERP\n' : scr_label

scrs_label = 'Short Gir: \n---------\n'

scrs_label := s01 ? scrs_label + 'BTCUSDTPERP\n' : scrs_label
scrs_label := s02 ? scrs_label + 'ADAUSDTPERP\n' : scrs_label



lab_1 = label.new(bar_index-10, 0, scr_label, color=color.green, textcolor=color.white, style = label.style_label_down, yloc = yloc.price)
label.delete(lab_1[1])
plot(0, transp = 100)

lab_2 = label.new(bar_index, 0, scrs_label, color=color.red, textcolor=color.white, style = label.style_label_down, yloc = yloc.price)
label.delete(lab_2[1])
plot(0, transp = 100)

processingclouds
Pine Script Master
Pine Script Master
Posts: 115
Joined: January 30th, 2022

Re: Kesişim fiyatını gösterme

Check this code out to see if this is what you are looking to do. Your question is not really clear, so more input would help refine the solution.

Code: Select all

//@version=4
study("tarama")

sure='1'

ema5 =ema(close, 5)
ema10 =ema(close, 10)


long = crossover(ema5,ema10)
short = crossunder(ema5,ema10)

customFuncl() =>long
customFuncs() =>short

t1=input('BTCUSDTPERP', title='Symbol 01',type=input.symbol)
t2=input('ADAUSDTPERP', title='Symbol 02',type=input.symbol)
s1 = security(t1, timeframe.period, customFuncl())
s2 = security(t2, timeframe.period, customFuncl())
s01 = security(t1, timeframe.period, customFuncs())
s02 = security(t2, timeframe.period, customFuncs())


scr_label = 'Long Gir: \n---------\n'

scr_label := s1 ? scr_label + 'BTCUSDTPERP\n' : scr_label
scr_label := s2 ? scr_label + 'ADAUSDTPERP\n' : scr_label

scrs_label = 'Short Gir: \n---------\n'

scrs_label := s01 ? scrs_label + 'BTCUSDTPERP\n' : scrs_label
scrs_label := s02 ? scrs_label + 'ADAUSDTPERP\n' : scrs_label


if (s1 or s2)
    label.new(bar_index, 0, scr_label, color=color.green, textcolor=color.white, style = label.style_label_down, yloc = yloc.price)
if (s01 or s02)
    label.new(bar_index, 0, scrs_label, color=color.red, textcolor=color.white, style = label.style_label_up, yloc = yloc.price)

plot(0, transp = 0)

kartallkrall
Pine Script Rookie
Pine Script Rookie
Posts: 2
Joined: January 20th, 2022

Re: Kesişim fiyatını gösterme

When the crossover or crossunder condition is met, at what price the intersection occurred, Example: Ema5 crossover from the symbol list I specified is written on the Ema10 Long table, but at what price it cut or on the Ema5 crossunder Ema10 Short table, but at what price the two ema crossed.

processingclouds
Pine Script Master
Pine Script Master
Posts: 115
Joined: January 30th, 2022

Re: Kesişim fiyatını gösterme

To get the price when it cut, just store the close value in a variable. Script runs on each candle, so even if you use close value when it crossed over , it will work.

processingclouds
Pine Script Master
Pine Script Master
Posts: 115
Joined: January 30th, 2022

Re: Kesişim fiyatını gösterme

As an example of storing it in a variable:

var float longPrice = 0.0
if long
longPrice := close

Return to “Pine Script Q&A”