 Williams Fractals for TradeStation Updated: August 21st, 2019 (10:21 PM) Views / Replies: 898 / 5 Created: July 28th, 2019 (12:40 PM) by lrc11239 Attachments: 0

 Welcome to futures io.

 July 28th, 2019, 12:40 PM #1 (permalink) Brooklyn NY USA     Posts: 27 since Jul 2019 Thanks: 2 given, 0 received Williams Fractals for TradeStation Hello all, I'm new to TradeStation and this forum. Thank you for so much information. I've been trying to find the Williams Fractal plots for Tradestation. I'm currently using Thinkorswim and have them there but I'm switching my day trading platform to Tradestation and I'm not sure if they have the Fractals I'm using. I've tried to call the Tech department and they really don't know if the platform has them. Does anyone know if Tradestation has the Williams Fractal plots? I've also included the ThinkScript codes if anyone is able to convert to EasyLanguage would be much appreciated. Many thanks as always!! #wizard plots #wizard text: Inputs: sequence count: #wizard input: sequenceCount input sequenceCount = 2; def maxSideLength = sequenceCount + 10; def upRightSide = fold i1 = 1 to maxSideLength + 1 with count1 while count1 != sequenceCount and count1 != -1 do if GetValue(high, -i1, -maxSideLength) > high or (GetValue(high, -i1, -maxSideLength) == high and count1 == 0) then -1 else if GetValue(high, -i1, -maxSideLength) < high then count1 + 1 else count1; def upLeftSide = fold i2 = 1 to maxSideLength + 1 with count2 while count2 != sequenceCount and count2 != -1 do if GetValue(high, i2, maxSideLength) > high or (GetValue(high, i2, maxSideLength) == high and count2 >= 1) then -1 else if GetValue(high, i2, maxSideLength) < high then count2 + 1 else count2; def downRightSide = fold i3 = 1 to maxSideLength + 1 with count3 while count3 != sequenceCount and count3 != -1 do if GetValue(low, -i3, -maxSideLength) < low or (GetValue(low, -i3, -maxSideLength) == low and count3 == 0) then -1 else if GetValue(high, -i3, -maxSideLength) > low then count3 + 1 else count3; def downLeftSide = fold i4 = 1 to maxSideLength + 1 with count4 while count4 != sequenceCount and count4 != -1 do if GetValue(low, i4, maxSideLength) < low or (GetValue(low, i4, maxSideLength) == low and count4 >= 1) then -1 else if GetValue(low, i4, maxSideLength) > low then count4 + 1 else count4; plot UpFractal = if upRightSide == sequenceCount and upLeftSide == sequenceCount then high else Double.NaN; plot DownFractal = if downRightSide == sequenceCount and downLeftSide == sequenceCount then low else Double.NaN; UpFractal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP); UpFractal.SetDefaultColor(GetColor(3)); UpFractal.SetLineWeight(2); DownFractal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN); DownFractal.SetDefaultColor(GetColor(4)); DownFractal.SetLineWeight(2); Can you help answer these questions
from other members on futures io?
 BigML with Trading DatasetsTraders Hideout Multiple working buy/sell order with preset SL and TP - ...NinjaTrader Alert for MACD crossoverThinkOrSwim adding labels that always stay on the left on horizonal ...ThinkOrSwim Programming Highlighting Oscillators in Sierra ChartsSierra Chart

in the last 7 days on futures io
 ES futures Spoo-nalysis SP500/SPX306 thanks Recession? Depression? Bailout!265 thanks Coronavirus COVID-19236 thanks Finally Turning the Corner, tha "its 80% Psychology ...82 thanks Understanding Footprint Charts / Number bars80 thanks

 July 29th, 2019, 06:57 AM #2 (permalink) Vendor: www.abctradinggroup.com  Hamburg Germany   Trading Experience: Advanced Platform: Multicharts, Tradestation Broker/Data: DTN IQ Favorite Futures: ES   Posts: 2,163 since Apr 2013 Thanks: 384 given, 1,396 received lrc11239, welcome to futures.io. You might be able to find an indicator that does what you want in the official Tradestation forum. For example this one might work for you: https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=60258 Regards, ABCTG The following user says Thank You to ABCTG for this post:

Plainview

Favorite Futures: Futures

Posts: 7 since Mar 2012 I find that this code works pretty well [not sure it's exactly the same, but it's pretty close]
For Lows (I plot PaintBars with slightly thick plots in the lower half of the bar, so this is paintbar study code; it works best on bars rather than candles):

