(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:

We are here to help. Just let us know what you need.

We work extremely hard to keep things positive in our community.

We do not tolerate rude behavior, trolling, or vendors advertising in posts.

We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.

We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple.

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!!

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;

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):

For Highs:

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

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."];

{ 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." ) );

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}

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;

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: