The 13th Worrier Automated v1.5 based on Thomas Geislers Indicator idea. (13th Worrior)

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #145793 quote
    Szeles
    Participant
    Junior
    //the 13th V1.5 /////////////by Joe Szeles//////////////////////
    
    //IDEA BASED ON:
    // The13thWarrior_V1.1
    // 06.09.2020 (Release 1.1)
    // Thomas Geisler
    // Sharing ProRealTime knowledge
    // https://www.prorealcode.com/library/////
    
    Defparam cumulateorders = false
    
    positionsize=2
    
    myOBVn = 5
    
    
    myCandle = 1
    
    //Heikin Ashi
    ONCE haOpen = OPEN
    ONCE haClose = CLOSE
    N = 0
    IF BARINDEX = 0 THEN
    haOpen = OPEN
    haClose = CLOSE
    ELSIF N = 0 THEN
    haClose =(OPEN+HIGH+LOW+CLOSE)/4
    haOpen =(haOpen[1]+haClose[1])/2
    ENDIF
    
    once tradetype        = 1 // [1]long&short;[2]long;[3]short
     
    
    mm6= average[299]
    mm5= average[120]
    mm4= average[10]
    mm3= average[7]
    mm2= average[4]
    mm1= average[3]
    mm0= average[2]
    mm= average[1]
    
    //long
    
    tradelong = mm>mm0 and mm0>mm1 and mm1>mm2 and mm2>mm3 and mm3>mm4 and mm4>mm5 and mm5>mm6
     
    //short
    
    tradeshort = mm<mm0 and mm0<mm1 and mm1<mm2 and mm2<mm3 and mm3<mm4 and mm4<mm5 and mm5<mm6
    
    //Candle-Colour from OBV and HA
    IF myCandle = 1 THEN
    myOBV = OBV(CLOSE)
    myAV = Average[myOBVn](myOBV)
    IF  myOBV > myAV AND haClose > haOpen and (tradetype=1 or tradetype=2) and tradelong THEN
    if not onmarket then
    buy positionsize contract at market
    endif
    endif
    if myOBV < myAV AND haClose < haOpen and (tradetype=1 or tradetype=3) and tradeshort THEN
    if not onmarket then
    sellshort positionsize contract at market
    endif
    endif
    ENDIF
    //%trailing stop function
    trailingPercent = .278 //org .26
    stepPercent = .0155//org .014
    if onmarket then
    trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailinstart points profit
    trailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stop
    endif
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
    newSL = tradeprice(1)+trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>trailingstep THEN
    newSL = newSL+trailingstep
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
    newSL = tradeprice(1)-trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>trailingstep THEN
    newSL = newSL-trailingstep
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    
    
    set stop loss 400
    set target profit 1600
    
    GraHal, ichimoku18, d4man and Kovit thanked this post
    screenshot-1601339169lcp84.png screenshot-1601339169lcp84.png
    #146445 quote
    robertogozzi
    Moderator
    Master

    Thanks for sharing your idea and yourcode.

    Any suggestion about which TF’s and instruments are best best suited for this strategy?

    HA candlesticks are used only for entry conditions, not for indicators nor trailing stop, is that correct?

    #146450 quote
    GraHal
    Participant
    Master

    Attached is one possibility … spread = 5, position size = 1

    robertogozzi and Paul thanked this post
    S.jpg S.jpg s-2.jpg s-2.jpg
    #146496 quote

    Strangely with 200K spead 5 and position size 1 it doesn’t give any trades before July 2016 ??

    DOW-2-H-MYS.png DOW-2-H-MYS.png DOW-2-H-MYS-Bis.png DOW-2-H-MYS-Bis.png
    #146501 quote
    robertogozzi
    Moderator
    Master

    On a 2h system, there are probably not bars before that date if tick-by-tick option is selected. Try not selecting it.

    #146502 quote

    Already done but the result is identical.

    #146506 quote
    robertogozzi
    Moderator
    Master

    Yes, the same start for the 4h TF. It’s similar for many instruments, so I think that’s the limit.

    Mauro T. "Algorithm System" thanked this post
    #146524 quote
    Szeles
    Participant
    Junior

    I had really good results with wall street cash $1 at 2h time-frame.

    Screenshot-152.png Screenshot-152.png
    #146526 quote
    Szeles
    Participant
    Junior

    I tried it for day trading in various x-seconds (2, 6 19, 24, 71) , but they need readjustment every 2 or 3 days. the ones i started 4 days ago still work, but they fail in the simulation at the current date. because of that I added a maximum for the strategy profit and trading time limitation  in some versions, to lower the risk of loosing the gains. some gained 1000$ over night, but the bad trades are mostly really bad. the Friday crash was really bad and took all the gains from the days before.  Also good results with HUF  Hungary 12 cach (13thworrior v1.3 HUF 30min.itf)

    Screenshot-256.png Screenshot-256.png 13th-worrior-v.3.4.b-39-sec.itf 13th-worrior-v.3.4.a-2-sec.itf 13thworrior-v1.3-HUF-30min.itf
    #146563 quote
    Szeles
    Participant
    Junior

    It worked fine @ 39 seconds for days, when i simulate now it doesn`t work at all, except i move one second forward to 40 second time frame.  strange psitionsize =2, spread =6, 40 second timeframe, DJ $1

    ////////v.3.3.c 2 sec DOW/////////////////////////////////////
    //the 13th warrior
    Defparam cumulateorders = true
    
    positionsize=2
    
    myOBVn = 5
    
    
    myCandle = 1
    
    
    
    //Heikin Ashi
    ONCE haOpen = OPEN
    ONCE haClose = CLOSE
    N = 0
    IF BARINDEX = 0 THEN
    haOpen = OPEN
    haClose = CLOSE
    ELSIF N = 0 THEN
    haClose =(OPEN+HIGH+LOW+CLOSE)/4
    haOpen =(haOpen[1]+haClose[1])/2
    ENDIF
    
    once positionsize     = 1
    once tradetype        = 1 // [1]long&short;[2]long;[3]short
     
    //========= STRATEGY ===================================
    
    
    mm6= average[299]
    mm5= average[120]
    mm4= average[10]
    mm3= average[7]
    mm2= average[4]
    mm1= average[3]
    mm0= average[2]
    mm= average[1]
    
    //long/////////////////////////////////////////////////////////////////////////
    c10=low<lowest[2](low[1])
    c11=close<low[1]
    tradelong = (c10 and c11) or (mm>mm0 and mm0>mm1 and mm1>mm2 and mm2>mm3 and mm3>mm4 and mm4>mm5 and mm5>mm6)
     
    //short
    c20=high>highest[2](high[1])
    c21=close>high[1]
    tradeshort = (c20 and c21) or (mm<mm0 and mm0<mm1 and mm1<mm2 and mm2<mm3 and mm3<mm4 and mm4<mm5 and mm5<mm6)
    
    
    //Candle-Colour from OBV and HA//////////////////////////////////////////
    IF myCandle = 1 THEN
    myOBV = OBV(CLOSE)
    myAV = Average[myOBVn](myOBV)
    IF  myOBV > myAV AND haClose > haOpen and (tradetype=1 or tradetype=2) and tradelong THEN
    if not onmarket then
    buy positionsize contract at market
    endif
    endif
    endif
    if myOBV < myAV AND haClose < haOpen and (tradetype=1 or tradetype=3) and tradeshort THEN
    if not onmarket then
    sellshort positionsize contract at market
    endif
    endif
    //%trailing stop function/////////////////////////////////////////////////////////////
    trailingPercent = .23 //org .26
    stepPercent = .015//org .014
    if onmarket then
    trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailinstart points profit
    trailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stop
    endif
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions/////////////////////////////////////////////////////////////////////
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
    newSL = tradeprice(1)+trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>trailingstep THEN
    newSL = newSL+trailingstep
    ENDIF
    ENDIF
     
    //manage short positions/////////////////////////////////////////////////////////////////
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
    newSL = tradeprice(1)-trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>trailingstep THEN
    newSL = newSL-trailingstep
    ENDIF
    ENDIF
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    ////////EXIT STRATEGY DAYTRADING - GRAB CASH AND RUN///////////////////
    
    
    
    
    
    x=250-rsi// max stop loss value in $$
    
    
    contractprofit = 3000 //maximum target profit
    
    set stop loss x
    set target profit contractprofit/3
    
    if  strategyprofit >= contractprofit then //stop bot from trading and take profits
    quit
    
    endif
    Screenshot-263.png Screenshot-263.png
    #146571 quote
    GraHal
    Participant
    Master

    now it doesn`t work at all,

    Maybe just no conditions that match your trigger conditions?

    Anyway we are all best to steer clear of Non Standard Timeframes (TF) that don’t add up to 1 min (so 40 sec in non standard TF also) and 1 hour etc.

    There is a big discussion topic on here about use of the 29 second TF if you need to be convinced?

    Szeles thanked this post
    #146575 quote
    Szeles
    Participant
    Junior

    There is a big discussion topic on here about use of the 29 second TF if you need to be convinced?

    Im convinced, I was experimenting with the code and was surprised about the results, but its too hard to replicate the results, so ill stay clear of these TF in real trades, thanks a lot.

    GraHal and swedshare thanked this post
    Screenshot-265.png Screenshot-265.png
    #146800 quote
    Szeles
    Participant
    Junior

    I couldnt get it going on the standard timeframe , just works fine on the 11 minute and 6 minute time frame. but couldnt simulate longer than 2 months. anybody some ideas how to get it going on a standard timeframe??

    ///////v.3.1.d 19 sec DOW//////////////////////////////////
    //the 13th warrior NIFTY 6min/////////////////
    Defparam cumulateorders = false
    
    
    
    
    
    //Money Management DOW
    MM = 1 // = 0 for optimization
    if MM = 0 then
    positionsize=2
    ENDIF
    if MM = 1 then
    ONCE startpositionsize = 2
    accelerator=1.5 //goes parabolic in an extreme volatile market
    ONCE factor = 5 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etc
    ONCE margin = (close*.005) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverage
    ONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverage
    ONCE tier1 = 55 // DOW €1 IG first tier margin limit
    ONCE maxpositionsize = 550 // DOW €1 IG tier 2 margin limit
    ONCE minpositionsize = 2 // enter minimum position allowed
    IF Not OnMarket THEN
    positionsize = round (startpositionsize + Strategyprofit/(factor*margin))*accelerator
    ENDIF
    IF Not OnMarket THEN
    IF startpositionsize + Strategyprofit/(factor*margin) > tier1 then
    positionsize = round((((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1)*accelerator //incorporating tier 2 margin
    ENDIF
    IF Not OnMarket THEN
    if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN
    positionsize = round (minpositionsize) //keeps positionsize from going below allowed minimum
    ENDIF
    IF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize then
    positionsize = round (maxpositionsize)// keeps positionsize from going above IG tier 2 margin limit
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    
    
    
    myOBVn = 5
    
    
    myCandle = 1
    
    
    
    //Heikin Ashi
    ONCE haOpen = OPEN
    ONCE haClose = CLOSE
    N = 0
    IF BARINDEX = 0 THEN
    haOpen = OPEN
    haClose = CLOSE
    ELSIF N = 0 THEN
    haClose =(OPEN+HIGH+LOW+CLOSE)/4
    haOpen =(haOpen[1]+haClose[1])/2
    ENDIF
    
    once positionsize     = 1
    once tradetype        = 2 // [1]long&short;[2]long;[3]short
     
    //========= STRATEGY ===================================
     
    //long
    c10=low<lowest[2](low[1])
    c11=close<low[1]
    tradelong = c10 and c11
     
    //short////
    c20=high>highest[2](high[1])
    c21=close>high[1]
    tradeshort = c20 and c21
    
    
    
    
    //Candle-Colour from OBV and HA
    IF myCandle = 1 THEN
    myOBV = OBV(CLOSE)
    myAV = Average[myOBVn](myOBV)
    IF  myOBV > myAV AND haClose > haOpen and (tradetype=1 or tradetype=2) and tradelong THEN
    if not onmarket then
    buy positionsize contract at market
    set stop loss 41+rsi
    set target profit 70+rsi
    endif
    endif
    if myOBV < myAV AND haClose < haOpen and (tradetype=1 or tradetype=3) and tradeshort THEN
    if not onmarket then
    sellshort positionsize contract at market
    set stop loss 43+rsi
    set target profit 70+rsi
    endif
    endif
    ENDIF
    //%trailing stop function//////////////////////////////////////////////////////////
    trailingPercent = .19 //org .26
    stepPercent = .0155//org .014
    if onmarket then
    trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailinstart points profit
    trailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stop
    endif
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions/////////////////////////////////////////////////////////////////////
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
    newSL = tradeprice(1)+trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>trailingstep THEN
    newSL = newSL+trailingstep
    ENDIF
    ENDIF
     
    //manage short positions/////////////////////////////////////////////////////////////////
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
    newSL = tradeprice(1)-trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>trailingstep THEN
    newSL = newSL-trailingstep
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    13thworrior-v.3.1-NIFTY-11min.itf
    #146802 quote
    Szeles
    Participant
    Junior
    lol forgot the screenshot
    Screenshot-311.png Screenshot-311.png
    #146835 quote
    GraHal
    Participant
    Master
    Runs good on 1 min on the Nifty on 10k bars (10K bars compare directly with what you show above). I’m going to put it on Demo Forward Test … keep em coming! 🙂
    Szeles thanked this post
    S-3.jpg S-3.jpg S-4.jpg S-4.jpg
Viewing 15 posts - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.

The 13th Worrier Automated v1.5 based on Thomas Geislers Indicator idea. (13th Worrior)


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Szeles @szeles Participant
Summary

This topic contains 19 replies,
has 4 voices, and was last updated by Szeles
5 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/05/2020
Status: Active
Attachments: 20 files
Logo Logo
Loading...