Hi all,
Below is another code that shows the array result of a boolean
comparison of two compressed arrays is not itself a compressed array, at
least not in the same way as the originals, according to observation of
a Plot().
Can anyone explain what is going on here?
It is beginning to seem to me that there are some pretty severe
limitations on the usage of TimeFrameSet(), and that one cannot count on
"being in the compressed domain" after calling it, because various
subsequent operations (e.g. ValueWhen(), Boolean comparison, others
???) do not seem to be valid when operating on compressed arrays.
Of course, the program does what it does, and it is up to us to
understand it ...
I do not understand why I am seeing what I'm seeing. How is one
supposed to think about this?
- Progster
--------------------------------------------------------------------
/*
HTF_Plot_Test_04.afl
Shows how result of boolean comparison of compressed arrays creates
a non-compressed array
(based on examination of a Plot() of that result).
*/
TFBase = Interval() ;
TFMult = 5 ;
Extension = Param( "Extension", 1, .1, 5, .1 );
MyHigh = High ;
MyLow = Low ;
// Plot raw lines on base TF
Plot_Raw = ParamToggle( "Plot_Raw", "No|Yes", 0 );
if(Plot_Raw){
Plot( MyHigh, "MyHigh", colorBlue, styleLine ) ;
Plot( MyLow, "MyLow", colorYellow, styleLine ) ;
}
TimeFrameSet( TFBase * TFMult ) ;
cMyHigh = High ;
cMyLow = Low ;
cHH = cMyHigh > ( Ref( cMyHigh, -1 ) + Extension ) ;
cLL = cMyLow > ( Ref( cMyLow, -1 ) - Extension ) ;
cOutsideBar = cHH AND cLL ;
// Plot compressed HTF lines on base TF
/* The results of this is not sensical in absolute terms, but if you
disregard date/time
you can visually examine collections of such compressed plots to
verify the relationships
between them.
*/
Plot_HTF_Comp = ParamToggle( "Plot_HTF_Comp", "No|Yes", 1 );
if(Plot_HTF_Comp){
Plot( cMyHigh, "cMyHigh", colorRed, styleLine ) ;
Plot( cMyLow, "cMyLow", colorWhite, styleLine ) ;
}
// These plot as "expected", with leading {EMPTY} elements, same
displayed length as cMyHigh, etc.
Plot_cHH_cLL = ParamToggle( "Plot_cHH_cLL", "No|Yes", 0 );
if(Plot_cHH_cLL){
Plot( cHH, "cHH", colorRed, styleLine ) ;
Plot( cLL, "cLL", colorWhite, styleLine ) ;
}
// This does not plot as expected, but has leading zeros for the full
length of the lower TF chart
Plot_cOutsideBar = ParamToggle( "cOutsideBar", "No|Yes", 0 );
if(Plot_cOutsideBar){
Plot( cOutsideBar, "cOutsideBar", colorRed, styleLine ) ;
}
TimeFrameRestore() ;