Here is a 4Hr EURUSD strategy where I decided to combine 4 different supertrend indicators to filter out weaker trends.
The parameters are mostly standard (as originally found) with the exception of a variable named ‘margin’ that defines the minimum distance between two of the specific trend lines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
Defparam cumulateorders = false possize = 1 ////////////////////////////////////////////////////////////// //Andrew Abraham Trend Trader //Posted by @Nicolas in PRC Library ///////////////////////////////////////////////////////////// Length = 21 Multiplier = 3 avrTR = weightedaverage[Length](AverageTrueRange[1](close)) highestC = highest[Length](high) lowestC = lowest[Length](low) hiLimit = highestC[1]-(avrTR[1]*Multiplier) lolimit = lowestC[1]+(avrTR[1]*Multiplier) if(close > hiLimit AND close > loLimit) THEN ret = hiLimit ELSIF (close < loLimit AND close < hiLimit) THEN ret = loLimit ELSE ret = ret[1] ENDIF ///////////////////////////////////////////////////////////// //Simplified supertrend (without volatility component ATR) //Posted by @verdi55 in PRC Library ///////////////////////////////////////////////////////////// ONCE direction = 1 ONCE STlongold = 0 ONCE STshortold = 1000000000000 factor = 0.005 indicator1 = medianprice indicator3 = close indicator2 = indicator3 * factor STlong = indicator1 - indicator2 STshort = indicator1 + indicator2 If direction = 1 and STlong < STlongold then STlong = STlongold endif If direction = -1 and STshort > STshortold then STshort = STshortold endif If direction = 1 and indicator3 < STlong then direction = -1 endif If direction = -1 and indicator3 > STshort then direction = 1 endif STlongold = STlong STshortold = STshort If direction = 1 then ST = STlong else ST = STshort endif ///////////////////////////////////////////////////////////// //PRC_adaptive SuperTrend (r-square method) | indicator //Posted by @Nicolas in PRC Library ///////////////////////////////////////////////////////////// Period = 10 mult = 2 Data = customclose SumX = 0 SumXX = 0 SumXY = 0 SumYY = 0 SumY = 0 if barindex>Period then // adaptive r-squared periods for k=0 to period-1 do tprice = Data[k] SumX = SumX+(k+1) SumXX = SumXX+((k+1)*(k+1)) SumXY = SumXY+((k+1)*tprice) SumYY = SumYY+(tprice*tprice) SumY = SumY+tprice next Q1 = SumXY - SumX*SumY/period Q2 = SumXX - SumX*SumX/period Q3 = SumYY - SumY*SumY/period iRsq=((Q1*Q1)/(Q2*Q3)) avg = supertrend[mult,round(Period+Period*(iRsq-0.25))] EndIf ////////////////////////////////////////////////////////////////// OriginalST = Supertrend[3,5] ///////////////////////////////////////////////////////////////// margin = 7*pointsize If countofposition = 0 and abs(ret[1]-ST[1]) > margin and abs(ret-ST) > margin Then If close > ret and close > ST and close > avg Then Buy possize contract at market ElsIf close < ret and close < ST and close < avg Then Sellshort possize contract at market EndIf ElsIf longonmarket and ((abs(ret[1]-ST[1]) < margin and abs(ret-ST) < margin) or ((close < ret and close < ST and close < avg and close < OriginalST) and (close[1] < ret[1] and close[1] < ST[1] and close[1] < avg[1] and close[1] < OriginalST[1]))) Then Sell at market ElsIf shortonmarket and ((abs(ret[1]-ST[1]) < margin and abs(ret-ST) < margin) or ((close > ret and close > ST and close > avg and close > OriginalST) and (close[1] < ret[1] and close[1] < ST[1] and close[1] > avg[1] and close[1] < OriginalST[1]))) Then Exitshort at market EndIf |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Does anyone have some ideas suche regards to a seasonality filter perhaps? Maybe too stay out of the market during certain periods of even take larger/smaller positions during others.
You could just try running my Seasonality In Sample and Out Of Sample with Rating indicator and then use each months rating as variables that you use as a position size multiplier – similar to Reiner’s pathfinder strategy. Unfortunately as the seasonality ratings change as each year passes by backtesting is impossible – you would have to rely on forward testing only to prove it as at the moment the indicator only gives ratings from the present day back through to the beginning of the sampling period.
made some changes to your code
Made some changes to your code..please check
https://screencast.com/t/uP5yAY375uN
https://screencast.com/t/DJ8rKyOzxO
Looks promising, you can share the code here and maybe explain a bit more on what exactly you changed.
https://www.prorealcode.com/topic/combined-supertrend-further-discusion/
You can find me at http://www.FXautomate.com
Ahh. So i got it ? 4 different supertrends without thinking will solve all problems
sure
nothing is promising here
What? This has nothing to do with the website. The site is simply a service to help people without coding skills or time to automate their own manual trading strategies.
If I find it is no good I will tell them. I don’t even sell my strategies although I do trade them live myself.
I simply created the site as many people have asked me to assist them with automating their trading strategies in the past.
Advertising is allowed,as long as people are helping others and if provided services are about prorealtime.