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.
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
You must be logged in to post a comment.
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.
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.
You can find me at www.FXautomate.com Ahh. So i got it ? 4 different supertrends without thinking will solve all problems sure nothing is promising here