I’d like to use functionality similar to DEFPARAM CALCULATEONLASTBARS in an indicator. I want to be able to pass it a variable though (not hardcode a set number of bars to load). I can’t find any way to do this though. Alternatively is there a way to replicate this functionality within the indicator? The indicator may be used on multiple different timeframes, so it is difficult to limit the calculation purely on date/time.
No variable can be used with any of the DEFPARAM instruction, I’m sorry.
About your second question, you could use a DRAWONLASTBARONLY and then make a loop from there to calculate and display your indicator within the last X bars defined in the loop. A bit tricky if your indicator has already one or more FOR/NEXT loop built-in, but it could work as intended.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue