soru

MAcross tracker

12
Please test it :)
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
study("MAcross tracker",overlay=true)
k = ismonthly ? 'M' : isweekly ? 'W' : isdaily ? 'D' : ''
ma_len = input(200)
TW1=input('240')
TW2=input('1D')
TW3=input('1W')
TW4=input('1M')
Ins1 = input("FX:USDCAD")
Ins2 = input("FX:AUDUSD")
Ins3 = input("FX:EURUSD")
Ins4 = input("FX:GBPUSD")
signal(x,y)=>
    ma = security(y,x, sma(close,ma_len))
    c = security(y,x, close)
    s = cross(ma,c) ? cross(ma,c) : na
    [s]

[s1_TW1] = signal(TW1,Ins1)
[s1_TW2] = signal(TW2,Ins1)
[s1_TW3] = signal(TW3,Ins1)
[s1_TW4] = signal(TW4,Ins1)
[s2_TW1] = signal(TW1,Ins2)
[s2_TW2] = signal(TW2,Ins2)
[s2_TW3] = signal(TW3,Ins2)
[s2_TW4] = signal(TW4,Ins2)
[s3_TW1] = signal(TW1,Ins3)
[s3_TW2] = signal(TW2,Ins3)
[s3_TW3] = signal(TW3,Ins3)
[s3_TW4] = signal(TW4,Ins3)
[s4_TW1] = signal(TW1,Ins4)
[s4_TW2] = signal(TW2,Ins4)
[s4_TW3] = signal(TW3,Ins4)
[s4_TW4] = signal(TW4,Ins4)
hline(1,color=black,linewidth=2)
plotshape(s1_TW1 ? 1 : na,style=shape.labeldown,color=#006600, textcolor=black,text='4h', location=location.absolute)
plotshape(s1_TW2 ? 1 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1D', location=location.absolute)
plotshape(s1_TW3 ? 1 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1W', location=location.absolute)
plotshape(s1_TW4 ? 1 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1M', location=location.absolute)
hline(2,color=black,linewidth=2)
plotshape(s2_TW1 ? 2 : na,style=shape.labeldown,color=#006600, textcolor=black,text='4h', location=location.absolute)
plotshape(s2_TW2 ? 2 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1D', location=location.absolute)
plotshape(s2_TW3 ? 2 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1W', location=location.absolute)
plotshape(s2_TW4 ? 2 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1M', location=location.absolute)
hline(3,color=black,linewidth=2)
plotshape(s3_TW1 ? 3 : na,style=shape.labeldown,color=#006600, textcolor=black,text='4h', location=location.absolute)
plotshape(s3_TW2 ? 3 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1D', location=location.absolute)
plotshape(s3_TW3 ? 3 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1W', location=location.absolute)
plotshape(s3_TW4 ? 3 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1M', location=location.absolute)
hline(4,color=black,linewidth=2)
plotshape(s4_TW1 ? 4 : na,style=shape.labeldown,color=#006600, textcolor=black,text='4h', location=location.absolute)
plotshape(s4_TW2 ? 4 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1D', location=location.absolute)
plotshape(s4_TW3 ? 4 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1W', location=location.absolute)
plotshape(s4_TW4 ? 4 : na,style=shape.labeldown,color=#006600, textcolor=black,text='1M', location=location.absolute)
bgcolor(n>n[1] ? blue : gray)