Entry on fib retracement?
Forums › ProRealTime English forum › ProOrder support › Entry on fib retracement?
- This topic has 25 replies, 4 voices, and was last updated 7 years ago by GraHal.
-
-
01/25/2017 at 2:38 PM #22431
Hi Grahal, thanks so much for the reply! Sorry I took so long to get back to you, it’s been a busy weekend!
Thanks for the code, I’ve tested it and its working well for me! I think when I was trying it before I was making it much more complicated than it needed to be!
Looking at your results, how come you are able to get 5 minute data going back 2 years? on my chart I am only able to test back one month. Also, what is the reasoning behind the close being greater than the exponential moving average?
Thanks!
01/25/2017 at 3:37 PM #22435Here is what I get with 200k bars and 1 point spread. Unfortunately, the stoploss is so wide that it can blow up some nice profit made by the strategy. Entries seem correct, so you should work on this stoploss part I think 🙂
01/25/2017 at 3:47 PM #22440Thanks Nicolas, I will update when I have sorted the correct exit.
For the short side would it be correct to write the code like this:
123456789IF MakeTrade = 1 AND lowest[20](low) < ll THENfib1 = (hh - lowest[20](low)) * 0.382Entry1 = lowest[20](low) + fib1ENDIFIF MakeTrade = 1 AND lowest[20](low) < ll AND close < ExponentialAverage[15](close) THENSELLSHORT 1 SHARES AT Entry1 LIMITENDIFThis would be written alongside the buy instructions to enter if the low is broken instead of the high
01/25/2017 at 6:36 PM #22467Hi Kg
Is your Platform via IG and are you selecting 5Min : X Units then select 100,00 units … see attached.
Re Close > EMA is so Buys are made during an Up Period when it is more likely that following a 0.382 retracement price will then continue upwards.
Cheers
GraHal01/25/2017 at 7:58 PM #2247701/25/2017 at 9:02 PM #22491I have to ‘see in my mind / vision’ what code is doing … so I get lost easily! 🙂
If I visioned it correct, the strategy is based on a 38% retracement after a rise; then continues up (Elliott Waves)? I added Close > EMA as an extra Buy condition to reduce buy trades during consolidation (Stage Analysis – 1 & 3).
SellShort needs to be the opposite logic I guess? I’ve had a play and also with 23.6% and 61.8% retracement, but I can’t get the full code to work as well as the ‘Long only code’.
My next thought / test was Line 3, is it correct KG?:
Entry1 = lowest[20](low) + fib1
(I’ve been ‘lured away’ for a while by the ‘Raul Dax 5 Min Scalp’ Algo:))
Cheers
GraHal01/26/2017 at 9:55 AM #2254301/26/2017 at 4:39 PM #22623I thought that line was correct, but like you said getting it to work as well as the buy side is difficult.
There was one instance in my backtest where there was a break to the upside and it entered long, but then before the maketrade period was over there was a breakout on the bottom too. The system simply exited the long and went short which shouldnt happen.
I will have another play around with the code and post any updates!
1 user thanked author for this post.
01/27/2017 at 12:20 PM #22732Hi KG
Your ‘Long + my revisons’ is making money on Demo, but I’m not sure it’s working in line with Elliott Waves / Fib Retracement theory? (see attached).
Look forward to what you come up with for the Long + Short version. I’m not great at coding, but I’m enjoying helping / adding bits.
Thanks
GraHal01/27/2017 at 3:26 PM #22757I made modifications myself about the code, I’m not sure about the short positions logic.. it’s may be wrong, but here is the full code.
I add a short stoploss (40 points), with a simple monthly pivots filter (above / below). Just throwing ideas on this Friday afternoon. Results are decent, even if we loose almost 2 times more than we win .. I let you review entries logic.
1234567891011121314151617181920212223242526272829303132333435363738394041424344DEFPARAM CumulateOrders = FalseDEFPARAM FlatAfter = 214500StartTime = 065000FinalTime = 113000// Set Breakout box for between 5pm and 7amIf Time = 065000 THENhh = highest[80](high)ll = lowest[80](low)ENDIF//Only make trade between 7am and 10amMakeTrade = Time >= StartTime AND Time <= FinalTimeIF MakeTrade AND highest[20](high) > hh THENfib = (highest[20](high) - ll) * 0.382Entry = ll + fibENDIFIF MakeTrade AND lowest[20](low) < ll THENfib1 = (hh - lowest[20](low)) * 0.382Entry1 = lowest[20](low) + fib1ENDIFhhh = max(high,hh)lll = min(low,ll)If Month<>Month[1] thenmonthlyHigh = hhh[1]monthlyLow = lll[1]monthlyPivot = (monthlyHigh + monthlyLow + Close[1]) / 3hh = 0ll = close*100EndifIF MakeTrade AND highest[20](high) > hh AND close > monthlyPivot THENBuy 1 SHARE AT Entry LIMITENDIFIF MakeTrade AND lowest[20](low) < ll AND close < monthlyPivot THENSELLSHORT 1 SHARES AT Entry1 LIMITENDIFSET TARGET pPROFIT 100SET STOP pLOSS 401 user thanked author for this post.
01/28/2017 at 11:55 PM #22891 -
AuthorPosts
Find exclusive trading pro-tools on