Hi @RobertPayne! Wow, are we honored to have you stop by. Welcome to useThinkscript. I have quite a few RPayne studies in my notepad ++! I do understand that you have a site where you can capitalize on your knowledge of programming and thinkscript. What I do like about your site is that you do give and have given some of the simpler studies away. Thank you for that.
@BenTen is the proprietor of this site. I do not want to speak out of turn for him, but is there anything that we mere mortals can do with the script from Mr. Siligardos from TASC in 2011? Or Is that the same one that Tos has built in, that does not work?
We have several here that are trying to up their game and you would be the perfect person for some of us to learn from.
(btw, The crowd at the TSLounge seem to be stuck with this problem as well. There, now I have made them mad! )
I have placed the Semi-Cup Formation script from TASC below. Would you be so kind as to look it over and let us know what, if anything, can be changed make it work?
Once again, we are honored that you have stopped by. Markos
@BenTen is the proprietor of this site. I do not want to speak out of turn for him, but is there anything that we mere mortals can do with the script from Mr. Siligardos from TASC in 2011? Or Is that the same one that Tos has built in, that does not work?
We have several here that are trying to up their game and you would be the perfect person for some of us to learn from.
(btw, The crowd at the TSLounge seem to be stuck with this problem as well. There, now I have made them mad! )
I have placed the Semi-Cup Formation script from TASC below. Would you be so kind as to look it over and let us know what, if anything, can be changed make it work?
Once again, we are honored that you have stopped by. Markos
Code:
# SemiCupFormation G Siligardos April 2011 TASC Magazine.
input price = close;
input minLength = 20;
input maxLength = 252;
input factor = 2.0;
script VariableSumMax {
input price = close;
input index1 = 0;
input index2 = 0;
input maxOffset = 0;
def inf = 1 / 0;
plot VSum = fold i = index1 to index2 with s do s + getValue(price, i,
maxOffset);
plot VMax = fold i = index1 to index2 with m = -inf do Max(m, getValue(price,
i, maxOffset));
}
def LogPrice = log(price);
def DXPlus = Max(LogPrice - LogPrice[1], 0);
def DXMinus = Max(LogPrice[1] - LogPrice, 0);
def offset = fold i = MinLength to MaxLength + 1 with off = -1 do if off =
= -1 and getValue(price, i, MaxLength) > price * factor then i else off;
def HiLogPrice = if IsNaN(getValue(LogPrice, offset, MaxLength)) then LogPrice
else getValue(LogPrice, offset, MaxLength);
def LoLogPrice = -VariableSumMax(-LogPrice, 0, offset + 1, MaxLength).VMax;
def B2Offset = if offset < 0 then -1 else round(offset * 0.6, 0);
def B3Offset = if offset < 0 then -1 else round(offset * 0.4, 0);
def L2 = LoLogPrice * 0.6 + HiLogPrice * 0.4;
def L3 = LoLogPrice * 0.4 + HiLogPrice * 0.6;
def eps = 0.000000001;
def SumDXPlusB0toB2 = VariableSumMax(DXPlus, B2Offset + 1, offset + 1, MaxLength).VSum;
def SumDXMinusB0toB2 = VariableSumMax(DXMinus, B2Offset + 1, offset + 1, MaxLength).Vsum;
def DX1 = AbsValue(SumDXPlusB0toB2 - SumDXMinusB0toB2) / (SumDXPlusB0toB2 +
SumDXMinusB0toB2 + eps) * 100;
def SumDXPlusB2toB5 = VariableSumMax(DXPlus, 0, B2Offset + 1, MaxLength).VSum;
def SumDXMinusB2toB5 = VariableSumMax(DXMinus, 0, B2Offset + 1, MaxLength).VSum;
def DX2 = AbsValue(SumDXPlusB2toB5 - SumDXMinusB2toB5) / (SumDXPlusB2toB5 +
SumDXMinusB2toB5 + eps) * 100;
def HighestB2toB3 = VariableSumMax(LogPrice, B3Offset + 1, B2Offset + 1, MaxLength).VMax;
def HighestB3toB5 = VariableSumMax(LogPrice, 0, B3Offset + 1, MaxLength).VMax;
plot SemiCup = offset > 0 and DX1 > 25 and DX2 < 25 and HighestB2toB3 < L3 and
HighestB3toB5 < L2;
SemiCup.SetDefaultColor(GetColor(2));
SemiCup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
SemiCup.SetLineWeight(3);
AddChartLabel(SemiCup, concat("Semi-Cup formation size: ", offset + 1), GetColor(2));
# SemiCupVisual
input price = close;
input length = 100;
def formation = IsNaN(price[-length]);
def t = length - sum(formation, length);
def inf = 1 / 0;
def Hi = HighestAll(if formation then price else -inf);
def Lo = LowestAll(if formation then price else inf);
def a = (Hi - Lo) / Power(length - 1, 10);
plot Cup = if formation then Min(Hi, a * Power(t, 10) + 0.98 * Lo) else Double.NaN;
Cup.SetDefaultColor(GetColor(2));
Last edited: