Hi,
I refer to TJ's code for S&C article on relative strength. This querry
concerns the "startpoint" in second part on plotting baseline relative
strength
http://www.amibroker.com/members/traders/05-2001.html
startpoint = 10; // the start point of comparision will be 10th bar
this gives the relative strength reading from 10th bar from beginning of
data. This is not much use in comparing recent performance.
I wish to make the startpoint a user defined field. I wish to provide both
the following options:
1> "enter start date: ......" (as in plot relative strength from 03/01/09)
and
2> "Look back period:......." (as in plot relative strength for the last 30
trading days).
This is how i try coding the first option. (needless to say, it doesnt work)
-------------------------------------------------------------------------
MaxGraph = 2; // as many as you wish to use
BaseDate=ParamDate("Relative Performance from:", "18-5-09");
startpoint = BaseDate; //ValueWhen(BaseDate =DateNum(), BarIndex(), 1); //
the start point of comparison. if date not specified, default date is used.
// here is a base line
price = Foreign("S&P CNX NIFTY", "C");
baseline = 100 * ( price/ValueWhen( Cum(1) == startpoint, price ) - 1 );
------------------------------------------------------------------
I also try
----------------------------------------------------------
startpoint = ValueWhen(BaseDate =DateNum(), BarIndex(), 1); // the start
point of comparision. if date not specified, default date is used.
I appreciate any advice pointing me to the right conceptual resource, as
well as help in coding both options right.
Tx
Kazaan