Stochastic & Ema Crossover Screener
Forums › ProRealTime English forum › ProScreener support › Stochastic & Ema Crossover Screener
- This topic has 11 replies, 3 voices, and was last updated 6 years ago by robertogozzi.
-
-
04/27/2018 at 7:24 AM #69262
Hi Everyone,
I am new to coding and prorealtime too. I would like to code a screener that has more conditions, hope to get some help here.
Is it necessay to state the screener timeframe? i am looking to do daily screening.
Condition for buy :
- 20 EMA is higher than the 50 EMA.
- And, the stochastic K line CROSS OVER the D line
- And closing price is higher than the 50 EMA.
Note: i would like to use stochastic ( 14, 5, 3)
Thank you
04/27/2018 at 8:39 AM #69266I created a new topic, since you are requesting something different, though slightly, from a Stochastic Crossover.
I already have some code, I just need to change it a bit. I’ll try to post something as soon as possible.
Roberto
04/27/2018 at 9:04 AM #69268There you go (for Short trades you’ll have to test conditions the other way round). You do not need to state the timeframe in the code itself, as far as you check only one, just select the one you want in the screener box when you create it.
1234567891011StocK = Stochastic[14,5](close)StocD = Average[3,0](StocK)Ema50 = Average[50,1](close)Ema20 = Average[20,1](close)Up = Ema20 > Ema50 AND close > Ema50 AND StocK CROSSES OVER StocDIF Up THENResult = 1ELSEResult = 0ENDIFSCREENER[Result] (Result AS "Up")To know what the second parameter in AVERAGE means you may read https://www.prorealcode.com/documentation/average/.
Roberto
04/27/2018 at 1:36 PM #69281thanks Roberto, will try it out!
07/14/2018 at 4:37 AM #75943Hi,
I tried some modifications to short trades but came up with nothing across the timeframes. Can you please check this to see where my error is?
EMA 20, 50, 100 and stochastic crossover123456789101112StocK = Stochastic[14,3](close)StocD = Average[3](StocK)Ema100 = Average[100,1](close)Ema50 = Average[50,1](close)Ema20 = Average[20,1](close)Down = Ema20 < Ema50 and Ema50 < Ema100 AND close < Ema50 AND StocK CROSSES UNDER StocDIF Down THENResult = 1ELSEResult = 0ENDIFSCREENER[Result] (Result AS "Down")07/14/2018 at 5:13 AM #75944Hi,
Also tried this combination to see if it makes any difference. I’m still very new and poor at coding.
EMA Stoch crossover123456789101112131415StocK = Stochastic[14,3](close)StocD = Average[3](StocK)Ema100 = Average[100,1](close)Ema50 = Average[50,1](close)Ema20 = Average[20,1](close)Up = Ema20 > Ema50 and Ema50 > Ema100 AND close > Ema50 AND StocK CROSSES OVER StocDDn = Ema20 < Ema50 and Ema50 < Ema100 AND close < Ema50 AND StocK CROSSES UNDER StocDReturnValue = 0IF Dn THENReturnValue = -1ELSIF Up THENReturnValue = 1ENDIFSCREENER[ReturnValue] (ReturnValue AS "1=Up / -1=Dn")07/14/2018 at 10:47 AM #75963When you make corrections/integrations, only add ONE at a time, because the more you add to the original code the more difficult it will be to detect errors.
So, first let’s add the SHORT scan:
12345678910111213StocK = Stochastic[14,5](close)StocD = Average[3,0](StocK)Ema50 = Average[50,1](close)Ema20 = Average[20,1](close)Up = Ema20 > Ema50 AND close > Ema50 AND StocK CROSSES OVER StocDDn = Ema20 < Ema50 AND close < Ema50 AND StocK CROSSES UNDER StocDResult = 0IF Up THENResult = 1ELSIF Dn THENResult = 2ENDIFSCREENER[Result] (Result AS "1=Up/2=Dn")When it works as expected you may add new features (one at a time!), like a new MA as you did.
1 user thanked author for this post.
07/14/2018 at 2:12 PM #75985Dear robertogozzi,
Thanks for going through the trouble to produce the codes. I’d like a final request to combine these codes if you don’t mind.
LONG
H4 stochastic and H1 stochastic (14,3,5) %K > %D in both with price above EMA 50 in both and EMA 20 above EMA 50 and EMA 50 above EMA 100
SHORT
H4 stochastic and H1 stochastic (14,3,5) %K < %D in both with price below EMA 50 in both and EMA 20 below EMA 50, and EMA 50 below EMA 100
I hope with this I’ll be able to stop bothering you.
07/14/2018 at 3:32 PM #75987There you go
EMAs & Stochastic MTF screener 11234567891011121314151617181920212223242526TIMEFRAME(4 hours)StocKa = Stochastic[14,5](close)StocDa = Average[3,0](StocKa)Ema100a = Average[100,1](close)Ema50a = Average[50,1](close)Ema20a = Average[20,1](close)UPa = close > Ema50a AND Ema20a > Ema50a AND Ema50a > Ema100a AND StocKa > StocDaDNa = close < Ema50a AND Ema20a < Ema50a AND Ema50a < Ema100a AND StocKa < StocDaTIMEFRAME(1 hour)StocKb = Stochastic[14,5](close)StocDb = Average[3,0](StocKb)Ema100b = Average[100,1](close)Ema50b = Average[50,1](close)Ema20b = Average[20,1](close)UPb = close > Ema50b AND Ema20b > Ema50b AND Ema50b > Ema100b AND StocKb > StocDbDNb = close < Ema50b AND Ema20b < Ema50b AND Ema50b < Ema100b AND StocKb < StocDbTIMEFRAME(default)Result = 0IF UPa AND UPb THENResult = 1ELSIF DNa AND DNb THENResult = 2ENDIFSCREENER[Result] (Result AS "1=Up/2=Dn")LONG
H4 stochastic and H1 stochastic (14,3,5) %K > %D in both with price above EMA 50 in both and EMA 20 above EMA 50 and EMA 50 above EMA 100
SHORT
H4 stochastic and H1 stochastic (14,3,5) %K < %D in both with price below EMA 50 in both and EMA 20 below EMA 50, and EMA 50 below EMA 100
You didn’t write BOTH after the hilighted words, as you had done before. I assumed it in the above code. Should you have meant NOT TO PURPOSELY write that word, then the code changes a bit as follows:
EMAs & Stochastic MTF screener 212345678910111213141516171819202122232425262728TIMEFRAME(4 hours)StocKa = Stochastic[14,5](close)StocDa = Average[3,0](StocKa)Ema50a = Average[50,1](close)UPa = close > Ema50a AND StocKa > StocDaDNa = close < Ema50a AND StocKa < StocDaTIMEFRAME(1 hour)StocKb = Stochastic[14,5](close)StocDb = Average[3,0](StocKb)Ema50b = Average[50,1](close)UPb = close > Ema50b AND StocKb > StocDbDNb = close < Ema50b AND StocKb < StocDbTIMEFRAME(default)Ema100 = Average[100,1](close)Ema50 = Average[50,1](close)Ema20 = Average[20,1](close)UP = Ema20 > Ema50 AND Ema50 > Ema100DN = Ema20 < Ema50 AND Ema50 < Ema100Result = 0IF UPa AND UPb AND UP THENResult = 1ELSIF DNa AND DNb AND DN THENResult = 2ENDIFSCREENER[Result] (Result AS "1=Up/2=Dn")1 user thanked author for this post.
07/14/2018 at 9:03 PM #7601807/21/2018 at 6:20 AM #76398Hi,
From the code you created below, how does one screen the 1 hour timeframe for stochastic crossover below 20 and crossunder above 80?
Stochastic123456789101112131415161718192021TIMEFRAME(daily)StocKa = Stochastic[14,3](close)StocDa = Average[5,0](StocKa)UPa = StocKa > StocDaDNa = StocKa < StocDaTIMEFRAME(1 hour)StocKb = Stochastic[14,3](close)StocDb = Average[5,0](StocKb)Ema50b = Average[50,1](close)UPb = close > Ema50b AND StocKb > StocDb AND Stockb < 20DNb = close < Ema50b AND StocKb < StocDb AND Stockb > 80TIMEFRAME(default)Result = 0IF UPa AND UPb THENResult = 1ELSIF DNa AND DNb THENResult = 2ENDIFSCREENER[Result] (Result AS "1=Up/2=Dn")07/21/2018 at 10:26 AM #76408Like I did at post https://www.prorealcode.com/topic/split-stochastic-ema-crossover-screener/#post-75944, lines 6 and 7. Instead of testing whether something is > or < or = than something else you just need to write CROSSES OVER or CROSSES UNDER.
Lines 11 and 12 of your code above should be replaced by
1234//UPb = close > Ema50b AND StocKb > StocDb AND Stockb < 20//DNb = close < Ema50b AND StocKb < StocDb AND Stockb > 80UPb = close > Ema50b AND StocKb > StocDb AND Stockb CROSSES UNDER 20DNb = close < Ema50b AND StocKb < StocDb AND Stockb CROSSES OVER 801 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on