Пока за всё время не ошибался. Посмотри отработает ли на этот раз.
Скрипт:
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © NgUTech
//version=5
indicator("Bitcoin Golden Pi Cycles", overlay=true)
auto = input.bool(true, 'Auto Calculate Fast MA period', tooltip='Fast MA days are calculated to give the best approximatation to π and πϕ (ignores entered number). See indicator description for more information.')
a_days = input.int(111, 'Top Fast MA (Days)', inline='A')
a_mult = input.int(1, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='A')
b_days = input.int(350, 'Top Slow MA (Days)', inline='B')
b_mult = input.int(2, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='B')
c_days = input.int(138, 'Bottom Fast MA (Days)', inline='C')
c_mult = input.int(1, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='C')
d_days = input.int(700, 'Bottom Slow MA (Days)', inline='D')
d_mult = input.int(1, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='D')
[a_, b_, c_, d_] = request.security(syminfo.tickerid, 'D', [ta.sma(close, auto ? math.round(b_days/math.pi) : a_days)[barstate.isrealtime ? 1 : 0], ta.sma(close, b_days)[barstate.isrealtime ? 1 : 0], ta.sma(close, auto ? math.round(d_days/math.pi/math.phi) : c_days)[barstate.isrealtime ? 1 : 0], ta.sma(close, d_days)[barstate.isrealtime ? 1 : 0]])
a = a_mult*a_[barstate.isrealtime ? 0 : 1]
b = b_mult*b_[barstate.isrealtime ? 0 : 1]
c = c_mult*c_[barstate.isrealtime ? 0 : 1]
d = d_mult*d_[barstate.isrealtime ? 0 : 1]
plot(a, 'Top Fast MA', color= color.orange)
plot(b, 'Top Slow MA', color= color.red)
plot(c, 'Bottom Fast MA', color= color.teal)
plot(d, 'Bottom Slow MA', color= color.blue)
isTop = ta.crossover(a, b)
isBottom = ta.crossover(d, c)
plotshape(isTop, 'Top Labels', shape.labeldown, location.abovebar, color.green, text='Top', textcolor=color.white, size=size.large)
plotshape(isBottom, 'Bottom Labels', shape.labelup, location.belowbar, color.red, text='Bottom', textcolor=color.white, size=size.large)
alertcondition(isTop, "Cycle Top", message="Pi Cycle Top")
alertcondition(isBottom, 'Cycle Bottom', message="Golden Pi Cycle Bottom")
Скрипт:
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © NgUTech
//version=5
indicator("Bitcoin Golden Pi Cycles", overlay=true)
auto = input.bool(true, 'Auto Calculate Fast MA period', tooltip='Fast MA days are calculated to give the best approximatation to π and πϕ (ignores entered number). See indicator description for more information.')
a_days = input.int(111, 'Top Fast MA (Days)', inline='A')
a_mult = input.int(1, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='A')
b_days = input.int(350, 'Top Slow MA (Days)', inline='B')
b_mult = input.int(2, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='B')
c_days = input.int(138, 'Bottom Fast MA (Days)', inline='C')
c_mult = input.int(1, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='C')
d_days = input.int(700, 'Bottom Slow MA (Days)', inline='D')
d_mult = input.int(1, 'Multiplier', options=[1, 2, 3, 5, 8, 13, 21, 34], inline='D')
[a_, b_, c_, d_] = request.security(syminfo.tickerid, 'D', [ta.sma(close, auto ? math.round(b_days/math.pi) : a_days)[barstate.isrealtime ? 1 : 0], ta.sma(close, b_days)[barstate.isrealtime ? 1 : 0], ta.sma(close, auto ? math.round(d_days/math.pi/math.phi) : c_days)[barstate.isrealtime ? 1 : 0], ta.sma(close, d_days)[barstate.isrealtime ? 1 : 0]])
a = a_mult*a_[barstate.isrealtime ? 0 : 1]
b = b_mult*b_[barstate.isrealtime ? 0 : 1]
c = c_mult*c_[barstate.isrealtime ? 0 : 1]
d = d_mult*d_[barstate.isrealtime ? 0 : 1]
plot(a, 'Top Fast MA', color= color.orange)
plot(b, 'Top Slow MA', color= color.red)
plot(c, 'Bottom Fast MA', color= color.teal)
plot(d, 'Bottom Slow MA', color= color.blue)
isTop = ta.crossover(a, b)
isBottom = ta.crossover(d, c)
plotshape(isTop, 'Top Labels', shape.labeldown, location.abovebar, color.green, text='Top', textcolor=color.white, size=size.large)
plotshape(isBottom, 'Bottom Labels', shape.labelup, location.belowbar, color.red, text='Bottom', textcolor=color.white, size=size.large)
alertcondition(isTop, "Cycle Top", message="Pi Cycle Top")
alertcondition(isBottom, 'Cycle Bottom', message="Golden Pi Cycle Bottom")
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.