Calling indicator
Forums › ProRealTime English forum › ProOrder support › Calling indicator
- This topic has 11 replies, 3 voices, and was last updated 5 years ago by umebon.
Tagged: CALL
-
-
07/08/2019 at 6:38 PM #102207
I’m need help how the code is for calling values from an indicator. The indicator is made by Thomas on this forum(thanks for sharing!) and i want to use the return of mytdaylow, mytdayhigh and mytdaycenter in my trading system but I don’t understand how too call it.
Return from indicator1Return mydayhigh COLOURED (255, 0, 0)style(line, 2) AS "High", mydaylow COLOURED (0, 255, 0)style(line, 2) AS "Low", mytdayhigh COLOURED (0, 255, 0)style(dottedline, 4) AS "Today High", mytdaylow COLOURED (255, 0, 0)style(dottedline, 4) AS "Today Low", mytdaycenter COLOURED (255,153,0,255)style(dottedline, 4)as "Today Centerline"07/08/2019 at 7:07 PM #102210The syntax for CALL is:
1myValue1, myValue2, myValue3 = CALL "myIndicator"[parameter1,parameter2]where myvalue are the returned values and parameter is the variables required by the indicator (so for example a period or setting).
So for your indicator replace myValue1 etc with your returned names and replace parameters with any that your indicator needs.
If a value is not used in your strategy then just replace its name with ‘ignored’.
1 user thanked author for this post.
07/08/2019 at 7:12 PM #102211Tnx, and what parameter do I use?
Here is the whole code from the indicator that i use by Thomas
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140// myCandel-Infos-V1.2// 18.06.2019 (Release 1.2)// Thomas Geisler// Sharing ProRealTime knowledge// https://www.prorealcode.com/library/defparam drawonlastbaronly=true // Zeichung nur am letzten Bar//--init--alpha = 255lookback = 1Info = 1Arrows = 1DayTrend = 1Centerline = 1HighLowIntraday = 1HighLow = 0Trendforce = 0OBVforce = 0//-- end--//--Info--// previous Candle Range[1] and ATR[10] and EMA-ATR[20]of ATR[1]myRange = round(Range[1])myATR = round(AverageTrueRange[10](close[0]))myEATR = round(ExponentialAverage[20](AverageTrueRange[10](close[0])))If Info = 1 thenif myATR < ExponentialAverage[20](myATR) thenDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Serif,Bold,12) coloured(153,153,153,alpha)elseDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Serif,Bold,12) coloured(255,153,0,alpha)endifendif//--end--//--Dailys highest high and lowest Low--if HighLow thenif openday <> openday[1] thendayindex = dayindex + 1dayhigh = 0daylow = close//dayopen = open//dayclose = closeif dayindex > lookback thenfor j = 1 to barindexif dayindex[j] = dayindex - lookback thenmydayhigh = dayhigh[j]mydaylow = daylow[j]breakendifnextendifendifdayhigh = max(dayhigh,high)daylow = min(daylow,low)endifif dayindex < lookback or not highlow thenmydayhigh = undefinedmydaylow = undefinedendifif dayindex < lookback or not Centerline thenmytdaycenter = undefinedendif//--end--//-- proof close over/under high or low of intraday range--mytdayhigh=DHigh(0)mytdaylow=DLow(0)DM0 = (mytdayhigh-mytdaylow)/2+mytdaylowIf DayTrend = 1 thenif close > DM0 thenDrawText(" • over",barindex,open-10,Serif,Bold,12) coloured(0,255,0,alpha)elseDrawText(" • under",barindex,open+10,Serif,Bold,12) coloured(255,0,0,alpha)endifendif//--end--//--Centerline, center of range between intraday high/low--If CenterLine = 1 thenmytdaycenter = DM0elsemytdaycenter = undefinedendif//--end--//--Show Intraday HighLow as dotted line--If HighLowIntraday = 1 thenmytdayhigh = DHigh(0)mytdaylow = DLow(0)elsemytdayhigh = undefinedmytdaylow = undefinedendif//--end--//--Arrows--//Trend bzw Trend forceif Arrows = 1 thenBullTrend = (Close - LOWEST[20](LOW)) / AVERAGETRUERANGE[10]BearTrend = (HIGHEST[20](HIGH) - Close) / AVERAGETRUERANGE[10]Trend = (BullTrend - BearTrend)TrendEMA = ExponentialAverage[20](Trend)// On Balance Volumen zur Bestimmung der Kaufkraft der Bewegung/TrendmyOBV = OBVmyOBVA1 = ExponentialAverage[20](myOBV)myOBVA2 = ExponentialAverage[10](myOBV)if Trendforce = 1 and OBVforce = 1 thenIf Trend > TrendEMA and myOBV > myOBVA1 and myOBV > myOBVA2 thenDRAWARROWup(barindex,low-2) coloured(0,255,0,alpha)elsif Trend < TrendEMA and myOBV < myOBVA1 and myOBV < myOBVA2 thenDRAWARROWdown(barindex,high+2)coloured(255,0,0,alpha)endifelsIf OBVforce = 1 and not Trendforce thenif myOBV > myOBVA1 and myOBV > myOBVA2 thenDRAWARROWup(barindex,low-2) coloured(0,255,0,alpha)elsif myOBV < myOBVA1 and myOBV < myOBVA2 thenDRAWARROWdown(barindex,high+2)coloured(255,0,0,alpha)endifelsIf Trendforce = 1 and not OBVforce thenif Trend > TrendEMA thenDRAWARROWup(barindex,low-2) coloured(0,255,0,alpha)elsif Trend < TrendEMA thenDRAWARROWdown(barindex,high+2)coloured(255,0,0,alpha)endifendifendif//--end--Return mydayhigh COLOURED (255, 0, 0)style(line, 2) AS "High", mydaylow COLOURED (0, 255, 0)style(line, 2) AS "Low", mytdayhigh COLOURED (0, 255, 0)style(dottedline, 4) AS "Today High", mytdaylow COLOURED (255, 0, 0)style(dottedline, 4) AS "Today Low", mytdaycenter COLOURED (255,153,0,255)style(dottedline, 4)as "Today Centerline"// End and make money07/08/2019 at 7:51 PM #10221307/08/2019 at 8:00 PM #10221407/08/2019 at 10:18 PM #102220I found some time to try to get CALL to work with that indicator but I couldn’t. There are no parameters needed but even if I created one by // out the lookback = 1 and creating lookback as a changeable parameter it still gives an error message.
The following strategy should just call the indicator (named MyIndicator(13) in my case) and draw the same lines on the chart but it gives the attached error.
1234567ignored,ignored,mytdayhigh,mytdaylow,mytdaycenter = CALL "MyIndicator(13)"[1]buy 1 contract at -high limitgraphonprice mytdayhighgraphonprice mytdaylowgraphonprice mytdaycenterI tested the same on a different indicator and it worked just fine so there is something about this indicator that it does not like.
You could just hard code the indicator into your strategy rather than use CALL while we all work out what is wrong.
07/08/2019 at 10:25 PM #102222From a quick scan through of the code it seems that the values that you want are just the daily high and daily low and a mid point between them which you can simply get by adding the following to your strategy:
123mytdayhigh=DHigh(0)mytdaylow=DLow(0)mytdaycentre = (mytdayhigh-mytdaylow)/2+mytdaylow07/09/2019 at 7:22 AM #10223807/09/2019 at 8:06 AM #10224607/09/2019 at 8:50 AM #102251So the correct format is (change indicator name to whatever you have it named as):
1ignored,ignored,mytdayhigh,mytdaylow,mytdaycenter = CALL "MyIndicator"(close)This deals with the required customclose that the indicator needs. I’ve had this issue before (this time I was putting the close in the [ ] which is why I could not get it to work!) Maybe the documentation for CALL needs a little update to cover this issue?
1 user thanked author for this post.
07/09/2019 at 9:10 AM #10225207/15/2019 at 8:54 AM #102573 -
AuthorPosts
Find exclusive trading pro-tools on