petergluis
Active member
I use open, high, low and close of yesterday and today's open to generate a trend following indicator. It is more sensitive to trend changes than Hull moving averages. It should be used in daily chart in order to follow the trends. The part code is from toshelper.com.
Ruby:
input offset = 1;
input offset2 = 1;
input offset3=0;
input period = {default DAY, “2 DAYS”, “3 DAYS”, “4 DAYS”, WEEK, MONTH, “OPT EXP”};
plot Data = high(period = period)[offset];
Data.AssignValueColor(if Data > Data[1] then Color.green else Color.magenta);
plot Data2 = low(period = period)[offset2];
Data2.AssignValueColor(if Data2 > Data2[1] then Color.green else Color.magenta);
plot Data3 = close(period = period)[offset];
Data3.AssignValueColor(if Data3 > Data3[1] then Color.green else Color.magenta);
plot Data4 = open(period = period)[offset2];
Data4.AssignValueColor(if Data4 > Data4[1] then Color.green else Color.magenta);
plot Data5 = open(period = period)[offset3];
Data5.AssignValueColor(if Data5 > Data5[1] then Color.green else Color.magenta);
Last edited by a moderator: