My First code …
EUR/USD mini ,Timeframe 5 min
Only Long , and check RSI , Bollinger Band with reinvestm. profit
////// RSI_BB_LONG /////
DEFPARAM CumulateOrders=False
DEFPARAM FLATBefore = 083000
DEFPARAM FLATAfter = 120000
REINV = 1 // set-up 0 for not reinvest.
levier = 5
IF REINV = 0 THEN
n = levier
ENDIF
IF REINV = 1 THEN // Reinvest capital
capital = 2000 + strategyprofit
n = (capital / 200) *levier
ENDIF
if n > 30 then
n = 30
endif
// Variable
c3 = Low < Bollingerdown
c4 = Low[1] < Bollingerdown
c6 = Close < Open
c7 = Close[1] < Open[1]
MM15 = ExponentialAverage[20](close)
// Range
r1 = range[1] > range
c1 = RSI[10] < 30
IF c1 and c3 and c4 and c6 and c7 and r1 and not ONMARKET THEN
BUY n SHARES AT High Stop
//BUY 1 SHARES AT HIGH STOP
//SET STOP %LOSS 0.8
//SET TARGET $PROFIT 15
ENDIF
IF longonmarket and high > MM15 THEN
SELL AT MARKET
ENDIF
SET STOP %LOSS 0.4
and somenthing else
The Back test is good but only one year back
welcome your fdb
Hello JR1976,
Thanks for your contribution, I have moved your post from the Library pending list to the forum.
My test shows that the strategy isn’t so good before the last year. Did you include the spread in your backtests?
Your idea is good : taking long position while piercing the lowest bollinger band, but while it is very effective in ranging market (price revert to its mean), it is not the case in trending one, that’s the main reason I believe it doesn’t perform well before 2015.
Hi Nicolas ,
Thanks for your consultant , I confirm I used the spread 1 point
regards.
HI Nicolas,
I’am checked there is an error in the code , because not start the levrier
This the rule correct
IF REINV = 1
THEN // Reinvest capital
capital = 200 + strategyprofit
n = (capital / 200) *levier
ENDIF
Could you please check If should be better before 2015 ?
HI ,
I tried to optimized the code to avoid the trend period … the new variable is to trade IF
c8 = dailyhigh > Dhigh(50)
dailyHigh = DHigh(1)
Could you please backtest 2014 to complete the check ??
///// RSI_BB_LONG_Pr /////
DEFPARAM CumulateOrders=False
DEFPARAM FLATBefore = 083000
DEFPARAM FLATAfter = 120000
REINV = 1 // set-up 0 for not reinvest.
levier = 2
IF REINV = 0 THEN
n = levier
ENDIF
IF REINV = 1 THEN // Reinvest capital
capital = 200 + strategyprofit
n = (capital / 150) *levier
ENDIF
if n > 30 then
n = 30
endif
// Variable
c1 = RSI[10] < 30
c3 = Low < Bollingerdown
c4 = Low[1] < Bollingerdown
c6 = Close < Open
c7 = Close[1] < Open[1]
//new
c8 = dailyhigh > Dhigh(50)
dailyHigh = DHigh(1)
MM15 = ExponentialAverage[20](close)
//MM100 = ExponentialAverage[100](Dailyhigh)
// Range
r1 = range[1] > range
IF c1 and c3 and c4 and c6 and c7 and r1 and c8 and not ONMARKET THEN
BUY n SHARES AT High Stop
//BUY 1 SHARES AT HIGH STOP
//SET STOP %LOSS 0.8
//SET TARGET $PROFIT 15
ENDIF
IF longonmarket and high > MM15 THEN
SELL AT MARKET
ENDIF
SET STOP %LOSS 0.4
I’m sorry, it is still not good. Please use the “Insert PRT code” when you add codes in your post, thank you.