Conversion de code Reversal de tradeView

Forums ProRealTime forum Français Support ProScreener Conversion de code Reversal de tradeView

Viewing 1 post (of 1 total)
  • #175913

    Bonjour je souhaiterai convertir ce code origine tradeview vers prorealcode quelqu’un peu il m’aider.

    L’idée est en faire un screener qui me sorte toutes les actions triggé par l’algorithme

    C’est de loin le plus efficace que j’ai pu tester sur tradeview pour mes besoin.

    J’ai fait quelque tentatives infructueuse

    Merci pour votre aide.

     

    NB:

    C la première fois que je post sur ce forum si je me suis trompé de rubrique je m’en excuse.

     

    //@version=4
    ////////////////////////////////////////////////////////////
    // Copyright by HPotter v1.0 28/07/2021
    // This is combo strategies for get a cumulative signal.
    //
    // First strategy
    // This System was created from the Book “How I Tripled My Money In The
    // Futures Market” by Ulf Jensen, Page 183. This is reverse type of strategies.
    // The strategy buys at market, if close price is higher than the previous close
    // during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
    // The strategy sells at market, if close price is lower than the previous close price
    // during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
    //
    // Second strategy
    // A type of technical indicator that is created by plotting two bands around
    // a short-term simple moving average (SMA) of an underlying asset’s price.
    // The upper band is created by adding a value of the average true range
    // (ATR) – a popular indicator used by technical traders – to the moving average.
    // The lower band is created by subtracting a value of the ATR from the SMA.
    // STARC is an acronym for Stoller Average Range Channels. The indicator is
    // named after its creator, Manning Stoller.
    //
    // WARNING:
    // – For purpose educate only
    // – This script to change bars colors.
    ////////////////////////////////////////////////////////////
    Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing)
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
    iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
    pos

    STARC(LengthMA,LengthATR,K) =>
    pos = 0.0
    xMA = sma(close, LengthMA)
    xATR = atr(LengthATR)
    xSTARCBandUp = xMA + xATR * K
    xSTARCBandDn = xMA – xATR * K
    pos := iff(close > xSTARCBandUp, 1,
    iff(close < xSTARCBandDn, -1, nz(pos[1], 0)))
    pos

    strategy(title=”Combo Backtest 123 Reversal & STARC Bands”, shorttitle=”Combo”, overlay = true)
    line1 = input(true, “—- 123 Reversal —-“)
    Length = input(14, minval=1)
    KSmoothing = input(1, minval=1)
    DLength = input(3, minval=1)
    Level = input(50, minval=1)
    //————————-
    line2 = input(true, “—- STARC Bands —-“)
    LengthMA = input(5, minval=1)
    LengthATR = input(15, minval=1)
    K = input(1.33, minval=0.01, step = 0.01)
    reverse = input(false, title=”Trade reverse”)
    posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
    posSTARC = STARC(LengthMA,LengthATR,K)
    pos = iff(posReversal123 == 1 and posSTARC == 1 , 1,
    iff(posReversal123 == -1 and posSTARC == -1, -1, 0))
    possig = iff(reverse and pos == 1, -1,
    iff(reverse and pos == -1 , 1, pos))
    if (possig == 1 )
    strategy.entry(“Long”, strategy.long)
    if (possig == -1 )
    strategy.entry(“Short”, strategy.short)
    if (possig == 0)
    strategy.close_all()
    barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )

Viewing 1 post (of 1 total)

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