![]() |
Linear Regression Moving Average |
Post Reply ![]() |
Page 12> |
Author | |
bparsons ![]() Newbie ![]() Joined: 17 Sep 2005 Location: Australia Posts: 2 |
![]() ![]() ![]() ![]() Posted: 17 Sep 2005 at 7:28pm |
Guys can you tell me if BullCharts will enable me to do a linear
regression moving average ? I want to do something like a standard
moving average 10 day/50 day except with linear regression ?
If it doesnt anyone got any ideas on what software would enable me to do this ? Thanks in Advance |
|
![]() |
|
Dingo ![]() Regular ![]() Joined: 10 Jul 2005 Posts: 35 |
![]() ![]() ![]() ![]() |
From the formula definitions of the various MA options available:
TIME SERIES: Uses linear regression to determine where the line of best would have ended. Is this what you were after (10 and 50 day Time Series MA): ![]() |
|
![]() |
|
zorro ![]() Newbie ![]() ![]() Joined: 17 Apr 2005 Posts: 17 |
![]() ![]() ![]() ![]() |
yep, the time series moving average is a moving linear regression
|
|
![]() |
|
bparsons ![]() Newbie ![]() Joined: 17 Sep 2005 Location: Australia Posts: 2 |
![]() ![]() ![]() ![]() |
Thanks Guys - that's excellent my demo copy should arrive in the mail
shortly. Active forums are a great bonus for a product like this.
|
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
Thats exactly the info i needed too Now how do i color code the line if its rising=Green and a Red colour for when it is going down? |
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
Well it might just sound like a gay little geek feature, but i guess a couple of pictures would say a 1000 words. Who knows... maybe i've discovered a different way of trading trends. CMC market maker software TM. Allows dual colouring of lines up/down. Anyhow a couple of examples so perhaps one of our programmers can make it possible. ie. dual coloured lines on chart. Picture 1: Supertrend indicator on chart for ATR stop loss placement. Picture 2: LinearRegression(13) for riding the trend too the end. Isn't that what we all want? |
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
Picture2: |
|
![]() |
|
blackdog ![]() Regular ![]() ![]() Joined: 14 Nov 2006 Location: Vatican City State Posts: 43 |
![]() ![]() ![]() ![]() |
I too have been playing around to get BullCharts to colour code the direction of the lines but so far I have been unsuccessful.
The following code to worked on the first attempt, except it showed a gap for one bar between red and green sections of the line. Subsequent attempts to modify the script (including returning it to origional) have all failed with BC displaying unwanted straight lines for the undefined sections.
[color=red]
if (ma3<hist(ma3,1),ma3,undefined);[color=green] if (ma3<hist(ma3,1),undefined,ma3);
|
|
![]() |
|
blackdog ![]() Regular ![]() ![]() Joined: 14 Nov 2006 Location: Vatican City State Posts: 43 |
![]() ![]() ![]() ![]() |
The following script for an indicator ma3, displays red for a line moving down and green for a line moving up. Line moving sideways displays same color as line previously. It however still leaves a gap of one bar where the line changes direction. Im sure there is some simple way to overcome this gap problem...I just haven't found it yet. In the mean time the fudge is to fill the gap with the underlying blue (default colour).
ma3; {to fill in gap when indicator changes direction} linecolor:= if (ma3<hist(ma3,1),0,if (ma3>hist(ma3,1),1,prev ));[drawundefined =gap] {no lines drawn when indicator is "undefined"}[ color=red]if (linecolor=0,ma3,undefined); [color=green]if (linecolor=1,ma3,undefined);
|
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
Yep, the best one can do at the moment is a work around. A new attribute would make it possible. eg. [linestyle=linecolor] just like [linestyle=pricecolor] and [linestyle=bar] makes dual colouring of them possible. Here's my attempt :) [target =Price; category=Moving Average; Author=Max]StartDate:= InputDate("Start date", date(2004,1,2));HoldingDays:= BarsSince(OnOrSkipped(StartDate));period := input("Time periods",28,1);bar := ma(2*ma(C,int(period/2),W) - ma(C,period,W),int (sqrt(period)), W);{Flag the StartDate} begin:= If(bar>=PREV(undefined),PREV(undefined),bar*Holdingdays);[color =lime; name=up; width=1; linestyle=solid]if (begin=0,if(bar>=hist(bar,1),bar,bar),undefined);[color =dark orchid; name=down; linestyle=solid]if (begin=0,if(bar<hist(bar,1),bar,undefined),undefined);[color =rgb(230,230,230); name=down2; linestyle=solid]bar2 := ( hist(bar,1)+bar)/2;if (begin=0,if(bar<hist(bar,1),bar2,undefined),undefined);[linestyle =pricecolor][color =dark green] if(begin=0,bar>=hist(bar,1),undefined);[color =crimson] if(begin=0,bar<hist(bar,1),undefined)
|
|
![]() |
Post Reply ![]() |
Page 12> |
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |