samiranadhikari
Member
I would love to see thinkscript for RSI bars as described in the following code for motivewave.
I would love to see thinkscript for the following code for vidya 2 indicator (motivewave). I found this indicator very useful.
VIDYA2 Indicator by Chande and Kroll are types of Adaptive Moving Averages that use Standard Deviation and feedback in their calculation. Two paths are plotted with different alpha values.
Code:
//input = price, user defined, default is closing price
//method = moving average (ma), user defined, default is SMMA
//period = user defined, default is 14
//top = user defined, default is 70
//bottom = user defined, default is 30
//MT = more than, LT = less than
//index = current bar number
diff = price - price[index-1];
up = 0, down = 0;
if (diff MT 0) up = diff;
else down = abs(diff);
avgUp = ma(method, index, period, UP);
avgDown = ma(method, index, period, DOWN);
RS = avgUp / avgDown;
RSI = 100 - ( 100 / (1 + RS));
//signals
setBarColor(RSI,top,bottom);
buy = crossedAbove(RSI, top);
sell = crossedBelow(RSI, bottom);
I would love to see thinkscript for the following code for vidya 2 indicator (motivewave). I found this indicator very useful.
Code:
//input = user defined, default is close
//period = user defined, default is 20
//alpha1 = user defined, default is .2
//alpha2 = user defined, default is .04
//prev = previous, index = current bar number
//std = stdDev = standard deviation
stdDev = std(index, period, input);
avStdDev = ma(method, index, period, stdDev);
prevVidya1 = isNull(price, vidya1[index-1]); //feedback
prevVidya2 = isNull(price, vidya2[index-1]); //feedback
ratio = stdDev/avStdDev;
Plot1: vidya1 = (alpha1 * ratio * price) + ((1-(alpha1*ratio)) * prevVidya1);
Plot2: vidya2 = (alpha2 * ratio * price) + ((1-(alpha2*ratio)) * prevVidya2);
//Signals
buy = crossedAbove(VIDYA1, VIDYA2);
sell = crossedBelow(VIDYA1, VIDYA2);
VIDYA2 Indicator by Chande and Kroll are types of Adaptive Moving Averages that use Standard Deviation and feedback in their calculation. Two paths are plotted with different alpha values.
Last edited by a moderator: