Bollinger Bandit

Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)
  • #84108

    The Bollinger Bandit uses one standard deviation above the 50-day moving average as a potential long entry and one standard deviation below the 50-day moving average as a potential short entry.
    The longer that we are in a trade, the easier it is to exit the market with a profit. We keep decrementing the number of days in our moving average calculation until we reach ten. From that point on, we do not decrement. There is one more element to our exit technique: the moving average must be below the upper band if we are long and above the lower band if we are short.
    This element is to prevent the system from going back into the same trade that we just liquidated. If we hadn’t used this additional condition and we were long and the moving average was above the upper band, the long entry criteria would still be set up and a long trade would be initiated.
    One more test must be passed before we initiate a position; the close of today must be greater than the close of 30 days ago for a long position and the close of today must be less than the close of 30 days ago for a short position. This additional requirement is a trend filter. We only want to go long in an uptrend and short in a downtrend.
    This system is longer term in nature, so we will use 50 days in our calculations.
    Could someone please translate into PRC code ? Thanks

    ———————————-
    Bollinger Bandit Pseudocode
    LiqDay is initially set to 50
    upBand = Average(Close,50) + StdDev(Close,50) *1.25 dnBand = Average(Close,50) – StdDev(Close,50) *1.25 rocCalc = Close of today – Close of thirty days ago

    Set liqLength to 50
    If rocCalc is positive, a long position will be initiated when today’s market action >= upBand
    If rocCalc is negative, a short position will be initiated when today’s market action <= dnBand
    liqPoint = Average(Close, 50)
    If liqPoint is above the upBand, we will liquidate a long position if today’s market action <= liqPoint If liqPoint is below the dnBand, we will liquidate a short position if today’s market action >= liqPoint
    If we are not stopped out today, then liqLength = liqLength – 1 If we are stopped out today, then reset liqLength to fifty
    —————————————-BELOW -TO TRANSLATE——————————————————–
    Bollinger Bandit Program
    {Uses Bollinger Bands and Rate of change to determine entry points. A trailing stop that is proportional with the amount of time a trade is on is used as the exit technique.}

    Inputs: bollingerLengths(50),liqLength(50),rocCalcLength(30); Vars: upBand(0),dnBand(0),liqDays(50),rocCalc(0);
    upBand = BollingerBand(Close,bollingerLengths,1.25); dnBand = BollingerBand(Close,bollingerLengths,-1.25);

    rocCalc = Close – Close[rocCalcLength-1]; {remember to subtract 1} if(MarketPosition <> 1 and rocCalc > 0) then Buy(“BanditBuy”)tomorrow upBand
    stop;
    if(MarketPosition <>-1 and rocCalc < 0) then SellShort(“BanditSell”) tomorrow dnBand stop;

    if(MarketPosition = 0) then liqDays = liqLength; if(MarketPosition <> 0) then
    begin
    liqDays = liqDays – 1;
    liqDays = MaxList(liqDays,10);

    end;
    if(MarketPosition = 1 and Average(Close,liqDays) < upBand) then Sell(“Long Liq”) tomorrow Average(Close,liqDays) stop; if(MarketPosition = -1 and Average(Close,liqDays) > dnBand) then BuyToCover(“Short Liq”) tomorrow Average(Close,liqDays) stop;

    ———————————-THANKS—————————————–

    #84109

    bonjour achel, il serais bien que tu t’exprime en Français sur le forum français

    par avance merci et bon week end

    1 user thanked author for this post.
    #84115

    Topic moved to automatic trading forum (ProOrder) and in the English section.

    #84147

    Here is the translated code for ProOrder:

    What timeframe and instrument suits the best the strategy? For what purpose it was designed for?

    1 user thanked author for this post.
    #84166

    What timeframe and instrument suits the best the strategy?

    Attached is DAX 1 hour over 100k bars with spread = 2

    #84171

    There was a mistake in the previous code, please use this one instead!

     

    #84248

    The Bollinger Bandit program demonstrates how to:

    •  Invoke the Bollinger Band function. This function call is less than intuitive and must be passed three parameters: (1) price series, (2) number of elements in the sample used in the calculation for the standard deviation, and (3) number of deviations above/below moving average. You must use a negative sign in the last parameter to get the band to fall under the moving average.
    • Invoke the MaxList function. This function returns the largest value in a list.
    • Do a simple rate of change calculation.
    • Create and manage a counter variable, liqLength.

     

    • Could it be possible for you to backtest with above parameters one or more of the equities listed on attached table ?
    • Could it be possible to create an indicator fo a manual trading process ?
    • Thanks very much
    • BR
    #84307

    Could it be possible for you to backtest with above parameters one or more of the equities listed on attached table ?

    I think that you’ll be able to do it by yourself?

    Could it be possible to create an indicator fo a manual trading process ?

    Do you mean an indicator with buy/sell signals on the price chart and with the strategy described in your first post?

    #84317

    Yes

    Is this possible ?

    #84328

    Let’s try this:

     

    2 users thanked author for this post.
    #84344

    Thanks Nicolas

    This looks awesome

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

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