Why Can't use or call some indicator?
Forums › ProRealTime English forum › ProScreener support › Why Can't use or call some indicator?
- This topic has 9 replies, 2 voices, and was last updated 7 years ago by Francesco.
-
-
05/07/2017 at 12:52 PM #34756
Hallo to all,
I tried to write a simple screener using Schaff Trend Cycle Indicator, but when I try to build it, platform says “Selected indicator Is not available in ProBuilder Language. Select another indicator.”
But STC is a built-in ProRealTime 10.3 indicator.
I tried also to…
Call “Schaff Trend Cycle”[10,23,50]
But the result is the same.
What’s the problem?
05/08/2017 at 9:12 AM #34806Some indicators can’t be used in “Simplified creation”, they need to be recoded into the screener directly.
I found the Schaff trend cycle codes in these 2 posts: https://www.prorealcode.com/prorealtime-indicators/schaff-trend-cycle/
and there: https://www.prorealcode.com/topic/dax-intraday-scalping-strategy/
05/10/2017 at 7:52 AM #34998Thank you for your answer Nicolas.
I had already found indicators that You mention, but both of them draw a different graphic compared of Schaff Trend Cycle that comes with Prorelatime 10.3.
I asked to Prorealtime support service and I’m waiting for an answer.
However, in the meantime I found an interesting article here: http://traders.com/Documentation/FEEDbk_docs/2010/04/close.html
In the article, the calculation method of STC is explained like this:
*** Code Start ***
1234567891011121314151617181920212223242526272829303132333435<strong>SCHAFF TREND CYCLE EASYLANGUAGE CODE</strong>Inputs: TCLen (10), MA1 (23), MA2 (50);Plot1(_SchaffTC(TCLen,MA1,MA2), "Schaff_TLC");Plot2(25);Plot3 (75);Inputs: TCLen(NumericSimple), MA1(NumericSimple), MA2 (NumericSimple);Variables: XMAC(0), Frac1(0), PF(0), PFF(0), Frac2(0), Factor(.5);{Calculate a MACD Line}XMAC=MACD (c,MA1,MA2);{1st Stochastic: Calculate Stochastic of a MACD}Value1=Lowest (XMAC,TCLen);Value2=Highest (XMAC,TCLen) - Value1;{%Fast K of MACD}Frac1=IFF(Value2 > 0, ((XMAC-Value1)/Value2) * 100,Frac1[1]);{Smoothed Calculation for % Fast D of MACD}PF=IFF(CurrentBar <=1,Frac1,PF[1]+ (Factor * (Frac1-PF[1])));{2nd Stochastic: DCalculate Stochastic of smoothed Percent Fast D, 'PF', above}Value3=Lowest(PF,TCLen);Value4=Highest(PF,TCLen)-Value3;{% of Fast K of PF}FRAC2=IFF(Value4 > 0,((PF - Value3)/Value4) * 100,Frac2[1]);{Smoothed Calculation for %Fast D of PF}PFF=IFF(CurrentBar<=1,Frac2,PFF[1]+(Factor * (Frac2-PFF[1])));{The STC Function is the % Fast D of PF}_SchaffTC=PFF;*** Code end ***
I tried to translate it, but I have 2 problems:
- In this formula: XMAC=MACD (c,MA1,MA2), the parameter c is not documented. It seems to be the cycle, but what is its default value?
- CurrentBar is a value that must be present in ProBuilder also. Maybe is it BarIndex?
Thanks.
05/10/2017 at 8:43 AM #3500305/10/2017 at 9:15 AM #3500905/10/2017 at 9:55 AM #35019I translated the code, but my indicator plots nothing and I can’t find the error.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748//input parametersTCLen = 10MA1 = 23MA2 = 50Once Factor = 0.5//{Calculate a MACD Line}XMAC = ExponentialAverage[MA1](Close) - ExponentialAverage[MA2](Close)//{1st Stochastic: Calculate Stochastic of a MACD}Value1 = Lowest[TCLen](XMAC)Value2 = Highest[TCLen](XMAC) - Value1//{%Fast K of MACD}if Value2 > 0 thenFrac1 = ((XMAC - Value1)/Value2) * 100elseFrac1 = Frac1[1]endif//{Smoothed Calculation for % Fast D of MACD}if BarIndex <=1 thenPF = Frac1elsePF = PF[1] + (Factor * (Frac1 - PF[1]))endif//{2nd Stochastic: DCalculate Stochastic of smoothed Percent Fast D, 'PF', above}Value3 = Lowest[TCLen](PF)Value4 = Highest[TCLen](PF) - Value3//{% of Fast K of PF}if Value4 > 0 thenFrac2 = ((PF - Value3)/Value4) * 100elseFrac2 = Frac2[1]endif//{Smoothed Calculation for %Fast D of PF}if BarIndex <= 1 thenPFF = Frac2elsePFF = PFF[1] + (Factor * (Frac2 - PFF[1]))endif//return PFFRETURN PFF05/12/2017 at 9:28 PM #3536705/16/2017 at 4:53 PM #35720I reviewed code translation: “<=” operator needs to be inverted to “>=” on both code lines 24 and 42.
The result is on the attached image: the first Schaff Trend Indicator is the ProRealTime built-in, the second “My Schaff Trend Cycle” is the translated indicator.
Curves are a little bit different, but inversion points are the same.
Now I can use it to build a screener.
1 user thanked author for this post.
08/03/2017 at 9:00 AM #42380I made some improvements from you code @Francesco, thanks for taking the time to translate it. Now the indicator seems almost identical than the one of the platform. I certainly add your indicator to the library, since the code of the Schaff trend cycle is an often query in the forums 🙂
Schaff Trend Cycle1234567891011121314151617181920212223242526272829303132333435363738394041//input parametersTCLen = 10MA1 = 23MA2 = 50Once Factor = 0.5if barindex>MA2 then//{Calculate a MACD Line}XMAC = ExponentialAverage[MA1](Close) - ExponentialAverage[MA2](Close)//{1st Stochastic: Calculate Stochastic of a MACD}Value1 = Lowest[TCLen](XMAC)Value2 = Highest[TCLen](XMAC) - Value1//{%Fast K of MACD}if Value2 > 0 thenFrac1 = ((XMAC - Value1)/Value2) * 100elseFrac1 = Frac1[1]endif//{Smoothed Calculation for % Fast D of MACD}PF = PF[1] + (Factor * (Frac1 - PF[1]))//{2nd Stochastic: DCalculate Stochastic of smoothed Percent Fast D, 'PF', above}Value3 = Lowest[TCLen](PF)Value4 = Highest[TCLen](PF) - Value3//{% of Fast K of PF}if Value4 > 0 thenFrac2 = ((PF - Value3)/Value4) * 100elseFrac2 = Frac2[1]endif//{Smoothed Calculation for %Fast D of PF}PFF = PFF[1] + (Factor * (Frac2 - PFF[1]))endifRETURN PFF, 75 coloured(0,0,255) as "level 75", 25 coloured(0,0,255) as "level 25"NOW IN LIBRARY : Schaff Trend Cycle
08/03/2017 at 11:07 PM #42454 -
AuthorPosts
Find exclusive trading pro-tools on