By Samuel K. Tennis aka “Mr. EasyLanguage”
There was a price pattern (pivot formation) made rather famous by Kent Calhoun a decade or two ago called the 5VBTP (Five Vertical Bar Trading Pattern). As he explains, he did not create it, he just named it and defined some rules. Mr. Pat Raffalovich and myself have each worked, jointly and separately, with Mr. Calhoun over the years. For this example of coding a Price Action SetUp and Trigger I am going to borrow just a portion of what I learned from Mr. Calhoun.
The basic pattern we are going to explore consists of a four bar setup and a fifth bar which will either Trigger our entry or cancel the pattern. Hold up your left hand and the four fingers demonstrate the bar pattern. The high of one bar ago is the highest high of the four bars. The fourth bar (the zero or current bar in EasyLanguage) can have a lower low then the previous bar, or be an inside bar, either way.
se_SetUp = High  > High  and // High of one bar ago is greater than the High of the current bar High  > High  and // High of one bar ago is greater than the High of two bars ago High  > High  ; // High of one bar ago is greater than the High of three bars ago
The Trigger Price will be the Lowest Low of the two most recent bars, the setup bar and the pivot bar itself, minus zero or more ticks. A tick on EasyLanguage can be referenced using the KeyWork “Point” or “Points” but you will see that I have a “skt_OneTick” User Function which I use primarily to remove the micro pip when on a ForEx chart, so that need not distract you any further at this time.
if se_SetUp then se_Price = se_Trigger - se_Points ; // Order price is x-ticks below the Lowest Low of the two most recent setup bars
Now, once we have a SetUp we wait for price action to confirm or cancel it. A single tick higher than our pivot high patter and we are off to the races again, looking for a new pattern to form.
The code I am providing is only a portion, as I mentioned, of the whole methodology but this is enough to give us something to work with. The first study, a “proof of concept” is named “Ask Mr. EZL, Price Action #1”. On my workspace I applied the study to both Data1 (Daily) and Data2 (Weekly), as a test, and if you try this you will discover that TradeStation has an error in it’s display when you offset Data2 back a bar as I do to mark the SetUp Bar to mark the Pivot Bar. It Paints one daily bar ago, instead of one weekly bar ago. Oops! So I just hide Data2 usually.
In the study I am painting the SetUp Bar (Plot 1 & 2), there are Color Inputs provided, marking the entry price with a small cross (Plots 3 & 4)and plotting a large point (dot) when a fill occurs (Plots 5 & 6). That just happened to tbe the order I applied the plots as I developed and tested the code.
Once I had everything debugged and validated for accuracy I saved the Study as “Ask Mr. EZL, Price Action #2”, created two User Functions and removed all the now unnecessary declarations and code. The reason for the User Function is two fold. First, by putting all the logic possible in the function(s) I only have one place to make adjustments instead of having to change the Study and the Strategy. The second, and most important reason for this example, is so I can say
le_SetUp_d2 = MrEZL_PriceAction_LE (le_Ticks, le_Price_d2, ShowCmtry) of Data2 ;
and by adding just those few extra characters get a second time frame for analysis! We really do not care much, at this time, about the Price value for Data2, just about the SetUp, though the price will tell us if it is cancelled, but our Data1 / Daily should be cancelled LONG before the Data2 / Weekly can!
This is not intended to be a profitable strategy but a demonstration of SetUp and Trigger using Price Action. I write EasyLanguage code while Murray develops profitable trading systems!
To begin exploring this powerful concept, please request this free code using the form to the right.