Home                           

 Try Investor/RT             

 Investor/RT Tour           

 Getting Started              

 What's New                  

 Testimonials                 

  Q&A - Broken down by Topic . . .      Complete List of Questions - All Topics
     Charts and Technical Indicators      TPO Charts
     RTL: Scans, Signals, and Custom Indicators      Importing and Exporting
     Trading Systems and Backtesting      Schedules
     Quotepages, Portfolios and Custom Columns      Alarms / Alerts
     Data: Historical Data, the Database, and Data Services      User Variables (T# and V#)
     Custom Instruments: Spreads and Pairs      General / Miscellaneous
     Controls, Windows, and the Button Indicator      Autotrading
     Slide Shows      Product Line

 
Q&A Home

Investor/RT Answer
Answers to Common Questions

   

Question

How would I create a signal that found MSH (Market Structure High) and MSL (Market Structure Low)?
   

Answer

The Market Structure High (MSH) is commonly defined as a series of three candles in which the high of the middle candle is higher than the high of the candle to it's left and to it's right, as seen in the image below:

The syntax for the scan or signal which would detect this condition (on the third candle) follows:

HI.1 > HI.2 AND HI.1 > HI

...which basically states that the high of the last candle is higher than the high two candles ago, and the high of the last candle is higher than the high of the current candle.  Sometimes an additional condition is added requiring that the close of the 3rd candle be lower than the open of the 3rd candle.  The following syntax would be used in that case:

HI.1 > HI.2 AND HI.1 > HI AND CL < OP

The formation above would also meet this criteria, as the 3rd candle is a down candle.

A common short "trigger" is used when a 4th candle breaks below the low of the 3rd candle, as can be seen in the figure on the right.  This condition could be detected with the syntax:

HI.2 > HI.3 AND HI.2 > HI.1 AND CL.1 < OP.1 AND LO < LO.1

The MSH is commonly considered to have "failed" if price turns back to the high of the second candle.

Ideally, candles 1 and 2 are also "up" candles in MSH formations, adding these additional conditions gives us:

HI.2 > HI.3 AND HI.2 > HI.1 AND CL.1 < OP.1 AND LO < LO.1 AND CL.3 > OP.3 AND CL.2 > OP.2

This is indeed the case in the series of bars seen in the image above.

 
 The Market Structure Low (MSL) is commonly defined as a series of three candles in which the low of the middle candle (candle 2) is lower than the low of the candle to it's left (candle 1) and to it's right (candle 3), as seen in the image below:

The syntax for the scan or signal which would detect this condition (on the third candle) follows:

LO.1 < LO.2 AND LO.1 < LO

...which basically states that the low of the middle candle is higher than the low two candles ago, and the low of the middle candle is lower than the low of the current candle.  Sometimes an additional condition is added requiring that the close of the 3rd candle be higher than the open of the 3rd candle.  The following syntax would be used in that case:

LO.1 < LO.2 AND LO.1 < LO AND CL > OP

The formation above would also meet this criteria, as the 3rd candle is an up candle.

A common long "trigger" is used when a 4th candle breaks above the high of the 3rd candles, as can be seen in the figure on the right.  This condition could be detected with the syntax:

LO.2 < LO.3 AND LO.2 < LO.1 AND CL.1 > OP.1 AND HI > HI.1

The MSL is commonly considered to have "failed" if price turns back to the low of the second candle.

Ideally, candles 1 and 2 are also "down" candles in MSH formations, adding these additional conditions gives us:

LO.2 < LO.3 AND LO.2 < LO.1 AND CL.1 > OP.1 AND HI > HI.1 AND CL.3 < OP.3 AND CL.2 < OP.2

This is also indeed the case in the series of bars seen in the image to the right.

 

  So the complete syntax that we arrived at for MSH and MSL follow:

MSH
HI.2 > HI.3 AND HI.2 > HI.1 AND CL.1 < OP.1 AND LO < LO.1 AND CL.3 > OP.3 AND CL.2 > OP.2

MSL
LO.2 < LO.3 AND LO.2 < LO.1 AND CL.1 > OP.1 AND HI > HI.1 AND CL.3 < OP.3 AND CL.2 < OP.2

Marking The Apex
Now, if you use this syntax in a signal, and add the signal marker to a chart, the market is going to mark the 4th candle in the structure.  Some many prefer to mark the "apex" of the structure (candle 2).  There are two was this can be accomplished.  The first method uses the following trick.  Let's assume we saved the two signals above with names "MSH" and "MSL".  We would just create two more signals, named "MSH_Shifted" and "MSL_Shifted", with the following syntax:

MSH_Shifted
MA(SIGNAL) = 1

MSL_Shifted
MA(SIGNAL) = 1

Where SIGNAL is setup setup as the signal "MSH" in "MSH_Shifted", and "MSL" in "MSL_Shifted".  MA is setup as seen below:

Notice that the "Shift" checkbox is checked, and it is setup to shift the data 2 bars left (to the apex).  Also make sure that the MA is setup for a Simple 1 period smoothing (no smoothing).

There is an easier way to shift the signals markers.  Directly in the "Signal Marker" indicator preferences, there is a "Shift Markers Left/Right X Bars" options.  You can actually select (click on) any signal marker, and then use the right and left arrows on your keyboard to shift them righ and left.  I mentioned the other method first because many users complain about the line that is drawn that connects the markers back to the bars on which their signal conditions were actually true.  Keep in mind that these markers are "cheating" in that they are looking into the future two bars.

The chart below displays these shifted markers using the first method.  This chart definition for this chart can be download by right-clicking here and choosing "Save Target As".