Moving Trend (Rafter indicator)

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
dlahyani
Posts: 24
Joined: 06 Feb 2007

Moving Trend (Rafter indicator)

Postby dlahyani » 13 Jul 2009

looking for someone who can help convert this code to MC from esignal efs code.
thanks in advance, Daniel

Code: Select all

*********************************
function preMain()
{
setStudyTitle("Movtrend");
setCursorLabelName("Movtrend", 0);
setDefaultBarFgColor(Color.blue, 0);
setPriceStudy(true);
}
function main(n) {
if(n == null)
n = 20;
var sum = 0;
var i = 0;
var mt = 0;

for(i = n; i > 0; i--)
sum += (i - (n + 1) / 3) * close(i - n);
wt = 6 / (n * (n + 1)) * sum
return wt;
}

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 13 Jul 2009

what does it do?
do you have a screen shot?

dlahyani
Posts: 24
Joined: 06 Feb 2007

Postby dlahyani » 13 Jul 2009

Hi TJ,

check this description.

www.tssupport.com/support/base/?action=article&id=1803


Daniel


Image

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 11 Aug 2009

you can set the bands to invisible if you do not wish to see them.

Code: Select all

// Moving Trend Band (MTB)
// as described by William Rafter
//
// Author: TJ
// Date: 20090811
// http://www.tssupport.com/forum/viewtopic.php?p=28041#28041
//

input:
Length(20),
Upcol(blue),
Dncol(red);

var:
MovTrend(0),
sd(0),
upband(0),
lowband(0);

{---------- end of variables ----------}

MovTrend = LinearRegvalue( Close, length, 0 );

sd = StdDev(movtrend, length);
upband = MovTrend + sd;
lowband = MovTrend - sd;

Plot10( MovTrend, "MTB");

if movtrend > MovTrend[1] then
SetPlotColor[1](10, upcol)
else
SetPlotColor[1](10, dncol);

plot30(upband, "UpBand");
plot40(lowband, "LowBand");

{---------- end of MTB ----------}

more info here:
http://www.traderslaboratory.com/forums ... -6563.html


170.86
Last edited by TJ on 06 Dec 2009, edited 2 times in total.

dlahyani
Posts: 24
Joined: 06 Feb 2007

movtrend

Postby dlahyani » 22 Oct 2009

TJ,

thank you for the effort.

Best, Dan


Return to “User Contributed Studies and Indicator Library”