Re: Fun with ThinkScript September 11, 2014 10:06AM |
Registered: 12 years ago Posts: 321 |
Re: Fun with ThinkScript September 11, 2014 10:29AM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript September 11, 2014 02:10PM |
Registered: 10 years ago Posts: 615 |
def DX = if (DIPlus(5) + DIMinus(5) > 0) then 100 * AbsValue(DIPlus(5) - DIMinus(5)) / (DIPlus(5) + DIMinus(5)) else 0; def ADX = WildersAverage(DX, 13); def ADX2 = ADX > ADX[1]; def DIplus = DIPlus(5); def DIminus = DIMinus(5); def long = DIplus crosses above DIminus and ADX2 <> ADX2[1]; def short = DIplus crosses below DIminus and ADX2 <> ADX2[1]; plot dotUp = if long then low * 0.997 else Double.NaN; dotUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); dotUp.SetLineWeight(5); dotUp.SetDefaultColor(color.white); plot dotDn = if short then high * 1.003 else Double.NaN; dotDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); dotDn.SetLineWeight(5); dotDn.SetDefaultColor(color.white);
Re: Fun with ThinkScript September 11, 2014 07:42PM |
Registered: 12 years ago Posts: 321 |
Re: Fun with ThinkScript September 11, 2014 10:39PM |
Registered: 9 years ago Posts: 34 |
Re: Fun with ThinkScript September 13, 2014 05:46AM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 13, 2014 06:30AM |
Registered: 10 years ago Posts: 615 |
Quote
strategynode
I dont know what I am doing wrong but I am using this as a study on a 1 min chart but seems to give both buy and sell signal on the same bar. I dont know if some has faced this or knows why?
Quote
strategynode
Also I think there are some post which are missing I see that there is a scan available for the "E UP" but I dont see any explanation what and how it works? may be its in another thread can some body point it out?
Re: Fun with ThinkScript September 13, 2014 06:55AM |
Registered: 10 years ago Posts: 615 |
Quote
astiril2809
I am looking for a simple TOS script to use. Basically when 5wma crosses 12wma would like a green down arrow to appear. and vice versa when 12wma crosses the 5wma would like red up arrow to appear.
plot wma5 = WMA(close, 5); plot wma12 = WMA(close, 12); plot UParrow = wma5 crosses above wma12; UParrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); UParrow.SetDefaultColor(Color.GREEN); UParrow.SetLineWeight(3); plot DNarrow = wma5 crosses below wma12; DNarrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); DNarrow.SetDefaultColor(Color.RED); DNarrow.SetLineWeight(3);
Quote
astiril2809
Finally, I am looking for alert when the 18sma and the 28sma get very close together. an alert such as a buy bubble to pop up when both these are at say 95% touching.
def ma18 = Average(close, 18); def ma28 = Average(close, 28); def near = ma18 between (ma28 * 0.95) and (ma28 * 1.05); AddLabel(near, "18sma and 28sma are near each other", Color.YELLOW);
Re: Fun with ThinkScript September 13, 2014 10:24AM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 15, 2014 02:29PM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 16, 2014 01:57AM |
Registered: 9 years ago Posts: 34 |
Re: Fun with ThinkScript September 16, 2014 10:38AM |
Registered: 10 years ago Posts: 615 |
Quote
astirl
many, many thanks...
may I just ask for couple quick changes after trying it out in tos.
to change the 18sma and 28sma to ema. and if possible to add a dot(yellow) to occur at where the now changed 18 and 28ema's get close together.
regards and just to say thank you for such a speedy response.
astirl
Quote
Thank you for the scrip, see above post. The only problem is that the label 18 and 28 are near is being displayed all the time. Is there any way this can be changed so that it only appears when the lines are almost touching.
Re: Fun with ThinkScript September 16, 2014 10:44AM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript September 16, 2014 02:40PM |
Registered: 9 years ago Posts: 34 |
Re: Fun with ThinkScript September 17, 2014 01:14AM |
Registered: 9 years ago Posts: 34 |
# stochslow def SlowD = StochasticFull(80, 30, 2, 2, hlc3, hlc3, hlc3, 3, "EMA" ).FullD; def SlowDup = SlowD crosses above 30; def SlowDdn = SlowD crosses below 80; # CCI def CCI = CCI(7); def CCIup = CCI crosses above -100; def CCIdn = CCI crosses below 100; # MFI def MFIup = MoneyFlowIndex(length = 1).MoneyFlowIndex crosses above 20; def MFIdn = MoneyFlowIndex(length = 1).MoneyFlowIndex crosses below 80; # RMI def emaInc = ExpAverage(Max(close - close[5], 0), 5); def emaDec = ExpAverage(Max(close[5] - close, 0), 5); def RMI = if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec); def RMIob = RMI >= 75; def RMIos = RMI <= 25; # Signals plot signalUP = SlowDup and CCIup and MFIup and RMIos; signalUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); signalUP.SetLineWeight(3); signalUP.SetDefaultColor(Color.GREEN); plot signalDN = SlowDdn and CCIdn and MFIdn and RMIob; signalDN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); signalDN.SetLineWeight(3); signalDN.SetDefaultColor(Color.RED);
# # TD Ameritrade IP Company, Inc. (c) 2013-2014 # declare lower; input price = close; input length = 10; input averageLength = 3; input over_bought = 80; input over_sold = -80; assert(length >= 2, "'length' must be greater than or equal to 2: " + length); def sumSqr = fold i = 0 to length with sum do sum + Sqr((length - i) - fold j = 0 to length with rank do rank + if GetValue(price, i, length - 1) > GetValue(price, length - j - 1) or GetValue(price, i) == GetValue(price, length - j - 1) and i <= length - j - 1 then 1 else 0); plot Spearman = 100 * (1 - 6 * sumSqr / (length * (Sqr(length) - 1))); plot SpearmanAverage = Average(Spearman, averageLength); plot OverBought = over_bought; plot ZeroLine = 0; plot OverSold = over_sold; Spearman.SetDefaultColor(GetColor(9)); SpearmanAverage.SetDefaultColor(GetColor(8)); OverBought.SetDefaultColor(GetColor(5)); ZeroLine.SetDefaultColor(GetColor(5)); OverSold.SetDefaultColor(GetColor(5));
Re: Fun with ThinkScript September 17, 2014 02:11AM |
Registered: 10 years ago Posts: 615 |
Quote
strategynode
New Indicator I wish to add - The Spearman Indicator (its Already in tos) - the buy signal is when the spearman line crosses spearmanaverage from below and the sell would be the opposite.
input price = close; input length = 10; input averageLength = 3; input over_bought = 80; input over_sold = -80; assert(length >= 2, "'length' must be greater than or equal to 2: " + length); def sumSqr = fold i = 0 to length with sum do sum + Sqr((length - i) - fold j = 0 to length with rank do rank + if GetValue(price, i, length - 1) > GetValue(price, length - j - 1) or GetValue(price, i) == GetValue(price, length - j - 1) and i <= length - j - 1 then 1 else 0); def Spearman = 100 * (1 - 6 * sumSqr / (length * (Sqr(length) - 1))); def SpearmanAverage = Average(Spearman, averageLength); plot SpearmanUP = Spearman crosses above SpearmanAverage; SpearmanUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); SpearmanUP.SetLineWeight(3); SpearmanUP.SetDefaultColor(Color.GREEN); plot SpearmanDN = Spearman crosses below SpearmanAverage; SpearmanDN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); SpearmanDN.SetLineWeight(3); SpearmanDN.SetDefaultColor(Color.RED);
Re: Fun with ThinkScript September 17, 2014 02:12AM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript September 17, 2014 02:17AM |
Registered: 9 years ago Posts: 34 |
# stochslow def SlowD = StochasticFull(80, 30, 2, 2, hlc3, hlc3, hlc3, 3, "EMA" ).FullD; def SlowDup = SlowD crosses above 30; def SlowDdn = SlowD crosses below 80; # CCI def CCI = CCI(7); def CCIup = CCI crosses above -100; def CCIdn = CCI crosses below 100; # MFI def MFIup = MoneyFlowIndex(length = 1).MoneyFlowIndex crosses above 20; def MFIdn = MoneyFlowIndex(length = 1).MoneyFlowIndex crosses below 80; # RMI def emaInc = ExpAverage(Max(close - close[5], 0), 5); def emaDec = ExpAverage(Max(close[5] - close, 0), 5); def RMI = if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec); def RMIob = RMI >= 75; def RMIos = RMI <= 25; # Signals plot signalUP = SlowDup and CCIup and MFIup and RMIos; signalUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); signalUP.SetLineWeight(3); signalUP.SetDefaultColor(Color.GREEN); plot signalDN = SlowDdn and CCIdn and MFIdn and RMIob; signalDN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); signalDN.SetLineWeight(3); signalDN.SetDefaultColor(Color.RED);
Re: Fun with ThinkScript September 17, 2014 04:14AM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 17, 2014 06:03AM |
Registered: 10 years ago Posts: 615 |
Quote
strategynode
I am sorry to ask for one last thing, I wanted to combine this indicator with the existing indicators.
Quote
Astiril
Hi Robert. Perhaps last easy one for me. No more asks....
Just a simple code added in that gives blue arrow when 5 woman and 12 AMA crosses over the 18 ema and 28ema
Regards.....and thank you
Re: Fun with ThinkScript September 17, 2014 05:40PM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 17, 2014 05:47PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript September 17, 2014 06:24PM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 17, 2014 06:28PM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 17, 2014 07:07PM |
Registered: 9 years ago Posts: 4 |
Re: Fun with ThinkScript September 17, 2014 07:20PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript September 17, 2014 10:26PM |
Registered: 11 years ago Posts: 119 |
Re: Fun with ThinkScript September 19, 2014 12:39AM |
Registered: 9 years ago Posts: 2 |
Re: Fun with ThinkScript September 19, 2014 05:18AM |
Registered: 10 years ago Posts: 615 |
Quote
makp451
Hi Robert,
I am new to the forum and have read all of your thread. All I can say is WOW!!!! It’s very helpful. THANK YOU for your time and effort.I am using a lot of your code!
Quote
makp451
Is there a way to add a label to a daily and weekly chart that shows the percent above/below the 50day/10week SMA ...
<paraphrase>I'd also like to add a multitude of other labels. How would I do that?<end paraphrase>
def RSI = RSIWilder(length = 14).RSI; AddLabel(yes, "RSI: " + Round(RSI, 2), if RSI > 70 then Color.PINK else if RSI < 30 then Color.LIGHT_GREEN else Color.YELLOW);
Re: Fun with ThinkScript September 19, 2014 03:18PM |
Registered: 9 years ago Posts: 2 |