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

Re: [amibroker] little piece of code for standard error channel



PureBytes Links

Trading Reference Links

no problem. By-the-way these 3 lines can be removed from the code because 
they were only used in the other version. I forgot to delete them

> dhh = abs(H - yy);
> dll = abs(L - yy);
> dtt = MAX(dhh,dll);

rgds, Ed


----- Original Message ----- 
From: "suree namsiripongpan" <suree_n@xxxxxxxxx>
To: <ed2000nl@xxxxxxx>
Sent: Saturday, November 13, 2004 4:21 PM
Subject: Re: [amibroker] little piece of code for standard error channel


> dear ed, 
> 
> many thanks, it works !
> 
> 
> --- ed nl <ed2000nl@xxxxxxx> wrote:
> 
>> previous mail was the standard deviation. This one I
>> use StdErr(C,per). Again I'm not sure if you need to
>> add wd = wd / 2;
>> 
>> rgds, Ed
>> 
>> 
>> /*
>> 
>> trend channel development
>> 
>> standard deviation
>> 
>> 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;
>> 
>> dhh = abs(H - yy);
>> dll = abs(L - yy);
>> dtt = MAX(dhh,dll);
>> 
>> // calculate the standard deviation
>> wd = SelectedValue(StdErr(C,per));
>> 
>> Plot(yy, "LinReg", colorBlue, 1);
>> Plot(yy + wd, "Upper Boundary", colorRed, 1);
>> Plot(yy - wd, "Lower Boundary", colorBrightGreen,
>> 1);
>> Plot(C,"",colorwhite,64);
>> 
>> // calculate points into the "future" (no real
>> future display possible - as far as I know -)
>> fut = 4;
>> fxx = IIF(x > selv AND x <= selv + fut, x - (selv -
>> per),null);
>> fyy = daa + dbb * fxx;
>> 
>> Plot(fyy, "LinReg", colorBlue ,styleDots |
>> styleNoLine);
>> Plot(fyy + wd, "Upper Boundary", colorRed ,styleDots
>> | styleNoLine);
>> Plot(fyy - wd, "Lower Boundary", colorBrightGreen
>> ,styleDots | styleNoLine);
>> 
>>   ----- Original Message ----- 
>>   From: suree namsiripongpan 
>>   To: amibroker@xxxxxxxxxxxxxxx ; ed2000nl@xxxxxxx 
>>   Sent: Saturday, November 13, 2004 10:45 AM
>>   Subject: [amibroker] little piece of code for
>> standard error channel
>> 
>> 
>>   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.
>>   > 
>> 
> === message truncated ===
> 
> 
> 
> 
> __________________________________ 
> 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/