MA of bullish candlesticks
Forums › ProRealTime English forum › ProBuilder support › MA of bullish candlesticks
- This topic has 8 replies, 3 voices, and was last updated 6 years ago by robertogozzi.
-
-
05/14/2018 at 3:08 PM #70378
Is it possible to write an SMA that only operates un candles having a bullish body, while ignoring the other ones?
05/14/2018 at 3:27 PM #70383Yes you can use the “non linear data serie SMA” I introduced in this code: Moving Average of Price Median (and other examples in the New Renko System thread).
Are you reinventing the RSI? 😉
1 user thanked author for this post.
05/14/2018 at 6:48 PM #70418No, I was just wondering what crossings may happen creting two different MAS, one for Bullish candles and one for Bearish ones.
05/14/2018 at 9:46 PM #70433Well, that’s an idea! I think we could it easily with the examples I pointed. I will code it tomorrow.
1 user thanked author for this post.
05/15/2018 at 8:55 PM #7053305/15/2018 at 9:42 PM #7054005/15/2018 at 10:29 PM #70553Nicolas please look at me picture . no more back data BAR !!
Please stick to the topic! Thank you.
05/16/2018 at 8:19 AM #70569Here is the code of what you are looking for, the moving average of bullish and bearish candlesticks:
12345678910111213141516171819202122232425262728293031323334353637383940414243priceMAperiod=20countup=0countdn=0sumup=0sumdn=0lastup=0lastdn=0for i = 0 to barindex doif close[i]<>lastup and close[i]>open[i] thenlastup=close[i]countup=countup+1priceup=lastupsumup=sumup+priceupendifif countup=priceMAperiod thenbreak//endifnextfor i = 0 to barindex doif close[i]<>lastdn and close[i]<open[i] thenlastdn=close[i]countdn=countdn+1pricedn=lastdnsumdn=sumdn+pricednendifif countdn=priceMAperiod thenbreak//endifnextif lastup<>lastup[1] thenavgup = sumup/priceMAperiodendifif lastdn<>lastdn[1] thenavgdn = sumdn/priceMAperiodendifreturn avgup coloured(0,200,0), avgdn coloured(200,0,0)1 user thanked author for this post.
05/16/2018 at 9:03 AM #70585Thank you very much Nicolas!
-
AuthorPosts