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

[amibroker] little piece of code for standard error channel



PureBytes Links

Trading Reference Links

dear ed, 

with reference to the code below, can u modify it to
plot 
standard error channel trendline instead ?

many think


--- ed nl <ed2000nl@xxxxxxx> wrote:

> hi iascool,
> 
> see code below. The number of future bars have
> length "fut". The future channel I plotted as dots. 
>  However they will not be plotted on the last bar
> (Barcount). I do not think it is possible to draw
> into the future (after Barcount) or I do not know
> how. Because to do that you need to be able to
> extend the arrays we calculate with and I don't
> think this is possible. Maybe somebody else (TJ?)
> could comment on that.
> 
> Also I added an example of how you could use the
> trend channel to find buy or sell points. These are
> plotted in the chart. Just let the trend channel
> walk through time and you will see buy and sell
> signals appear occasionally. They are always plotted
> 1 bar after the channel.
> 
> rgds, Ed
> 
> 
> /*
> 
> trend channel development
> 
> Edward Pottasch, nov 2004
> 
> */
> 
> 
> per = 20;
> fut = 10;
> mm = (H + L) / 2;
> 
> x = Cum(1);
> lastx = LastValue(x); 
> selv = SelectedValue(x);
> 
> aaa = LinRegIntercept(mm, per);
> bbb = LinRegSlope(mm, per);
> 
> daa = SelectedValue(ValueWhen(x, aaa, 1));
> dbb = SelectedValue(ValueWhen(x, bbb, 1));
> 
> xx = IIF(x > selv - per AND x <= selv, x - (selv -
> per),null);
> yy = daa + dbb * xx;
> 
> fxx = IIF(x > selv AND x <= selv + fut, x - (selv -
> per),null);
> fyy = daa + dbb * fxx;
> 
> dhh = abs(H - yy);
> dll = abs(L - yy);
> dtt = MAX(dhh,dll);
> 
> wd = SelectedValue(HHV(dtt,per));
> 
> Buy = Ref(L,-1) == Ref(yy - wd, -1) AND Ref(selv ==
> x,-1);
> BuyPrice = O;
> Short = Ref(H,-1) == Ref(yy + wd, -1) AND Ref(selv
> == x,-1);
> ShortPrice = O;
> 
> Plot(yy, "LinReg", colorBlue, 1);
> Plot(yy + wd, "Upper Boundary", colorRed, 1);
> Plot(yy - wd, "Lower Boundary", colorBrightGreen,
> 1);
> 
> // plot into future
> Plot(fyy, "LinReg", colorBlue ,styleDots |
> styleNoLine);
> Plot(fyy + wd, "Upper Boundary", colorRed ,styleDots
> | styleNoLine);
> Plot(fyy - wd, "Lower Boundary", colorBrightGreen
> ,styleDots | styleNoLine);
> 
> Plot(C,"",colorwhite,64);
> PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer
> = 0, yposition = BuyPrice, offset = 0 );
>
PlotShapes(IIf(Short,shapeHollowDownArrow,0),colorLightBlue,
> layer = 0, yposition = ShortPrice, offset = 0 );
> 
>   ----- Original Message ----- 
>   From: iascool 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Wednesday, November 10, 2004 12:53 PM
>   Subject: [amibroker] Re: little piece of code
> 
> 
> 
>   Hi Ed
>   I have a same peice of code in excel with the
> regressionlines as 
>   stated by you. Is it posible for u to code it
> further so that the 
>   reg-lines can be projected 10timeunits ahead in
> future.This is what 
>   I have in excel and it is off emmense use.
> 
>   Regards
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "ed nl"
> <ed2000nl@xxxx> wrote:
>   > previous subject line was in error ....
>   > 
>   > in my attemps to make a trend following systems
> I made this little 
>   piece of code pure for visualisation. Put is in
> the Ind. Builder and 
>   click somewhere in the chart with the mouse.
>   > 
>   > rgds, Ed
>   > 
>   > /*
>   > 
>   > trend channel development
>   > 
>   > Edward Pottasch, nov 2004
>   > 
>   > */
>   > 
>   > 
>   > per = 10;
>   > mm= (H + L) / 2;
>   > 
>   > x = Cum(1);
>   > lastx = LastValue( x ); 
>   > selv = SelectedValue(x);
>   > 
>   > aaa = LinRegIntercept( mm, per);
>   > bbb = LinRegSlope( mm, per );
>   > 
>   > daa = SelectedValue(ValueWhen( x, aaa, 1));
>   > dbb = SelectedValue(ValueWhen( x, bbb, 1));
>   > 
>   > xx = IIF(x > selv - per AND x <= selv, x - (selv
> - per),null);
>   > yy = daa + dbb * xx;
>   > 
>   > detrend = mm - yy;
>   > wd = SelectedValue(HHV(abs(detrend),per));
>   > 
>   > Plot(yy, "LinReg", colorBlue );
>   > Plot(yy + wd, "Upper Boundary", colorRed );
>   > Plot(yy - wd, "Lower Boundary", colorBrightGreen
> );
>   > 
>   > Plot(C,"",colorwhite,64);
>   > 
>   > [Non-text portions of this message have been
> removed]
> 
> 
> 
> 
> 
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
> 
>   Check group FAQ at:
>
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> 
> 
>         Yahoo! Groups Sponsor 
>               ADVERTISEMENT
>              
>        
>        
> 
> 
>
------------------------------------------------------------------------------
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
>       
>     b.. To unsubscribe from this group, send an
> email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       
>     c.. Your use of Yahoo! Groups is subject to the
> Yahoo! Terms of Service. 
> 
> 
> 
> [Non-text portions of this message have been
> removed]
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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:
    http://docs.yahoo.com/info/terms/