Recursive Studies September 07, 2018 10:17AM |
Registered: 5 years ago Posts: 1 |
declare upper; #FisherTransform input price = hl2; input length = 10; def maxHigh = Highest(price, length); def minLow = Lowest(price, length); def range = maxHigh - minLow; def value = if IsNaN(price) then Double.NaN else if IsNaN(range) then value[1] else if range == 0 then 0 else 0.66 * ((price - minLow) / range - 0.5) + 0.67 * value[1]; def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value; def fish = 0.5 * (log((1 + truncValue) / (1 - truncValue)) + fish[1]); def FTOneBarBack = fish[1]; def FT = fish; #ChaikinVolatility input ROClength = 10; assert(ROCLength > 0, "'roc length' must be positive: " + ROCLength); def diff2 = high - low; def avg2 = Average(diff2, 10); def CV = if avg2[roclength] == 0 then 100 else (avg2 - avg2[roclength]) / avg2[roclength] * 100; plot up = ftOneBarBack < -2.5 and ft < -2.5 and cv > 500; plot down = ftOneBarBack > 2.5 and ft > 2.5 and cv > 500; up.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP); up.setDefaultColor(Color.BLUE); down.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN); down.setDefaultColor(color.BLUE); #TAC_ADX def ADX1 = DMI(length = 3).ADX; def ADX2 = DMI(length = 4).ADX; def ADX3 = DMI(length = 5).ADX; def adxmax = max(max(ADX1, ADX2), ADX3); def adxmin = min(min(ADX1,ADX2), ADX3); #Heikin Ashi Candles def openMA = CompoundValue(1, Average(open, 1), open); def closeMA = CompoundValue(1, Average(close, 1), close); def highMA = CompoundValue(1, Average(high, 1), high); def lowMA = CompoundValue(1, Average(low, 1), low); def haOpen2 = CompoundValue(1, ( (haOpen2[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) / 4.0) / 2.0), open);; def haClose2 = ((openMA + highMA + lowMA + closeMA) / 4.0) ;; def haLow = Min(lowMA, haOpen2); def haHigh = Max(highMA, haOpen2); #MACD def Value2 = MovingAverage(averageType = AverageType.EXPONENTIAL, close, 12) - MovingAverage(averageType = AverageType.EXPONENTIAL, close, 26); def Avg = MovingAverage(averageType = AverageType.EXPONENTIAL, Value2, 9); def Diff = Value2 - Avg; #Ichimoku def Tenkan = (Highest(high, 9) + Lowest(low, 9)) / 2; def Kijun = (Highest(high, 26) + Lowest(low, 26)) / 2; def "Span A" = (Tenkan[26] + Kijun[26]) / 2; def "Span B" = (Highest(high[26], 2 * 26) + Lowest(low[26], 2 * 26)) / 2; def Chikou = close[-26]; #SimpleTrendChannelFilter input trendCheck = {default Min}; def avg20 = Average(close, 20); def avg50 = Average(close, 50); def Downtrend3 = close < avg50 and (if trendCheck != trendCheck.Min then avg20 < avg50 else yes); def Uptrend3 = close > avg50 and (if trendCheck != trendCheck.Min then avg20 > avg50 else yes); #HACOLT Assert(1.1 >= 0, "'candle size factor' must not be negative: " + 1.1); def haOpen = CompoundValue(1, (haOpen[1] + ohlc4[1]) / 2, ohlc4); def haClose = (haOpen + Max(high, haOpen) + Min(low, haOpen) + ohlc4) / 4; def temaHaClose = TEMA(haClose, 55); def zeroLagHaClose = 2 * temaHaClose - TEMA(temaHaClose, 55); def temaTypPrice = TEMA(hl2, 55); def zeroLagTypPrice = 2 * temaTypPrice - TEMA(temaTypPrice, 55); def shortCandle = BodyHeight() < (high - low) * 1.1; def keepGreen = haClose >= haOpen or haClose[1] >= haOpen[1] or close >= haClose or high > high[1] or low > low[1] or zeroLagTypPrice >= zeroLagHaClose; def keepGreenAll = keepGreen or (keepGreen[1] and (close >= open or close >= close[1])); def holdLong = shortCandle and high >= low[1]; def utr = keepGreenAll or (keepGreenAll[1] and holdLong); def keepRed = haClose < haOpen or haClose[1] < haOpen[1] or zeroLagTypPrice < zeroLagHaClose; def keepRedAll = keepRed or (keepRed[1] and (close < open or close < close[1])); def holdShort = shortCandle and low <= high[1]; def dtr = keepRedAll or (keepRedAll[1] and holdShort); def upw = !dtr and dtr[1] and utr; def dnw = !utr and utr[1] and dtr; def upwSave = if upw or dnw then upw else upwSave[1]; def buy = upw or (!dnw and upwSave); def longTermSell = close < ExpAverage(close, 60); def neutral = buy or (if longTermSell then no else neutral[1]); def HACOLT = if buy then 100 else if neutral then 50 else 0; #CMF def tmp_var = if high == low then volume else (close - low - (high - close)) / (high - low) * volume ; def sum_close = Sum(tmp_var, length = 21) * 100; def total = Sum(volume, length = 21); def CMF = if total == 0 then 0 else sum_close / total ; #Entry Parameters def upTrend = ohlc4 < "Span A" and ohlc4 < "Span B" and CMF > 0 and Uptrend3 == yes and HACOLT == 100 and Value2 > 0 and Avg > 0 and Diff > 0 and haOpen2 > haLow and haOpen2 < haHigh and adxmin < 30; def neutral1 = ohlc4 < "Span A" and ohlc4 < "Span B" and CMF > 0 and Uptrend3 == yes and HACOLT == 100 and Value2 > 0 and Avg > 0 and Diff > 0 and haOpen2 == haLow and adxmin < 30; def neutral2 = ohlc4 < "Span A" and ohlc4 < "Span B" and CMF > 0 and Uptrend3 == yes and HACOLT == 100 and Value2 > 0 and Avg > 0 and Diff > 0 and haOpen2 == haHigh and adxmin < 30; def downTrend = ohlc4 > "Span A" and ohlc4 > "Span B" and CMF < 0 and Downtrend3 == yes and HACOLT <= 50 and Value2 < 0 and Avg < 0 and Diff < 0 and haOpen2 > haLow and haOpen2 < haHigh and adxmax > 70; def neutral3 = ohlc4 > "Span A" and ohlc4 > "Span B" and CMF < 0 and Downtrend3 == yes and HACOLT <= 50 and Value2 < 0 and Avg < 0 and Diff < 0 and haOpen2 == haHigh and adxmax > 70; def neutral4 = ohlc4 > "Span A" and ohlc4 > "Span B" and CMF < 0 and Downtrend3 == yes and HACOLT <= 50 and Value2 < 0 and Avg < 0 and Diff < 0 and haOpen2 == haLow and adxmax > 70; plot buy1 = upTrend == yes and neutral1[1] == yes; plot buy2 = upTrend == yes and neutral2[1] == yes; plot buy3 = upTrend[1] == yes and neutral1 == yes; plot buy4 = upTrend[1] == yes and neutral2 == yes; plot buy5 = neutral1 == yes and neutral2[1] == yes; plot buy6 = neutral1[1] == yes and neutral2 == yes; plot buy7 = neutral1 == yes and neutral1[1] == yes; plot buy8 = neutral2 == yes and neutral2[1] == yes; plot sell1 = downTrend == yes and neutral3[1] == yes; plot sell2 = downTrend == yes and neutral4[1] == yes; plot sell3 = downTrend[1] == yes and neutral3 == yes; plot sell4 = downTrend[1] == yes and neutral4 == yes; plot sell5 = neutral3 == yes and neutral4[1] == yes; plot sell6 = neutral3[1] == yes and neutral4 == yes; plot sell7 = neutral3 == yes and neutral3[1] == yes; plot sell8 = neutral4 == yes and neutral4[1] == yes; buy1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy1.SetDefaultColor(Color.LIGHT_GRAY); buy1.HideTitle(); buy2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy2.SetDefaultColor(Color.LIGHT_GRAY); buy2.HideTitle(); buy3.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy3.SetDefaultColor(Color.LIGHT_GRAY); buy3.HideTitle(); buy4.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy4.SetDefaultColor(Color.LIGHT_GRAY); buy4.HideTitle(); buy5.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy5.SetDefaultColor(Color.LIGHT_GRAY); buy5.HideTitle(); buy6.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy6.SetDefaultColor(Color.LIGHT_GRAY); buy6.HideTitle(); buy7.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy7.SetDefaultColor(Color.LIGHT_GRAY); buy7.HideTitle(); buy8.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); buy8.SetDefaultColor(Color.LIGHT_GRAY); buy8.HideTitle(); sell1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell1.SetDefaultColor(Color.LIGHT_GRAY); sell1.HideTitle(); sell2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell2.SetDefaultColor(Color.LIGHT_GRAY); sell2.HideTitle(); sell3.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell3.SetDefaultColor(Color.LIGHT_GRAY); sell3.HideTitle(); sell4.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell4.SetDefaultColor(Color.LIGHT_GRAY); sell4.HideTitle(); sell5.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell5.SetDefaultColor(Color.LIGHT_GRAY); sell5.HideTitle(); sell6.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell6.SetDefaultColor(Color.LIGHT_GRAY); sell6.HideTitle(); sell7.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell7.SetDefaultColor(Color.LIGHT_GRAY); sell7.HideTitle(); sell8.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); sell8.SetDefaultColor(Color.LIGHT_GRAY); sell8.HideTitle();
Re: On Balance Volume September 09, 2018 10:49AM |
Registered: 5 years ago Posts: 6 |
Re: Recursive Studies September 10, 2018 08:29AM |
Registered: 9 years ago Posts: 67 |
Help to convert study for watchlist September 12, 2018 05:09PM |
Registered: 5 years ago Posts: 23 |
Re: Help to convert study for watchlist September 16, 2018 11:09AM |
Registered: 7 years ago Posts: 126 |
input length = 13; input paintBars = yes; def EMA = ExpAverage(close, length); def MACD = ExpAverage(close, 12) - ExpAverage(close, 26); def MACDHist = MACD - ExpAverage(MACD, 9); def GreenPrice = EMA > EMA[1] and MACDHist > MACDHist[1]; def RedPrice = EMA < EMA[1] and MACDHist < MACDHist[1]; Plot scan=close; assignBackgroundColor(if GreenPrice then Color.lime else if RedPrice then Color.red else Color.yellow); scan.assignValueColor(if GreenPrice then Color.black else if RedPrice then Color.white else Color.black);
Re: Help to convert study for watchlist September 16, 2018 12:13PM |
Registered: 5 years ago Posts: 23 |
Re: Recursive Studies September 17, 2018 07:34PM |
Registered: 11 years ago Posts: 106 |
Plot Yesterday's Custom OR on Today's Chart September 18, 2018 11:59AM |
Registered: 7 years ago Posts: 9 |
VPCI Indicator by Lazy Bear September 20, 2018 06:57PM |
Registered: 5 years ago Posts: 2 |
Re: VPCI Indicator by Lazy Bear September 23, 2018 09:20AM |
Registered: 7 years ago Posts: 126 |
Quote
Sim_Boy
If someone could convert it to TOS that would be excellent!
#// #// @author LazyBear #// #// If you use this code in its orignal/modified form, do drop me a note. #// #study("Volume Price Confirmation Indicator [LazyBear]", shorttitle="VPCI_LB" ) # Converted to TOS by Rigel 2018. # declare lower; input shortTerm = 5; input longTerm = 20; def agg=aggregationPeriod.MIN; input src = close; input BBlength = 20; #, title="BB Length" input mult = 2.5; def vpc = vwap(period=longTerm*agg) - Average(src, longTerm); def vpr = vwap(period=shortTerm*agg) / Average(src, shortTerm); def vm = Average(volume, shortTerm) / Average(volume, longTerm); plot vpci = vpc * vpr * vm; vpci.setDefaultColor(color.green); plot zero=0; zero.setdefaultColor(color.cyan); input lengthMA=8 ; #, "VPCI MA Length" plot MA = Average(vpci, lengthMA); MA.setdefaultColor(color.pink); def bb_s = vpci; plot basis = Average(bb_s, BBlength); def dev = (mult * StDev(bb_s, BBlength)); plot upper = (basis + dev); plot lower = (basis - dev); basis.setdefaultColor(color.white); basis.setPaintingStrategy(PaintingStrategy.line); basis.setStyle(curve.SHORT_DASH);
E-Charts Scanner for ToS September 25, 2018 09:17AM |
Registered: 5 years ago Posts: 14 |
Re: VPCI Indicator by Lazy Bear September 25, 2018 07:00PM |
Registered: 5 years ago Posts: 2 |
Re: Fun with ThinkScript September 26, 2018 12:51PM |
Registered: 5 years ago Posts: 1 |
Re: Fun with ThinkScript September 26, 2018 09:06PM |
Registered: 9 years ago Posts: 14 |
input percentIntraDay = 0.1; input percent = 4; def p = if GetAggregationPeriod() < AggregationPeriod.DAY then percentIntraDay else percent; def threshold = close[1] * p / 100; def UpSignal = low - high[1] > threshold; def DownSignal = low[1] - high > threshold; def mostRecent = {default init, up, down}; mostRecent = if UpSignal then mostRecent.up else if DownSignal then mostRecent.down else mostRecent[1]; def topPrice; def bottomPrice; def gapEnd = if mostRecent[1] == mostRecent.up and low <= bottomPrice[1] then 1 else if mostRecent[1] == mostRecent.down and high >= topPrice[1] then 1 else 0; topPrice = if UpSignal then low else if DownSignal then low[1] else if gapEnd == 1 then Double.NaN else if mostRecent[1] == mostRecent.up then if low < topPrice[1] then low else topPrice[1] else topPrice[1]; plot Top = if topPrice > 0 then topPrice else Double.NaN; Top.SetDefaultColor(Color.YELLOW); Top.SetPaintingStrategy(PaintingStrategy.DASHES); bottomPrice = if UpSignal then high[1] else if DownSignal then high else if gapEnd == 1 then Double.NaN else if mostRecent[1] == mostRecent.down then if high > bottomPrice[1] then high else bottomPrice[1] else bottomPrice[1]; plot Bottom = if bottomPrice > 0 then bottomPrice else Double.NaN; Bottom.SetDefaultColor(Color.YELLOW); Bottom.SetPaintingStrategy(PaintingStrategy.DASHES);
Re: E-Charts Scanner for ToS September 28, 2018 04:05AM |
Registered: 7 years ago Posts: 126 |
Re: Fun with ThinkScript September 28, 2018 05:40AM |
Registered: 7 years ago Posts: 126 |
ADX MTF period September 28, 2018 01:16PM |
Registered: 6 years ago Posts: 33 |
Hi Rigel, can you please help me converting the ADX STUDY into a MTF study please. September 28, 2018 01:37PM |
Registered: 6 years ago Posts: 33 |
Re: Fun with ThinkScript September 29, 2018 10:57PM |
Registered: 5 years ago Posts: 4 |
Re: Fun with ThinkScript October 02, 2018 01:46AM |
Registered: 6 years ago Posts: 32 |
Re: Fun with ThinkScript October 02, 2018 10:24PM |
Registered: 9 years ago Posts: 14 |
Re: Fun with ThinkScript October 10, 2018 10:47AM |
Registered: 8 years ago Posts: 59 |
Re: Fun with ThinkScript October 18, 2018 01:00PM |
Registered: 9 years ago Posts: 67 |
input ATRlength = 10; # default length = 14 - can range anywhere from 6 to 21 def priceC = close; input averageType = AverageType.WILDERS; input ATRmultiplier = 1.50; # default multiplier = 2.0 - can range anywhere from 1.0 to 5.0 def ATR = MovingAverage(averageType, TrueRange(high, close, low), ATRlength); def avgDailyMovement = (ATR / priceC) * 100; input profitMultiplier = 3.00; input AccountEquity = 100000.00; input PercentRiskPerTrade = 0.005; def EquityRiskPerTrade = AccountEquity * PercentRiskPerTrade; def SharesToBuy = (EquityRiskPerTrade / (avgDailyMovement * ATRmultiplier)); def currentPositionSize = SharesToBuy * priceC; def stopAmount = avgDailyMovement * ATRmultiplier; def longSellStop = priceC - stopAmount; def shortBuyStop = priceC + stopAmount; def profitTarget = avgDailyMovement * profitMultiplier; def longSellLimit = priceC + profitTarget; def shortBuyLimit = priceC - profitTarget; AddLabel(yes, "Shares to Buy: " + Round(SharesToBuy, 0), CreateColor (255, 255, 255)); AddLabel(yes, "Position Size: " + Round(currentPositionSize, 2), CreateColor (255, 255, 255)); AddLabel(yes, "Long SELL Stop: " + Round(longSellStop, 2), CreateColor (255, 255, 255)); AddLabel(yes, "Long SELL Limit: " + Round(longSellLimit, 2), CreateColor (255, 255, 255)); AddLabel(yes, "Short BUY Stop: " + Round(shortBuyStop, 2), CreateColor (255, 255, 255)); AddLabel(yes, "Short BUY Limit: " + Round(shortBuyLimit, 2), CreateColor (255, 255, 255));
Re: Fun with ThinkScript October 18, 2018 03:11PM |
Registered: 5 years ago Posts: 1 |
declare lower; input fastLength = 12; input slowLength = 26; input MACDLength = 9; input averageType = AverageType.EXPONENTIAL; plot Diff = MACD(fastLength, slowLength, MACDLength, averageType).Diff; def HA = if Diff > Diff[1] and Diff > 0 then Diff else HA[1]; plot HighestAngle = HA; Diff.SetDefaultColor(GetColor(5)); Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); Diff.SetLineWeight(3); Diff.DefineColor("Positive and Up", Color.GREEN); Diff.DefineColor("Positive and Down", Color.DARK_GREEN); Diff.DefineColor("Negative and Down", Color.RED); Diff.DefineColor("Negative and Up", Color.DARK_RED); Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up" else Diff.color("Positive and Down" else if Diff < Diff[1] then Diff.color("Negative and Down" else Diff.color("Negative and Up");
Re: Fun with ThinkScript October 18, 2018 06:47PM |
Registered: 6 years ago Posts: 32 |
Set up 233 Chart on TOS? October 22, 2018 12:23AM |
Registered: 5 years ago Posts: 1 |
Re: Set up 233 Chart on TOS? October 22, 2018 01:12PM |
Registered: 12 years ago Posts: 172 |
Re: Set up 233 Chart on TOS? October 23, 2018 03:17PM |
Registered: 10 years ago Posts: 464 |
Re: Fun with ThinkScript October 28, 2018 10:38AM |
Registered: 5 years ago Posts: 9 |
Re: Fun with ThinkScript October 30, 2018 09:45AM |
Registered: 5 years ago Posts: 4 |