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

[amibroker] Standard Error bands - Indicator



PureBytes Links

Trading Reference Links




The original works correctly it just contain superfluous code 
(extra parameter info), here is the correct forumla. Thanks TJ.
/* Standard Error Bands 
*/ Periods 
= Param(<FONT 
color=#ff00ff>"Standard Error", <FONT 
color=#ff00ff>18, <FONT 
color=#ff00ff>1, <FONT 
color=#ff00ff>100, <FONT 
color=#ff00ff>1<FONT 
color=#000000>); <FONT 
color=#800000>function<FONT 
size=2> SteBand( array, periods, upper ) { 
  Lr = <FONT 
color=#0000ff>LinearReg<FONT 
size=2>( array, periods );   se = <FONT 
color=#0000ff>StdErr<FONT 
size=2>( array, periods );   <FONT 
color=#800000>return LR + <FONT 
color=#0000ff>IIf( upper, <FONT 
color=#ff00ff>1, -<FONT 
color=#ff00ff>1 ) * <FONT 
color=#ff00ff>2<FONT 
color=#000000> * se; } upperstderrband = SteBand( <FONT 
color=#000000>C, Periods, <FONT 
color=#000000>True<FONT 
size=2> ); lowerstderrband = SteBand( <FONT 
color=#000000>C, Periods, <FONT 
color=#000000>False<FONT 
size=2> ); midstderrband = (upperstderrband + 
lowerstderrband )/2<FONT 
face="Courier New">; <FONT 
color=#0000ff>Plot( <FONT 
color=#000000>Close, <FONT 
color=#ff00ff>"Close", <FONT 
color=#000000>colorBlack, <FONT 
color=#000000>styleCandle<FONT 
face="Courier New"> ); <FONT 
color=#0000ff>Plot( upperstderrband , <FONT 
color=#ff00ff>"upperstderrband ", <FONT 
color=#000000>colorGreen, <FONT 
color=#ff00ff>4<FONT 
color=#000000> ); Plot<FONT 
color=#000000>( lowerstderrband , "lowerstderrband 
", <FONT 
color=#000000>colorRed, <FONT 
color=#ff00ff>4<FONT 
color=#000000> ); Plot<FONT 
color=#000000>( midstderrband , "midstderrband 
", <FONT 
color=#000000>colorBlack , <FONT 
color=#000000>styleLine<FONT 
face="Courier New">); <FONT 
color=#000000>GraphXSpace = <FONT 
color=#ff00ff>3; 
Regards,William Peters<A 
href="">www.amitools.com
-----Original Message-----From: dcrotty2003 [<A 
href=""><FONT 
size=2>mailto:dcrotty2003@xxxxxxxxxxxx]Sent: 
Saturday December 20, 2003 5:52 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
[amibroker] Re: Standard Error bands - IndicatorHi 
William,Maybe it's just me, but the Param:Periods= 
Param("Periods", 3, 1, 100, 1);...doesn't seem to 
work.Dave.--- In amibroker@xxxxxxxxxxxxxxx, "William 
Peters"<williampeters@xxxx> wrote:> Hi,>> Just 
sharing some code that I originally found on this forum(somewhere) 
and> was subsequently found to be wrong. Tomasz has made 
thecorrections so here> it is. I've also added it to the AFL library 
on the AmiBroker web site.>> /* Standard Error Bands */> 
Var= Param("Standard Error", 18, 1, 100, 1);> Periods= Param("Periods", 
3, 1, 100, 1);>> function SteBand( array, periods, upper )> 
{>   Lr = LinearReg( array, periods );>   se = 
StdErr( array, periods );>   return LR + IIf( upper, 1, -1 ) * 
2 * se;> }>> upperstderrband = SteBand( C, Var, True 
);> lowerstderrband = SteBand( C, Var, False );> midstderrband = 
(upperstderrband + lowerstderrband )/2;>> Plot(upperstderrband 
,"upperstderrband ",colorGreen,4);> 
Plot(Close,"Close",colorBlack,styleCandle);> Plot(lowerstderrband 
,"lowerstderrband ",colorRed,4);> Plot(midstderrband ,"midstderrband 
",colorBlack ,styleLine);> GraphXSpace = 3;> Regards,> 
William Peters> www.amitools.comSend BUG REPORTS to 
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx(Web page: 
<A href="" 
target=_blank><FONT 
size=2>http://groups.yahoo.com/group/amiquote/messages/<FONT 
size=2>)--------------------------------------------Check group FAQ at: 
<A href="" 
target=_blank><FONT 
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
size=2>Yahoo! Groups LinksTo visit your group on the web, go 
to: <A href="" 
target=_blank><FONT 
size=2>http://groups.yahoo.com/group/amibroker/<FONT 
size=2>To unsubscribe from this group, send an email 
to: amibroker-unsubscribe@xxxxxxxxxxxxxxxYour use of Yahoo! 
Groups is subject to: <A 
href="" target=_blank><FONT 
size=2>http://docs.yahoo.com/info/terms/


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





Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.