CALL issue?

Viewing 4 posts - 1 through 4 (of 4 total)
  • #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

     

     

     

     

    #88608

    Yes, 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.

    2 users thanked author for this post.
    #88656

    Yes, 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.

    #88748

    Because DRAWONLASTBARONLY is set to false in the main code, it is normal that it overrides the one set in the CALLed indicator.

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login