Re: Fun with ThinkScript October 25, 2016 06:39PM |
Registered: 7 years ago Posts: 10 |
Re: Fun with ThinkScript October 25, 2016 08:29PM |
Registered: 8 years ago Posts: 61 |
Re: Fun with ThinkScript October 26, 2016 12:25AM |
Registered: 7 years ago Posts: 8 |
Trying to Scan October 28, 2016 03:22PM |
Registered: 7 years ago Posts: 5 |
Re: Fun with ThinkScript October 30, 2016 03:29AM |
Registered: 9 years ago Posts: 6 |
Re: Fun with ThinkScript October 30, 2016 08:55AM |
Registered: 7 years ago Posts: 3 |
Re: Trying to Scan October 30, 2016 10:32AM |
Registered: 8 years ago Posts: 61 |
Scan Help November 01, 2016 09:10PM |
Registered: 7 years ago Posts: 5 |
Condition true recognition help November 13, 2016 08:14PM |
Registered: 9 years ago Posts: 34 |
Re: Condition true recognition help November 14, 2016 02:49AM |
Registered: 8 years ago Posts: 63 |
Re: Condition true recognition help November 14, 2016 11:59AM |
Registered: 10 years ago Posts: 615 |
Quote
strategynode
I am trying to figure out if a certain condition is true within n number of bars
so right now it looks very long and inefficient wondering if there is a easier way to do this I think fold function might help but I am not very familiar with it and am not able to make it work, here is how it looks right now.
(condition[1] or condition[2] or condition[3] or condition[4] or condition[5] or condition[6]..... or condition[n]) is true
# +--------------------------------------------------+ # | Example: Condition True Within N Bars | # | Robert Payne | # | rrpayne.blogspot.com | # +--------------------------------------------------+ plot MA10 = Average(close, 10); plot MA20 = Average(close, 20); # Define the "condition" as MA10 crossing below MA20 def condition = MA10 crosses below MA20; # Determine if the "condition" has been TRUE within the last "N" bars def N = 5; def trueWithin = Sum(condition, N); # change candle color to yellow as a visual cue for this example AssignPriceColor(if trueWithin then Color.YELLOW else Color.CURRENT);
Re: Condition true recognition help November 14, 2016 09:52PM |
Registered: 9 years ago Posts: 34 |
Re: Fun with ThinkScript November 15, 2016 05:31PM |
Registered: 7 years ago Posts: 6 |
Re: Fun with ThinkScript November 16, 2016 07:51AM |
Registered: 8 years ago Posts: 34 |
Breakout Scan Help November 17, 2016 07:58AM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript November 17, 2016 12:36PM |
Registered: 8 years ago Posts: 22 |
Re: Fun with ThinkScript November 17, 2016 01:18PM |
Registered: 10 years ago Posts: 615 |
Quote
Kamadi
Can someone please explain to me what the difference is between Close > Open and Close - Open? Do they mean the same thing.
Re: Fun with ThinkScript November 17, 2016 06:01PM |
Registered: 8 years ago Posts: 22 |
Re: Fun with ThinkScript November 18, 2016 12:07AM |
Registered: 7 years ago Posts: 1 |
input fastLength = 12; input slowLength = 26; input MACDLength = 9; def H1 = AggregationPeriod.HOUR ; def H4 = AggregationPeriod.FOUR_HOURS ; def D = AggregationPeriod.DAY ; def W = AggregationPeriod.WEEK ; DefineGlobalColor("UpTrend", Color.DARK_GREEN); DefineGlobalColor("DownTrend", Color.RED); DefineGlobalColor("NoTrend", Color.LIGHT_GRAY); def TF = GetAggregationPeriod(); def TFCHECK = if TF < H1 then yes else no ; #H1 def FastAvgH1 = ExpAverage(close(period = H1) ,FastLength); def SlowAvgH1 = ExpAverage(close(period = H1) , SlowLength); def ValueH1 = FastAvgH1 - SlowAvgH1; def AvgH1 = ExpAverage(ValueH1, MACDLength); def DiffH1 = (ValueH1 - AvgH1); #H4 def FastAvgH4 = ExpAverage(close(period = H4) ,FastLength); def SlowAvgH4 = ExpAverage(close(period = H4) , SlowLength); def ValueH4 = FastAvgH4 - SlowAvgH4; def AvgH4 = ExpAverage(ValueH4, MACDLength); def DiffH4 = (ValueH4 - AvgH4); #D def FastAvgD = ExpAverage(close(period = D) ,FastLength); def SlowAvgD = ExpAverage(close(period = D) , SlowLength); def ValueD = FastAvgD - SlowAvgD; def AvgD = ExpAverage(ValueD, MACDLength); def DiffD = (ValueD - AvgD); #W def FastAvgW = ExpAverage(close(period = W) ,FastLength); def SlowAvgW = ExpAverage(close(period = W) , SlowLength); def ValueW = FastAvgW - SlowAvgW; def AvgW = ExpAverage(ValueW, MACDLength); def DiffW = (ValueW - AvgW); plot DOT = if TFCHECK THEN low - 0.1 else Double.NaN ; DOT.AssignValueColor(if (DiffH1 >0 AND DiffH4 > 0 AND DiffD > 0 AND DiffW > 0) then GlobalColor("UpTrend" ) else if (DiffH1 < 0 AND DiffH4 < 0 AND DiffD < 0 AND DiffW < 0) then GlobalColor("DownTrend" ) else GlobalColor("NoTrend" )); DOT.SetPaintingStrategy(PaintingStrategy.POINTS); DOT.SetLineWeight(3);
Re: Fun with ThinkScript November 18, 2016 08:20AM |
Registered: 7 years ago Posts: 10 |
Re: Fun with ThinkScript November 18, 2016 08:42AM |
Registered: 10 years ago Posts: 615 |
def dailyHigh = high(period = "day"
def dailyHigh = high(period = "day" );
Re: Fun with ThinkScript November 18, 2016 09:11AM |
Registered: 7 years ago Posts: 10 |
Re: Fun with ThinkScript November 18, 2016 09:27AM |
Registered: 10 years ago Posts: 615 |
Quote
rcmcfe
Unfortunately, my text editor (mac) doesn't have a search function.
Re: Fun with ThinkScript November 23, 2016 05:57PM |
Registered: 8 years ago Posts: 22 |
Some assistance please November 24, 2016 11:01PM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript November 30, 2016 12:11AM |
Registered: 7 years ago Posts: 1 |
Intraday EMAs November 30, 2016 05:32PM |
Registered: 7 years ago Posts: 1 |
Re: Intraday EMAs December 01, 2016 07:51PM |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript December 01, 2016 09:51PM |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript December 02, 2016 07:18AM |
Registered: 10 years ago Posts: 615 |
Quote
devildriver6
Now I have a question I can't quite figure out.
I'm trying to get the average of the volume bars, but I ONLY want the after hours bars to be calculated in the After Hours volume average, and ONLY the RTH bars to be calculated within the RTH volume average, both within the same indicator.
This way, it takes the averages of both sections and isn't too high in AHs and too low in RTHs.
Maybe Robert can help here.
# determine when the market is open def mktIsOpen = SecondsFromTime(0930) >= 0 and SecondsTillTime(1600) > 0; # calculate volume when the market is open plot volRTH = if mktIsOpen then volume else Double.NaN; # calculate volume when the market is closed plot volAH = if !mktIsOpen then volume else Double.NaN;