strategy BarHunter DAX v1p

Viewing 15 posts - 241 through 255 (of 256 total)
  • Author
    Posts
  • #161942 quote
    Tanou
    Participant
    Senior

    @Paul, do you trust these to let them take orders in real? Only in Demo for now? The drawdown looks a bit high isnt it?

     

    Otherwise incredible job 😀

    #163746 quote
    Paul
    Participant
    Master

    Thnx. Just occasionally I check the how it would’ve performed OOS. I don’t have it in demo or live.

    #163750 quote
    Paul
    Participant
    Master

    here is a modified code & idea from Vonasi, instead of seasonal pattens it hunts for intraday patterns. Which in essence is a bit like barhunter, but now better written and changed to fit the purpose.

    Timeframe 15m to 4 hours. There are maybe combinations possible. I post the code so it can be explored.

    This code is setup for forex eurusd mini, 1hour tf and optimised on 30k bars without sl/pt/ts or spread.

    note stepsize is depended on the market it is applied too.

    Midlanddave thanked this post
    CurveHunter-v1.itf Screenshot-2021-03-10-at-20.48.20.jpg Screenshot-2021-03-10-at-20.48.20.jpg
    #163757 quote
    Vonasi
    Moderator
    Master

    here is a modified code & idea from Vonasi, instead of seasonal pattens it hunts for intraday patterns

    The seasonality bit I’ll take credit for but the intraday patterns is all your own doing. Happy curve hunting!

    #163828 quote
    GraHal
    Participant
    Master

    Thank You Paul for yet another intriguing Strategy!

    I’m putting attached on Demo Forward Test.

    Spread = 5

    Midlanddave and Paul thanked this post
    CurveHunt.jpg CurveHunt.jpg curveHUnt-2.jpg curveHUnt-2.jpg PaulCurveHuntv1-DJI-M15-v1.1GH.itf
    #217290 quote
    Meta Signals Pro
    Participant
    Veteran

    @Paul @mods

    Hi there,
    I keep getting kicked out by IG in LIVE with this strategy without understanding why. Apparently many people have had the same experience;

    I tried to increase the SL and the Trailing vs the original figure but it doesn’t work;

    Here under the code modified.

    once minstop = 15 // minimum trailing stop distance

    set stop %loss 3

     

    Anybody has manage to launched it live ?

    thanks for your help,

    Chris

     

    //-------------------------------------------------------------------------
    // Code principal : DAX H1 Timehunter v4.5p
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // hoofd code : Timehunter v4.5p 1h dax
    //-------------------------------------------------------------------------
    // dax 1 hour timeframe backtest / dax 1 minute live
    // spread 4
    
    // optimise entryhour 0 to 23
    // optimise entryminute 0 to 59 but set to 0 using 1 hour or higher timeframe
    
    // on timeframe 5 minutes with entryminute interval of 5
    // on timeframe 10 minutes with entryminute interval of 10
    // on timeframe 15 minutes with entryminute interval of 15
    // on timeframe 30 minutes with entryminute interval of 30
    
    defparam cumulateorders = false
    defparam preloadbars = 1000
    
    timeframe (default)
    
    once positionsize = 1
    
    once mode = 1 // use [1] for 1 hour timeframe, [0] for 1 minute timeframe
    
    once tds = 3 // off when optimising [trend detection system]
    
    // separate long/short or go both
    once longtrading =1
    once shorttrading =1
    
    once holiday =1
    once closefriday =1
    
    once displaydim =1 // displays the number of days in market (activated graph)
    once maxdim =5 // maximum days in market (first day = 0)
    
    // select the number of points above/below the breakvaluelong/short
    once entryhour =4
    once entryminute=0
    
    // select the number of points above/below the breakvaluelong/short
    once breakpointpercentage=4
    
    // breakpoint calculation
    breakpoint = ((close/10000)*breakpointpercentage)*pointsize
    
    // reset low timeframe
    if intradaybarindex=0 then
    tradecounter=0
    tradeday=1
    endif
    
    // holiday
    if holiday then
    if (month = 5 and day = 1) or (month = 12 and day >=24) then
    tradeday=0
    else
    tradeday=1
    endif
    endif
    
    
    timeframe (1 hour, updateonclose)
    
    // reset high timeframe
    if intradaybarindex=0 then
    breakvaluelong=99999
    breakvalueshort=0
    endif
    
    // define break value
    if (longtrading and not shorttrading) or (longtrading and shorttrading) then
    if hour=entryhour and (minute>=entryminute) then
    startbarlong=intradaybarindex
    breakvaluelong=high
    endif
    endif
    
    if (shorttrading and not longtrading) or (longtrading and shorttrading) then
    if hour=entryhour and (minute>=entryminute) then
    startbarshort=intradaybarindex
    breakvalueshort=low
    endif
    endif
    
    // trend detection system
    if tds=0 then
    trendup=1
    trenddown=1
    else
    if tds=1 then
    trendup=(average[10](close)>average[10](close)[1])
    trenddown=(average[10](close)<average[10](close)[1])
    else
    if tds=2 then
    period= 2
    inner = 2*weightedaverage[round( period/2)](typicalprice)-weightedaverage[period](typicalprice)
    hull = weightedaverage[round(sqrt(period))](inner)
    trendup = hull > hull[1]
    trenddown = hull < hull[1]
    else
    if tds=3 then
    period= 2
    inner = 2*weightedaverage[round( period/2)](totalprice)-weightedaverage[period](totalprice)
    hull = weightedaverage[round(sqrt(period))](inner)
    trendup = hull > hull[1]
    trenddown = hull < hull[1]
    endif
    endif
    endif
    endif
    
    // point pivot [fifi743]
    if dayofweek < dayofweek[1] then
    weeklyhigh = prevweekhigh
    weeklylow = prevweeklow
    weeklyclose = prevweekclose
    prevweekhigh = high
    prevweeklow = low
    weeklypivot = (weeklyhigh + weeklylow + weeklyclose) / 3
    endif
    
    prevweekhigh = max(prevweekhigh, high)
    prevweeklow = min(prevweeklow, low)
    prevweekclose = close
    
    if dayofweek = 1 then
    dayhigh = dhigh(2)
    daylow = dlow(2)
    dayclose = dclose(2)
    endif
    if dayofweek >=2 and dayofweek < 6 then
    dayhigh = dhigh(1)
    daylow = dlow(1)
    dayclose = dclose(1)
    endif
    
    pivot = (dayhigh + daylow + dayclose) / 3
    ecart=2
    ecartwp=3
    
    // conditions
    condbuy=intradaybarindex=startbarlong
    condbuy=condbuy and trendup
    condbuy=condbuy and (close>pivot or (close <pivot and (pivot-close)/pointsize >ecart))
    condbuy=condbuy and (close>weeklypivot or (close <weeklypivot and (weeklypivot-close)/pointsize >ecartwp))
    
    condsell=intradaybarindex=startbarshort
    condsell=condsell and trenddown
    condsell=condsell and (close<pivot or (close>pivot and (close-pivot)/pointsize >ecart))
    condsell=condsell and (close<weeklypivot or (close>weeklypivot and (close-weeklypivot)/pointsize >ecartwp))
    
    timeframe (default)
    
    // entry
    if mode then // mode[1] backtesting on 1 hour timeframe
    if tradeday and tradecounter < 1 then
    if (longtrading and not shorttrading) or (longtrading and shorttrading) then
    if condbuy then
    buy positionsize contract at (breakvaluelong+breakpoint) stop
    tradecounter=tradecounter+1
    endif
    endif
    if (shorttrading and not longtrading) or (longtrading and shorttrading) then
    if condsell then
    sellshort positionsize contract at (breakvalueshort-breakpoint) stop
    tradecounter=tradecounter+1
    endif
    endif
    endif
    else // mode[0] running demo / live on 1 minute timeframe
    if tradeday and tradecounter < 1 then
    if (longtrading and not shorttrading) or (longtrading and shorttrading) then
    if condbuy then
    if high > breakvaluelong+breakpoint then
    buy positionsize contract at market
    tradecounter=tradecounter+1
    endif
    endif
    endif
    if (shorttrading and not longtrading) or (longtrading and shorttrading) then
    if condsell then
    if low < breakvalueshort-breakpoint then
    sellshort positionsize contract at market
    tradecounter=tradecounter+1
    endif
    endif
    endif
    endif
    endif
    
    timeframe (1 hour, updateonclose)
    
    // trailing atr stop on high timeframe
    once trailingstoptype = 1 // trailing stop - 0 off, 1 on
    once trailingstoplong = 5 // trailing stop atr relative distance
    once trailingstopshort = 5 // trailing stop atr relative distance
    
    once atrtrailingperiod = 14 // atr parameter value
    once minstop = 15 // minimum trailing stop distance
    //----------------------------------------------
    atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000
    trailingstartl = round(atrtrail*trailingstoplong)
    trailingstarts = round(atrtrail*trailingstopshort)
    //
    if trailingstoptype then
    tgl =trailingstartl
    tgs=trailingstarts
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    maxprice = 0
    minprice = close
    newsl = 0
    endif
    if longonmarket then
    maxprice = max(maxprice,close)
    if maxprice-tradeprice(1)>=tgl*pointsize then
    if maxprice-tradeprice(1)>=minstop then
    newsl = maxprice-tgl*pointsize
    else
    newsl = maxprice - minstop*pointsize
    endif
    endif
    endif
    if shortonmarket then
    minprice = min(minprice,close)
    if tradeprice(1)-minprice>=tgs*pointsize then
    if tradeprice(1)-minprice>=minstop then
    newsl = minprice+tgs*pointsize
    else
    newsl = minprice + minstop*pointsize
    endif
    endif
    endif
    endif
    
    timeframe (default)
    
    // trailing atr stop exits on low timeframe
    if trailingstoptype then
    if longonmarket then
    if newsl>0 then
    sell at newsl stop
    endif
    endif
    if shortonmarket then
    if newsl>0 then
    exitshort at newsl stop
    endif
    endif
    endif
    
    // close to reduce risk in the weekend
    if closefriday then
    if onmarket then
    if (dayofweek=5 and hour=22) then
    sell at market
    exitshort at market
    endif
    endif
    endif
    
    // stoploss & profit target
    set target %profit 2
    set stop %loss 3
    
    // display days in market
    if displaydim then
    if (not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket))) then
    dim=0
    endif
    if not ( dayofweek=1 and hour <= 1) then
    if onmarket then
    if openday <> openday[1] then
    dim = dim + 1
    endif
    endif
    endif
    if onmarket and dayofweek=1 and hour=1 then
    //dim=-1 // shows when position is active on monday first hour
    endif
    if onmarket and dim>=maxdim then
    sell at market
    exitshort at market
    endif
    endif
    
    //graph dim // display days in market
    //graphonprice newsl coloured(0,0,255,255) as "trailingstop atr"
    
    //graphonprice breakvaluelong+breakpoint coloured(121,141,35,255) as "breakpoint"
    //graphonprice breakvalueshort-breakpoint coloured(121,141,35,255) as "breakpoint"
    //graphonprice breakvaluelong coloured(255,0,0,255) as "breakvaluelong"
    //graphonprice breakvalueshort coloured(255,0,0,255) as "breakvalueshort"
    
    //graph barindex-tradeindex
    //graph intradaybarindex
    #217291 quote
    GraHal
    Participant
    Master

    without understanding why

    What Rejection message do you see? Check the Cancelled / Rejected  tab on the Orders List?

    Meta Signals Pro thanked this post
    #217302 quote
    Meta Signals Pro
    Participant
    Veteran

    hi @Grahal,

    It says “the level of order is to close from the market level. The minimum is 10 points”;
    I thought it was the SL; but apparently not.
    I am on IG Live.
    Did you launch it live?

    #217320 quote
    fifi743
    Participant
    Master

    @Meta Signals Pro
    It’s a pending stop order that’s too close ?

    #217321 quote
    GraHal
    Participant
    Master

    the level of order is to close from the market level. The minimum is 10 points”;

    So does it run in Live for a while (over several bars) but then gets Rejected when it tries to exeute an Order / Trade?

    If Yes, then it’s, as fifi says, a pending Buy or SellShort Order as below …

    buy positionsize contract at (breakvaluelong+breakpoint) stop
    sellshort positionsize contract at (breakvalueshort-breakpoint) stop
    fifi743 thanked this post
    #217322 quote
    fifi743
    Participant
    Master

    The breakpoint must be greater than 10 points

    #217323 quote
    fifi743
    Participant
    Master

    replace with the code below

    minidistance=10
    
    buy positionsize contract at (breakvaluelong+max(breakpoint,minidistance)) stop
    sellshort positionsize contract at (breakvalueshort-max(breakpoint,minidistance)) stop
    Meta Signals Pro thanked this post
    #217330 quote
    ProRealAlgos
    Participant
    Junior

    You can also, when starting a prepared instance of the system, choose to check the “Re-adjustable stops” checkbox which will allow ProRealTime to adjust the stoploss level based on the current minimum stop distance.

    Meta Signals Pro thanked this post
    #217332 quote
    GraHal
    Participant
    Master

    Above only works if the coded pending order is > 10 so best bet is fifi code + enable the adjustabe stop box.

    Meta Signals Pro thanked this post
    #217376 quote
    Meta Signals Pro
    Participant
    Veteran

    Thanks Guys ^^

    Here is the modified code for the followers!

     

    //-------------------------------------------------------------------------
    // hoofd code : Timehunter v4.5p 1h dax
    //-------------------------------------------------------------------------
    // dax 1 hour timeframe backtest / dax 1 minute live
    // spread 4
    
    // optimise entryhour   0 to 23
    // optimise entryminute 0 to 59 but set to 0 using 1 hour or higher timeframe
    
    // on timeframe  5 minutes with entryminute interval of  5
    // on timeframe 10 minutes with entryminute interval of 10
    // on timeframe 15 minutes with entryminute interval of 15
    // on timeframe 30 minutes with entryminute interval of 30
    
    defparam cumulateorders = false
    defparam preloadbars    = 1000
    
    timeframe (default)
    
    once positionsize = 1
    
    once mode     = 1 // use [1] for 1 hour timeframe, [0] for 1 minute timeframe
    
    once tds      = 3 // off when optimising [trend detection system]
    
    // separate long/short or go both
    once longtrading  =1
    once shorttrading =1
    
    once holiday      =1
    once closefriday  =1
    
    once displaydim   =1 // displays the number of days in market (activated graph)
    once maxdim       =5 // maximum days in market (first day = 0)
    
    // select the number of points above/below the breakvaluelong/short
    once entryhour  =4
    once entryminute=0
    
    // select the number of points above/below the breakvaluelong/short
    once breakpointpercentage=4
    
    // breakpoint calculation
    breakpoint = ((close/10000)*breakpointpercentage)*pointsize
    
    // reset low timeframe
    if intradaybarindex=0 then
    tradecounter=0
    tradeday=1
    endif
    
    // holiday
    if holiday then
    if (month = 5 and day = 1) or (month = 12 and day >=24) then
    tradeday=0
    else
    tradeday=1
    endif
    endif
    
    
    timeframe (1 hour, updateonclose)
    
    // reset high timeframe
    if intradaybarindex=0 then
    breakvaluelong=99999
    breakvalueshort=0
    endif
    
    // define break value
    if (longtrading and not shorttrading) or (longtrading and shorttrading) then
    if hour=entryhour and (minute>=entryminute) then
    startbarlong=intradaybarindex
    breakvaluelong=high
    endif
    endif
    
    if (shorttrading and not longtrading) or (longtrading and shorttrading) then
    if hour=entryhour and (minute>=entryminute) then
    startbarshort=intradaybarindex
    breakvalueshort=low
    endif
    endif
    
    // trend detection system
    if tds=0 then
    trendup=1
    trenddown=1
    else
    if tds=1 then
    trendup=(average[10](close)>average[10](close)[1])
    trenddown=(average[10](close)<average[10](close)[1])
    else
    if tds=2 then
    period= 2
    inner = 2*weightedaverage[round( period/2)](typicalprice)-weightedaverage[period](typicalprice)
    hull = weightedaverage[round(sqrt(period))](inner)
    trendup = hull > hull[1]
    trenddown = hull < hull[1]
    else
    if tds=3 then
    period= 2
    inner = 2*weightedaverage[round( period/2)](totalprice)-weightedaverage[period](totalprice)
    hull = weightedaverage[round(sqrt(period))](inner)
    trendup = hull > hull[1]
    trenddown = hull < hull[1]
    endif
    endif
    endif
    endif
    
    // point pivot [fifi743]
    if dayofweek < dayofweek[1] then
    weeklyhigh = prevweekhigh
    weeklylow = prevweeklow
    weeklyclose = prevweekclose
    prevweekhigh = high
    prevweeklow = low
    weeklypivot = (weeklyhigh + weeklylow + weeklyclose) / 3
    endif
     
    prevweekhigh = max(prevweekhigh, high)
    prevweeklow = min(prevweeklow, low)
    prevweekclose = close
    
    if dayofweek = 1 then
    dayhigh = dhigh(2)
    daylow = dlow(2)
    dayclose = dclose(2)
    endif
    if dayofweek >=2 and dayofweek < 6 then
    dayhigh = dhigh(1)
    daylow = dlow(1)
    dayclose = dclose(1)
    endif
    
    pivot = (dayhigh + daylow + dayclose) / 3
    ecart=2
    ecartwp=3
    
    // conditions
    condbuy=intradaybarindex=startbarlong
    condbuy=condbuy and trendup
    condbuy=condbuy and (close>pivot or (close <pivot and (pivot-close)/pointsize >ecart))
    condbuy=condbuy and (close>weeklypivot or (close <weeklypivot and (weeklypivot-close)/pointsize >ecartwp))
    
    condsell=intradaybarindex=startbarshort
    condsell=condsell and trenddown
    condsell=condsell and (close<pivot or (close>pivot and (close-pivot)/pointsize >ecart))
    condsell=condsell and (close<weeklypivot or (close>weeklypivot and (close-weeklypivot)/pointsize >ecartwp))
    
    timeframe (default)
    
    minidistance=10
    
    // entry
    if mode then // mode[1] backtesting on 1 hour timeframe
    if tradeday and tradecounter < 1 then
    if (longtrading and not shorttrading) or (longtrading and shorttrading) then
    if condbuy then
    buy positionsize contract at (breakvaluelong+max(breakpoint,minidistance)) stop
    tradecounter=tradecounter+1
    endif
    endif
    if (shorttrading and not longtrading) or (longtrading and shorttrading) then
    if condsell then
    sellshort positionsize contract at (breakvalueshort-max(breakpoint,minidistance)) stop
    tradecounter=tradecounter+1
    endif
    endif
    endif
    else        // mode[0] running demo / live on 1 minute timeframe
    if tradeday and tradecounter < 1 then
    if (longtrading and not shorttrading) or (longtrading and shorttrading) then
    if condbuy then
    if high > breakvaluelong+breakpoint then
    buy positionsize contract at market
    tradecounter=tradecounter+1
    endif
    endif
    endif
    if (shorttrading and not longtrading) or (longtrading and shorttrading) then
    if condsell then
    if low < breakvalueshort-breakpoint then
    sellshort positionsize contract at market
    tradecounter=tradecounter+1
    endif
    endif
    endif
    endif
    endif
    
    timeframe (1 hour, updateonclose)
    
    // trailing atr stop on high timeframe
    once trailingstoptype     = 1    // trailing stop - 0 off, 1 on
    once trailingstoplong     = 5    // trailing stop atr relative distance
    once trailingstopshort    = 5    // trailing stop atr relative distance
    
    once atrtrailingperiod    = 14   // atr parameter value
    once minstop              = 15   // minimum trailing stop distance
    //----------------------------------------------
    atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000
    trailingstartl = round(atrtrail*trailingstoplong)
    trailingstarts = round(atrtrail*trailingstopshort)
    //
    if trailingstoptype then
    tgl =trailingstartl
    tgs=trailingstarts
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    maxprice = 0
    minprice = close
    newsl = 0
    endif
    if longonmarket then
    maxprice = max(maxprice,close)
    if maxprice-tradeprice(1)>=tgl*pointsize then
    if maxprice-tradeprice(1)>=minstop then
    newsl = maxprice-tgl*pointsize
    else
    newsl = maxprice - minstop*pointsize
    endif
    endif
    endif
    if shortonmarket then
    minprice = min(minprice,close)
    if tradeprice(1)-minprice>=tgs*pointsize then
    if tradeprice(1)-minprice>=minstop then
    newsl = minprice+tgs*pointsize
    else
    newsl = minprice + minstop*pointsize
    endif
    endif
    endif
    endif
    
    timeframe (default)
    
    // trailing atr stop exits on low timeframe
    if trailingstoptype then
    if longonmarket then
    if newsl>0 then
    sell at newsl stop
    endif
    endif
    if shortonmarket then
    if newsl>0 then
    exitshort at newsl stop
    endif
    endif
    endif
    
    // close to reduce risk in the weekend
    if closefriday then
    if onmarket then
    if (dayofweek=5 and hour=22) then
    sell at market
    exitshort at market
    endif
    endif
    endif
    
    // stoploss & profit target
    set target %profit 2
    set stop %loss 3
    
    // display days in market
    if displaydim then
    if (not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket))) then
    dim=0
    endif
    if  not ( dayofweek=1 and hour <= 1) then
    if onmarket then
    if openday <> openday[1] then
    dim = dim + 1
    endif
    endif
    endif
    if onmarket and dayofweek=1 and hour=1 then
    //dim=-1 // shows when position is active on monday first hour
    endif
    if onmarket and dim>=maxdim then
    sell at market
    exitshort at market
    endif
    endif
    
    //graph dim // display days in market
    //graphonprice newsl coloured(0,0,255,255) as "trailingstop atr"
    
    //graphonprice breakvaluelong+breakpoint coloured(121,141,35,255) as "breakpoint"
    //graphonprice breakvalueshort-breakpoint coloured(121,141,35,255) as "breakpoint"
    //graphonprice breakvaluelong coloured(255,0,0,255) as "breakvaluelong"
    //graphonprice breakvalueshort coloured(255,0,0,255) as "breakvalueshort"
    
    //graph barindex-tradeindex
    //graph intradaybarindex
    
    GraHal thanked this post
Viewing 15 posts - 241 through 255 (of 256 total)
  • You must be logged in to reply to this topic.

strategy BarHunter DAX v1p


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paul @micky75d Participant
Summary

This topic contains 255 replies,
has 11 voices, and was last updated by sfl
2 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/15/2020
Status: Active
Attachments: 136 files
Logo Logo
Loading...