# adding lowest low to swing parameter formulae query

Folks one of the issues with the swing code is that it can't specifically identify the last swing bottom to determine whether its a lower swing bottom than the previous swing bottom or is a higher swing bottom. So for example, I will use the code that Matt used in his gann swings 2 webinar and I have had no luck in adding a lowest low condition into the script.

So in Matts code he buys when there are two lower swing tops and then the next up swing takes out the swing high of the lowest collection of swings of that condition. The issue is that when it does cross up, it does not care whether it is after a new swing low or in fact a higher swing low. What I am asking is this, is it possible to insert a lowest low script in the swing script, so that when it does buy on the condition of crossing above the lower swing high that the immediate bottom preceeding the swing up through the lower swing high arises out of a lower swing low rather than a higher swing low.

I have attached a chart showing the two different swing bottom outcomes as they relate to the below script. What I am hoping to achieve via using lowest low is so that it only finds the condition of the swing script when it is coming off a lower bottom such as in point B on the attached chart. I have tried and failed so hoping that its possible.

thanks

Matts script

//Gann Swing Trend Up U1
g1 = GANNSWING(SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=True);
e1 = SWINGEND(g1);
c1 = High() CrossesAbove e1[1];
c2 = e1[2] < e1[1];
c3 = (e1[5] > e1[3]) and (e1[3] > e1[1]);
c4 = c1 and c2 and c3;

norepeat(c4)

Hi Tim,

As I understand your requirements, you wish to enter if the High of the Bar following the "Lowest Low" crosses above the High of the Lowest Low bar.

Identifying a Lower Swing Low than previous Swing Low is relatively easy:

// ---------------------

// TRB Lower Gann Swing Low

// Define Gann Swing properties: 2 Bar Swing

GS =GANNSWING(DEFAULT=SwingList, SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=False, USECLUSTERS=False, USEBREAKOUT=False);

// Define Swing ends

SE0 = SWINGEND(GS)[0];

SE1 = SWINGEND(GS)[1];

SE2 = SWINGEND(GS)[2];

// Test that Target Swing end is a Low Swing End

SE0Low =SE0 < SE1;

// Test that SE0 is lower than SE2

SE0Lower = SE0 < SE2;

// Test for Lower Low Signal

SignalLowerLo = SE0Low and SE0Lower;

SignalLowerLo

// ---------------------

You will note that the above Script does NOT identify the Low of the Last Bar on the chart as a Swing Low, even though it is lower than the 2-Day Swing Low preceding it (see the screenshot below). It cannot identify this Bar as a Lower Swing Low because no Swing Up has yet occurred to confirm it as a SwingEnd.

Now, the more difficult part, that is identifying what you consider the "Lowest Swing Low". Is it:

• Simply a Swing Low below the previous Swing Low - as identified by the above Script;
• A 2-Day Swing Low coincident with Weekly (Monthly) Swing Low below the previous Weekly (Monthly) Swing High and/or previous Weekly (Monthly) Swing Low;
• The Lowest 2-Day Swing Low in the past 30/60/90/... Days; or
• Some other criteria?

Once the criteria for "Lowest Swing Low" (let's make it a variable called "LowestSWLow") is determined and the Script code for it developed and included with the above code, the test for the Lower Low Signal would become:

// ---------------------

// Test for Lower Low Signal

SignalLowerLo = SE0Low and SE0Lower and LowestSWLow;

SignalLowerLo

// ---------------------

Now, if you wish to enter immediately after the SignalLowerLo, ie when the High of the SignalLowerLo Bar is crossed above, the following code will do that:

// ---------------------

// UP ENTRY BARS

// Use the following for highlighting the Entry Bar with no gap, allow outside bar

UpBar0 = (HIGH(0) > HIGH(1)) AND (LOW(0) <= HIGH(1) );

EntrySignal = (TIMESINCESIGNAL(SignalLowerLo) =1) AND UpBar0;

EntrySignal

// ---------------------

Which brings us to a final code listing that will identify the Entry Bar that immediately follows the Lower Low Signal (but without it being the, as yet undefined, LowerSwLow):

// ---------------------

// TRB Lower Gann Swing Low & Entry

// Define Gann Swing properties: 2 Bar SwingGS =GANNSWING(DEFAULT=SwingList, SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=False, USECLUSTERS=False, USEBREAKOUT=False);

// Define Swing ends

SE0 = SWINGEND(GS)[0];

SE1 = SWINGEND(GS)[1];

SE2 = SWINGEND(GS)[2];

// Test that Target Swing end is a Low Swing End

SE0Low =SE0 < SE1;

// Test that SE0 is lower than SE2

SE0Lower = SE0 < SE2;

// Test for Lower Swing Low

SignalLowerLo = SE0Low and SE0Lower;

//UP ENTRY BARS

// Use the following for highlighting the Entry Bar with no gap, allow outside bar

UpBar0 = (HIGH(0) > HIGH(1)) AND (LOW(0) <= HIGH(1) );

EntrySignal = (TIMESINCESIGNAL(SignalLowerLo) =1) AND UpBar0;

EntrySignal

// ---------------------

If you apply the first and last scripts to SHOWBARs you will be able to identify the Lower Lows (Fuchsia) and the Entry Bars (Green) that follow them, as can be seen in the following screenshot with a Dotted 2-Day Gann Swing Overlay: You'll note that in the above screen shot there is one Lower Low (Fuchsia) NOT followed by and Entry Signal (Green) - that's because the Bar after the Lower Low signal is an Inside Bar (ie lower High) and only the bar immediately following the Lower Low signal is considered for entry purposes. Hopes this helps in you exploration of Optuma scripting.

Cheers

Trevor

The Auld Tyma at