Page 1 of 1

Kesişim fiyatını gösterme

Posted: Thu Jan 20, 2022 8:34 pm
by kartallkrall
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)

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

Posted: Sat Feb 19, 2022 2:20 am
by processingclouds
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)

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

Posted: Wed Feb 23, 2022 10:01 pm
by kartallkrall
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.

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

Posted: Wed Mar 09, 2022 8:17 am
by processingclouds
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.

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

Posted: Wed Mar 09, 2022 8:18 am
by processingclouds
As an example of storing it in a variable:

var float longPrice = 0.0
if long
longPrice := close