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
DEFPARAM DRAWONLASTBARONLY = True
// Arrows is a boolean, true or false toggle option as a variable for the indicator setting
// Donchian
hh = highest[30](High)
ll = lowest[30](Low)
middle = (hh-ll)*0.500
IF Arrows = 1 THEN
// Long signal
IF close = hh THEN
DRAWSEGMENT(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 signal
IF close = ll THEN
DRAWARROW(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)
ENDIF
ENDIF
drawtext(" -- 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, middle
DEFPARAM DRAWONLASTBARONLY = False
ignored, ignored, middle = CALL "MAIN_INDICATOR"[1]
// Long signal
IF close = middle THEN
DRAWARROW(barindex-1,middle) COLOURED (10,255,10,50)
ENDIF
RETURN