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

[amibroker] Odd behavior in Explore / Add Column



PureBytes Links

Trading Reference Links

Can anyone please spot the problem in my code here?  I am running an Explore, "n last days", "n = 1", "all symbols".

Seems to me that the resulting TRatio column should always contain the precisely same value, from the top of the column to the bottom, because I'm passing only one value to as an argument to TrendRatio() through every single iteration of Explore.  And that one value should be identical every time Explore loops, since the closing prices I'm using are from a call to Foreign(), and I'm not using any info at all from the current symbol.

I've run this with the entire FT database, and while most iterations report identical TRatio values (as I'd expect), there are occasional values that differ and occasional values that are blank.  I was easily able to replicate the behavior with a stock database, passing the symbol "T" to Foreign(), for example.

Thanks for any help.

    -Paul

///////////////////////////////

_SECTION_BEGIN( "test 2");

Buy = Sell = False;

/////////////////////////////////////////////////////////////////////
//HELPER FUNCTIONS
/////////////////////////////////////////////////////////////////////

function TrendRatio( PriceArray_ )
{
  aROC_short =
ROC ( PriceArray_, 1 );
  aROC_med   =
ROC ( PriceArray_, 63 );
 
return EMA ( aROC_med, 252 ) / EMA ( aROC_short, 252 );
}

///////////////////////////////////////////////////////////////////
//BEGINNING OF SCRIPT
///////////////////////////////////////////////////////////////////

Filter = 1 ;

TR_          = TrendRatio(
Foreign( "RUT-I", "C") );
AddColumn(TR_, "TRatio", 1.2 );
_SECTION_END();





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html




Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links