Plot 8 Day EMA(close, 3) on Daily chart
Forums › ProRealTime English forum › ProBuilder support › Plot 8 Day EMA(close, 3) on Daily chart
- This topic has 8 replies, 3 voices, and was last updated 7 years ago by kris00l.
-
-
09/03/2017 at 4:54 PM #4530209/04/2017 at 12:42 AM #45322
What doeas parameter 3 mean (after close)?
09/04/2017 at 2:40 AM #4532309/06/2017 at 2:17 PM #45637This kind of code should be close enough to a real daily EMA, but in intraday timeframes:
12345678910111213p=14 // periodsonce dailyEMA = DClose(0)if intradaybarindex=0 thenoldEMA=dailyEMAendifk = 2/(p + 1)dailyEMA = Dclose(0)*k+oldEMA*(1-k)RETURN dailyEMA09/06/2017 at 6:39 PM #45653Thanks Nicolas. Based on EMA formula (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages) and my initial request:
EMA(3) is what gets calculated. In you example code it is EMA(14). But what I need is to convert below pinescript:
//@version=3
study(“My Script”)
m=security(tickerid, “8D”, ema(close,3))
plot(m)also, once this is works I need to convert this as a screener. Currently Tradingview lacks in this. TOS doesn’t have 8D but they do have 1d, 2d, 3d and 4day period but NOT 8D :(.
09/06/2017 at 8:58 PM #4566409/06/2017 at 11:12 PM #4566809/07/2017 at 8:31 AM #45693Just a quick and rough code this morning (have to go), please have in mind that there is no multi timeframe support in ProBuilder.
12345678910111213141516171819p=3 // periodsonce dailyEMA = DClose(0)if barindex<>oldBAR and barindex>0 thenoldEMA=dailyEMA[1]oldBAR=barindexcount=count+1if count=8 thencount=0price=Dclose(0)endifendifk = 2/(p + 1)dailyEMA = price*k+oldEMA*(1-k)RETURN dailyEMAAbout the screener, please give me at least one condition to fire alerts! Thank you.
09/08/2017 at 4:09 AM #45761Thanks Nicolas ..this gave me the idea … here’s the code but i’m not getting the quite the value it should be for 8D ema(3).
8D EMA(3)12345678910111213141516171819202122once count = 0if count = 7 thenp=3 // periodsonce dailyEMA = DClose(7)if intradaybarindex=0 thenoldEMA=dailyEMAendifk = 2/(p + 1)dailyEMA = (Dclose(7)-oldEMA)*k+oldEMAcount = 0endifcount = count + 1RETURN dailyEMAwithin “if count” structure and having dclose(0) will get EMA(3) so Dclose(7) will get me close of 8th day. Previous ema calculation is what i think needs to be fixed to get my code working 100% accurately.
-
AuthorPosts
Find exclusive trading pro-tools on