Entry Setup indicator
Forums › ProRealTime English forum › ProBuilder support › Entry Setup indicator
- This topic has 7 replies, 4 voices, and was last updated 7 years ago by Derek.
-
-
08/01/2017 at 4:20 PM #42235
I was wondering if there is any indicator showing when a setup, either Long or Short, presents for a trade to be eventually entered.
I admit I did not spend much time investigating. I was just willing to experience a bit, so I ended up with this code:
Entry Setup indicator123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293DEFPARAM CalculateOnLastBars = 1000// initialization of variablesUp = close > openDn = close < openONCE PipDistance = 0// ----------------------------- Macd ------------------------------------IF Macd1 < 1 OR Macd1 > 999 THENMacd1 = 12 //default 12ENDIFIF Macd2 < 1 OR Macd2 > 999 THENMacd2 = 26 //default 26ENDIFIF Macd3 < 1 OR Macd3 > 999 THENMacd3 = 9 //default 9ENDIFMacdVal = MACD[Macd1,Macd2,Macd3](close)MacdSignal = MACDline[Macd1,Macd2,Macd3](close)Up = Up AND MacdVal > MacdVal[1] AND MacdSignal > MacdValDn = Dn AND MacdVal < MacdVal[1] AND MacdSignal < MacdVal// ----------------------------- Rsi -------------------------------------IF RsiNum < 1 OR RsiNum > 999 THENRsiNum = 14 //default 14ENDIFIF RsiUpperLimit < 1 OR RsiUpperLimit > 999 THENRsiUpperLimit = 70 //default 70ENDIFIF RsiLowerLimit < 1 OR RsiLowerLimit > 999 THENRsiLowerLimit = 30 //default 30ENDIFIF RsiMiddleLimit < 1 OR RsiMiddleLimit > 999 THENRsiMiddleLimit = 50 //default 50ENDIFRsiVal = Rsi[RsiNum]Up = Up AND RsiVal > RsiVal[1] AND RsiVal > RsiMiddleLimitDn = Dn AND RsiVal < RsiVal[1] AND RsiVal < RsiMiddleLimit// ----------------------------- Stochastic ------------------------------IF Stoc1 < 1 OR Stoc1 > 999 THENStoc1 = 8 //default 8ENDIFIF Stoc2 < 1 OR Stoc2 > 999 THENStoc2 = 3 //default 3ENDIFIF Stoc3 < 1 OR Stoc3 > 999 THENStoc3 = 3 //default 3ENDIFIF StocUpperLimit < 1 OR StocUpperLimit > 999 THENStocUpperLimit = 80 //default 80ENDIFIF StocLowerLimit < 1 OR StocLowerLimit > 999 THENStocLowerLimit = 20 //default 20ENDIFStocD = Stochastic[Stoc1,Stoc2](close)StocK = Average[Stoc3](StocD)Up = Up AND StocK > StocDDn = Dn AND StocK < StocD// ----------------------------- Moving Averages -------------------------// variable AVGTYPE can hold values://// 0 = SMA// 1 = EMA// 2 = WMA// 3 = Wilder MA// 4 = Triangular MA// 5 = End point MA// 6 = Time series MA//IF FastAvg < 1 OR FastAvg > 999 THENFastAvg = 3 //default 3ENDIFIF SlowAvg < 1 OR SlowAvg > 999 THENSlowAvg = 9 //default 9ENDIFIF AvgType < 0 OR AvgType > 6 THENAvgType = 1 //default 1 (Ema)ENDIFMAfast = Average[FastAvg, AvgType]MAslow = Average[SlowAvg, AvgType]//Up = Up AND MAfast CROSSES OVER MAslow//Dn = Dn AND MAfast CROSSES UNDER MAslowUp = Up AND MAfast > MAslowDn = Dn AND MAfast < MAslow// ----------- Draw Arrows on return (some pips below BAR) ---------------IF Up THENDRAWARROWUP(barindex,low - (PipDistance * pipsize)) coloured(50,205,50) //greenELSIF Dn THENDRAWARROWDOWN(barindex,high + (PipDistance * pipsize)) coloured(255,0,0) //redENDIFRETURN Up OR DnAs you can see it evaluates Macd, Rsi, Stochastic and Moving Averages, either UP (long) or DOWN (short) and displays an arrow accordingly. Other indicators/Oscillators may be added.
It allows many variables (some of them, especially limits, not yet used for the most part) to be tailored by the user.
Many default values come from some (not much) testing on daily Eur/Usd bars.
It returns either ZERO (no setup) or NOT ZERO (1 or -1) for “good” setups. A trade may entered according to the colour of the arrow on the chart, after considering other patterns, support and resistance areas etc….
Variable “PipDistance” was meant to be the distance, in pips, above/below the candle to make it more visible, but it did not work as expected, so I reset it to ZERO by default.
I always check that if variables are either < 1 or > 999 they will default to embedded values.
It could be used in automated strategies by cheking if the returned value is either -1 or 1 (0 = no setup).
If there is already some PRT code published about setups I would appreciate receiving a link.
Any suggestion or further development is encouraged, if anyone is interested.
Roberto
08/01/2017 at 7:29 PM #4226508/01/2017 at 8:06 PM #4226808/01/2017 at 9:18 PM #42274Anything you like Nicolas, any suggestion/improvement is welcome.
I also think I should change the last line as follows:
1RETURN Up OR (Dn * -1)so that it returns 1 for UP and -1 (instead of 1) for DOWN, because the way it is now it always returns either ZERO for no setup or 1 for any setup, no matter if a Long or Short one!
08/01/2017 at 9:23 PM #4227508/02/2017 at 8:07 AM #42284Sorry, I wrote SHRINKED, but it should have been written SHRUNK.
08/02/2017 at 9:08 AM #42288Yes Roberto, it is far more elegant like you did 🙂
1 user thanked author for this post.
08/02/2017 at 8:46 PM #42364Hi Roberto!
I have created whole trading systems in probuilder a while back and my generalized solution to your initial question was to create different statuses for different indicator combinations. This was important to me to efficiently factor in the time it took for a set-up actually leading to the actual event and the trade.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on