BCParticipant
Master
I found this strategy from below website, made some minor modification, and add a MA filter, 240 per unit to simulate a daily MA.
https://www.babypips.com/trading/system-short-term-bollinger-reversion-180426
Walk forward by MA filter, stop loss and target profit screen capture attached.
Please enjoy and comment.
// Bollinger Reversion Strategy
// Market: USD-JPY
// Time Frame: 1 Hour
// Time Zone: Any
// Spread: 2
// Original Idea from below website
// https://www.babypips.com/trading/system-short-term-bollinger-reversion-180426
defparam preloadbars = 5000
defparam cumulateorders = True
// no MM Position Size
Once noMMPositionSizeLong = 1
Once noMMPositionSizeShort = 1
// Optional Function ( 1 = Enable 0 = Disable )
BollingerMiddleExit = 1
BollingerUpDownExit = 0
MAFilter = 1
MaxStopLoss = 1
MaxTargetProfit = 1
MoneyManagement = 0
// Main Indicators Parameters Setup
Once BollingerMAPeriods = 50 // Not Optimize
Once RSIPeriods = 9 // Not Optimize
// Optional Function Parameters Setup
// MA Filter
If MAFilter then
Once MAFilterPeriods = 1680 // Variables Optimized, Range: 240-2400 Step: 240
TrendMA = Average[MAFilterPeriods](close)
LongMAFilter = Close > TrendMA
ShortMAFilter = Close < TrendMA
Endif
// 1) MaxStopLoss Setting
If MaxStopLoss then
//Long
ONCE stopLossLong = 1.4 // by %, Variables Optimized
//Short
ONCE stopLossShort = 1 // by %, Variables Optimized
Endif
//2) Target Profit Setting
If MaxTargetProfit then
//Long
ONCE takeProfitLong = 1.2 // by %, Variables Optimized
//Short
ONCE takeProfitShort = 1 // by %, Variables Optimized
Endif
// Money Management
If MoneyManagement then
Once StartPositionSize = 1
Once Size = StartPositionSize
Once InitialCapital = (100000*Size)
Once LastBalance = 0
Equity = InitialCapital + LastBalance + StrategyProfit
Once MaxPosition = 100
Once StepX = InitialCapital * 1
For TimesX = 1 to MaxPosition Do
If Equity >= StepX * TimesX then
PositionSize = Size * TimesX
ElsIf Equity <= InitialCapital then
PositionSize = StartPositionSize
endif
Next
PositionSizeLong = PositionSize
PositionSizeShort = PositionSize
// Fuse System
Once CloseBalanceMaxDrop = 50
If equity<QuickLevel then
Quit
Endif
RecordHighest = MAX(RecordHighest,Equity)
QuickLevel = RecordHighest*((100-CloseBalanceMaxDrop)/100)
Endif
//Core Indicator
MyBollingerUpBand = BollingerUp[BollingerMAPeriods](close)
MyBollingerLowBand = BollingerDown[BollingerMAPeriods](close)
MyBollingerMidBand = Average[BollingerMAPeriods](close)
MyRSILong = RSI[RSIPeriods](close)
MyRSIShort = RSI[RSIPeriods](close)
//Long Setup
LongCondition1 = Close < Open
LongCondition2 = Low < MyBollingerLowBand
LongCondition3 = Close > MyBollingerLowBand
LongCondition4 = High < MyBollingerMidBand
LongCondition5 = MyRSILong < 30 // Not Optimize
LongSignal = LongCondition1 and LongCondition2 and LongCondition3 and LongCondition4 and LongCondition5
//Short Setup
ShortCondition1 = Open > Close
ShortCondition2 = High > MyBollingerUpBand
ShortCondition3 = Close < MyBollingerUpBand
ShortCondition4 = Low > MyBollingerMidBand
ShortCondition5 = MyRSIShort > 70 // Not Optimize
ShortSignal = ShortCondition1 and ShortCondition2 and ShortCondition3 and ShortCondition4 and ShortCondition5
//Trading Action
GoLong = LongSignal
GoShort = ShortSignal
If MAFilter then
GoLong = LongSignal and LongMAFilter
GoShort = ShortSignal and ShortMAFilter
Endif
//Long Entry
If GoLong then
If MoneyManagement then
Buy PositionSizeLong Contract at Market
Else
Buy noMMPositionSizeLong Contract at Market
Endif
If MaxStopLoss then
StopLoss = StopLossLong
Endif
If MaxTargetProfit then
TakeProfit = TakeProfitLong
Endif
Endif
//Short entry
If GoShort then
If MoneyManagement then
SellShort PositionSizeShort Contract at Market
Else
SellShort noMMPositionSizeShort Contract at Market
Endif
If MaxStopLoss then
StopLoss = StopLossShort
Endif
If MaxTargetProfit then
TakeProfit = TakeProfitShort
Endif
Endif
// Bollinger Middle Exit
If BollingerMiddleExit then
If LongonMarket and Close > MyBollingerMidBand then
Sell at Market
Endif
If ShortonMarket and Close < MyBollingerMidBand then
ExitShort at Market
Endif
Endif
// Bollinger Up Down Exit
If BollingerUpDownExit then
If LongonMarket and Close > MyBollingerUpBand then
Sell at Market
Endif
If ShortonMarket and Close < MyBollingerLowBand then
ExitShort at Market
Endif
Endif
// Stop Loss
If MaxStopLoss then
Set Stop %Loss StopLoss
Endif
// Target Profit
If MaxTargetProfit then
Set Target %Profit TakeProfit
Endif
, please enjoy and comment.
BCParticipant
Master
Another version with different SL, TP method and exit module.
good strategy , only consideration is few trade
only consideration is few trade
Unfortunately this is quite often the way. Some of the best strategies place very few trades – but good trades, unfortunately the lack of trades makes them tough to test for robustness. A portfolio of many strategies that place few trades but good trades is a desirable thing to have but achieving this can be difficult due to the time required to prove robustness on this type of strategy. Also lots of strategies means the potential of lots of positions open at the same time so a big bank is needed to avoid ruin in this scenario.
Sometimes it just seems easier to buy an ETF and open a beer and just get on with life!
BCParticipant
Master
Hi Vonsai
😩😩😩😩I wish someday I can meet u and beer togeher
Hi Bin
Thanks for sharing I like this strategy much! This one is pretty similar as my trading habit as I always look for the opportunities of BB reversal.
Apart from RSI, Stochastic is one of my favorite indicator combining with BB for determining a reversal e.g. <20 go long, >80 go short. Could be a good filter maybe : P
Best
Hang
COngrats for this work
COuld you test the strategy also for other FOREX ?
Thanks