inputs: f(5), m(10), s(20), Tradesize(10000), x1(.2), x2(.6); vars: RSf(0), RSm(0), RSs(0), profit1(0), profit2(0), originalSize(0); RSf = rsi(c, f); RSm = rsi(c, m); RSs = rsi(c, s); profit1 = 0.2; profit2 = 0.6; if entryprice > 0 then originalsize = tradesize/Entryprice else originalsize = 1; If c > 0 and RSf > 50 and RSm > 50 and RSs > 50 then begin Buy Tradesize/c shares next bar market; end; If marketposition = 1 and RSf < 50 then begin Sell("s1") (originalsize * x1) shares next bar market; end; If marketposition = 1 and RSm < 50 then begin Sell("s2") (originalsize * x2) shares next bar market; end; If marketposition = 1 and RSs < 50 then begin Sell("s3") next bar market; end;