I want to display the Fall in analysis window, how can i do that? Please help.
strDate1 = StrToDateTime("04/04/2022");
strDate2 = StrToDateTime("17/06/2022");
ClosePrice1 = ValueWhen(DateTime()==strDate1,C,1);
ClosePrice2 = ValueWhen(DateTime()==strDate2,C,1);
Fall = (ClosePrice1 - ClosePrice2)/ClosePrice1 ;
AddColumn(Fall, "Percentage Fall", 1.2);
nsm51
#2
see this Lookup function. It has better logic to search.
AFL Function Reference - LOOKUP (amibroker.com)
3 Likes
Still i get no result. 
InputDate1 = "04/04/2022";
InputDate2 = "17/06/2022";
ClosePrice1 = Lookup( Close, _DT( InputDate1 ), -1 );
ClosePrice2 = Lookup( Close, _DT( InputDate1 ), -1 );
Fall = 0;
Fall = (ClosePrice1 - ClosePrice2)/ClosePrice1 ;
AddColumn(Fall, "Percentage Fall", 1.2);
@erukumk I think you made a mistake when copying, you are using the same InputDate1 in both lines
I get a result
InputDate1 = "04/04/2022";
InputDate2 = "17/06/2022";
ClosePrice1 = Lookup( Close, _DT( InputDate1 ), -1 );
ClosePrice2 = Lookup( Close, _DT( InputDate2 ), -1 );
Fall = 100 * ( ClosePrice1 - ClosePrice2 ) / ClosePrice1 ;
Filter = 1;
AddColumn( ClosePrice1, "ClosePrice1" );
AddColumn( ClosePrice2, "ClosePrice2" );
AddColumn( Fall, "% Fall", 1.2 );

2 Likes
@erukumk make sure you've set the Filter variable. Without it, your Exploration will produce no output.
1 Like
system
Closed
#7
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.