fourier
October 18, 2017, 10:45am
1
Hi All,
I have a quick question regarding slicing array , i.e , getting the
arrays values of interest; I know i can use a for loop to do this ,
am just wondering if there is a built in function; my goal is to
index the visible bars / bars inrange with my own indexing instead
of BarIndex() and perhaps save array memory.
Thank you
tempArray [0] = 0;
fvb = FirstVisibleValue(BarIndex());
lvb = LastVisibleValue(BarIndex());
j = 0;
for(i = fvb ; i < lvb+1 ; i++) {
tempArray[j] = Open[i];
j++;
}
fxshrat
October 19, 2017, 10:15am
2
@fourier , Examples have been posted here already
This is out of the top of my head. So it’s untested (also since I don’t have your data). PS: I don’t know if the sym variable is correct so you have to change to actual name if it is different one. /// @link How can I do running sim of Quarterly Sales at Yearly level for each Quarter? sym = Name() + "_st1";// synthetic ticker name quarter = Foreign( sym, "1" );// Foreign Aux1 field sales = Foreign( sym, "2" );// Foreign Aux2 field cond = quarter > 0;//if A…
@Chupacabra , And why don’t you say so in your first post then but rather leave much room for guessing? Have you read here How to use this site ? /// @link Counting problem SetBarsRequired( 10000, 10000 ); iloscBar = Param(“iloscBar”,14,1,100); dn = DateNum(); newDay = dn != Ref( dn, -1 ); spV = SparseCompress( newday, V ); spsum = Sum( spV, iloscBar ); csum = SparseExpand( newday, spsum ); Plot( Valuewhen( newday, csum ), "Sum(Volume) at Starts of D…
I think I more or less know now what you are looking for or want to know if it is possible… Let's say you have some array condition and you want to output a custom array based on that very same condition. The size would be the number of "TRUE" occurrences of that array condition. If that's what you are looking for then yes, you can do that too. You would need following functions for creating your user-defined matrix function (let's call it MxDynamixArray()): SparseCompress(…), NullCount(……
fourier
October 19, 2017, 10:41am
3
Alright I will read through those post and try the sample codes, much appreciated @fxshrat .