Scalping EURUSD
Forums › ProRealTime English forum › ProOrder support › Scalping EURUSD
- This topic has 32 replies, 7 voices, and was last updated 7 years ago by Ronny.
-
-
08/13/2017 at 2:23 PM #43115
Just to add som information to this thread, I have been running this algo live since mid May. The results are attached in a PDF.
This is the version I have been running, Maz version (I have not done any manual interference):
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204// ADX-Bollinger Mean Reversion v 1.12// Version 0.23// https://www.prorealcode.com/topic/scalping-eurusd/DEFPARAM cumulateOrders = falseDEFPARAM preloadBars = 300once GMTOffset = 2 // Your time zone reletive to +/- GMT (in hours) 0=GMT | 1=CETonce optimization = 1// -- Optimizations selection --if optimization = 1 then // USD_JPY :: M5 (Jan 2016- Apr 2017)startTime = 090000 // 100000endTime = 230000 // 240000fridayEndTime = 225000 //bolUpPeriod = 20bolDnPeriod = 20maShrtPeriod = 8maLongPeriod = 200adxPeriod = 21adxThreshold = 22stopLossMode = 3 // 1: Static | 2: Dynamic | 3: Trailing1 | 4: Trailing2stopLoss = 67 // For Static stopslATRmultiple = 5 // For Dynamic stoptargetATRmultiple = 7 // For Dynamic target//tslATRmultiple = 8 // For Dynamic trailing stop, also try 5 and 3moneymgmt = 1 // 1: Fixt position size | 2: Increasing position sizeelsif optimization = 2 thenstartTime = 090000 // 100000endTime = 230000 // 240000fridayEndTime = 225000 //bolUpPeriod = 20bolDnPeriod = 20maShrtPeriod = 8maLongPeriod = 200adxPeriod = 21adxThreshold = 22stopLossMode = 3 // 1: Static | 2: Dynamic | 3and4: Trailing stopsstopLoss = 70 // For Static stopslATRmultiple = 5 // For Dynamic stopmoneymgmt = 1 // 1: Fixt position size | 2: Increasing position size// elsif optimization = 3 then // ... and so onendif// Money mgmtIF moneymgmt = 1 thenpositionSize = 1elsif moneymgmt = 2 thenREM Money ManagementCapital = 10000Risk = 0.2Sl = 70 // Could be our variable XREM Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*Risk)PositionSize = abs(round((maxrisk/Sl)/PointValue)*pipsize)endif// -- Time zone adjustments --startTime = startTime + ( GMTOffset * 10000 )endTime = endTime + ( GMTOffset * 10000 )fridayEndTime = fridayEndTime + ( GMTOffset * 10000 )// -- Indicators -----bLow = BollingerDown[bolUpPeriod]bHigh = BollingerUp[bolDnPeriod]MA1 = average[maShrtPeriod]MA2 = average[maLongPeriod]ad = adx[adxPeriod]atr = averageTrueRange[40]// -- Entry conditions -----// -- Common Conditions (for both long and short) --isTradingTime = (currenttime > startTime and currenttime < endTime)atADXLevel = (ad > adxThreshold)isLateFriday = (dayOfWeek = 5 and time >= fridayEndTime)if isTradingTime and atADXLevel then// -- long conditions only --bc1 = not longOnMarket //and isTradingTime and atADXLevelbc1 = bc1 and (max(low, close) < bLow) //(low < bLow and close < bLow)bc1 = bc1 and (MA1 > MA2) //and (MA2 > MA2[1])// -- Short conditions only --sc1 = not shortOnMarket //and isTradingTime and atADXLevelsc1 = sc1 and (min(high, close) > bHigh) //(high > bHigh and close > bHigh)sc1 = sc1 and (MA1 < MA2) //and (MA2 < MA2[1])elsebc1 = 0sc1 = 0endifif onMarket then// -- Long EXIT conditions only --le1 = longOnMarket and ( (close > bHigh) or isLateFriday )// -- Short EXIT conditions only --se1 = shortOnMarket and ( (close < bLow) or isLateFriday )elsele1 = 0se1 = 0endif// -- Execution Handlers -----if bc1 thenbuy positionSize contract at marketelsif sc1 thensellShort positionSize contract at marketelsif le1 thensell at marketelsif se1 thenexitshort at marketendifSET TARGET pPROFIT (atr * targetATRmultiple)/pointsize //dynamic ATR based targetif stopLossMode = 1 then // static stop lossSET STOP pLOSS stopLosselsif stopLossMode = 2 then // dynamic ATR based stop lossSET STOP pLOSS (atr * slATRmultiple)/pointsizeelsif stopLossMode = 3 then // trailing stop 1SET STOP pLOSS stoploss//trailingstop = (atr * tslATRmultiple)/pointsizetrailingstop = 30//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE (Maximum favorable excursion) of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendifelsif stopLossMode = 4 then // trailing stop 2SET STOP pLOSS stoplosstrailingstart = 30 //trailing will start @trailinstart points profittrailingstep = 10 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIFENDIF1 user thanked author for this post.
08/14/2017 at 8:52 AM #43134Hi Ronny! Thanks for sharing! I tested this strategy mostly on demo and after letting it run for some time and a few tries on backtest I decided not to run it live. The main problem that I found was trades it got into when the short term trend was turning around ( same problem as with all mean-rev.) However on such short timeframe I found it hard to determinate if it was possible to get a long term edge and not just a short term curve fit.
08/14/2017 at 9:41 AM #43144I can understand that this one easily gets curve fitted. It’s a pity actually, I like the idea behind it. Looking at the equity curve, it has a quite stable downwards movement. Maybe it could tell us that it’s something there to explore 🙂 Anyway 55 trades is not representative, but I get a feeling that I should shut it down. I like testing the strategys with small amounts in live trade, more than demotrading.
-
AuthorPosts