Dear forum members,
This is my first post on this forum.
I am looking for help in programming proscreeners and in first place a non-crossover indicator between two moving averages.
Let us cut it down into subcomponents and to start with in case of a bullish non-crossover the screener requires for a moving average – let’s take a standard 7-period moving average – to have a negative orientation in three successive period and to reverse higher during a fourth period.
If forum members can help with this first piece we will then move to the next part of the screener.
Thanks for help.
There you go (not tested):
MyAvg = average[7](close)
Result = MyAvg > MyAvg[1] and (summation[3](MyAvg < MyAvg[1])[1] = 3)
Screener[Result]
There you go:
Sma20 = average[20,0](close)
MyAvg = average[7,0](close)
Result = MyAvg > MyAvg[1] and (summation[3](MyAvg < MyAvg[1])[1] = 3)
Result = Result AND Sma20 > Sma20[1] AND close > MyAvg
Screener[Result]
adding ,0 to averages is useless, I added it just to show that there’s an optional parameter to calculate different types, see https://www.prorealcode.com/documentation/average/.
Great. Thank you so much. Works perfectly.
Have added lines of code to select minimum capital exchanged I had obtained long time ago.
Although it works I am wondering if it can be streamlined.
Happy 2020.
// Non-crossover M7/M20
Sma20 = average[20,0](close)
MyAvg = average[7,0](close)
KapitalMini = 2000 // Minimum Capital (in K)
Kapital = Volume * WeightedClose / 1000
KapitalOK = ( Kapital > KapitalMini )
Result = MyAvg > MyAvg[1] and (summation[3](MyAvg < MyAvg[1])[1] = 3)
Result = Result AND Sma20 > Sma20[1] AND close > MyAvg AND KapitalOK
Screener[Result]
Some suggestions:
- For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text from the code part!
- Do NOT quote all posts, as it makes reading topics slower and more dificult. Do it when many people update that topic and you need to refer to someone specifically. This topic is just us two! Thank you 🙂
As to streamlining it can always be done, depending on what are your goals. Post your details and myself or someone else may help you further.