Code
 ```Input: MyStrength(2); If SwingLow(1,L,MyStrength,MyStrength + 1) <> -1 {and L <> L} then begin CommentaryCL("Action Bar"); If Low[MyStrength] < Low[MyStrength + 1] then begin PlotPB[MyStrength](0.5*(H+L)[MyStrength],(SwingLow(1,L,MyStrength,MyStrength + 1)),"FrctlL"); If AlertEnabled then Alert("Fractal Low Formed " + GetSymbolName); end Else begin PlotPB[MyStrength + 1]((SwingLow(1,L,MyStrength,MyStrength + 2)),(H[MyStrength + 1]+L[MyStrength + 1])/2,"FrctlL"); If AlertEnabled then Alert("Fractal Low Formed " + GetSymbolName); end; end Else Begin NoPlot(1); NoPlot(2); End;```
For Highs:

Code
 ``` Input: MyStrength(2); If SwingHigh(1,H,MyStrength,MyStrength + 1) <> -1 {and H <> H} then begin CommentaryCL("Action Bar"); If High[MyStrength] > High[MyStrength + 1] then begin PlotPB[MyStrength]((SwingHigh(1,H,MyStrength,MyStrength + 1)),(H[MyStrength]+L[MyStrength])/2,"FrctlH"); If AlertEnabled then Alert("Fractal High Formed " + GetSymbolName); end Else begin PlotPB[MyStrength + 1]((SwingHigh(1,H,MyStrength,MyStrength + 2)),(H[MyStrength + 1]+L[MyStrength + 1])/2,"FrctlH"); If AlertEnabled then Alert("Fractal High Formed " + GetSymbolName); end; end Else Begin NoPlot(1); NoPlot(2); End;```

Last edited by TraderDoc2; July 30th, 2019 at 10:48 AM. Columbus, OH USA

Favorite Futures: eMini ES

Posts: 2 since Feb 2016

From Bill Williams himself...

Code
 ```[LegacyColorValue = TRUE]; { --------------------------------------------------------------------- -- SHOW: FRACTAL-SQUATS Study -- -- -- -- Developed by Bill Williams -- -- Easy Language Programing by: Bill Williams -- -- -- Copyright by Bill Williams - Profitunity Trading Group -- --------------------------------------------------------------------- See Profitunity Manual for information on how to apply this STUDY. These FRACTAL formation will be identified by this logic: Rising Markets: | | | ||| || |||| ||||| | | | | | | | | | | | | | | | | | | | | | | | | | ___________________________________________________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | ||| || |||| ||||| Declining Markets: Additional formations can be added by placing the appropriate code in the User functions: UpFractal DownFractal and by adding the logic in this study for determining where to place the Fractal/Squat identifier. NOTE: Documentation was limited by File Size Restrictions.} INPUT: PtsInTic(1), TicExpnd(1); VAR : UpHump(FALSE), DownHump(FALSE), Expansion(0), Move(0); UpHump = UpFractal = 1; DownHump = DownFractal = 1; IF TicExpnd >= MinimumMove THEN Move = TicExpnd ELSE Move = MinimumMove; Expansion = Move * PtsInTic; IF UpHump THEN BEGIN IF H >= H AND H > H THEN Plot1(HIGH + Expansion Points,"UpHump"); IF H = H AND H = H THEN Plot1(HIGH + Expansion Points,"UpHump"); IF H > H AND H = H THEN Plot1(HIGH + Expansion Points,"UpHump"); IF H = H AND H = H AND H = H THEN Plot1(HIGH + Expansion Points,"UpHump"); IF H = H AND H = H AND H = H AND H = H THEN Plot1(HIGH + Expansion Points,"UpHump"); END; IF DownHump THEN BEGIN IF L <= L AND L < L THEN Plot2(LOW - Expansion Points,"DwnHump"); IF L = L AND L = L THEN Plot2(LOW - Expansion Points,"DwnHump"); IF L < L AND L = L THEN Plot2(LOW - Expansion Points,"DwnHump"); IF L = L AND L = L AND L = L THEN Plot2(LOW - Expansion Points,"DwnHump"); IF L = L AND L = L AND L = L AND L = L THEN Plot2(LOW - Expansion Points,"DwnHump"); END;```
The following is a NEWER version, but there are LESS examples:

