Wow I have had my knuckles rapped!
[B]Tymen[/B] below is the code for the slope meter and as I have arranged it in such a way also a function that goes with it. Obviously the two could be incorporated if you so wish.
The figures are obviously meaningless in that they were just used for testing. But you can see how you can add timeframes and the appropriate factor to go with them.
As usual just copy, paste and save into Chartstudio each on a new page.
I am now off out for the day, so will be unable to make any further contact for a few hours.
Regards
Ken
indicator AA_BB_slope_meter_kw ;
input pipdiff = 1.5;
draw zeroline(“zeroline”, solid_line, black,2),
entry_long(“long”, solid_line, green,2),
entry_short(“short”, solid_line, red,2),
res(“slopemeter”, solid_line, blue,2);
vars i(number), pip_fctr(number), avg(series),
tm_frm = timestamp, TF(number), lst(number);
begin
lst := back(close);
if close[lst] <10 then
pip_fctr := 0.0001
else
pip_fctr := 0.01;
TF := (tm_frm[lst] - tm_frm[lst - 1]) / 60;
pipdiff := BB_fn_lookup_TF(TF);
zeroline := makeseries (front(close), back(close), 0);
entry_long := makeseries (front(close), back(close), pip_fctr * pipdiff );
entry_short := makeseries (front(close), back(close), -1*pip_fctr * pipdiff );
avg := sma(close,20);
for i := front(close) + 20 + 1 to back(close) do
res[i] := avg[i] - avg[i-1];
end.
/////////////////////////////////////
function BB_fn_lookup_TF;
input TF(number);
result res(number);
begin
if TF = 15 then res := 1.5;
if TF = 20 then res := 1.8;
if TF = 25 then res := 2.0;
if TF = 30 then res := 2.4;
if TF = 35 then res := 2.8;
if TF = 40 then res := 3.5;
if TF = 45 then res := 4.0;
end.