I have not tried more complex indicators for one simple reason. If the higher 
timeframe compressed data contains all values I need (including incomplete last 
bar) I do not have to do anything . Build in indicators and my scripts will do 
everything for me. You calculate indicators on higher timeframe and expand them 
on a lower timeframe. If data compression on higher timeframe does not include 
everything you need you have to combine somehow data on higher timeframe with 
data on lower timeframe and invent new implementation of the indicators or 
create new intelligently combined weekly and data array, so build in indicators 
can use this array. That's why my preference is to fix data compression on the 
higher timeframe first before I start thinking about an exotic stuff.
So far, I have used multiple charts to avoid unnecessary programming.
I do not understand why you would use "expandFirst". Create two charts higher 
and lower timeframe in a layout and play bar by bar. I believe the code is 
correct. Of course, I did not test every possible case, that's why you found 
few mistakes. The main objective was to prove the concept and highlight the 
differences between "traditional" method and your method. 
Sometimes loops are more efficient than  array processing especially when you 
use lastvalue, nested barssince, nested valuewhen,.. etc. Every situation is 
unique, so it is hard to say in advance what is the best implementation. Always 
check "Code check $ Profile" and "Display chart timing".

Regards,

AF

Reply via email to