Bollinger Bounce – Tweezer Strategy – Dax 1h

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #23014 quote
    StantonR
    Participant
    Senior

    Hi There

    I have been trading a strategy on Forex but back-tested it on Dax with some surprising results.The strategy was originally developed for small accounts. I would like to start implementing it in live trading but would like some validation before taking it live.

    The strategy is very basic :

    Long Entrytweezer topbreak above bollinger band

    Short EntryTweezer bottombreak below bollinger band

    DEFPARAM CumulateOrders = False
    DEFPARAM preloadbars = 150
    
    // Position is closed at 20h00 PM
    DEFPARAM FlatAfter = 200000
    
    
    tweezerTop = ABS(High -(High[1]))<= High * 0.0025
    tweezerBottom = ABS(Low -(Low[1]))<= Low * 0.0025
    
    bullindicator = OPEN[1] > CLOSE [1] AND OPEN < CLOSE
    bearindicator = OPEN[1] < CLOSE [1] AND OPEN > CLOSE
    Boll = 20
    
    Boldown = BollingerDown[Boll](close)
    Bolup = BollingerUp[Boll](close)
    
    
    BolliLong = (low < Boldown) and tweezerBottom and bullindicator
    Bolishort = (high > Bolup) and tweezerTop and bearindicator
    
    IF NOT LongOnMarket AND BolliLong THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket and Bolishort THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    
    
    SET STOP PLOSS 10
    SET STOP PTRAILING 10
    
    bollibouncereturns-1485698140c4lp81.jpg bollibouncereturns-1485698140c4lp81.jpg
    #23026 quote
    Nicolas
    Keymaster
    Master

    Thanks Stanton to share it with us.

    I see you are using 2 different kind of stoploss in the strategy :

    SET STOP PLOSS 10
    SET STOP PTRAILING 10
    

    ProOrder will not accept them together, you’ll need to define if you want to use the trailing stop of the stoploss functionnality. I know it works under ProBacktest, but IG servers will not operate with these 2 different instructions at the same time.

    Did you test the strategy in tick by tick mode already? (v10.3)

    #23030 quote
    StantonR
    Participant
    Senior

    Hi Nicolas

    I tested in version 10.3 with tick by tick data and the results didnt work.
    I fell into that noob trap of the 0 bars issues.
    I am busy refining the strategy on 10.3 now will post when I have better results

    #23193 quote
    StantonR
    Participant
    Senior

    Hi There

    Code has been optimize , thanks Nicolas for your trailing stop functionality.

    Works well with  AUDUSD  can be optimized to work with most types of instruments.

    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM preloadbars = 150
    
    n = 1
    
    tweezerTop = ABS(High -(High[1]))<= High * 0.0075
    tweezerBottom = ABS(Low -(Low[1]))<= Low * 0.0075
    
    bullindicator = OPEN[1] > CLOSE [1] AND OPEN < CLOSE
    bearindicator = OPEN[1] < CLOSE [1] AND OPEN > CLOSE
    Boll = 20
    
    Boldown = BollingerDown[Boll](close)
    Bolup = BollingerUp[Boll](close)
    
    
    BolliLong = (low < Boldown) and tweezerBottom and bullindicator
    Bolishort = (high > Bolup) and tweezerTop and bearindicator
    
    IF NOT LongOnMarket AND BolliLong THEN
    BUY n CONTRACTS AT MARKET
    
    
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket and Bolishort THEN
    SELLSHORT n CONTRACTS AT MARKET
    
    ENDIF
    
    //trailing stop function
    trailingstart = 10 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    #23198 quote
    Nicolas
    Keymaster
    Master

    This kind of strategy is pretty most the start of many more improvements for a pure mean reversion based theory of the current price behaviour.

    Since you are not with the trend, you bet on the price to revert to its mean, because it has too much derived from it, price break Bollinger bands .. blablabla 🙂 Scenarios that work well in ranging market (both sides) or in the same trend as a narrowed channel.

    #23317 quote
    GraHal
    Participant
    Master

    Hi Stanton

    What do you get with AUD/USD 1H TF over 100000 bars? I get attached?

    Cheers
    GraHal

    AUDUSD.jpg AUDUSD.jpg
    #23322 quote
    StantonR
    Participant
    Senior

    Hi GraHal

    I get similar results I use $1000 starting capital

    Thanks

    #23325 quote
    StantonR
    Participant
    Senior

    As Nicolas said it will work in ranging markets.

    So my next step is to identify a range and if it breaks above or below the range get out to avoid losses.

    #23343 quote
    GraHal
    Participant
    Master

    I’m not great at coding and may do stuff that’s a bit maverick 🙂 I rem’d out the exits and got a better equity curve – top curve below.

    Then I amended as below and got the 2nd curve, less drawdown. Apologies if it’s counter your strategy, but may spark a few ideas? Curves below are with 0.6 spread; I need to check what AUD/USD spread is out of hours?

    IF NOT LongOnMarket AND BolliLong  and SMI[14,3,5](close) < 45 THEN
    BUY n CONTRACTS AT MARKET
    
    
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket and Bolishort and SMI[14,3,5](close) > 45 THEN
    SELLSHORT n CONTRACTS AT MARKET
    
    ENDIF

    Cheers
    GraHal

    AUDUSD-2.jpg AUDUSD-2.jpg
    #24103 quote
    CN
    Participant
    Senior

    Looks intresting, put the aud/usd version in mini at live to try it out.

    It does not have the issue with TSL as the scalp algo that raul made?

    #24178 quote
    CN
    Participant
    Senior

    Ok, So i’m ITM 50$ atm but the SL is at 15$. Why is that and why is the trailing stop not working?

    
    
    //-------------------------------------------------------------------------
    // Main code : BB AUD/USD
    //-------------------------------------------------------------------------
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM preloadbars = 150
    
    n = 1
    
    tweezerTop = ABS(High -(High[1]))<= High * 0.0075
    tweezerBottom = ABS(Low -(Low[1]))<= Low * 0.0075
    
    bullindicator = OPEN[1] > CLOSE [1] AND OPEN < CLOSE
    bearindicator = OPEN[1] < CLOSE [1] AND OPEN > CLOSE
    Boll = 20
    
    Boldown = BollingerDown[Boll](close)
    Bolup = BollingerUp[Boll](close)
    
    
    BolliLong = (low < Boldown) and tweezerBottom and bullindicator
    Bolishort = (high > Bolup) and tweezerTop and bearindicator
    
    IF NOT LongOnMarket AND BolliLong THEN
    BUY n CONTRACTS AT MARKET
    
    
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket and Bolishort THEN
    SELLSHORT n CONTRACTS AT MARKET
    
    ENDIF
    
    //trailing stop function
    trailingstart = 10 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    #24189 quote
    StantonR
    Participant
    Senior

    Hi There

    The code I used for the trailing stop was taken from Nicolas and I have not properly debugged it yet.

    Might just be easier to use ptrailing

    #24197 quote
    StantonR
    Participant
    Senior

    Hi There

     

    Have optimized the bolibounce strategy for EUR/USD

    You can use this and just optimise / use variables to find the right combination of stops and trailing for other forex pairs.

     

    //-------------------------------------------------------------------------
    // Main code : BB EURUSD 1H
    //-------------------------------------------------------------------------
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM preloadbars = 150
    
    n = 2
    
    tweezerTop = ABS(High -(High[1]))<= High * 0.0075
    tweezerBottom = ABS(Low -(Low[1]))<= Low * 0.0075
    
    bullindicator = OPEN[1] > CLOSE [1] AND OPEN < CLOSE
    bearindicator = OPEN[1] < CLOSE [1] AND OPEN > CLOSE
    
    smiind = SMI[14,3,5](close)
    
    Boll = 20
    
    Boldown = BollingerDown[Boll](close)
    Bolup = BollingerUp[Boll](close)
    
    
    BolliLong = (low < Boldown) and tweezerBottom and bullindicator and smiind < 45
    Bolishort = (high > Bolup) and tweezerTop and bearindicator and smiind > 45
    
    IF NOT LongOnMarket AND BolliLong THEN
    BUY n CONTRACTS AT MARKET
    
    
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket and Bolishort THEN
    SELLSHORT n CONTRACTS AT MARKET
    
    ENDIF
    
    SET STOP pLOSS 10 pTRAILING 10

     

     

    Sorry ignore above cant do this on prorealcode

    Capture.jpg Capture.jpg
    #24206 quote
    GraHal
    Participant
    Master

    @Stanton Only way I can get same results as you above is with nil / zero spread and tick-tick unchecked.

    Also isn’t the ploss 10 redundant as the ptrailing 10 would do the same job at 10 points loss and as soon as the TS starts to follow the price then the ploss is out of the game? Or am I missing something?

    Cheers
    GraHal

    #24208 quote
    CN
    Participant
    Senior

    @StantonR, Could you clarify?

    @Nicholas, what is wrong with the TSL?

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.

Bollinger Bounce – Tweezer Strategy – Dax 1h


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
StantonR @stantonr Participant
Summary

This topic contains 25 replies,
has 4 voices, and was last updated by GraHal
9 years ago.

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