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

[amibroker] Re: What is wrong with my relative strength indicator?



PureBytes Links

Trading Reference Links

Thanks Graham,
Barcount is better.
I modify the indicator, as below:

//offset from current date
Offset = Param("Startpoint", 20, 1, 500, 1);
price = Close;
baseprice = price[BarCount - Offset];
//plotprice = IIf(DateNum()<(Now(3)-Offset), 0, 100 * ( 
price/baseprice - 1));
Plotprice = IIf(BarIndex()<(BarCount - Offset), 0, 100*
(price/baseprice -1)); 
Plot( plotprice, Name(), colorBrightGreen, styleThick );

//Ticker can be selected
ticker = ParamStr("Ticker 1", "SPY" );
price = Foreign( ticker, "C");
baseprice = price[BarCount - Offset];
//plotprice = IIf(DateNum()<(Now(3)-Offset), 0, 100 * ( 
price/baseprice - 1));
Plotprice = IIf(BarIndex()<(BarCount - Offset), 0, 100*
(price/baseprice -1)); 
Plot( Plotprice, ticker, colorRed );

Title = "Compare to " + Offset + " days ago, "+ Name()+" ="+WriteVal
(Graph0) + " vs. " + ticker + " ="+WriteVal(Graph1) + " at " + Date();


Now it can display. I want to set the display before the offset date 
to 0. Seems barindex() doesn't work. How can I get the index of each 
bar?


Gary

--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> I think that is a weekend
> You might be better using barcount/cum(1)/barindex() as your basis 
for this.
> You can always have a date determined from this. Or make certain 
you write
> in a check that the date has the right DayOfWeek() within 1 to 5.
> 
> Cheers,
> Graham
> http://groups.msn.com/ASXShareTrading
> http://groups.msn.com/FMSAustralia
> 
> 
> -----Original Message-----
> From: liguoyi [mailto:liguoyi@x...] 
> Sent: Saturday, 6 September 2003 12:26 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] What is wrong with my relative strength 
indicator?
> 
> 
> Below is my indicator to calculate the relative strength based on 
the 
> startpoint, say 2001/09/21
> 
> //startpint can be selected
> //startpoint = Param("Startpoint", 1010921, 1000101, 1031231, 
1); //default
> is 2001/sept/21 = 101 09 21 startpoint = 1010921; price = Close; 
baseprice =
> ValueWhen( DateNum() == startpoint, C); Plot( 100 * ( 
price/baseprice - 1),
> Name(), colorBrightGreen, 
> styleThick );
> 
> //Ticker can be selected
> ticker = ParamStr("Ticker 1", "SPY" );
> price = Foreign( ticker, "C");
> baseprice = ValueWhen( DateNum() == startpoint, price);
> Plot( 100 * ( price/baseprice -1 ), ticker, colorRed );
> 
> 
> It shows fine. But if I edit the startpoint and change it to 
1011021, 
> there is no display for the indicatior. It is strange. Can anybody 
> help me? Thanks
> 
> Gary
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor ---------------------
~--> Buy
> Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark 
Printer
> at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
> http://www.c1tracking.com/l.asp?cid=5511
> http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
> --------------------------------------------------------------------
-~->
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/