CALL issue?
Forums › ProRealTime English forum › ProBuilder support › CALL issue?
- This topic has 3 replies, 3 voices, and was last updated 5 years ago by Nicolas.
-
-
01/14/2019 at 6:55 PM #88598
Hi
First of all let me explain what I’m trying to do here, hopefully this isn’t me missing something!
My main indicator returns 14 variables. As part of this indicator I return these values at barindex so they are always visible because they change often and as a result I have to set DEFPARAM DRAWONLASTBARONLY = True as otherwise they would be continually blurred across the chart.
I would also like to use these 14 variables and use DRAWARROW at barindex-1 when price equals any one of them in the past, therefore I have to set DEFPARAM DRAWONLASTBARONLY = False as otherwise I would miss when the condition occurred.
Obviously I cannot achieve this in one indicator because of the conflicting DEFPARAM DRAWONLASTBARONLY setting. If I break this out into two indicators it’s fine. The problem is, the calculations for the 14 variables are quite CPU intensive as they are, therefore if I duplicate the code into two separate indicators I am exacerbating the problem and the indicators are very slow.
So I thought about trying to use the CALL command in the second indicator to see if this helps. The problem is I’m either using the CALL function incorrectly or there is a problem with it.
Without providing my exact code I have written a couple of indicators to highlight the issue I’m experiencing. Basically if I only add the ‘CALLING_INDICATOR’ to my chart (added on price) it draws everything that’s in the ‘MAIN_INDICATOR’ even though it is not added to the the chart at all and isn’t part of anything I’ve ‘CALL’ed. Is this the expected behavior?
Thanks, Rob
MAIN_INDICATOR12345678910111213141516171819202122232425262728293031323334DEFPARAM DRAWONLASTBARONLY = True// Arrows is a boolean, true or false toggle option as a variable for the indicator setting// Donchianhh = highest[30](High)ll = lowest[30](Low)middle = (hh-ll)*0.500IF Arrows = 1 THEN// Long signalIF close = hh THENDRAWSEGMENT(barindex, hh, barindex[1], hh[1]) coloured(0,0,0)DRAWARROW(barindex-1,hh) COLOURED (10,255,10,50)DRAWCANDLE(Open,High,Low,Close) COLOURED (0,0,0) BORDERCOLOR(0,0,0)ENDIF// Short signalIF close = ll THENDRAWARROW(barindex-1,ll) COLOURED (255,10,10,50)DRAWCANDLE(Open,High,Low,Close) COLOURED (0,0,0) BORDERCOLOR(0,0,0)DRAWSEGMENT(barindex, ll, barindex[1], ll[1]) coloured(01,0,0)ENDIFENDIFdrawtext(" -- 100.0%",barindex,hh,Monospaced,Standard,11) coloured(0,0,0)drawtext(" (#hh#)",barindex,hh,Monospaced,Standard,11) coloured(0,0,0)drawtext(" -- 0.00%",barindex,ll,Monospaced,Standard,11) coloured(0,0,0)drawtext(" (#ll#)",barindex,hh,Monospaced,Standard,11) coloured(0,0,0)RETURN hh, ll, middleCALLING_INDICATOR12345678910DEFPARAM DRAWONLASTBARONLY = Falseignored, ignored, middle = CALL "MAIN_INDICATOR"[1]// Long signalIF close = middle THENDRAWARROW(barindex-1,middle) COLOURED (10,255,10,50)ENDIFRETURN01/14/2019 at 7:21 PM #88608Yes, because if you CALL an indicator it means you want to use it, doesn’t it?
If you DON’T want to display those objects when youe MAIN_INDICATOR is CALLed then you’ll have to add a variable called “Flag” (or whatever you prefer) as either True or False, then use the false value when CALLing it, while setting it to true when it’s on your charts.
Of course you’ll have to change all lines where any (un)wanted object is drawn so that they are executed only when the variable FLAG is set.
01/15/2019 at 9:44 AM #88656Yes, because if you CALL an indicator it means you want to use it, doesn’t it?
If you DON’T want to display those objects when youe MAIN_INDICATOR is CALLed then you’ll have to add a variable called “Flag” (or whatever you prefer) as either True or False, then use the false value when CALLing it, while setting it to true when it’s on your charts.
Of course you’ll have to change all lines where any (un)wanted object is drawn so that they are executed only when the variable FLAG is set.
Personally, If I CALL a variable from an indicator and ignore the other two then it would be better if it just returned what I called rather than non variable content (i.e. all the DRAW code etc) but there you go.
Alternatively if we could control DEFPARAM DRAWONLASTBARONLY within code sections rather than globally then that would also be good.
01/16/2019 at 9:48 AM #88748 -
AuthorPosts
Find exclusive trading pro-tools on