Q trend trading bien

Forums ProRealTime forum Français Support ProBuilder Q trend trading bien

Viewing 6 posts - 1 through 6 (of 6 total)
  • #217675

    Bonjour

    J’aimerai savoir si qq aurait pu me traduire ce code ci-dessous pour l’utiliser sur la plateforme c’est un code de trading vieux

    merci

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © tarasenko_

    //@version=5
    indicator(“Q-Trend”, overlay = 1)

    // Inputs
    src = input(close, “Source”, group = “Main settings”)
    p = input.int(200, “Trend period”, group = “Main settings”, tooltip = “Changes STRONG signals’ sensitivity.”, minval = 1)
    atr_p = input.int(14, “ATR Period”, group = “Main settings”, minval = 1)
    mult = input.float(1.0, “ATR Multiplier”, step = 0.1, group = “Main settings”, tooltip = “Changes sensitivity: higher period = higher sensitivty.”)
    mode = input.string(“Type A”, “Signal mode”, options = [“Type A”, “Type B”], group = “Mode”)
    use_ema_smoother = input.string(“No”, “Smooth source with EMA?”, options = [“Yes”, “No”], group = “Source”)
    src_ema_period = input(3, “EMA Smoother period”, group = “Source”)
    color_bars = input(true, “Color bars?”, group = “Addons”)
    show_tl = input(true, “Show trend line?”, group = “Addons”)
    signals_view = input.string(“All”, “Signals to show”, options = [“All”, “Buy/Sell”, “Strong”, “None”], group = “Signal’s Addon”)
    signals_shape = input.string(“Labels”, “Signal’s shape”, options = [“Labels”, “Arrows”], group = “Signal’s Addon”)
    buy_col = input(color.green, “Buy colour”, group = “Signal’s Addon”, inline = “BS”)
    sell_col = input(color.red, “Sell colour”, group = “Signal’s Addon”, inline = “BS”)

     

    // Calculations
    src := use_ema_smoother == “Yes” ? ta.ema(src, src_ema_period) : src // Source;

    h = ta.highest(src, p) // Highest of src p-bars back;
    l = ta.lowest(src, p) // Lowest of src p-bars back.
    d = h – l

    ls = “” // Tracker of last signal

    m = (h + l) / 2 // Initial trend line;
    m := bar_index > p ? m[1] : m

    atr = ta.atr(atr_p)[1] // ATR;
    epsilon = mult * atr // Epsilon is a mathematical variable used in many different theorems in order to simplify work with mathematical object. Here it used as sensitivity measure.

    change_up = (mode == “Type B” ? ta.cross(src, m + epsilon) : ta.crossover(src, m + epsilon)) or src > m + epsilon // If price breaks trend line + epsilon (so called higher band), then it is time to update the value of a trend line;
    change_down = (mode == “Type B” ? ta.cross(src, m – epsilon) : ta.crossunder(src, m – epsilon)) or src < m – epsilon // If price breaks trend line – epsilon (so called higher band), then it is time to update the value of a trend line.
    sb = open < l + d / 8 and open >= l
    ss = open > h – d / 8 and open <= h
    strong_buy = sb or sb[1] or sb[2] or sb[3] or sb[4]
    strong_sell = ss or ss[1] or ss[2] or ss[3] or ss[4]

    m := (change_up or change_down) and m != m[1] ? m : change_up ? m + epsilon : change_down ? m – epsilon : nz(m[1], m) // Updating the trend line.

    ls := change_up ? “B” : change_down ? “S” : ls[1] // Last signal. Helps avoid multiple labels in a row with the same signal;
    colour = ls == “B” ? buy_col : sell_col // Colour of the trend line.
    buy_shape = signals_shape == “Labels” ? shape.labelup : shape.triangleup
    sell_shape = signals_shape == “Labels” ? shape.labeldown : shape.triangledown

     

    // Plottings
    plot(show_tl ? m : na, “trend line”, colour, 3) // Plotting the trend line.

    // Signals with label shape
    plotshape(signals_shape == “Labels” and (signals_view == “All” or signals_view == “Buy/Sell”) and change_up and ls[1] != “B” and not strong_buy, “Buy signal” , color = colour, style = buy_shape , location = location.belowbar, size = size.normal, text = “BUY”, textcolor = color.white) // Plotting the BUY signal;
    plotshape(signals_shape == “Labels” and (signals_view == “All” or signals_view == “Buy/Sell”) and change_down and ls[1] != “S” and not strong_sell, “Sell signal” , color = colour, style = sell_shape, size = size.normal, text = “SELL”, textcolor = color.white) // Plotting the SELL signal.
    plotshape(signals_shape == “Labels” and (signals_view == “All” or signals_view == “Strong”) and change_up and ls[1] != “B” and strong_buy, “Strong Buy signal” , color = colour, style = buy_shape , location = location.belowbar, size = size.normal, text = “STRONG”, textcolor = color.white) // Plotting the STRONG BUY signal;
    plotshape(signals_shape == “Labels” and (signals_view == “All” or signals_view == “Strong”) and change_down and ls[1] != “S” and strong_sell, “Strong Sell signal” , color = colour, style = sell_shape, size = size.normal, text = “STRONG”, textcolor = color.white) // Plotting the STRONG SELL signal.

    // Signal with arrow shape
    plotshape(signals_shape == “Arrows” and (signals_view == “All” or signals_view == “Buy/Sell”) and change_up and ls[1] != “B” and not strong_buy, “Buy signal” , color = colour, style = buy_shape , location = location.belowbar, size = size.tiny) // Plotting the BUY signal;
    plotshape(signals_shape == “Arrows” and (signals_view == “All” or signals_view == “Buy/Sell”) and change_down and ls[1] != “S” and not strong_sell, “Sell signal” , color = colour, style = sell_shape, size = size.tiny) // Plotting the SELL signal.
    plotshape(signals_shape == “Arrows” and (signals_view == “All” or signals_view == “Strong”) and change_up and ls[1] != “B” and strong_buy, “Strong Buy signal” , color = colour, style = buy_shape , location = location.belowbar, size = size.tiny) // Plotting the STRONG BUY signal;
    plotshape(signals_shape == “Arrows” and (signals_view == “All” or signals_view == “Strong”) and change_down and ls[1] != “S” and strong_sell, “Strong Sell signal” , color = colour, style = sell_shape, size = size.tiny) // Plotting the STRONG SELL signal.

    barcolor(color_bars ? colour : na) // Bar coloring

    // Alerts
    alertcondition(change_up and ls[1] != “B”, “Q-Trend BUY”, “Q-Trend BUY signal were given.”) // Buy alert.
    alertcondition(change_down and ls[1] != “S”, “Q-Trend SELL”, “Q-Trend SELL signal were given.”) // Sell alert.
    alertcondition((change_up and ls[1] != “B”) or (change_down and ls[1] != “S”), “Q-Trend Signal”, “Q-Trend gave you a signal!”)
    alertcondition(change_up and ls[1] != “B” and strong_buy, “Strong BUY signal”, “Q-Trend gave a Strong Buy signal!”)
    alertcondition(change_down and ls[1] != “S” and strong_sell, “Strong SELL signal”, “Q-Trend gave a Strong Sell signal!”)

    #217752

    À première vue, je peux dire que cet indicateur est la SuperTrend d'une Kijun (lissée ou non), avec certains signaux générés lors de la cassure des chandeliers du plus haut ou du plus bas.

    #217762

    Ok, il n’y a pas de Kijun dans ce code, il ne l’utilise qu’une fois pour créer la première valeur de la ligne de tendance. L’indicateur est le suivant : on ajoute ou retranche la valeur d’un ATR à la ligne. POINT.

    J’ai malgré tout ajouté l’indicateur à la Library ici: Q-Trend

     

    #217764

    yes bravo

    et encore merci

    #224016

    Bonjour Nicolas, merci pour votre belle contribution, j’adore l’indicateur Q-Tend

    J’ai essayé de faire en sorte que l’indicateur Q-Tend génère des ordres d’achat et de vente aux points de changement de tendance en remplaçant tous les ordres “drawtext(“▲”,barindex,low) coloured(“lime”)” le résultat n’est pas très réussi, génère trop de orders dans des endroits indésirables,

    Il est possible de passer des commandes où l’indicateur génère des signaux “▲”

    Voici mes modifications :

    if signalsview=1 then
    if strongbuy and ls<>1 then
    buy 1 share at market
    endif

    if strongsell and ls<>-1 then
    sell at market
    endif

    else
    if r<>r[1]and r>0 then
    sell at market
    endif
    if r<>r[1]and r=0 then
    buy 1 share at market
    endif
    endif
    endif
    Il serait extraordinaire de convertir cet indicateur en ProOrder
    merci beaucoup
    #224017

    Bonjour, d’après les commentaires sous le code Qtrend dans la library, il y a déjà un sujet dans le forum proorder pour stratégie auto dérivée du Q-trend si ça peut aider:

    https://www.prorealcode.com/topic/strategy-based-on-q-trend/

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

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