Strategy based on Q-Trend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #218453 quote
    T-rader
    Participant
    Average

    Hey guys,

    I saw Nicolas indicator tried it on my charts. I relly liked the strongbuy/strongsell signals and tried to make it into a strategy but I can´t make it buy/sell att the strong indicators, only at the normal signals that are behind // in the attached strategy. What am I missing?

    atrp = 14 //ATR Period
    mult = 1.0 //ATR Multiplier
    mode = 1 //Signal mode options = [1="Type A", 2="Type B"]
    useemasmoother = 0 //Smooth source with EMA? 0=false ; 1=true
    srcemaperiod = 3 //EMA Smoother period
    colorbars = 0 //Color bars? 0=false ; 1=true
    signalsview = 1 //0 = trend inversion ; 1 = strong buy / strong sell only
    // — end of settings
    Ls=1
    
    source = customclose
    
    // Calculations
    if useemasmoother then
    src = average[srcemaperiod,1](source)
    else
    src=source
    endif
    
    hh = highest[p](src) // Highest of src p-bars back;
    ll = lowest[p](src) // Lowest of src p-bars back.
    d = hh - ll
    
    if barindex>p then
    once m = (hh + ll) / 2 // Initial trend line;
    atr = AverageTrueRange[atrp][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.
    
    if mode=2 then //type B
    changeup = src crosses over m+epsilon or src crosses under m+epsilon
    changedown = src crosses over m-epsilon or src crosses under m-epsilon
    else
    changeup = src crosses over m+epsilon or src > m+epsilon
    changedown = src crosses under m-epsilon or src < m-epsilon
    endif
    
    sb = open < ll + d / 8 and open >= ll
    ss = open > hh - d / 8 and open <= hh
    strongbuy = sb or sb[1] or sb[2] or sb[3] or sb[4]
    strongsell = ss or ss[1] or ss[2] or ss[3] or ss[4]
    
    endif
    
    if (changeup or changedown) then
    if changeup then
    m=m + epsilon
    elsif changedown then
    m=m - epsilon
    endif
    else
    m=m[1]
    endif
    
    if changeup then
    r=0
    g=255
    elsif changedown then
    r=255
    g=0
    endif
    
    if signalsview=1 then
    if strongbuy and ls<>1 then
    buy at market
    endif
    
    if strongsell and ls<>-1 then
    sell at market
    endif
    
    //if r<>r[1]and r>0 then
    //sell at market
    //endif
    
    //if r<>r[1]and r=0 then
    //buy at market
    //endif
    
    endif

     

    Q-Trend

    JADINVEST thanked this post
    #218473 quote
    Nicolas
    Keymaster
    Master

    Here is the modified version to trade only the “strong” signals:

    defparam cumulateorders=false
    defparam preloadbars=0
    
    p=200
    atrp = 14 //ATR Period
    mult = 1.0 //ATR Multiplier
    mode = 1 //Signal mode options = [1="Type A", 2="Type B"]
    useemasmoother = 0 //Smooth source with EMA? 0=false ; 1=true
    srcemaperiod = 3 //EMA Smoother period
    colorbars = 0 //Color bars? 0=false ; 1=true
    signalsview = 1 //0 = trend inversion ; 1 = strong buy / strong sell only
    // — end of settings
    
    
    source = customclose
    
    // Calculations
    if useemasmoother then
    src = average[srcemaperiod,1](source)
    else
    src=source
    endif
    
    hh = highest[p](src) // Highest of src p-bars back;
    ll = lowest[p](src) // Lowest of src p-bars back.
    d = hh - ll
    
    if barindex>p then
    once m = (hh + ll) / 2 // Initial trend line;
    atr = AverageTrueRange[atrp][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.
    
    if mode=2 then //type B
    changeup = src crosses over m+epsilon or src crosses under m+epsilon
    changedown = src crosses over m-epsilon or src crosses under m-epsilon
    else
    changeup = src crosses over m+epsilon or src > m+epsilon
    changedown = src crosses under m-epsilon or src < m-epsilon
    endif
    
    sb = open < ll + d / 8 and open >= ll
    ss = open > hh - d / 8 and open <= hh
    strongbuy = sb or sb[1] or sb[2] or sb[3] or sb[4]
    strongsell = ss or ss[1] or ss[2] or ss[3] or ss[4]
    
    endif
    
    if (changeup or changedown) then
    if changeup then
    m=m + epsilon
    elsif changedown then
    m=m - epsilon
    endif
    else
    m=m[1]
    endif
    
    if changeup then
    r=0
    g=255
    elsif changedown then
    r=255
    g=0
    endif
    
    if signalsview=1 then
    if strongbuy and ls<>1 then
    buy at market
    ls=1
    endif
    
    if strongsell and ls<>-1 then
    sellshort at market
    ls=-1
    endif
    
    //if r<>r[1]and r>0 then
    //sell at market
    //endif
    
    //if r<>r[1]and r=0 then
    //buy at market
    //endif
    
    endif
    #220136 quote
    JADINVEST
    Participant
    New

    Hello,

    When I run the strategy in ProOrder, nothing happens! Neither with the original version, nor with Nicolas’ version…

    Can you help me

    thanks

    #220173 quote
    Nicolas
    Keymaster
    Master
    What timeframe and instrument please? In ordrer to replicate your issue, this is a crucial information! Thank you.
    #220179 quote
    JADINVEST
    Participant
    New
    J’ai essayé en 1s, M1 et M15 sur l’EURUSD mini. Ce que j’essaie de faire avec cet indicateur et cette stratégie est d’aller et venir en fonction du « signalview = 0 » Flèche verte = acheter au marché, flèche rouge = sortir puis vendre au marché, flèche verte = sortie puis acheter… J’ai essayé d’éliminer certains signaux en jouant sur les réglages pour ne garder que les mouvements intéressants, en vain. Aussi avec la programmation assistée PRT = erreur. Merci d’avance Nicolas
    #220185 quote
    JADINVEST
    Participant
    New
    I tried in 1s, M1 and M15 on the EURUSD mini. What I am trying to do with this indicator and this strategy is to go back and forth based on the “signalview=0” Green arrow= buy at the market, red arrow= exit then sell at the market, green arrow= exit then buy… I tried to eliminate some signals by playing on the settings to keep only the interesting movements, in vain. Also with PRT assisted programming = error. Thank you in advance Nicolas
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Strategy based on Q-Trend


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
T-rader @t-rader Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by JADINVEST
2 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/01/2023
Status: Active
Attachments: No files
Logo Logo
Loading...