[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Having a nasty time figuring this APL out.



PureBytes Links

Trading Reference Links

The statement in the loop ...

TestVolume = IIf((Ref(Volume ,-i+1)> Ref(Volume ,-i)),True,False);

does NOT reference ONE data point along the Volume array at the 
current bar -i + 1, it references the entire array.

If you wanted to reference one point along the array then you can do 
so by writing for example

Volume[i] ... 

The way you have written the code TestVolume is an array ... 
therefore PassTest is an array.  You can plainly see this by noting 
out the offending statement and adding

Filter = 1;
AddColumn(TestVolume, "TV", 1.2);
AddColumn(PassTest, "{T", 1.2);

to your code and running an Explore ...

--- In amibroker@xxxxxxxxxxxxxxx, "Homar Simpson" <x77777x@xxx> wrote:
>
>   As I mentioned I've been programming for 30 years.
> 
>   What I'm doing here is assigning a SINGLE boolean variable based 
on
> the comparison of array contents. If I did this in VB or VBA , there
> would be no issue. Are you saying  the boolean takes on the
> characteristic of the tested array?  I think Tradestation does
> something like that.
> 
>   If thats the case , how would you 
> 
>   If I say  Var1=x(5)-y(2), then Var1 is not an array. 
> 
>   Explain how:
>       if (PassTest==False)  i=0;
>   generates an array error??
> 
> 
>  Please explain the actual reason, I've read the docs and there's
> nothing there to make this clear.
> 
> 
> ================================================================
> Days=Param("Days To Test",3,1,15,1);
> 
> PassTest=True;
> 
> for(i=Days; i>0 ; i--) 
> 
> {
> TestVolume = IIf((Ref(Volume ,-i+1)> Ref(Volume ,-i)),True,False); 
> 
> PassTest = IIf(testvolume == False,False,PassTest );
> 
> 
> if (PassTest==False)  i=0;
> 
> 
> }
> 
> 
> _TRACE("--------------------------------- ");
> 
> FL1=PassTest;
> FL2=Close >Param("ClosingPrice",5,0,999999,1);	
> 
> Filter = FL1 AND FL2;
> 
> AddColumn(Close,"Close",1.4);
> AddColumn(Volume,"Volume",1.0);
> AddTextColumn( FullName(), "Full name", 77);
> 
> AddColumn(Ref(Volume,-1),"Volume -1",1.0);
> AddColumn(Ref(Volume,-2),"Volume -2",1.0);
> AddColumn(Ref(Volume,-3),"Volume -3",1.0);
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.9/573 - Release Date: 12/5/2006 4:07 PM