Codifica Insync Indicator da TradingView

Forums ProRealTime forum Italiano Supporto ProBuilder Codifica Insync Indicator da TradingView

Currently, there are 0 users and 1 guest visiting this topic.
View all attachments
Viewing 4 posts - 1 through 4 (of 4 total)
  • #138247 Report

    Buongiorno, come da titolo ho necessità di convertire l’Insync Indicator dal codice di TradingView. Questo è uno strumento di consenso, un aggregatore di una decina dei più comuni indicatori ai quali vengono attribuiti o sottratti 5 punti (partendo da una linea mediana di 50) in base alle indicazioni di ipervenduto o ipercomprato che forniscono; l’Insync in questo modo raggiunge le soglie estreme in prossimità del valore 100 oppure 0 e questo crea una zona di preallarme per operare sui mercati, meglio se accompagnato dalla formazione di pattern Candlestick.
    Segue il codice TradingView, fornisco anche il codice Metastock qualora fosse preferibile.
    Grazie per l’aiuto.

    //
    // @author LazyBear
    //
    //
    // v02, April0215, Updated to have dynamic levels
    //
    study(title = “Insync Index [LazyBear]”, shorttitle=”II_LB”)
    src=close
    Line95=input(95), Line75=input(75), Line25=input(25), Line5=input(5)
    div = input(10000, title=”EMO Divisor”, minval=1)
    emoLength = input(14, minval=1, title=”EMO length”)
    fastLength = input(12, minval=1, title=”MACD Fast EMA Length”)
    slowLength=input(26,minval=1, title=”MACD Slow EMA Length”)
    signalLength=input(9,minval=1, title=”MACD Signal Length”)
    mfiLength = input(20, minval=1, title=”MFI Length”)

    calc_emo() => sma(div * change(hl2) * (high – low) / volume, emoLength)
    calc_macd(source) =>
    fastMA = ema(source, fastLength)
    slowMA = ema(source, slowLength)
    fastMA – slowMA

    calc_mfi(length) =>
    src = hlc3
    upper = sum(volume * (change(src) <= 0 ? 0 : src), length) lower = sum(volume * (change(src) >= 0 ? 0 : src), length)
    mf = rsi(upper, lower)
    mf

    calc_dpo(period_) =>
    isCentered = false
    barsback = period_/2 + 1
    ma = sma(close, period_)
    dpo = isCentered ? close[barsback] – ma : close – ma[barsback]
    dpo

    calc_roc(source, length) =>
    roc = 100 * (source – source[length])/source[length]
    roc

    calc_stochD(length, smoothD, smoothK) =>
    k = sma(stoch(close, high, low, length), smoothK)
    d = sma(k, smoothD)
    d

    calc_stochK(length, smoothD, smoothK) =>
    k = sma(stoch(close, high, low, length), smoothK)
    //d = sma(k, smoothD)
    k

    lengthBB=input(20, title=”BB Length”), multBB=input(2.0, title=”BB Multiplier”)
    lengthCCI=input(14, title=”CCI Length”)
    dpoLength=input(18, title=”DPO Length”)
    lengthROC=input(10, title=”ROC Length”)
    lengthRSI=input(14, title=”RSI Length”)
    lengthStoch=input(14, title=”Stoch Length”),lengthD=input(3, title=”Stoch D Length”), lengthK=input(1, title=”Stoch K Length”)
    lengthSMA=input(10, title=”MA Length”)

    bolinslb=sma( src,lengthBB ) – multBB * ( stdev( src,lengthBB ) )
    bolinsub=sma( src,lengthBB ) + multBB * ( stdev( src,lengthBB ) )
    bolins2= (src- bolinslb ) / ( bolinsub – bolinslb )
    bolinsll=( bolins2 < 0.05 ? -5 : ( bolins2 > 0.95 ? 5 : 0 ) )
    cciins= ( cci(src, lengthCCI) > 100 ? 5 : ( cci(src, lengthCCI ) < -100 ? -5 : 0 ) )
    emvins2= calc_emo() – sma( calc_emo(),lengthSMA)
    emvinsb= ( emvins2 < 0 ? ( sma( calc_emo() ,lengthSMA ) < 0 ? -5 : 0 ) : 0 ) emvinss= ( emvins2 > 0 ? ( sma( calc_emo() ,lengthSMA ) > 0 ? 5 : 0 ) : 0 )
    macdins2= calc_macd( src) – sma( calc_macd( src) ,lengthSMA )
    macdinsb= ( macdins2 < 0 ? ( sma( calc_macd( src),lengthSMA ) < 0 ? -5 : 0 ) : 0 ) macdinss=( macdins2 > 0 ? ( sma( calc_macd( src),lengthSMA) > 0 ? 5 : 0 ) : 0 )
    mfiins=( calc_mfi( mfiLength ) > 80 ? 5 : ( calc_mfi( mfiLength ) < 20 ? -5 : 0 ) )
    pdoins2=calc_dpo( dpoLength ) – sma( calc_dpo( dpoLength ),lengthSMA )
    pdoinsb=( pdoins2 < 0 ? ( sma( calc_dpo( dpoLength ),lengthSMA) < 0 ? -5 : 0 ) :0 ) pdoinss=( pdoins2 > 0 ? ( sma( calc_dpo( dpoLength ),lengthSMA) > 0 ? 5 : 0 ) :0 )
    rocins2=calc_roc( src,lengthROC ) – sma( calc_roc( src,lengthROC ),lengthSMA )
    rocinsb=( rocins2 < 0 ? ( sma( calc_roc( src,lengthROC ),lengthSMA ) < 0 ? -5 : 0 ) : 0 ) rocinss = ( rocins2 > 0 ? ( sma( calc_roc( src,lengthROC ),lengthSMA ) > 0 ? 5 : 0 ) : 0 )
    rsiins= ( rsi(src, lengthRSI ) > 70 ? 5 : ( rsi(src, lengthRSI ) < 30 ? -5 : 0 ) ) stopdins=( calc_stochD(lengthStoch,lengthD,lengthK ) > 80 ? 5 : ( calc_stochD(lengthStoch,lengthD, lengthK ) < 20 ? -5 : 0 ) ) stopkins=( calc_stochK(lengthStoch,lengthD,lengthK) > 80 ? 5 : ( calc_stochK(lengthStoch,lengthD, lengthK ) < 20 ? -5 : 0 ) ) iidx = 50 + cciins + bolinsll + rsiins + stopkins + stopdins + mfiins + emvinsb + emvinss + rocinss + rocinsb + nz(pdoinss[10]) + nz(pdoinsb [10]) + macdinss + macdinsb ml=plot(50, color=gray, title=”Line50″) ll=plot(Line5, color= green, title=”Line5″) ul=plot(Line95, color = red, title=”Line95″) plot(Line25, color= green, style=3, title=”Line25″) plot(Line75, color = red, style=3, title=”Line75″) fill(ml, ll, color=red) fill(ml, ul, color=green) il=plot(iidx, color=maroon, linewidth=2, title=”InsyncIndex”) fill(ml,il,black) bc = iidx >= 50 ? (iidx >= Line95 ? #336600 : iidx >= Line75 ? #33CC00 : #00FF00) :
    (iidx <= Line5 ? #990000 : iidx <= Line25? #CC3300 : #CC9900)

    ebc = input(false, title=”Enable Barcolors”)
    barcolor(ebc?bc:na)

    ———————–

    Codice Metastock

    BOLInSLB
    Mov( C ,20 ,S ) – 2 * ( Std( C ,20 ) )

    BOLInSUB
    Mov( C ,20 ,S ) + 2 * ( Std( C ,20 ) )

    BOLInS2
    ( C – Fml( “BOLInSLB” ) ) / ( Fml( “BOLInSUB” ) – Fml( “BOLInSLB” ) )

    BOLInSLL
    If( Fml( “BOLInS2” ) ,< , .05 ,-5 ,If( Fml( “BOLInS2” ) ,> ,.95 ,5 ,0 ) )

    CCIInS
    If( CCI(14 ) ,> ,100 ,5 ,If ( CCI(14 ) ,< ,-100 ,-5 ,0 ) )

    EMVInS2
    EMV(10 ,S ) – Mov( EMV(10 ,S) ,10 ,S )

    EMVInSB
    If( Fml( “EMVInS2” ) ,< ,0 ,If( Mov( EMV(10 ,S ) ,10 ,S ) ,< ,0 ,-5 ,0 ) ,0 )

    EMVInSS
    If( Fml( “EMVInS2” ) ,> ,0 ,If( Mov( EMV(10 ,S ) ,10 ,S ) ,> ,0 ,5 ,0 ) ,0 )

    MACDInS2
    MACD( ) – Mov( MACD( ) ,10 ,S )

    MACDinSB
    If( Fml( “MACDInS2” ) ,< ,0 ,If( Mov( MACD( ) ,10 ,S ) ,< ,0 ,-5 ,0 ) ,0 )

    MACDInSS
    If( Fml( “MACDInS2” ) ,> ,0 ,If( Mov( MACD( ) ,10 ,S) ,> ,0 ,5 ,0 ) ,0 )

    MFIInS
    If( MFI( 20 ) ,> ,80 ,5 , If( MFI( 20 ) ,< ,20 ,-5 ,0 ) )

    PDOInS2
    DPO( 18 ) – Mov( DPO( 18 ) ,10 ,S )

    PDOInSB
    If( Fml( “PDOInS2” ) ,< ,0 ,If( Mov( DPO( 18 ) ,10 , S) ,< ,0 ,-5 ,0 ) ,0 )

    PDOInSS
    If( Fml( “PDOInS2” ) ,> ,0 ,If( Mov( DPO ( 18 ) ,10 ,S) ,> ,0 ,5 ,0 ) ,0 )

    ROCInS2
    ROC( C ,10 ,$ ) – Mov( ROC( C ,10 ,$ ) ,10 ,S )

    ROCInSB
    If( Fml( “ROCInS2” ) ,< ,0 ,If( Mov( ROC( C ,10 ,$ ) ,10 ,S ) ,< ,0 ,-5 ,0 ) ,0 )

    ROCInSS Index
    If( Fml( “ROCInS2” ) ,> ,0 ,If( Mov( ROC( C ,10 ,$ ) ,10 ,S ) ,> ,0 ,5 ,0 ) ,0 )

    RSIInS
    If( RSI(14 ) ,> ,70 ,5 ,If( RSI(14 ), < ,30 ,-5 ,0 ) )

    STO%dInS
    If( Stoch(14 ,3 ) ,> ,80 ,5 ,If( Stoch(14 ,3 ) ,< ,20 ,-5 ,0 ) )

    STO%kInS
    If( Stoch(14 ,1) ,> ,80 ,5 ,If( Stoch(14 ,1 ) ,< ,20 ,-5 ,0 ) )

    InSync Index
    50 + Fml( “CCIInS” ) + Fml( “BOLInSLL” ) + Fml( “RSIInS” ) + Fml( “STO%kInS ” ) + Fml( “STO%dInS” ) + Fml( “MFIInS” ) + Fml( “EMVInSB” ) + Fml( “EMVInSS” ) + Fml( “ROCInSS” ) + Fml( “ROCInSB” ) + Ref (Fml( “PDOInSS” ) ,-10 ) + Ref (Fml( “PDOInSB” ) ,-10 ) + Fml( “MACDInS S” ) + Fml( “MACDInSB” )

     

    Attachments:
    #145352 Report

    Ci scusiamo per il ritardo nella risposta, ho aggiunto questa conversione alla mia lista, lo farò al più presto

    #145964 Report

    L'indicatore è stato convertito, puoi scaricarlo da qui: Indice Insync

    Attachments:
    #145990 Report

    Grazie Nicolas per il prezioso aiuto.

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login