Dynamic Indicator Variables?

 

How can I reinitialize an indicator's period based on the output of another indicator's handle? Would I create the int/double on the oninit tab, or inside the oncalculate tab? 

Would I copy the handle/buffer over to OnTick and calculate the period variable and return it back to oncalculate?


Edit: I did some searching and apparently the function is capable in Pinescript. There's gotta be some way to make this functional in mql5.. 

Documentation on MQL5: Checkup / Period
Documentation on MQL5: Checkup / Period
  • www.mql5.com
Period - Checkup - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Could I declare handles of the source  indicator of the dynamic variable and the destination  indicator of the dynamic variable on global and then copy their buffers to oncalculate and oninit?