Hello,
I am developping a screener based on a custom indicator. this is used by the call instruction from the screener.
The screener does not return any result, so I I investigated and it seems to be due to the use of drawtext() in the indicator.
When I remove the drawtext in my indicator, the screener works.
Is this a known bug? is there a workaround?
Many thanks in advance for your help
Code of the indicator: “myindic”
if close >= average[50](close) then
trendstate = 1
//DRAWTEXT("•",barindex,0,monospaced,standard,11) coloured(40,200,0,190)
else
trendstate = -1
endif
RETURN trendState coloured(255,160,40,0) style(Point,1) as "trend"
Code of the screener that calls the indicator:
TIMEFRAME(4 hours)
trendValue = CALL "myindic"
screener (trendValue as "trend")
if we decomment the line drawtext in the indicator, the screener stops working
AVTParticipant
Senior
I assume that all those DRAWxxx commands are proBuilder only commands, something like “bring that value somehow into my window”.
Flatly spoken I think of 2 different kind of caches, one keeping the calculated value (which in a “normal” RETURN indi as “myindi” command is used by the return funcion directly) and one for the drawings (which is additionally used by DRAWxxx to insert the calculated value into the x/y axis values). And as a DRAWxxx indicator ends with a simple RETURN, the value (which a “normal” indicator would use now) is empty and cannot be accessed any longer (cause it was inserted into the drawing cache and is then gone).
Your way of changing the last line of the indicator seems the only workaround for me. Just my 2c.
thx AVT for your answer.
if I understand well, the presence of DRAWxxx functions in an indicator make it impossible to call it from a screener.
This is a weird bug / regression.
Very interesting, never seen this problem myself… and I can replicate it, thanks for let us know. While I’m still away from my office, could you please send a bug report to prorealtime to let them know about this problem please (CTRL+M)? I will track this one once I come back for good. You can add the link to this topic, I think it is sufficient to explain the bug.
I got news about this problem. The “coloured” instruction creates a problem that does not return the right value when the indicator is CALL(ED). A quick fix would be to delete the COLOURED of your DRAWTEXT line. This issue should be fixed quickly by PRT dev team. Thanks for reported it 🙂
thank you Nicolas for the workaround.
I am not sure to understand. What is the result of the indicator call?
- is it the value of the RETURN statement?
- or is it the drawtext (this would be strange…)
In my case the drawtext –> DRAWTEXT(“•”,barindex,0,monospaced,standard,11) –> this would give 0 I guess
the RETURN statement gives 1 or 0. It makes more sence that the call takes these values and not what is in the drawtext.
Returned values are only ones in RETURN instruction line of your code.
Hello Nicolas, any new for this wheather if it is fixed or not?
Again, I am sorry but it is an ugly bug!
All bugs are ugly IMO 🙂 I don’t know if it has already been fixed (did you try recently?) but I know for sure it will be very soon.