Re: Fun with ThinkScript July 16, 2015 05:00AM |
Registered: 8 years ago Posts: 61 |
Re: Fun with ThinkScript July 16, 2015 06:35AM |
Registered: 10 years ago Posts: 615 |
Quote
Tampman
Rob: Do you have a script just for auto retracement and extensions fibs?
Re: Fun with ThinkScript July 16, 2015 02:24PM |
Registered: 8 years ago Posts: 61 |
Re: Fun with ThinkScript July 17, 2015 07:40PM |
Registered: 10 years ago Posts: 615 |
Quote
Palmer
Heyyyyyy Robert. This is not the entire idea but I can take what you give back and go from there.
Wondering if this is possible:
Thinking in terms of going long when:
Condtion1: The RSI(14) crosses above 50.
Starting from the close of that bar, what was the lowest low value in the next 5 bars? Even better, what was the maximum difference in price from the close of that bar during the cross minus the lowest low in the next 5 bars?
def RSI = reference RSI(length = 14).rsi; def Xup = RSI crosses above 50; # if more than one cross up in a 5 day period, only use the first one plot SignalUP = Xup and Sum(Xup[1], 5) == 0; SignalUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); SignalUP.SetDefaultColor(Color.YELLOW); # get the highest high during the 5 days following the cross up def HH = Highest(high, 5); # plot a 5 bar line at the highest high following the cross up def countUP = if SignalUP then 0 else countUP[1] + 1; plot HH5 = if countUP <= 5 then GetValue(HH, countUP - 5) else Double.NaN; HH5.SetDefaultColor(Color.WHITE); # label the highest 5 day high AddChartBubble(high == HH5, high, Round(HH5), Color.WHITE); # calculate and label the difference between the highest 5 day high and the close of then signal day def diff = if high == HH5 then high - GetValue(close, countUP) else Double.NaN; AddChartBubble(high == HH5, high, "diff: " + Round(diff), Color.LIGHT_ORANGE);
Re: Fun with ThinkScript July 18, 2015 09:08AM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 18, 2015 03:44PM |
Registered: 8 years ago Posts: 7 |
Re: Fun with ThinkScript July 19, 2015 12:57PM |
Registered: 10 years ago Posts: 615 |
Quote
KevinR
How do I access the values created by EnableApproximation? For instance, I want to determine the slope (line - line[1]) but it still contains NaN...
# ----- define a valley as any point which is lower than the three preceding lows and the three following lows def Valley = low < Lowest(low[1], 3) and low < Lowest(low[-3], 3); # ----- mark each valley with an up arrow ----- plot ArrowUP = Valley; ArrowUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); ArrowUP.SetDefaultColor(Color.WHITE); ArrowUP.SetLineWeight(4); # ----- draw a straight line connecting each valley ----- plot line = if ArrowUP then low else Double.NaN; line.EnableApproximation(); line.SetDefaultColor(Color.LIME); line.SetLineWeight(2); # ----- calculate slope using the rise over run method ----- # setup "run" as a recursive variable to count the number of bars between vallies def run = if Valley then 1 else run[1] + 1; # "rise" will be current valley low - previous valley low # the "run" counter can be used in conjunction with the "GetValue" function to lookup the previous valley low def rise = if Valley then low - GetValue(low, run[1]) else Double.NaN; # slope is calculated as rise / run def slope = rise / run[1]; # display slope just so that you know what it is AddChartBubble(Valley, low, slope, if slope > 0 then Color.LIGHT_GREEN else Color.PINK); # ----- bonus section ----- # just for fun, let's use the slope calculated above to extend the lines connecting each valley def slopeX = if Valley then slope else slopeX[1]; def lineX = if Valley then low else lineX[1] + slopeX; plot LineExtension = lineX; LineExtension.SetDefaultColor(Color.CYAN); LineExtension.SetPaintingStrategy(PaintingStrategy.POINTS);
Re: Fun with ThinkScript July 19, 2015 01:57PM |
Registered: 10 years ago Posts: 35 |
Re: Fun with ThinkScript July 20, 2015 06:01PM |
Registered: 8 years ago Posts: 161 |
plot trendline but not horizontal July 21, 2015 10:12PM |
Registered: 8 years ago Posts: 4 |
Re: plot trendline but not horizontal July 21, 2015 10:55PM |
Registered: 10 years ago Posts: 615 |
Quote
RickT
I would like to plot a trendline on 2 highs in Thinkscript.
I was thinking 2 recent highest highs (on any timeframe)
def HH = HighestAll(high)
def HH = HighestAll(high[1]) <--------------[1] in thinkscript mean 1 prior
plot HighTrendline = ?
Seems somewhat simple but cannot find the right commands to do it.
Horizontal line is well documented but I want a line with some slope on it.
Anyone know how to do this?
Thanks in advance
Re: Fun with ThinkScript July 23, 2015 12:58PM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 23, 2015 03:39PM |
Registered: 10 years ago Posts: 615 |
Quote
Palmer
Just looking to reference more than one time frame for an indicator or condition.
Say you're looking for strength in the 1hr and 30min time frame before making an entry on the 15min chart.
declare lower; plot RSI60min = reference RSI(price = close(period = AggregationPeriod.HOUR)).rsi;
Re: Fun with ThinkScript July 23, 2015 03:49PM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 23, 2015 05:17PM |
Registered: 9 years ago Posts: 11 |
Re: Fun with ThinkScript July 23, 2015 08:03PM |
Registered: 10 years ago Posts: 615 |
Hi Robert, Let me know if you would like some divergence studies. I have RSI, MACD, and a few others Dave
Re: Fun with ThinkScript July 24, 2015 05:33PM |
Registered: 9 years ago Posts: 11 |
Re: Fun with ThinkScript July 25, 2015 01:07PM |
Registered: 9 years ago Posts: 9 |
Re: Fun with ThinkScript July 25, 2015 01:40PM |
Registered: 10 years ago Posts: 615 |
Quote
Mel
Does anyone have code to add a chart bubble to the end of moving average line. Sometimes it gets confusing with multiple moving average and which one is which. I want to see the name of the moving average attach to the line at the end i.e: 50 EMA or 100 SMA.
input length = 50; input AvgType = AverageType.SIMPLE; input price = close; plot Avg = MovingAverage(AvgType, price, length); Avg.SetDefaultColor(Color.DARK_ORANGE); def lastbar = IsNaN(close[-1]) and !IsNaN(close); AddChartBubble(lastbar, Avg, "MA" + length, Color.DARK_ORANGE);
Re: Fun with ThinkScript July 25, 2015 02:00PM |
Registered: 9 years ago Posts: 9 |
Re: Fun with ThinkScript July 25, 2015 02:04PM |
Registered: 10 years ago Posts: 615 |
Quote
Mel
Thank you Robert. Is there any way to move it forward in time i.e: 5 bars forward, so it is not covering the current bars?
AddChartBubble(lastbar[-5], Avg, "MA" + length, Color.DARK_ORANGE);
Re: Fun with ThinkScript July 25, 2015 02:12PM |
Registered: 9 years ago Posts: 9 |
Re: Fun with ThinkScript July 25, 2015 07:23PM |
Registered: 9 years ago Posts: 15 |
Re: Fun with ThinkScript July 26, 2015 08:19AM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 26, 2015 04:50PM |
Registered: 10 years ago Posts: 615 |
Quote
jakesdad
1-RSI divergence, by Mobius, change lengths and modify, let me know what you think
2- MACD Divergence,by Mobius, change lengths and modify
Quote
mark1234
Hi Robert, we're back again with another request.
Is there anyway to attach a sounded alert to the following script.
I would like to get the code to alert when the white volume tick is painted.
I'm sure you know the white volume tick generally coincides with either a doji or hammer like candle.
That would signal a bounce or trend change possibility.
Many thanks
Alert(close == close[1], GetSymbol() + " same close value as before", Alert.BAR, Sound.Bell);
Quote
Palmer
Remember the decal idea? How's this? They would be about 8 inches long and 4 inches high. Viny decals. You could put it on your laptop cover, filing cabinet, car window...center of your wife's make-up mirror...spinning smiley sticking its tongue out
Re: Fun with ThinkScript July 26, 2015 06:42PM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 26, 2015 07:16PM |
Registered: 10 years ago Posts: 615 |
Quote
Palmer
Gotcha....well, now a request. I know it's simple but the past 4 hours has me stumped. Just tryng to reference the MoneyFLowIndex for a condition but things are not lining up correctly....
declare lower;
def mfi = reference MoneyFlowIndex(10, close).MoneyFlowIndex;
def mfi = reference MoneyFlowIndex(length = 10).MoneyFlowIndex;
Re: Fun with ThinkScript July 26, 2015 07:24PM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 26, 2015 07:45PM |
Registered: 10 years ago Posts: 464 |
Re: Fun with ThinkScript July 27, 2015 01:27AM |
Registered: 9 years ago Posts: 15 |