EUR:USD 1 min = 51.79
USD:CHF 1 min = 41.86
GBP:USD 1 min = 41.43
AUD:USD 1 min = 33.36
EUR:GBP 1 min = 30.36
GBP:EUR 1 min = 23.86
The number is the average point gain per week and the equity curves look steady so there’s no huge anomalies.
Very simple code but looks effective.
Can someone also help me with applying an automatic increase / decrease in position size, relative to the strategy profit? I’m thinking for every +- £100 to increase / decrease position size by 0.1.
The code is below. Please feel free to edit with your thoughts and to let me know about the position size!
Thanks!!
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions to enter long positions
indicator1 = RSI[14](close)
c1 = (indicator1 < 20)
IF c1 AND not daysForbiddenEntry THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator2 = RSI[14](close)
c2 = (indicator2 > 60)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator3 = RSI[14](close)
c3 = (indicator3 > 75)
IF c3 AND not daysForbiddenEntry THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator4 = RSI[14](close)
c4 = (indicator4 < 40)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
HI ALex
congrats for the code …
play whit this “routine ” find in the Forum ..
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
//
Reinvest=1
if reinvest then
//Capital = 10000
Capital = 1000
//Risk = 1//in % pr position
Risk = 10//0.1//in % pr position
StopLoss = 50
//StopLoss = 70
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*(Risk/100))
MAXpositionsize=1000
//MINpositionsize=1
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)))))//*Pointsize))))
else
Positionsize=1
StopLoss = 50
//StopLoss = 70
Endif
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions to enter long positions
indicator1 = RSI[14](close)
c1 = (indicator1 < 20)
IF c1 AND not daysForbiddenEntry THEN
BUY Positionsize perpoint AT MARKET
ENDIF
// Conditions to exit long positions
indicator2 = RSI[14](close)
c2 = (indicator2 > 60)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator3 = RSI[14](close)
c3 = (indicator3 > 75)
IF c3 AND not daysForbiddenEntry THEN
SELLSHORT Positionsize PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator4 = RSI[14](close)
c4 = (indicator4 < 40)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
In my picture i mistake the spread , that for EUR/USD is competitive and the different are not too big
But if you test the other cross
EUR:USD 1 min = 51.79
USD:CHF 1 min = 41.86
GBP:USD 1 min = 41.43
AUD:USD 1 min = 33.36
EUR:GBP 1 min = 30.36
GBP:EUR 1 min = 23.86
I think you didn’tconsider the spread in your test , is it correct ?