Code
 ```{ ******************************* ********************************* *** *** *** FRACTAL PATTERNS *** *** PROFITUNITY TRADING GROUP *** *** *** ********************************* ******************************* } { STEP 1: Replace with the logical criteria that will trigger the placement of a ShowMe marker on the chart, such as Close > Close. Note that Condition1 is a logical variable, a temporary holding place for the true-false result of your criteria. } Condition1 = H > H and H > H and H > H and H > H; Condition2 = L < L and L < L and L < L and L < L; { OPTIONAL STEP: Replace CLOSE with your own formula for the price at which the marker will be placed. Note that Value1 is a numeric variable, a temporary holding place for the result of the numeric formula. } Value1 = H ; Value2 = L; { Leave the following as is. The plot is not named because there is only one plot, and the default name Plot1 will be adequate. The alert does not include a description because the alerting criteria and the plotting criteria are the same, and the description will be redundant. } if Condition1 then Plot1( Value1, "Fractal H", Green) ; If Condition2 then Plot2( Value2, "Fractal L", Red);``` July 30th, 2019, 03:55 PM #5 (permalink) Phoenix Arizona     Posts: 1 since Jul 2019 Thanks: 0 given, 1 received Williams Fractals Hello, Also new to the forum. I am using Tradestation 9.5 Update 28 and it has the Williams Fractal, it is a "Show Me", so you have to click over 1 tab to the right when you go to add an indicator and select the ShowMe options. Or perhaps I some how picked this up along the way from someone. Anyway here is the code. { Search Tag: WA-Fractals } { Reference: Bill Williams, PhD, "New Trading Dimensions" (John Wiley & Sons, Inc., 1998) } { This study works in Charting only. High and Low fractals are identified per Chapter 4 (see reference above). A minimum of 5 bars are required to identify the pattern. For a High fractal, the fractal bar must have 2 bars on the right and 2 bars on the left that have lower Highs. For the bars to the left, a bar that has the same High cannot be counted as one of the 2 'lower' bars. For the bars to the right of the fractal bar, you can't have a bar with a High that equals the high of the fractal bar, which invalidates the pattern. This can be seen in the examples found in Figure 4-4 (see reference above). Low fractals are similar, but use Low prices. } using elsystem; using elsystem.collections; inputs: int HighStrength( 2 )[DisplayName = "HighStrength", ToolTip = "Enter the number of bars required to identify a fractal high."], int LowStrength( 2 )[DisplayName = "LowStrength", ToolTip = "Enter the number of bars required to identify a fractal low."], int ShowFractalHighs( 1 ) [DisplayName = "ShowFractalHighs", ToolTip = "Enter 1 to mark the fractal highs. Enter any other value to prevent marking of the fractal highs."], int FractalHighOffsetTicks( 1 ) [DisplayName = "FractalHighOffsetTicks", ToolTip = "Set to the number of ticks that the marker will be offset above the fractal high price."], int ShowFractalLows( 1 ) [DisplayName = "ShowFractalLows", ToolTip = "Enter 1 to mark the fractal lows. Enter any other value to prevent marking of the fractal lows."], int FractalLowOffsetTicks( 1 ) [DisplayName = "FractalLowOffsetTicks", ToolTip = "Set to the number of ticks that the marker will be offset below the fractal low price."]; variables: Vector VectorOfHighs( NULL ), Vector VectorOfLows( NULL ), intrabarpersist int MinHighBarsNeeded( 0 ), intrabarpersist int MinLowBarsNeeded( 0 ), intrabarpersist double LastFractalHighPrice( -1 ), intrabarpersist double LastFractalLowPrice( -1 ), intrabarpersist int NumberOfDecimals( 2 ), bool FractHighFound( false ), bool FractLowFound( false ), intrabarpersist double HighOffset( 0 ), intrabarpersist double LowOffset( 0 ); { search for Fractal 'high' pattern } method bool FractalHighFound() variables: int Counter, bool HighFound, bool OkToContinue, double RefHigh, int NumLowerHighsFound; begin HighFound = false; { initialize } OkToContinue = true; { initialize } if VectorOfHighs.Count >= MinHighBarsNeeded then { ensure bars are available } begin RefHigh = VectorOfHighs[HighStrength] astype double; { the High of 'Strength' bars ago must be higher than the current bar and all of the other subsequent bars after 'Strength' bars ago } for Counter = 0 to HighStrength - 1 begin if VectorOfHighs[Counter] astype double >= RefHigh then begin OkToContinue = false; break; end; end; { check the bars to the left of the reference bar for 'Strength' lower highs than the RefHigh (without exceeding the RefHigh) } if OkToContinue then { first condition was met } begin for Counter = HighStrength + 1 to VectorOfHighs.Count - 1 begin if VectorOfHighs[Counter] astype double < RefHigh then begin NumLowerHighsFound += 1; if NumLowerHighsFound = HighStrength then begin HighFound = true; LastFractalHighPrice = RefHigh; break; end; end else if VectorOfHighs[Counter] astype double > RefHigh then begin break; end; end; end; end; return HighFound; end; { search for Fractal 'low' pattern } method bool FractalLowFound() variables: int Counter, bool LowFound, bool OkToContinue, double RefLow, int NumHigherLowsFound; begin LowFound = false; { initialize } OkToContinue = true; { initialize } if VectorOfLows.Count >= MinLowBarsNeeded then { ensure bars are available } begin RefLow = VectorOfLows[LowStrength] astype double; { the Low of 'Strength' bars ago must be lower than the current bar and all of the other subsequent bars after 'Strength' bars ago } for Counter = 0 to LowStrength - 1 begin if VectorOfLows[Counter] astype double <= RefLow then begin OkToContinue = false; break; end; end; { check the bars to the left of the reference bar for 'Strength' higher lows than the RefLow (without exceeding the RefLow } if OkToContinue then { first condition was met } begin for Counter = LowStrength + 1 to VectorOfLows.Count - 1 begin if VectorOfLows[Counter] astype double > RefLow then begin NumHigherLowsFound += 1; if NumHigherLowsFound = LowStrength then begin LowFound = true; LastFractalLowPrice = RefLow; break; end; end else if VectorOfLows[Counter] astype double < RefLow then begin break; end; end; end; end; return LowFound; end; { initialization and error checking of input values } once begin if ShowFractalHighs <> 1 and ShowFractalLows <> 1 then begin throw Exception.Create( !( "Both fractal highs and fractal lows are set to not show." ) ); end; if HighStrength < 2 then throw Exception.Create( !( "HighStrength input must be at least 2." ) ); if LowStrength < 2 then throw Exception.Create( !( "LowStrength input must be at least 2." ) ); HighOffset = FractalHighOffsetTicks * MinMove / PriceScale; LowOffset = FractalLowOffsetTicks * MinMove / PriceScale; MinHighBarsNeeded = HighStrength * 2 + 1; MinLowBarsNeeded = LowStrength * 2 + 1; NumberOfDecimals = NumDecimals( PriceScale ); VectorOfHighs = new Vector(); VectorOfLows = new Vector(); end; { the confirmation and marking of a fractal/pivot can only be determined at the close of the bar; note that the "DataNum" property of the AnalysisTechnique class starts at zero for Data1 so it must be incremented by 1 to correspond to the data stream to be used with BarStatus} if BarStatus( DataNum + 1 ) = 2 then begin {on each bar load the bar High and Low into respective vector; Vectors are used so that the pattern recognition code can 'loop back' through prices (in the Vectors) without affecting MaxBarsBack} VectorOfHighs.Insert( 0, High astype double ); VectorOfLows.Insert( 0, Low astype double ); FractHighFound = FractalHighFound(); FractLowFound = FractalLowFound(); if FractHighFound and ShowFractalHighs = 1 then Plot1[HighStrength]( High[HighStrength] + HighOffset, !( "FractHigh" ) ); if FractLowFound and ShowFractalLows = 1 then Plot2[LowStrength]( Low[LowStrength] - LowOffset, !( "FractLow" ) ); { alerts } if AlertEnabled then begin if FractHighFound then Alert( !( "Fractal high found at: " ) + NumToStr( LastFractalHighPrice, NumberOfDecimals ) ); if FractLowFound then Alert( !( "Fractal low found at: " ) + NumToStr( LastFractalLowPrice, NumberOfDecimals ) ); end; end; { ** Copyright © TradeStation Technologies, Inc. All Rights Reserved ** ** TradeStation reserves the right to modify or overwrite this analysis technique with each release. ** } The following 2 users say Thank You to dlaz758 for this post:

 August 21st, 2019, 10:21 PM #6 (permalink) Boca Raton, FL     Posts: 47 since Nov 2018 Thanks: 15 given, 31 received Just thought I'd mention for those who are not aware that fractals, what some call hi/lo pivots or swing pivots, TD Points etc, need a certain number of bars (5 in this case) to print before a fractal can be determined to have taken place. In the past. In other words not confirmed until after the fact/lagging current price action. They still have value as long as this is characteristic is plainly understood from the start. The following user says Thank You to SunTrader for this post:

 futures io > Williams Fractals for TradeStation Upcoming Webinars and Events (4:30PM ET unless noted)

Right now

## \$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now Similar Threads Thread Thread Starter Forum Replies Last Post ecoexplorer TradeStation 15 March 24th, 2020 12:29 PM idude Sierra Chart 3 July 3rd, 2015 04:39 PM Big Mike The Elite Circle 47 March 20th, 2015 02:24 PM tdaman NinjaTrader 15 February 15th, 2014 10:03 PM tdaman NinjaTrader 3 June 9th, 2011 06:59 PM 