Conversion de la strategie SSL CHANNEL CROSS de Tradingview

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #193289 quote
    ARCO75
    Participant
    Average

    cette strategie simple de TradingView , basée sur le croisement de 2 lignes donne des resultats backtests assez interessants que je souhaite utiliser sur PRT

    Code TradingView

    //@version=4
    strategy(“SSL Channel Cross”, overlay=true)
    period=input(title=”Period”, defval=10)
    len=input(title=”Period”, defval=10)
    smaHigh=sma(high, len)
    smaLow=sma(low, len)
    Hlv = 0
    Hlv := close > smaHigh ? 1 : close < smaLow ? -1 : Hlv[1] sslDown = Hlv < 0 ? smaHigh: smaLow sslUp = Hlv < 0 ? smaLow : smaHigh plot(sslDown, linewidth=2, color=color.red) plot(sslUp, linewidth=2, color=color.lime) longCondition = crossover(sslUp, sslDown) shortCondition = crossunder(sslUp, sslDown) if (longCondition) strategy.close("Short", strategy.long) strategy.entry("Long", strategy.long) if (shortCondition) strategy.close("Long", strategy.long) strategy.entry("Short", strategy.short) Merci d'avance

    Tradingview-CHANNEL-STRATEGIE.png Tradingview-CHANNEL-STRATEGIE.png
    #193307 quote
    Nicolas
    Keymaster
    Master

    Il s’agit d’une stratégie basé sur un ‘activator’, genre cette indicateur : https://www.prorealcode.com/prorealtime-indicators/gann-hilo-activator/

    Si le Close croise la ligne du dessus, alors on est en tendance haussière et vice versa, on peut créer ces lignes avec beaucoup d’autres choses (exemple un Donchian: https://www.prorealcode.com/prorealtime-indicators/donchian-channel-activator-factor/ ou des Bandes de Bollinger: https://www.prorealcode.com/prorealtime-indicators/bbands-stop/), ici ce sont des MA calculés sur les High et Low sur les X dernières périodes.

    Ci-dessous la stratégie.

    defparam cumulateorders=false 
    
    len=10//input(title="Period", defval=10)
    smaHigh=average[len](high)//sma(high, len)
    smaLow=average[len](low)//sma(low, len)
    Hlv = 0
    //Hlv := 
    if close > smaHigh then 
    hlv= 1 
    elsif close < smaLow then 
    hlv= -1 
    else 
    hlv = Hlv[1]
    endif 
    //sslDown 
    if Hlv < 0 then 
    ssldown= smahigh
    else
    ssldown=smalow
    endif
    //sslUp 
    if Hlv < 0 then 
    sslup = smaLow 
    else
    sslup = smaHigh
    endif 
    
    longCondition = sslup crosses over sslDown
    shortCondition = sslup crosses under sslDown
    
    if longCondition then 
    buy at market 
    endif 
    
    if shortCondition then
    sellshort at market
    endif
    
    graphonprice ssldown coloured("red")
    graphonprice sslup coloured("green")
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Conversion de la strategie SSL CHANNEL CROSS de Tradingview


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
ARCO75 @arco75 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
3 years, 10 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/16/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...