Charles - I didn't look at your code but here's
food for thought. This clip
from another script draws a
trendline starting from the cursor going back in time.
HTH, Joe
_SECTION_BEGIN("slope study");
Plot(C,"Close",1,64);
_TRACE("DBGVIEWCLEAR");
// LINEAR REGRESSION LINE
Daysback = Param("Lookback",20,2,100,1);
x = Cum(1);
lastx = SelectedValue( x );
// Lastx = LastValue(x);
// Set last bar at selected value
// Plot from that point backwards for NN bars say 10
i = LinRegIntercept(Close,Daysback);
aa = LastValue(ValueWhen(x ==Lastx,i));
s = LinRegSlope(Close,Daysback);
bb = LastValue(ValueWhen(x==Lastx,s)); // Slope of the regressed line
_TRACE("Intcpt= "+aa +" Slope= "+bb);
y = Aa + bb * ( x - (Lastx - DaysBack) );
_TRACE("lastx= "+ Lastx + " LX - 20= "+ (Lastx-20));
Plot( IIf( x >= ( Lastx-daysback) AND x <= Lastx, y, -1e10 ), "LinReg", colorRed,8 );
----- Original Message -----
From: "Charles J. Dudek" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, November 07, 2006 7:58 AM
Subject: [amibroker] Linear Trend with Automatic Start
Point
> as the starting point. I have not been able to figure out how to do
> that and would like some suggestions. Here is what I tried, which has
> not gotten an error message, but it has not produced anything either.
> I know the rest of the code works to draw a line and the only thing
> I'm manipulating is the daysbackb variable. Can this work without a
> lot of complex coding?
> .
> .
> .
> Daysbackb = LastValue(LowestSinceBars( Buy, C));
> shift = Param("Look back period",0,0,50000,1);
> xb = Cum(1);
> lastxb = LastValue( xb ) - shift;
> ab = LastValue( Ref(LinRegIntercept( p, Daysbackb), -shift) );
> bb = LastValue( Ref(LinRegSlope( p, Daysbackb ), -shift) );
> yb = Ab + bb * ( xb - (Lastxb - DaysBackb +1 ) );
> .
> .
> .
>
> Thanks for any help.
>
> Chuck
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
>
> <*> Your email settings:
> Individual Email | Traditional
>
> <*> To change settings online go to:
> http://groups.yahoo.com/group/amibroker/join
> (Yahoo! ID required)
>
> <*> To change settings via email:
> mailto:[EMAIL PROTECTED]
> mailto:[EMAIL PROTECTED]
>
> <*> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
> __._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
| Investment management software | Investment property software | Investment software |
| Investment tracking software | Return on investment software |
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
