Indicator Manual
Indicator Manual
Sunny J. Harris’
Indicators, Functions & Strategies
Last Update: 20230101
This manual is a continual work in progress. It is by no means finished. If you come across something
you need to know which is missing from the document, call me and I’ll get to that part right away.
-Sunny
Introduction
Quick Reference to Sunny Harris Indicators, Functions and Studies.
Sunny Harris (me) has been trading since 1981. It’s my job. It’s what I do. In addition, I write books about
trading (not a very lucrative endeavor, but a labor of love.) And, I do private consulting with new traders
who want to learn the business, and seasoned traders who want to get better. And I program
EasyLanguage and PowerLanguage.
Note that there are many hyperlinks in this document. You can hover over the hyperlinks (usually blue
words) and then by clicking on the link you jump to that page.
For more comprehensive understanding of Sunny’s technology and philosophy, we have a consulting
program available in person, by phone or via the Internet. (http:/www.moneymentor.com) Please call
me at (760) 908-3070 or on Skype at sunnyjharris for further information. Or, of course, you can reach
me at sunny@moneymentor.com. Reading my fourth book, “Getting Started in Trading,” followed by
my second book, “Trading 102—Getting Down to Business,” (in that order) will help you to understand
my philosophy and the thinking behind many of these indicators. Reading my 6th book, “TradeStation
Made Easy!” will teach you even more, including how to program your own indicators and strategies.
The indicators and strategies in this book are the same ones (exactly) that I use in my own daily trading.
I use them all, but not all on one chart. I have several screens and many charts on each. When you
purchase my products, I teach you to use them just like I do. I help you install them, and I send you
updates at no charge, forever.
All indicators, functions, showme’s, paintbars signals and strategies are offered strictly for educational
purposes only. They are available by one-time license only. They are not for sale. You are only charged
the one-time fee, no recurring charges. No fitness for purpose is implied, implicitly or explicitly. By using
these studies, you are indicating your agreement to the license agreement set forth in the appendix of
this document and/or in the Readme.txt file on the diskette or CD that contains the studies) you have
licensed. Please carefully read the Disclaimer that follows.
Consulting/Mentoring time cannot be returned or refunded. Once I have taught you something, I
cannot take it back. You can’t unlearn something. Also, software is not returnable. Once I send it to you
by email it is in your possession and I can never get it back. Please do not ask for a refund.
You cannot expect my indicators to “work” right out of the box, until and unless you tailor them to suit
your situation. Don’t worry though, I will assist you in this process.
Before you begin to install the software, you will need to download it from the email I will send you.
After it is downloaded to your computer, you must undertake to install the software.
In the email I also give you your j_Key password, which is unique to you. It is generally the first input
value in any of my indicators.
Next, you need to adjust the software to the rhythm of the market. You do that by testing different
time-frames. As I say in my talks, the S&P generally trades on a 15-minute chart while the bonds trade
on a 45-minute chart, stocks trade on daily charts. You must find the natural rhythm of your trading
instrument.
Clearly, when you find that my indicator shows you the correct buys and sells (the ones you expect),
you will have identified the rhythm of the market in question.
Then, after finding the correct time-frame, you will need to optimize the stops and profit protection to
maximize your returns. You will do this with the “sjh_ExitStrategies” strategy, or by setting your exits
by hand. If you have licensed my “sjh_ExitStrategies”, then run a full optimization, with all the
parameters maximized to find the best range of situations.
If you like any of them, I can always give you a FREE 7-day trial, which comes with a FREE 20-minute
consult to help you install them, get them on your chart, and show you exactly how I use them in my
own trading.
Ultimate-F Compounding
Spreadsheet
............................................................ $2,995.00
Dynamic Moving Average Crossover
Marker
Pennant Finder
............................................................... $695.00
SunnyBands
PBTouching SunnyBands
............................................................... $695.00
SunnyBars
RedLiteGreenLite
CPC Index
sjh_SmoothRSI
What’s Available?
This is the list of indicators, showmes, paintbars and functions available through Sunny’s website:
www.moneymentor.com. At this time, all of these indicators are for TradeStation or MultiCharts only.
I am developing indicators for Genesis Navigator, Ninja Trader and MetaStock, but they are not
available yet. Keep coming back; I’ll get there one of these days.
To view pictures of each of these indicators, click on the hyperlinked name of the indicator below.
For pictures of each of these indicators, read on. Each indicator has its own section, which explains the
inputs and shows a chart with the indicator on it.
CHAPTER 2: Sunny Harris’ Dynamic Average
There are other indicators by other vendors, that call themselves Dynamic or Adaptive. Marc Jurik has
one; Perry Kaufman has one. And there is one in TradeStation’s standard list of indicators. But none of
them works like mine. I invite you to try them all and compare. You will soon see by the evidence, that
mine has some sophisticated mathematics in the algorithm that allows it to move out of the way of
most whipsaw activity. And it’s the whipsaw that eats up all of most traders’ profits.
INPUTS:
j_Key(0), //your passkey value
j_Vendor(“TS”) //TradeStation (“TS”) or MultiCharts (“MC”)
j_Price1(C), //OHLC for fast avg
j_Price2(C), //OHLC for slow avg
j_L1(8), //length of fast mav
j_L2(13), //length of slow mav
j_T1(0.25), //scaling factor for fast DMA
j_T2(0.25), //scaling factor for slow DMA
j_ATR_Len(14) //Average True Range Length
j_Precision(2) //Number of Decimal Points to use in calculations
j_Color1(14), //color of 1st plot line
j_Color2(12), //color of 2nd plot line
j_Thick1(3), //thickness of fast plot line
j_Thick2(3) //thickness of slow plot line
;
Explanation of Inputs:
j_Key a password value given to you on trial or purchase of the indicator
j_Price1 Use O, H, L, or C for Open, High, Low or Close. You can use any of these price values
to calculate the fast line of the Dynamic Moving Average.
j_Price2 Use O, H, L, or C for Open, High, Low or Close. You can use any of these price values
to calculate the slow line of the Dynamic Moving Average.
j_T1 Scaling factor for the fast moving average (Optimize values from 0.1 to 0.4)
j_T2 Scaling factor for the slow moving average (Optimize values from 0.1 to 0.4)
j_Color1 Color value for the fast moving average (See Appendix A)
j_Color2 Color value for the slow moving average (See Appendix A)
j_Thick1 Thickness of the fast moving average line (0-6, see Appendix A)
j_Thick2 Thickness of the slow moving average line (0-6, see Appendix A;
When it comes to the Strategy form of this indicator, not all values for the inputs are optimizable. For
instance, you wouldn’t want to optimize the thickness of the lines or the color values. It wouldn’t make
sense. For more information on the Strategy format, see Chapter 3.
Select the DynamicMovingAverage from the list of available indicators. See Figure 2.2.
Next you need to set the Input Values to the proper values. See Figure 2.3.
The values I use most of the time are shown in Figure 2.3. Set them accordingly the first time. You can
venture out from there depending on your choice of symbol and time period.
Figure 2.3—DynamicMovingAverage Input Values
On the E-Mini S&P, daily bars, here’s what the indicator should look like. (Figure 2.4)
Figure 2.4—DynamicMovingAverage on a chart
Notice the sophistocation of the mathematics in this indicator! It beautifully stays away from most of
the choppiness in the market. When the market is in whipsaw mode, generally the indicator refuses to
cross back and forth, as most indicators do.
For comparison, let’s take a look at TradeStation’s built-in Adaptive Moving Average. In Figure 2.5 it is
shown with the same 8 and 13 input values as my DMA.
Furthermore, if you put my PHW yellow dots on the charts to mark the ideal buys and sells, you’ll see
that TradeStation’s AMA misses most of the ideal turning points. We’ll leave PHW dots for a later
chapter.
Notice in Figure 2.6 that the Jurik moving average follows price very closely. This one results in many
more crossovers and whipsaw. The blue and read averages on Figure 2.6 are Exponential MAV and
Simple MAV respectively.
Figure 2.7—Kaufman’s Adaptive Moving Average
Compare the moving average in Figure 2.7 to my moving average in Figure 2.4. They are not the same.
In fact, to see an enlarged area comparing the two moving averages, take a look at Figure 2.8.
Notice that Kaufman’s average still has more whipsaw than mine does.
Now on to the Strategy manifestation of this moving average. After examining the Strategy of this
format, we will go on to my DMA Histogram and SunnyBands, which are still more forms of my DMA.
That’s why I eventually invented my SunnyBands indicator. With SunnyBands I can trade the channels
easily, though still using the DMA for overall direction.
CHAPTER 2a: Dynamic Average for RadarScreen
RadarScreen is a different animal from Charting. A chart is obvious: it’s a picture, usually with lines,
showing price and indicators. RadarScreen, however, is like a spreadsheet. It is a collection of rows and
columns showing numbers instead of lines. It is a matrix, not a picture.
INPUTS:
j_Key(0 {CHG THIS}),
j_Indic(""),
j_Price1(C),
j_Price2(C), //OHLC
j_L1(8), //fastma
j_L2(13), //slowma
j_T1(0.25),
j_T2(0.25), //factor
j_Color1(14), //color of 1st plot line
j_Color2(12), //color of 2nd plot line
j_Thick1(3),
j_Thick2(3), //thickness of plot line
j_LRLength(3) //Length of Bars to Calculate LinearRegression Line
;
Explanation of Inputs:
j_Key a password value given to you on trial or purchase of the indicator
j_Price1 Use O, H, L, or C for Open, High, Low or Close. You can use any of these price
values to calculate the fast line of the Dynamic Moving Average.
j_Price2 Use O, H, L, or C for Open, High, Low or Close. You can use any of these price
values to calculate the slow line of the Dynamic Moving Average.
j_T1 Scaling factor for the fast moving average (Optimize values from 0.1 to 0.4)
j_T2 Scaling factor for the slow moving average (Optimize values from 0.1 to 0.4)
j_Color1 Color value for the fast moving average (See Appendix A)
j_Color2 Color value for the slow moving average (See Appendix A)
j_Thick1 Thickness of the fast moving average line (0-6, see Appendix A)
j_Thick2 Thickness of the slow moving average line (0-6, see Appendix A;
While my DMA for charting draws lines, the RadarScreen version writes numbers in rows and columns
and it colors the cells to give you rapid access to all the information.
When the fastDMA is on top, the sjh_DMA1 cell is colored gold (DarkBrown); while the slowDMA is on
top, the sjh_DMA2 cell is colored purple (DarkMagenta).
Notice in the figure above that in the first row the sjh_DMA2 cell is colored purple. You can tell at a
glance that the 1-minute eMini is short while the other time frames are each long (with the gold colored
cells under sjh_DMA1).
There is more information in the RadarScreen as well. The Diff column tells the difference between the
purple line and the gold line. If the number is positive the cell is colored green; if the number is negative,
the cell is colored red. Again, at a glance information.
The Angle column tells you the angle of the LinearRegression line of the last “n” bars, where n is
specified with the j_LRLength input parameter. I use this to tell me at a glance whether the DMA is
travelling sideways (flat) or is directional. Again, green cells show a positive angle while red cells show
a negative angle. Further, if the cell is gold, that means the angle is essentially flat.
I also use this RadarScreen to tell me quickly when all timeframes are pointing in the same direction. In
Figure 2A.1 the 5-min, 15-min, 30-min and daily are all in a long configuration, while only the 1-min is
saying short. This usually portends a strong move in the direction of the DMA, in this case long.
With all this information, it’s pretty easy to tell that with DMA1 on top (gold) and Angle in a green cell,
that it’s time to take long trades.
CHAPTER 3: DynamicMovingAverage Strategies
The simplest version of the strategy is simply to use the SDMA Indicator crossovers as signals to buy or
sell. In this form it is very simple to use. All you need to do is tailor the lengths and scaling factors to
produce the results you are looking for. You do this through optimizations.
I have found that the markets change over time. The market does not behave now as it did 10 years
ago. To this end, I re-run optimizations on a regular basis to “tune up” the parameters. There is no fixed
schedule on which to do this, but I would suggest running optimizations fairly often if you are using
short timeframe bars. For instance, if you use weekly bars, you probably should optimize every few
months or so, while if you are using 1-minute bars you should optimize as often as weekly.
Hint: you can’t make more profit than the ideal for any particular symbol. It is a good idea to use my
PHW Indicator to learn what the ideal profit is before embarking on optimizing the strategy.
There are several versions of the SDMA strategy with differing inputs. I have created conditions in some
of them that allow trades only to happen if price moves beyond the signal bar plus/minus a specified
amount and others that only take trades if the angle of movement is beyond a specified value. These
versions have name changes and version variations to signify which they are.
A Strategy is simply rules to buy and sell, based on underlying indicator(s). A Strategy can be based on
one or several or many indicators and other conditions.
In the case of my DynamicMovingAverage Strategy (SDMA), it is built simply on buying the upward
crossover of the fast and slow lines, and selling the downward crossover.
Many strategies can be added together to form a more complex strategy. For instance, I immediately
recommend adding my ExitStrategies to the DynamicMovingAverage (SDMA). And, if you want to trade
like I do, consider using the DMA and my SunnyBands together. I can teach you that.
You must now setup the initial input parameters for the strategy. It makes good sense to set the inputs
for the strategy to the same values as you used for the indicator. That way you can see visually where
the crossover points are.
Input Values
The values I start with are:
INPUTS:
j_Key(31), // a password value given to you on trial or license
j_P1(4), // 1=open, 2=high, 3=low, 4=close for fast moving average
j_P2(4), // 1=open, 2=high, 3=low, 4=close for slow moving average
j_L1(8), // length of fast moving average
j_L2(13), // length of slow moving average
j_T1(0.25), // scaling factor for fast mav
j_T2(0.25); // scaling factor for fast mav
j_Precision(2), // Number of decimals of precision for calculations
j_Indic(“00”), // Password Key given by Sunny
j_Epsilon(0.01), // epsilon amount to add for stop entry
j_NbrBars(4) // number of bars to look back for Highest or Lowest
Since you can’t plot a chart from within a strategy, there are no inputs for color or thickness.
Other than that, the inputs have the same meaning as in the indicator back in Chapter 2.
At this point, you will want to optimize ‘til your heart’s content. Remember to use my theory of how to
optimize without over-optimizing, finding alligators and islands for the clustering effects of good
optimization. If you didn’t attend one of my talks on this subject, the read my article at
www.moneymentor.com under the Articles link. It’s currently the second article in the list. It is entitled
“The Clustering Effects of Good Optimization.” Several years ago it appeared in one of the international
trading magazines. It’s about time to publish it again.
On the subject of optimizing this particular strategy, here are some things to consider.
1. It doesn’t make any sense to try to optimize the password value. Leave it the value I gave you.
2. Only the values P1 and P2 make any sense for Open, High, Low and Close. Don’t try any decimal
values.
3. For the lengths of the moving averages (L1 and L2), it doesn’t make any sense to use a larger
value for the fast moving average than for the slow moving average. Results would be
backwards. So, always use smaller values for the fast moving average.
4. For the T-factor values (T1 and T2), always use decimal values between 0 and 1. Find the best
fit for your application, but stay in that range. I always use 0.25.
5. When optimizing, remember that the number of tests you will run is equal to the number of
tests for each variable, multiplied times each other. So, if you use 8 choices for Length1 and 8
choices for Length2 you will run 64 tests. If you use 8 choices for Length1 and 8 choices for
Length2 and 8 choices for T1 and 8 choices for T2 it will be ( 8 * 8 * 8 * 8 ) = 4,096 tests. You
can very quickly get up into the millions of tests, which is untenable. If that happens, simply
select the Genetic option, right under the Exhaustive selection under Method.
After selecting the values to optimize, next click the Optimize button. (Figure 3.5) Then the tests will
start running. This is where I always say “let ‘er rip!”
While they are running, don’t edit any of the related functions, indicators or strategies with the
optimization running in the background. If you do, it will stop running the tests.
Figure 3.5: Click the Optimize Button
After you click the Optimize button, this is what I call “let ‘er rip!” While the tests are running, go do
something else. Leave the computer alone to do its work.
Figure 3.6: View Strategy Optimization Report
Also, as soon as the optimization finishes, before you do anything else, go to View Strategy
Optimization Report, (Figure 3.6), and save the report. Otherwise, it will disappear and all the time you
waited and all the work you did will be gone. It disappears very quickly, so do this step first thing.
To interpret and analyze your results refer to my article “The Clustering Effects of Good Optimization.”
The next figure shows the DMA Strategy on a chart, with its associated indicator. Notice that a Strategy
shows buys and sells, while an indicator does not. You cannot optimize an indicator; optimization only
makes sense on a strategy.
The next figure shows the Strategy Performance Report that is associated with the strategy on Figure
3.7. It is very long, so I’ve only presented part of it here.
Note that I have not optimized the inputs for this example. I have simply used the same values I have
been using with this strategy since 1991. You can work with it and optimize it and come up with your
own results.
Figure 3.8: Strategy Performance Report
Here are the inputs for version 11.02, also referred to as DMABufferAngle :
INPUTS:
j_Key(2047), // your password key
j_P1(4), {OHLC = 1234} // 1=open, 2=high, 3=low, 4=close for fast
moving average
j_P2(4), {OHLC = 1234} // 1=open, 2=high, 3=low, 4=close for fast
moving average
L1(8), // length of fast moving average
L2(13), // length of slow moving average
j_T1(0.25), // scaling factor for fast mav
j_T2(0.25), // scaling factor for fast mav
j_Precision(2), // Number of decimals of precision for
calculations
j_AngLen(10), // Nbr of bars for Angle Line
j_AngleAbove(2), // Angle must be more than this to take trade
j_BufferAbove(4), //only trade if crossover is > this buffer above
j_BufferBelow(4) //only trade if crossover is > this buffer below
;
These values are essentially the same as the previously listed inputs with the exception of the last 4
input values. These new input values are to allow you to force the market to move in your direction
before you take the trade. This can be very valuable in choppy markets, where you might just want to
stay in the same position you were originally in until the market actually starts to trend.
The values j_AngLen and j_AngleAbove are specific to the Angle drawn on the last n number of bars on
the chart. The values j_BufferAbove and j_BufferBelow are specific to forcing a buffer around price that
must be exceeded before taking the trade.
j_AngLen is the number of bars on which to calculate the angle of the line. j_AngleAbove is the number
of the angle which must be exceeded before taking the trade. For instance, if you want to use the last
10 bars to draw a line, and you want it to slope more than 2 degrees before you consider the trade,
then you would specify j_AngLen = 10 and j_AngleAbove = 2.
j_BufferAbove is the size of the buffer, in percent, which must be exceeded on an upward move before
allowing the move. Correspondingly, j_BufferBelow is the percentage size of the downward move
which must be exceeded before allowing the trade.
I like to see things at a glance, so I wanted to quickly visualize how the Histogram of the 1-minute chart
compares to the Histogram of the 5-minute chart. Are they in agreement, or are they in divergence?
So, now if the input value is 1, that tells me that both symbols are on the chart and to plot two
histograms.
You can have them on two subgraphs or overlaid on one subgraph just by clicking and dragging the
indicator.
Plotted below in Figure 3.9 is a chart of the two ES symbols with the Histograms in two subgraphs.
Notice that for the top subgraph I have used magenta and darkcyan for the indicator’s colors, while on
the bottom subgraph I am using red and darkgreen. That way, when I overlay them (in the next figure)
I can quickly tell them apart. So, now let’s look at a chart where they are overlaid. See Figure 3.10 below.
Figure 3.10 Double Histogram in One Subgraph
This is a handy new embellishment for me. It shows me when both the 1-minute and 5-minute (or any
timeframes of your choosing) are in agreement.
Keep in mind that selecting 0 (zero) for this input tells me that there is no second datastream and turns
off the feature.
CHAPTER 4: Dynamic Moving Average Histogram
Once upon a time, a student of mine asked me to make my DynamicMovingAverage easier to read. He
said that he couldn’t see the crossovers. So, I programmed the histogram version of the indicator so
that he could readily see where the DMA crossed over zero line. To make it even more obvious, I turned
the portion of the line that was greater than zero to green, and the portion below zero to red. That way,
he could easily read the crossovers.
It turns out that the Histogram is actually more useful that just reading crossovers. If you will look closely
at the indicator in Figure 4.1 and ask yourself my favorite question (“What is true?”), you will find that
there are other things to read in this indicator.
In this figure (4.1) I have left the DynamicMovingAverage on the chart so you can compare it to the
Histogram version. It is much simpler to read red and green.
Additionally, I provided inputs with which you can add any of the available averages to the
DMAHistogram. There are times you might wish to adjust your trading to not only the crossovers of the
DMA, but to the DMAHistogram’s crossover of its own moving average. So, by adjusting the values of
the j_WhichAverage input from 1 to 6, you can choose different moving averages as follows:
j_Which =
1 Harmonic Mean
2 Simple Moving Average
3 Exponential Moving Average
4 Weighted Moving Average
5 Sunny's Dynamic Moving Average
6 sjh_Solar09 Proprietary Average
7 MACD
The j_Avg value has two purposes. If you set it to 0, then the average is not plotted. If you set it to any
other positive number, that number is used as the length of the moving average.
If this isn’t enough, you can add a horizontal line at the zero value, so you can’t possibly miss the
crossover. It looks like Figure 4.3 with the zero horizontal line.
Figure 4.5: DMA Histogram with turning points marked by Vertical Lines
Example Uses:
I like to see things at a glance, so I wanted to quickly visualize how the Histogram of the 1-minute chart
compares to the Histogram of the 5-minute chart. Are they in agreement, or are they in divergence?
So, now if the input value is 1, that tells me that both symbols are on the chart and to plot two
histograms.
You can have them on two subgraphs or overlaid on one subgraph just by clicking and dragging the
indicator.
Plotted below in Figure 4.6 is a chart of the two ES symbols with the Histograms in two subgraphs.
Figure 4.6: Double Histogram in Two Subgraphs
Notice that for the top subgraph I have used magenta and darkcyan for the indicator’s colors, while on
the bottom subgraph I am using red and darkgreen. That way, when I overlay them (in the next figure)
I can quickly tell them apart. So, now let’s look at a chart where they are overlaid. See Figure 4.7 below.
Keep in mind that selecting 0 (zero) for this input tells me that there is no second datastream and turns
off the feature.
CHAPTER 4A: Dynamic Moving Average for
RadarScreen
Another client asked me to make the output of the histogram available in RadarScreen, which would
permit sorting and ordering stocks to find the best trading opportunities. What a great idea! So, here’s
what the indicator looks like on RadarScreen.
This one bears some explanation. You are already accustomed to looking at the Gold and Purple lines
of the DMA, which are displayed numerically in the first two columns of the “sjh_R_DMA_21.04.03”
indicator above. The next two columns of this indicator
xxxxxxxxxxxxxxxxxxxxxxxxxxx
CHAPTER 5A: DynamicMovingAverage Function
This function is able to be used to create your own indicators and strategies based on the math in my
DynamicMovingAverage.
;
CHAPTER 5: SunnyBands Indicator
The SunnyBands Indicator is another off shoot of my DynamicMovingAverage (DMA) indicator. This
one was designed to allow me to investigate the Excursions from the DMA, both favorable and adverse.
The “bands” are Average True Ranges away from the DMA.
I found by research, testing, and lots of looking at charts, that the best settings for the SunnyBands
bands, is 1.2 ATRs and 2.0 ATRs. You can change the values to anything you find works for you, through
the inputs.
These bands are NOT like Bollinger Bands. In Bollinger Bands, John uses Standard Deviations away
from a moving average. Standard Deviations tell the market where is “should” go; ATRs (which I use)
ask the market where it has been and is going. And the moving average is the one with the most
whipsaw. My DMA is smooth and dances seamlessly with the market.
With my indicator, two things are unique. Primarily, the DMA is unlike anyone else’s moving average.
My DMA calculates its own lengths dynamically within the program. Then, on top of that, the market
moves about as much as it usually moves, which led me to use Average True Range to measure how
much it usually moves.
NOTES
:
1. As of 10/22/2021 I have added features to allow for Commentary and WalkForward features
in SunnyBands. These features allow you to see the information for any bar you click on with
Commentary turned on.
2. As of 7/6/2011 I added code to print some very important values (to my personal trading) on
the right-hand edge of the chart. These new features are shown below in the section called
Addendum.
3. As of 7/15/2011 I added the ability to choose colors for the Bands themselves. I found that I
like to overlay 1-minute bands and 5-minute bands and needed to be able to differentiate
them. So, I’ve added 2 inputs: j_TopColor and j_BotColor. See Figure 5.1.
Figure 5.1—SunnyBands without Commentary turned on
Notice in the Commentary window to the right of the chart that the text changes color depending on
circumstances. For instance, the word Close is darkgreen if the current price is up from the previous
price and red if it is down.
The UIB (Upper Inner Band) is the teal color of the chart band, and likewise for the outer bands which
are darkgreen.
The MidAngle turns color like Close: it’s red if the angle is down and darkgreen if the angle is up.
I love to make things visually pleasing and informative, and this is my latest effort.
In the Figures above, I have set the number of Average True Ranges for the inner bands equal to 1.2.
and the ATRs for the InnerBands to 2.0. That means, roughly, that a point is plotted one point two (1.2)
times the range of the average last n number of bars away from the DMA and 2.0 times the range for
the Outer Bands.
Basically, if the range of the last n (let’s say 9) bars was 5 points, then the band would be plotted 6 points
above and 6 points (1.2 * 5 = 6) below the value of the DynamicMovingAverage for the inner bands.
More specifically, with varying inputs you can plot a different amount of ATRs above the fast-moving
average than the amount of ATRs below the slow-moving average. This makes sense because the
market usually moves downward faster and farther than it moves upward. That’s why I have allowed
for different values for the upper and lower bands.
Figure 5.1 shows SunnyBands on a TradeStation window. Also, Figure 5.4a shows SunnyBands, but with
a black background.
Figure 5.4—SunnyBands on a Black Background
The next figure (Figure 5.5) shows two SunnyBands charts overlaid on one chart. This chart shows 1-
minute bars and 5-minute bars (hidden) so you can see the interplay of the two. Notice that the 5-
minute Bands are colored DarkCyan, and that the 5-minute DMA is Magenta and DarkGreen. Notice
how the inner SunnyBands follow the outer SunnyBands in much the same way that price follows the
single SunnyBands. Again, we watch for values hitting the upper bands and then moving to the opposite
bands.
This indicator essentially has the same inputs as the DynamicMovingAverage, although it does have a
few extras. Next, I’ll show you the inputs.
Input Values for the SunnyBands
(version 7)
INPUTS:
j_Key(1348), //Password Key
Price1(C), //Price for Fast DMA (O, H, L, C)
Price2(C), //Price for Slow DMA (O, H, L, C)
j_L1(8), //Length of Fast DMA
j_L2(13), //Length of Slow DMA
j_T1(0.25), //Smoothing Factor for Slow DMA line
j_T2(0.25), //Smoothing Factor for Slow DMA line
j_Color1(14), //Color of Fast DMA
j_Color2(12), //Color of Slow DMA
j_ATR(14), //Length of Average True Range
j_m1(1.5), //Number of ATRs above
j_m2(1.5), //Number of ATRs below
j_TopThick(3), //Thickness of Upper Band Line
j_TopColor(DarkGray), //Color of Upper Band
j_BotThick(3), //Thickness of Lower Band Line
j_BotColor(DarkGray), //Color of Lower Band
j_DMAFastThick(2), //Thickness of Fast DMA Line
j_DMASlowThick(2), //Thickness of Slow DMA Line
j_Indic("") //Password for SunnyBands Future use
Indicators can’t be optimized, but for finding the best fits with this indicator you should experiment
with different values for j_L1 and j_L2 as well as j_T1 and j_T2. The other important values for
experimenting are j_ATR (try values from 5 to 15), and j_m1 and j_m2. Just look for the best visual fit.
Inputs:
Bool doReport (FALSE),
String File_Path ("C:\OME_Files\"),
String File_Name ("SS_Stats"),
String File_Ext (".csv")
;
I have many students who swear by this indicator. Here are a few examples:
"Nice Bands! This morning I did a couple of quick MES buys and sells. Then I bought into an upward
moving ES [signaled by the DMA_H]. Followed it to the top [SunnyBand]. Closed. Sold short at the top
[SunnyBand.] Followed it to the bottom [SunnyBand]. A $4,000 account (what I had moved to the
Futures account) returned about $2,000. Doesn’t get any better than that!". - Don M.
"I made $5,772 on the first day of my free trial of SunnyBands. It told me exactly where the turns were,
even with the high volatility today. You are one of the very few people that allows test drives. It's
nothing short of amazing!" -Aaron R.
Example Uses:
1. You can use this indicator to show the typical movement of the market. Generally, the
market will stay within 1.5 ATRs of the DMA. When the market is making an out-of-the-
ordinary move it moves beyond the grey lines.
2. You can use this indicator to show crossovers of price with the bands, to find extreme
movements. When price is above the DMA it can be bullish; when price is below the DMA
is can be bearish.
3. You can use this indicator to show when price crosses below the lower band and then
returns back through the lower band, it can be bullish. Likewise, when price crosses above
the upper band and then returns back through the upper band, it can be bearish. I use the
bands in this instance as profit taking stops.
4. As long as price remains in the lower half of the band it can be considered bearish. When
price then crosses over the midline it could be used as a stop. Likewise, as long as price
remains in the upper half of the band it can be considered bullish. When price comes back
down and crosses over the midline it could be used as a stop.
Addendum
The newest feature (as of 7/6/2011) in SunnyBands is a feature to print the values of the bands on the
far right-hand edge of the chart. In order to see these values, you must leave blank space at the end of
the chart. I put 15 extra bars of space on my chart. You do this by going through the Format Window
Space to the Right command sequence.
The chart in Figure 5.75 below is the main configuration I use for my own trading. On this chart you can
see (1) the PaintBar Indicator (DaySessions) that highlights the day session a different color from the
night session, (2) the Pennants showing breakout areas and congestion, (3) the SunnyBands which are
green and cyan, on either side of the SunnyDynamicMovingAverage (SDMA), which is purple and gold.
I also use my indicator DayDividers, which draws the dashed vertical lines that appear at each end of
the chart and my PHW indicator1 which draws yellow circles on the ideal turning points. You can change
the times of their trigger through input values, but I have them set to the open and close of the day
session. It makes it easier for me to read my charts.
1 PHW dots are on the ideal turning points, which can only be determined AFTER THE FACT. One cannot determine whether a turn has happened
until after it actually occurs. Thus, these dots, while a great help to keep you honest about where you should be trading, do not give trading signals
before the turn actually happens.
Figure 5.75—My Default Trading Screen
The newest addition to the SunnyBands is the text written to the right of the data. In order to view this
text you must first allow for Space to the Right. Having done that, you will see either “Gold on Top” or
“Purple on Top” in green or red respectively, to the right of the last closing price. This tells you at a
glance what position the DMA is in. It is especially helpful when the lines are close together. The next
new feature is in three parts: “Top = “, “Diff = “ and “Bot = “. These texts are followed by numbers telling
you the value of the top band, the spread between the two bands, and the value of the bottom band,
all as of the last bar on the chart.
Since price tends to revert to the mean, the “Diff” value is very important to me. It tells me how many
points are possible in a move that goes from the top band back down to the bottom band, or from the
bottom band up to the top band. And, if price is moving strongly, and thus not likely to move beyond
the midline, then half of the Diff is a potential move. Keep this in mind when choosing the timeframe
of your trading chart.
If you think of any features you’d like to see, just email me your suggestions.
NOTE: One thing I have noticed about TradeStation’s calculations, in the course of watching charts form
tick-by-tick: a smoothing such as my DMA is not smooth unless refreshed often.
For instance, the next figure shows the SunnyBands & DMA after the accumulation of many ticks
without refreshing.
Figure 5.8—Without Refreshing
It’s slight, but you can see that in Figure 5.5 the Bands “wiggle” at the right hand edge, but after
refreshing (Figure 5.6) the Bands are again smooth. It is more evident on the lower Band.
How I Trade
with This Indicator
For ideas on how to trade with SunnyBands, please see the next chapter.
Notes from User Sessions
This indicator is the Dynamic Moving Average with bands above and bands below the moving averages,
placed at n Average True Ranges above and below the averages. For the inner band, n = 1.2; for the
outer band, n = 2.0.
These bands are far superior to Bollinger Bands or Keltner Channels, which are calculated on Standard
Deviations and ATRs largely because they are based on my proprietary DMA.
I don't look for these bands to "squeeze." Rather, I look for price to ride the band for a while and then
move away from it.
The top band is calculated from the gold average, while the bottom band is calculated from the purple
average. Next, here's the crowning glory: In my own trading I use a 1-minute chart and a 5-minute chart
overlaid on a single chart. I make it so the 5-minute chart is in a hidden subgraph. Then I put SunnyBands
on Data1 and SunnyBands on Data2, so that I can see the 1-minute SunnyBands forming within the 5-
minute SunnyBands. It's like seeing the interaction of larger and smaller waves. It's a little challenging
to see, but if you look closely you'll see Gray SunnyBands inside of DarkCyan SunnyBands.
The 1-minute DMA is gold and purple, while the 5-minute DMA is green and red. Notice what happens
when the 1-min SunnyBand touches the 5-min SunnyBand! Now, don't get these confused with
Bollinger Bands. Mine use ATR (Average True Range) which tells where the market is actually going, not
Standard Deviation which tells where the market "should" go.
AND mine uses my proprietary DMA (Dynamic Moving Average) which avoids much of the whipsaw--
unlike an Exponential Moving Average, which whips all over the place.
Figure 5.9—SunnyBands
Figure 5.10—Bollinger Bands
Notice in figures 5.9 thru 5.12 how SunnyBands hugs price and the other indicators do not. SunnyBands
gives a clear picture of when to go short and when to go long. The others don’t.
CHAPTER 5A: SunnyBands Strategy Ideas
TRADING IN THE FINANCIAL MARKETS INVOLVES A RISK OF LOSS. THIS DOCUMENTATION AND OTHER CONTENT PRODUCED
BY MONEYMENTOR ARE FOR INFORMATIONAL OR EDUCATIONAL PURPOSES ONLY AND DO NOT CONSTITUTE TRADING OR
INVESTMENT RECOMMENDATIONS OR ADVICE.
The SunnyBands Indicator, as depicted above, can be used as a strategy. However, I have not as yet
been able to code the strategy rules into an automated strategy, but I’m working on it. To use it like I
use it, you have to put on your thinking cap and follow a set of rules. And, you must watch the market
as it ticks and forms bars. There is much to be said for the “intuition” that comes from learning how the
market moves by watching it, especially with the SunnyBands on the chart, over many, many weeks,
months or years. You’ll “see” things after you have spent considerable time with the indicator. My
students are always coming up with new and different observations on how to use SunnyBands.
If you want to play basketball and consistently shoot the ball into the hoop, you must practice. It isn’t
automated, it is learned from a long time of practicing. If you want to be a downhill skier, you have to
practice. You can’t even stand up the first time you get on the skis. It takes time. So, it is with
SunnyBands. I have traded with SunnyBands for 35 years of my 42-year career. It and my
DMA_Histogram are the only things I use to determine when to place trades.
NOTES:
As of 6/20/2012 I have added code to print some very important values (for my personal trading
methods). The inner SunnyBand (1.2 ATRs by default) (default color = dark teal) is called the Inner
SunnyBand. There is now code to delineate this band and give its value, both top and bottom. The outer
SunnyBand is called the Outer SunnyBand (2.0 ATRs by default) and is colored dark green by default.
Its values are also printed on the chart. I use these values as stops and limit entries in my own trading.
To begin with, I trade a chart with 1-minute bars, overlayed with 5-minute bars. I showed you how to
do that in the previous chapter, “Chapter 5, SunnyBands Indicator.” I watch the wave within the wave
of the two SunnyBands indicators. This wave within a wave is a fractal. You might Google “fractal.”
NOTE: TradeStation has a “bug” which does not allow for these overlaid indicators to be scaled properly
when using Chart Dragging. In that case, I use two separate charts, one 1-minute and the other 5-
minutes.
NOTE: If you want to use the overlay of 2 charts, they must both be on the same scale.
First, I put the PaintBar “sjh_PB_DaySession” on my chart. That way I can easily see which session I’m
in. By default, Session 1 (or the day session) bars are colored blue for up bars and red for down bars. In
the after-hours (or night) session, the bars are colored green for up bars and magenta for down bars.
In telling you how I trade in the text that follows, I will refer to up bars as blue/green and down bars as
red/magenta.
Next, I put the “BingTicks” indicator on my chart. BingTicks (see Chapter 18) plays a small sound file
(.wav) with every change in the market. It can be very noisy, but it tells me what the market is doing
and how fast. In the input parameters I specify a high-pitched sound for the UP sound, a low-pitched
sound for the DOWN sound, and for the SIDEWAYS sound I usually choose “Click.wav.” So, I have
binging and bonging going on all day long.
When the sounds come very close together, and are mostly all binging, I know the market is moving
very fast upward. Similarly, when the sounds are predominantly bongs and are coming fast, I know the
market is moving quickly downward. If the sounds are infrequent, I know that there are very few trades
taking place and that the market is therefore thinly traded. I can walk away from my monitor and still
listen to what the market is doing. What it doesn’t tell you is anything about the distance of the moves.
It doesn’t tell you anything about price.
Thirdly, I put my ShowMe indicator “sjh_SM_CurrentPrice” on the chart. This little indicator puts a dot
or a cross at the end of the chart at the current price. It focuses my attention on exactly where the
current price is. If you use the most recent version the dot turns red when price is moving down and
green when price is moving upward. I like to sit and watch the moving dot; it trains my neurology as to
price activity. This is where intuition is born. The dot is shown on the chart in Figure 5A.3; it’s darkred,
indicating that price was moving down.
The fourth thing I do is put SunnyBands on my chart. Actually, I already have 1-minute and 5-minute
bars both on the chart and I want to put on two sets of SunnyBands. I make the first set different colors
from the second set. (For instance, I use teal for the 1-minute band and cyan for the 5-minute band).
Then I click and drag the second SunnyBands (on the 5-minute chart) up to the 1-minute chart and drop
them there.
Next, I hide the 5-minute bars. To do this you go to Format Symbol and choose Data2 (the 5-minute
bars), click on Format and then click on the Scaling tab. (See Figure 5A.1).
Figure 5A.1—Format Data Stream 2
Under that tab you click on the roller beside Sub-graph (where it probably says “1”) and pull down to
“Hidden.” See Figure 5A.2.
Now you should have a chart with 1-minute bars showing, and two sets of SunnyBands (of differing
colors). Mine looks like this: (Figure 5A.3). See below.
NOTE: Creating this chart and following this process is available in a video on YouTube at
www.YouTube.com/. Or you can search for Sunny Harris and/or TradeStation.
Figure 5a.2—Hiding the longer term bars
Figure 5a.3—Double SunnyBands on Gold Futures (1-minute & 5-minute)
Once you have your chart ready, we are ready to talk about my trading rules.
PRIMARY RULES
1. If flat or short, watching red bars go down to lower band. When bars turn green and pierce
lower band and go back upward, I go Long.
2. If Long or Flat, watch green bars go upward until they pierce the Upper Band, turn red and go
back downward., then I go Short.
INTERMEDIATE RULES
1. Channel Trading. If DMA is flat (AbsValue(Angle < 6.0 ), then we will be countertrend trading,
moving from band to midline and back.
2. IF same as rule 1 above, only take profits at midline.
ADVANCED RULES
1. If trading Channel, and you exited at the midline and price exceeds H of exit bar, re-enter Long.
2. If trading Channel, and you exited at the midline and price exceeds L of exit bar, re-enter Short.
{=======================================================================}
{===== RULES & THOUGHTS ON USING SUNNYBANDS ============================}
{=======================================================================}
{
All these rules are "typical" and not hard and fast rules.
INITIAL:
Only one position on at a time. ie Don't buy shares and then buy again
and then sell both positions.
FIRST RULES:
Purple DMA on top means price movement is Bearish. Price is falling and
below the Top SunnyBand.
Gold DMA on top means price movement is Bullish. Price is rising and
above the Bottom SunnyBand (SBand).
SECONDLY:
LONGS:
Watch the mostly Red Candles going down. When they get below the Lower
SBand, watch for them to change to Green and rise above the Lower inner
or outer SBand. When the Green Candle penetrates the Lower Band take a
Long Position.
SHORTS:
Watch the mostly Green Candles going up. When they get up to the Upper
SBand, watch for them to change to Red and fall back below the Upper
SBand. When the Red Candle penetrates the Upper Band, take a Short
Position.
THIRDLY:
a. If you are Short and candles begin rising against your position, wait
for a Green candle to rise above the Upper SBand.
If it penetrates above, abandon your short position and go Long.
b. If you are Long and candles begin falling against your position, wait
for a Red candle to fall below the Lower SBand. If it penetrates below,
abandon your long position and go Short.
FOURTH:
a. If Short and Red Candle touched DMA and next bar is Green Candle,
reverse and go Long
b. As long as candles are below Top Band AND Below DMA, stay Short
c. Stay Short while candles are moving down and touching or below
Bottom Band
d. If Green Candle forms Above Bottom Band go Long
FIFTH:
a. Watch the slope of the DMA Lines.
1. If the lines are "flat" (LinearRegAngle of last 5 bars), then we only
"Expect" price to come up/go down to the DMA, and not all the way back to
the SBand.
===============================}
IMPORTANT NOTES
When you trade, either with real money or in simulation mode, it is a good policy to always use stops.
Stops prevent you from holding bad trades for extended periods (while you are wishing). Stops help
you to get out of losing trades quickly. The market can always “blow through” your stop if the market
is moving quickly (like in the period 8/19/15 through 8/26/15). Nevertheless, it is important to have
them, especially if you are a beginner.
REMEMBER, when using stops, to take them out of the market when you are hit, and when you open
a new trade. If you leave the stop in place and forget about it, you can have the stop hit when you are
not expecting it, at some later time. Let’s say you enter the market at 2100 and put a stop underneath
at 2090. Then, you exit the trade at 2200 for a profit and forget about the stop. Later on, you aren’t
trading at all and the market dips down to 2090 and automatically gets you short. You didn’t mean to
get short, you just forgot about the stop. So, don’t forget them!
Let’s look at a chart to illustrate this concept. Take a peek at Figure 5a.4 below.
If I were to enter the market going long at the green bar which penetrates the Outer Bottom Band at
about 8 bars to the left of the right-hand edge, I would set the stop at the lower SunnyBand, right after
the trade was established. Once the market had passed the DMA, I would raise the stop to the “Midline”
value at the DMA (Dynamic Moving Average). If then the trade continued up above the upper band, I
would move the stop up to the upper band.
INPUTS:
j_Key(3880); //=== Client's j_Key Password
VARIABLES:
oUpperInnerBand( 0 ), //=== Value of Upper Inner SunnyBand returned
oLowerInnerBand( 0 ), //=== Value of Lower Inner SunnyBand returned
oUpperOuterBand( 0 ), //=== Value of Upper Outer SunnyBand returned
oLowerOuterBand( 0 ), //=== Value of Lower Outer SunnyBand returned
oMidline( 0 ), //=== Value of Midline of DMA
oAngle( 0 ), //=== Value of LinearRegressionAngle of DMA
oDMAGold( 0 ), //=== Value of the Gold Dynamic Moving Average
oDMAPurple( 0 ) //=== Value of the Purple Dynamic Moving Average
;
Value1 = sjh_f_SunnyBands14.07.30
( 2047, "TS", C, 8, 13, 0.25, 0.25, 14, 2,
oUpperInnerBand,
oLowerInnerBand,
oUpperOuterBand,
oLowerOuterBand,
oMidline,
oAngle,
oDMAGold,
oDMAPurple
)
;
//=== IF previous bar was above SBand & this bar is below:
If C[1] > oUpperOuterBand AND C[0] < oUpperOuterBand
THEN
Buy 1 contract next bar at market;
It’s only an example, not a real system, but you should get the idea for a jumping off point.
CHAPTER 6: PHW Indicator
I initially created this indicator to show “what is possible.” I knew I couldn’t get more money out of a
chart that was possible, so what is possible? How much is the maximum amount of dollars you can
squeeze out of a particular symbol?
This indicator is called sjh_PHWIndicator$$. (Also has _R to denote RadarScreen version, and numbers
and possibly letters to denote version. i.e. sjh_PHWIndicator$$_11.07a.)
NOTE
S:
1. As of 7/4/2011 I have added two new inputs to the end of the input string. These input
variables are used to position the text written on the LastBarOnChart. These values show you
the Ideal, Buy & Hold and PHW values. Please jump down to the input descriptions to read
about these new values.
2. In order for the indicator to plot values it needs additional bars to be loaded. Read about this
above by clicking here. Otherwise, it won’t plot and you’ll call me to say it is broken.
3. Also, remember that the input value SwingPercent should be set to larger and smaller
fractions, depending on the data compression of the chart. For instance, a daily chart might
need a value of 0.01 for the dots to show up, while a 5-minute chart might use a value like
0.0001. These values are not set in stone; you’ll need to experiment to get the dots to look
right.
Introduction
If the chart only moves in one direction, then buy-and-sell is the best approach. If the chart moves up
and down rhythmically, then it is tradable. And, if it does have a rhythm, how much is the maximum
amount of profit potentially generated by these swings? These ideas lead to my PHW Indicator.
In essence, this indicator finds all the ideal pivots and marks them. Of course, it can’t mark them before
they happen, so that makes it a lagging indicator. I never meant for it to be predictive (there’s no such
thing); I use it for two things: research and confirmation.
When I’m creating an indicator I want to see how closely it matches the yellow PHW dots. When I’m
actually trading it, I want to see how close I come to the yellow PHW dots with my entries. And when
I’m doing research, I use PHW on RadarScreen to find the most tradable symbols.
The PHW Indicator with its yellow dots and calculations is shown in Figure 6.1. Notice that in addition
to plotting yellow dots, the indicator prints out the following calculations:
Along with the PHW indicator, there is another indicator, made exclusively for use with RadarScreen.
The RadarScreen version of the PHW Indicator is called sjh_PHWIndicator$_R. It is shown in Figure 6.2.
The RadarScreen indicator differs from the plotting indicator, in that nothing is plotted. The
RadarScreen indicator simply writes numbers in columns on a RadarScreen page. The
sjh_PHWIndicator$_R writes three columns of numbers that represent the ending Potential Hourly
Wage figure for the symbol in question, plus the Most Recent High and Most Recent Low.
The value of the RadarScreen version of this PHW indicator is often different from the TradeStation
charting value. This is because RadarScreen depends on you to “Load additional data for accumulative
calculations.” The more “bars back” you designate, the more time it takes RadarScreen to calculate.
Make your selections for this setting under Format Indicator. If you do not load additional bars,
RadarScreen calculates only for the LastBar. In Figure 6.2 below, I have loaded 51 bars of additional
data. The PHW calculation is in the second column from the right.
The next figure shows the RadarScreen output for the PHW Indicator. It is named sjh_PHWIndicator_R.
I have sorted this page by the highest PHW first. I find that very valuable in picking which stocks I want
to trade. To me, the most tradable stocks are the ones with the highest PHW, or most opportunity for
trading.
The indicator for charting and the indicator for RadarScreen are sold
separately.
In writing my 6th book, “Grading the Gurus,” I use the PHW Indicator in each and every test. (And I use
FileAppend to print the results of each stock to a file on my C: drive.) Before I can know whether a
system I am testing is any good, I must know what the potential profit for each symbol is. If stock XYZ
can only make $600 in the years under question, then we can’t expect any system designer to do better
than that. Likewise, if the designer only makes $100 with his system, when the PHW is $600, it doesn’t
qualify as a very good system.
Example
Here is a chart of the 15-minute EMini (@ES) showing the PHW dots. I have set the last two inputs to
position the text conveniently on the chart. I found the values that worked best by experimentation. To
get the values below the last prices on this chart I had to set j_Position to (Low-20). To get the text
spread out and not written on top of each other I set j_TextIncrement to 3.
Figure 6.4: PHW on 15-minute chart
Bars Back
To calculate the PHW Indicator, you must tell TradeStation or MultiCharts how many bars to use in the
calculations. If you calculate PHW on 50 5-minute bars you will most certainly get a different result than
if you use 50 daily bars.
And, if you want long-term PHW result on 5-minute bars, you might want to use 1000 bars for your
calculations.
To be precise, you should know how many 5-minute bars are in a trading day, or how many 15-minute
bars are in a trading day, etc. Further, if you are using daily bars on your chart, you need to know how
many trading days are in a month, or in a year.
I don’t worry about it. When I’m using the PHW Indicator on RadarScreen, all I really want to know is
how stock “A” compares to stock “B” or to all other stocks. I’m simply looking for stocks with high PHW
values to indicate that the stock is tradable. I want a stock (or future, or mutual fund) that oscillates. If
it goes only one direction for a long time, then it should be considered for investing; if it goes up and
down again and again, then you can consider trading this instrument for short and long trades.
In the figure above, you can see in the yellow column that I have sorted the data from the highest PHW
to the lowest PHW. That shows me the most tradable stocks.
Figure 6.6—Load Additional Data
Introduction
TradeStation provides several exit settings through EasyLanguage which are activated using the Set
commands. The possibilities include:
• Setbreakeven
• Setdollartrailing
• Setexitonclose
• Setpercentrailing
• Setprofittarget
• Setstopcontract
• Setstoploss
• Setstopposition
• Setstopshare
To make life easier, I coded them all into a single strategy where they can be turned off and on by using
the inputs. As a result, you can optimize this strategy (which is really just a signal component) to find
the most optimal exit strategy. If you were to try this using TradeStation’s Set commands, it would take
you all week to find the best fit, trying one exit at a time.
Input Values
Components
ShareOr
Position
ShareOrPosition = 1
SetStopShare is a reserved word that sets the way built-in stops calculate the exit order prices. Each
built-in stop reserved word has a parameter for the amount of profit or loss desired, SetStopShare is
simply a switch that changes the behavior of the built-in stops so that the exit order is calculated on a
per share/contract basis, otherwise the exit order is calculated on a total position basis.
If SetStopShare, SetStopContract, and SetStopPosiiton are used multiple times, even in different
strategies applied to the same chart, the last reference is controlling.
Example 1
When used with the SetStopLoss built-in exit strategy, SetStopShare sets the exit order based on a per
share/contract basis.
(If you held 1000 shares of the MSFT and set a $0.25 stop loss amount, you would exit $0.25 from your
entry price with a $250 loss. ($0.25 x 1000 shares))
Example 2
When used with a Forex symbol, such as EURUSD, a share refers to a lot (typically consisting of 100,000
units).
This example enters into a position of 1 lot size (100,000 units) and then attempts to exit based on a
stop loss of .001 per unit, which for this Forex symbol would be a stop loss of $100 for the lot (.001 *
100,000 units).
ShareOrPosition = 2
SetStopPosition is a reserved word that sets the way built-in stops calculate the exit order prices. Each
built-in stop command has a parameter for the amount of profit or loss desired, SetStopPosition is
simply a switch that changes the behavior of the built-in stop command so that the exit order is
calculated on a total position basis, verses a per share/ per contract basis, set by the SetStopContract
or SetStopShare switches.
If SetStopShare, SetStopContract, and SetStopPosition are used multiple times, even in different
strategies applied to the same chart, the last reference is controlling.
Example
When used with the SetStopLoss built-in exit strategy, SetStopPosition sets the exit order based on the
whole position number of shares basis.
(if you held 1000 shares of the MSFT and set a $250 stop loss amount, you would exit $0.25 from your
entry price with a $250 loss. ($250 / 1000 shares))
ProfitTarget
Amt
ProfitTargetAmt = 0 means “Off”
ProfitTargetAmt = any positive number is the amount of profit to set as a
target.
Setting the Profit Target is accomplished with the SetProfitTarget reserved word.
SetProfitTarget is a built-in stop reserved word that enables you to specify the amount of profit you are
looking to capture on a total position basis, or a one contract or one share basis. Within a strategy an
order to close your entire position is generated once the profit target amount has been reached.
Whether the profit target amount is based on a position or per share/contract basis is determined by
your setting to the first parameter, ShareOrPosition.
When used with an automated strategy where orders are being generated into the real-world, the
profit exit limit order is immediately sent into the market to be filled. If you lose internet connectivity,
your profit target is still active, but your strategy can longer generate additional orders.
Normally strategies generate orders on the close of the bar for execution on the next bar,
SetProfitTarget allows you to generate orders and exit on the same bar as the bar of entry, this is
especially useful when working with longer duration bars, (e.g. 30-min, 60-min, daily, weekly, monthly).
Examples
When used with the SetStopPosition reserved word, the Amount parameter sets the stop loss as a
dollar amount for the entire position based on the total number of shares or contracts in the current
open position. (if you held 500 shares of MSFT and specified $200 profit amount, you would exit $0.40
from your entry price.)
SetStopPosition;
SetProfitTarget(200);
{SetStopPosition is the default setting and is optional)
When used with the SetStopShare or SetStopContract reserved words, the Amount parameter sets the
profit as a one share or one contract amount. (if you held 500 shares of MSFT and specified $0.60 profit
amount, you would exit .60 from your entry price with a $300 profit.)
SetStopShare;
SetProfitTarget(.60);
(SetStopShare and SetStopContract are synonymous and both work for stock,
futures, options, etc.)
Orders Generated
Limit Order to Sell (Long Exit) or Limit Order to Buy to Cover (Short Exit)
StopLossAm
t
If you set StopLossAmount to 0, this stop will not be used.
The Stop Loss Amount is accomplished with the SetStopLoss reserved word.
SetStopLoss is a built-in stop reserved word that enables you to specify the amount of money you are
willing to risk either on a total position basis, or a one contract or one share basis. Within a strategy an
order to close your entire position is generated once the stop loss amount has been reached. Whether
the stop loss amount is based on a position or per share/contract basis is determined by set stop
reserved words: SetStopPosition, SetStopShare, or SetStopContract
When used with an automated strategy where orders are being generated into the real-world, the stop
exit order is monitored and the order held on your computer, once the Stop Loss amount is reached, a
market order is generated and sent to be executed. If you lose internet connectivity, you no longer
have a working stop.
Normally strategies generate orders on the close of the bar for execution on the next bar, SetStopLoss
allows you to generate orders and exit on the same bar as the bar of entry, this is especially useful when
working with longer duration bars, (e.g. 30-min, 60-min, daily, weekly, monthly).
Examples
When used with the SetStopPosition reserved word, the Amount parameter sets the stop loss as a
dollar amount for the entire position based on the total number of shares or contracts in the current
open position. (if you held 500 shares of MSFT and specified $200 stop loss amount, you would exit
$0.40 from your entry price.)
SetStopPosition;
SetStopLoss(200);
When used with the SetStopShare or SetStopContract reserved words, the Amount parameter sets the
stop loss as a one share or one contract amount. (If you held 500 shares of MSFT and specified $0.60
stop loss amount, you would exit .60 from your entry price with a $300 loss.)
SetStopShare;
SetStopLoss(.60);
(SetStopShare and SetStopContract are synonymous and both work for stock, futures, options, etc.)
Orders Generated
Market Order to Sell (Long Exit) or Market Order to Buy to Cover (Short Exit)
BreakEvenFloorAm
t
If you set BreakEvenFloorAmt to 0, this setting will not be used. If you set it to a positive number, that
amount will be used for the floor amount.
SetBreakEven is a built-in stop reserved word that allows you to exit a position at the breakeven point,
once a specified profit floor has been reached. The profit floor can be specified on a total position basis,
or a one contract or one share basis. Whether the profit target amount is based on a position or per
share/contract basis is determined by set stop reserved words: SetStopPosition, Setstopshare, or
Setstopcontract. SetBreakEven does not factor in commissions or slippage.
Example
s
Exit all shares or contracts in all positions at the breakeven point if the position has been up at least
$25.00 in profit at some point.
SetBreakEven(25);
Exit all shares or contracts in all positions at the breakeven point if the position has been up at least
$0.25 from the entry price.
SetStopShare;
SetBreakEven(.25);
DollarTrailingAmt
If you set DollarTrailingAmt to 0, this feature will not be used. If you set it to a positive number, that
amount will be used as the trailing dollar amount.
SetDollarTrailing is a reserved word is used to set a trailing stop to exit a position based on a specified
dollar Amount that trails the greatest position profit. A stop order is generated at the calculated price
based on the trailing Amount.
SetDollarTrailing
(Amount)
;
Amount is the greatest open position profit that you are willing to give back.
To place a dollar risk trailing stop at $5 below the greatest share price, use:
ShareOrPosition = 1 and
DollarTrailingAmt = 5
As the price rises in a long position, so does the placement of the stop. It is maintained at a stop value
$5 below the greatest share price.
PctTrailingFloorAmt
Setting PctTrailingFloorAmt = 0 or PctTrailingPct =0 causes this feature to be ignored; setting it to a
positive number less than or equal to 100 sets the percent trailing floor amount. Its corresponding
variable is PctTrailingPct, which sets the percent amount of the profit you are willing to lose.
SetPercentTrailing is a built-in stop reserved word is used to specify the amount of the maximum open
position profit you are willing to lose (as a percent) as well as the profit level that must be reached in
order for the stop to take effect. The position or contract/share is closed out when the specified
percentage of the maximum profit is lost.
In order to place a percentage based trailing stop that exits a position once it has returned 15% of the
maximum equity earned after the position has made $500, you would use:
ShareOrPosition = 1 and
PctTrailingFloorAmt = 500 and
PctTrailingPct = 15
PctTrai
lingPct
See above explanation. These two parameters work together.
ExitOnClose
Set this value either to True or False. If False, then this feature is ignored. If True, then the reserved
word SetExitOnClose will be used.
SetExitOnClose is a built-in stop reserved word used to place an order to exit all shares or contracts in
all positions on the close of the last bar of the trading session on an intra-day chart.
For historical simulations, SetExitOnClose generates a market order on the bar close event of the last
intra-day bar for each day in the chart. When used in an automated strategy placing real-world orders,
SetExitOnClose generates a limit order into the post market trading session, (if one exists), otherwise a
market order is generated for the open of the next regular session day.
SetExitOnClose by default uses the closing session time specified by the custom session settings of the
chart.
j_StdDev
j_StdDev set to a number greater than 0, sets the number of standard deviations away to use as a stop.
Typically price doesn’t move more than about 2-3 standard deviations away from its average. Generally
it moves more like 1 or 2 standard deviations.
Thus, when I’m optimizing this parameter, I generally set it to test from 0 to 3 in steps of .05. That makes
for lots of tests, but it will likely find something in that range that fits.
j_NextOpen
This value allows you to exit on the open of the next bar. If you set it to 0, it is ignored; if you set it to 1,
it means true and thus take the exit.
j_TrendChange
This value is set to 0=false; or nbr=# of bars. Exit if the Trend Changes over the next n number of bars.
For instance, set it to 3 to exit if the trend changes over the next 3 bars.
j_LongExitAfterBars
This values is set to 0 for false, or nbr = # of bars. If a positive number, then exit after this number of
bars. For instance, set it to 5 to exit Long trades after 5 bars have passed.
j_ShortExitAfterBars
This values is set to 0 for false, or nbr = # of bars. If a positive number, then exit after this number of
bars. For instance, set it to 5 to exit Short trades after 5 bars have passed.
Example
Here is an example of some settings for the ExitsStrategies:
It went on and on. It was next to impossible to compare system A to system B. There are things to
consider like how much money it takes to make the profit. Does it take $10,000 to make $10,000 or
$50,000 to make $10,000? One is 100% profit, while the other is 20% profit. And, is the Average Trade
large enough to cover commission and slippage?
I spent many years listening to gurus and reading books and going to seminars, looking for all the
answers.
John Bollinger (of Bollinger Bands fame) said that both the Profit Factor and the Ratio of Average Win
to Average Loss must be 2.0 or greater, and that the Percent Profitable should be 50% or more. Well,
that would be a rare system indeed.
Finally, after much thinking and research, I used my mathematical brain, and combined Profit Factor,
Ratio and Percent Profitable into one equation that answered most of the problem. I found that if you
multiply all three of them together you get an index that gives you a really good idea whether a system
is tradable. I called this my “Cardinal Profitability Construct” or CPC for short.
These values are easily found on the Strategy Performance Report in both TradeStation and
MultiCharts. See Figures below.
Figure 8.1 —TradeStation Performance Report
Notice in Figure 8.1 that 1.03 x .3571 x 1.85 are the inputs to the equation. The solution is thus CPC =
0.68 (truncated).
If you have read my book “Trading 102—Getting Down to Business,” you will remember my
commentary about the value of the CPC Index in Chapter 9. In short, my rule of thumb is that any system
I might consider trading must have a CPC Index of 1.2 or greater. Clearly, the system represented by the
Performance Report above does not pass this test—0.68 is well below 1.2. Nevertheless, many people
would jump into a system like the one above because it showed a Total Net Profit over $2,000. But,
more importantly, the CPC Index doesn’t pass, the Avg. Trade Net Profit is not greater than $100 and
over the long-term, this system will not work over time. The CPC Index is invaluable for independently
comparing systems.
Rather than calculate this index by hand over and over I decided to write the formula in EasyLanguage.
A little problem arose: you can’t calculate profit in an indicator. You must be in a strategy to calculate
profit. So, the CPC Index is a strategy. But, it doesn’t buy or sell anything; it just uses the profit statistics
to calculate the index and print the details in the EasyLanguage Output Window, in the Print Log. This
feature is even more valuable when using MultiCharts, because the statistics we need are in two
different locations in their output. The MultiCharts System Performance looks like this:
InputValues
j_Key(0), // password key specific to each user
j_Vendor(""), // text value of your software vendor
j_Indic(""), // text value for this indicator specific to each user
o_jKey(0) // output value (proprietary)
None of these values is optimizable. You have to put in the values I give you when you license the
software, but none of them matters to you as a user. They are essentially identifications internal to the
software.
The output of this index is not on a chart; rather, it is printed in the EasyLanguage Output Bar, in the
area called the Print Log, at the bottom of your workspace. Here’s what it looks like:
(Enlarged)
Or
• Date
• Time
• Gross Profit
• Gross Loss
• Total Net Profit (TNP)
• CPC Index
• Joe Krutsinger’s Profit to Drawdown ratio
• Mathematical Expectation
• Average Trade
• Average Win
• Average Loss
• Number of Wins
• Number of Losses
• Percent Profitable
• Profit Factor
• Ratio of Avg Win to Avg Loss
This output is convenient for another reason: you don’t have to look at the Strategy Performance
Report, which often gets in the way.
Before I leave this subject let me remind you that the Average Trade value is VERY important. Even if
you have a system that makes $20,000 in a year, you need to look at the Average Trade size. If it took
800 trades each making $25 to get to $20,000, it is an impossible system to trade in real life. A trade of
$25 theoretically is impossible to catch in real life. Slippage will kill you and you’ll never really catch that
$25.
The components are Percent Profitable, Ratio of Avg. Win to Avg. Loss, and Profit Factor.
Percent Profitable =
Or
= ( GP / NW ) / ( GL / NL )
Profit Factor =
Further Obfuscation
Let us now put all these equations together and do some factoring and reducing and see what the
formula looks like then.
(Nbr Wins) / (Total Nbr Trades) * (Gross Profit)/(# Winning Trades)/Avg Losing Trade * (Sum of all
Winning Trades) / (Sum of all Losing Trades)
= NW / NT * ( GP / NW ) / ( GL / NL ) * GP / GL
Input Values
j_Key(0), // password key specific to each user
j_Indic("0"), // text value for this indicator specific to each user
TriLen(4), // length of the congestion triangle, in bars
jLines(1), // 1=draw the support & resistance lines; 0=don’t draw
them
jNums(1), // 1=write the S&R numbers on the chart; 0=don’t write
them
j_Wid(3), // Width (thickness) of the lines to be drawn
j_Above(1.01), // Factor above the High to write the numbers
j_Below(.99); // Factor below the Low to write then numbers
Figure 9.1—Pennants
The pennants are blue sloping lines with red horizontal lines on top of and underneath them. They are
highlighted in translucent yellow.
The corresponding nu
How I Trade With This Indicator
The way I trade this indicator is to buy (or sell) the breakouts above (or below) the little horizontal red
lines. Then, if the market comes back to the support or resistance I get out. Otherwise, I wait for the
next pennant and move the stops up (or down).
When I use this indicator in conjunction with my SunnyBands, I watch for price to come down to the
little red lines (or up to if we’re in a long situation) and hit the upper or lower SunnyBands, and I take
my profits and wait for another trade.
CHAPTER 10: Solar09
Introduction
This indicator is based on weighted moving averages. It is very simple, but powerful. It turns red when
the market is moving downward and green when the market is moving upward. That’s about all there
is to it. Like all moving averages, it is a slightly lagging indicator.
Input Values
j_Key(1234), //personal password Sunny gives you
price(Close), // which price field to use: Open, High, Low or
Close
length(21), // length of the moving average
upcolor(DarkGreen), // color to paint upward moving average
downcolor(DarkRed), // color to paint downward moving average
colorDeltaBar(1), // =0 >> off; =1>>color the bar where the moving
average changes color
j_Offset(0), // offset the moving average number of bars
j_Key(0), // password key given upon purchase of license
j_Indic("000000000") // text password for Solar09
Indicator on a Chart
Simply insert the sjh_I_Solar09 indicator on your chart, of whatever symbol, using Insert Indicator
or Alt+C. Nothing will appear initially, until you set the proper input values, as above. Figure 10.1 shows
the indicator on a chart of the Dow.
Figure 10.1—Solar09 Indicator on Chart of Dow Jones daily
The next chart, Figure 10.2, shows the Solar09 indicator with the input value ColorDeltaBar set to a
color number. This turns on the painting of the transition bar. If ColorDeltaBar is equal to 0, the bar does
not get highlighted. If any positive number, the number specifies the color for the bar. (See Appendix A
for color values).
Figure 10.2—Solar09 Indicator with Bar set to 1 (on) which means black.
If you set the input value j_Offset to a positive number, the plot of the moving average will move back
in time that many bars. If you set j_Offset to a negative number, the plot will be moved that many bars
into the future.
CHAPTER 11: Solar09 Strategy
Most indicators can be turned into strategies. The Solar09 Indicator is no exception.
Introduction
The Solar09 Strategy is simply an interpretation of the Solar09 Indicator. This configuration simply takes
a trade when the moving average changes color.
The picture of the indicator on a chart is deceiving. It looks better than it is. The problem with the
indicator/system is that a trade can’t be placed until the next bar. The line doesn’t turn colors until after
a bar is completed. Nevertheless, it is amazingly accurate.
There are several Solar Systems (Solar03, Solar05, Solar07, and Solar09 so far). Each has a little bit
different tweak on the filters and triggers that set off the trade. While all are based on the red and green
line shown above, each Solar System has a different way of finessing the market. Some use MACD,
some ADX, some Pennant Formations, some Linear Regression, etc. You’ll have to decide for yourself,
based on your style and your favorite markets, which is best for you.
Input Values
INPUTS:
j_Key(1234), // personal password Sunny gives you
j_price(4), // you may choose Open, High, Low or Close based
on the respective values 1, 2, 3, or 4 (i.e.,
4=close)
length(21), // length of the moving average
j_Key(0), // password key given upon purchase of license
j_Indic("00000000000") // text password for Solar09
Because this is a strategy, the value for length can be optimized. The input value for j_price can also be
optimized from 1 to 4, for open, high, low or close.
The best optimization for the Solar09 strategy on the @ES daily contract, for the past year, is in choosing
a fast average (length = 5) and using the Open of the bars to calculate. This is shown in Figures 11.2 and
11.3 below.
It is left to the reader to choose their own values for their time frames and instruments.
CHAPTER 12: AllAverages Indicator
Mother is the necessity of invention, I’ve always told my kids. And that’s what led me to this indicator.
I wanted to see how each of the different types of moving averages compared to each other—profit
wise. And I got tired of having to go back and forth putting this average and then that average on my
chart, all with different names.
So, I put all the averages in one indicator, and subsequently in one strategy, to make it quick and easy
to plot any average from one place, and to test any moving average from one place and compare
profitability by optimization.
Introduction
While you can’t evaluate which average is “best” in the indicator format, you can easily look at them
and choose the one you visually prefer. And, it’s very easy when all you have to do is specify a different
number, and not add and delete differently named indicators with different parameters. In this
indicator, it’s all in one place. All you need do is choose “WhichAvg” and you can even say how many of
them to plot on the chart as long as it’s one, two or three.
I think the first time I got frustrated with all the different moving averages was when I realized I could
easily plot a 2 line moving average and look for crossovers, but I couldn’t plot a 2 line Exponential
Moving Average without putting two different indicators on the chart. That’s what got me started on
this indicator.
Input Values
INPUTS:
j_Key(2044), //jKey password
j_WhichAvg // (1 {1=H, 2=S, 3=X, 4=W, 5=DMA, 6=S9, 7=KAMA}),
// 1 = Harmonic Mean Moving Average
// 2 = Simple Moving Average
// 3 = Exponential Moving Average
// 4 = Weighted Moving Average
// 5 = Sunny’s Dynamic Moving Average
// 6 = Sunny’s Solar09 Moving Average
// 7 = Kaufman’s Adaptive Moving Average
j_Many(1), // 1, 2, or 3 moving averages
j_Item(4), // O, H, L, C = 1, 2, 3, 4
j_L1(9), // length of moving average 1
j_1Color(darkbrown), // color of average 1
j_1Thick(2), // thickness of line for average 1
j_1Style(2), // style of line for average 1 (ie: solid, dash, dot…)
j_T1(0.25), // smoothing factor for average 1 calculations
j_Precision1(5), // nbr of digits for calculations (ie 5 decimal
places)
j_L2(18), // length of moving average 2
j_2Color(darkmagenta),// color of average 2
j_2Thick(2), // thickness of line for average 2
j_2Style(2), // style of line for average 2
j_T2(0.25), // smoothing factor for average 2 calculations
j_Precision2(5), // number of decimals in calculations for average
j_L3(20), // length of moving average 2
j_3Color(darkgreen),, // color of average 1
j_3Thick(2), // thickness of line for average 1
j_3Style(2), // style of line for average 1 (ie: solid, dash,
dot…)
j_T3(0.25), // smoothing factor for average 1 calculations
j_Precision3(5), // nbr of digits for calculations (ie 5 decimal
places)
j_Displace(0), //
j_DisplaceText(5) //
;
Figure 12.1--Inputs
Examples
A chart won’t show the simplicity and flexibility of this indicator. But, here it is anyway for you to see
what three moving averages from sjhAllAverages looks like on a chart. If you’ll notice at the last bar on
the chart there is a little set of numbers. Those numbers are the lengths of each of the three moving
averages.
So, I put all the averages in one indicator, and subsequently in one strategy, to make it quick and easy
to plot any average from one single place, and to test any moving average from one place and compare
profitability by optimization.
Just by optimizing on the input value you can test all six types of moving average at once.
Introduction
You could compare each type of moving average to one another by testing all the parameters, one at a
time, on each type average, one average at a time. I didn’t like this technique. It seemed far too tedious
and prone to error.
Since you can’t optimize an indicator, and since you can only tell “which is best” by measuring
profitability, I wrote a strategy that would take an input to specify which average to use, and then I
could optimize that input over all the averages to find the most profitable one.
Input Values
These are the input values for the Strategy. The indicator is essentially the same.
INPUTS:
j_L1(8),
j_L2(13),
j_NAvg1(1 {1-6;Which Avg to Use}),
{
1 Harmonic Mean
2 Simple Moving Average
3 Exponential Moving Average
4 Weighted Moving Average
5 Sunny's Dynamic Moving Average
6 sjh_Solar09 Proprietary Average
7 Kaufman's AMA (KAMA)
}
j_NAvg2(1),
j_NOHLC1(1) ,
j_NOHLC2(1) ,
j_Key(0),
j_Indic("")
;
The lengths, j_L1 and j_L2 are the lengths of the two moving averages to plot, or to test.
The input value j_NAvg1 tells me which type of average to use for the first moving average. You specify
any value from 1 to 7 to designate the average. Any other value is meaningless.
The input value j_NAvg2 tells me which type of average to use for the second moving average.
So, you see, you could choose the first line to be an Exponential Average, and the second to be a Simple
Moving Average – or any of the combinations you wish.
The input values j_NOHLC1 and j_NOHLC2 tell me what bar value to use for each of the moving average
lines. You may specify them as follows:
1 Open
2 High
3 Low
4 Close
The nice thing about making them numeric inputs is that you can optimize on them as well.
The inputs j_Key and j_Indic are for password protection. When you purchase a license to use the
software, I’ll give you these values. They are unique to you.
There are no pictures to show with this indicator. It is all about the optimization. The simple moving
average, the exponential moving average, the weighted moving average, all look just like their
counterparts in TradeStation. The whole reason for this strategy is so you can optimize to find which
type moving average works best (makes the most profit) on your particular symbol and timeframe.
Chapter 14: Color the Day & Night Sessions
This PaintBar is for coloring the day session different from the night session. This routine is called
sjh_PB_DaySession.
I like knowing, in 24-hour traded symbols, whether I am looking at the day session or the night session,
at just a glance. I don’t like to have to think about it. Typically, in the eMini, there is lower volume in the
night session. In fact, I find it is significantly lower and the moves are generally much smaller. This is
important to know. And, I like setting my Neurology to key instantly off the color variations. That’s why
I color the night sessions differently from the day sessions.
Introduction
When I’m trading, and under stress, even while following my system rules, I can get easily sidetracked
and sometimes confused. And, if the phone rings and someone redirects my thoughts, I can look back
at the computer screen and not relate to what I’m seeing.
So, my mantra is to keep it simple. Make everything obvious. And, one of the techniques is to color-
code things. For instance, I like to keep my DynamicMovingAverage purple and gold. That way,
whenever I look up, if I see purple and gold lines crossing I know it’s my DMA.
Likewise, with the availability of 24-hour trading, I can enter or exit a trade any time of the day or night.
And especially when I’m analyzing historical charts I like to make it easy to see what part of the day or
night I’m looking at.
Input Values
As with all my indicators, the parameter that will turn off and on the indicator is the j_Key value.
INPUTS:
j_Key(31), // Set to your password value given by Sunny
j_Vendor("TS"), // TS=TradeStation, MC=MultiCharts, GN=Genesis,
MS=MetaStock, NJ=NinjaTrader
j_DayColorUp(Blue), // Color Day Session Up Bars
j_DayColorDn(Red), // Color Day Session Down Bars
j_NiteColorUp(Green), // Color Night Session Up Bars
j_NiteColorDn(Magenta), // Color Night Session Down Bars
j_OpenTime(0630), // Local opening time of day session
j_CloseTime(1315) // Local closing time of day session (begin nite
session)
;
It’s pretty self-explanatory. You specify the color you want the Day Session bars to be painted. In this
example I’ve chosen Blue. Then you choose the color you want the night, or Second Session bars to be
painted. Then, with OpenTime and CloseTime you specify the times the Day Session opens and closes.
The routine assumes if it’s not the Day Session, then the rest of the bars are in the night session.
Example
Blue and red bars are in the day session. Green and magenta bars are in the night session. The curvy
lines on the chart are from my DynamicMovingAverage (DMA).
Using this PB_DaySession helps set your Neurology to instantly key in to which session you are trading
in.
Chapter 15: SunnyBars
This is another one of those inventions born of necessity. I wanted to see how larger and diminishing
volume effected the movement of the markets.
This indicator is actually a set of PaintBars. There are three routines: sjh_SunnyBarsBodyVolume,
sjh_SunnyBarsTop, and sjh_SunnyBarsBot. The first routine paints the body of the candle, with the
width of the candle being dependent on the volume. The next two routines paint the top and bottom
wicks of the candle. To get a full SunnyBar you must put all three PaintBars on the chart.
Notice the higher volume bars are wider than the lower volume bars.
NOTE: The symbol on the chart must be in OHLC bar configuration, not in candlesticks.
Introduction
Back in the olden days I used to favor an indicator called EquiVolume by Richard Arms. It fell out of favor
as market software became taken over by larger concerns than his, and the indicator dropped off the
common lists.
Because I couldn’t find this indicator on TradeStation, I created my own. This indicator, SunnyBars, is a
combination of candlesticks the way I see them, and the concept of making higher volume bars wider,
and lower volume bars more narrow.
NOTE: These bars must be put on a chart of OHLC bars. The indicator won’t show up on a Candlestick
chart. The candles will overwrite the SunnyBars.
Input Values
There are only two inputs to the PaintBar Indicator SunnyBarsVolume, and they are your j_Key
password key, given to you by me, and changed from time to time to protect my proprietary software,
and the length of the Average to use for the Volume.
The Bottom and Top paintbars, which paint the wicks, have another input parameter, and that is to
specify the width of the blue wicks. That value can go from 0 to 6. I like to set mine to 3.
The next figures show the input values for each of the three (3) routines necessary to completely paint
SunnyBars. Remember, SunnyBars is a combination of three PaintBars.
Figure 15.2—Inputs for SunnyBars Body Volume PaintBar
Figure 15.2—Inputs for SunnyBars Bottom and Top are the same
Figure 15.3—SunnyBars: Narrow and Wide bars denote volume
Note in the figure above, that there are two really wide bars (when compared to the rest of the bars).
The widest green bar, is just after noon and is indicative of a blow off top. The widest red bar occurs
just after 13:00, and is a blow off as well, this time on the bottom. Notice how price tends to reverse
after these really thick bars.
Chapter 16: TimeSeriesForecast & RVI
Introduction
The Time Series Forecast (TSF) indicator is based on linear regression calculations using the Least
Squares method. Linear regression is a statistical tool used to predict future market values relative to
past values. TSF attempts to "predict" the future value of a market by determining the upward or
downward bias of a trend and extending that calculation into the future. For example, if prices are
trending up, TSF attempts to logically determine the upward bias of the price relative to the current
price and extend that calculation forward. When the market price is above the indicator, the trend is
considered up. When the market price is below the indicator, the trend is considered down.
Additionally, many analysts believe when prices rise above or fall below the indicator line, prices will
likely pull back to the line. The TSF indicator also monitors the current trend to determine if a change in
direction occurred.
The Time Series Forecast indicator is similar to the Linear Regression indicator with the exception of
two significant differences. The first difference is that TSF plots its line forward (to the right of the chart)
by the number of bars specified by the j_BarsForward input. The second difference is the default Length
input value used for the TSF is much shorter because the plot line is extended forward. A larger Length
input would create a grossly exaggerated plot and would not be as reliable as a shorter-term length
when analyzing trends and price activity.
TradeStation’s built-in indicator lags price movement. My version is the inverse of TradeStation’s
indicator, and does a great job of plotting price movement in advance of movement. You will notice
that when my indicator is at a top, the market will be making a bottom. And, when my indicator is at a
bottom, the market will be making a top.
On the RVI indicator it is just the opposite. Tops show tops, and bottoms show bottoms.
Inputs
INPUTS:
j_Price(Close),
j_Length(9),
j_BarsForward(5),
j_BarPlus(7),
j_Color(blue),
j_Thick(3)
;
Figure 16.1—TimeSeries and RVI
Chapter 17: CloseLastTrade
When I am doing research into how a trading system fares, and compares to other trading systems, I
like to have all the open trades closed, as of the last bar on the chart. There might be a trade of several
thousand dollars left open otherwise, and its values would not be counted into the Performance Report
statistics.
Introduction
This is a simple routine, in the form of a Strategy. All you need to do is add it to the list of
Signals/Strategies at the end of the list. It will then close all open trades at the end of the chart.
Input Values
There are no inputs for this strategy.
Examples
Let’s say the last trade on your strategy is a buy, and that it happened a month ago (or say 20 bars ago),
and that the market had been going up ever since. Then, the Strategy Performance Report would not
report this beautiful, long, profitable trade in the statistics for your system. Instead, the trade would be
left currently open, and would not be part of the profit and stats reported.
If you included the CloseLastTrade strategy, however, in your list of Signals, as the last signal, then it
would close that final trade at the last bar on the chart, and it would now appear as part of the statistics.
CHAPTER 18: BingTicks
To some it sounds like incessant notice, but to us traders the sound of the bing and the bong of this
indicators is soothing! This little indicator does nothing except play a small .wav file with each tick of
the market. I put it on a 1-minute chart of whatever I am trading.
Introduction
Back in the olden days, when all trading was done on the floor of an exchange, using open-outcry only,
the cacophony on the floor was thrilling. You could almost hear the waves of excitement as the market
got hotter and cooled down. You could tell which way the market was going based on the din of the
floor.
Now that much of our trading takes place on computers (aka “upstairs”), the emotion of the noise has
subsided. However, there is one way to recapture that excitement and to read the level of activity based
on sound. And that is to listen to the frequency of the up and down ticks through my little sjh_BingTicks
indicator.
With each tick of the market, with every trade, sjh_BingTicks plays a small sound file from your
harddrive. I use a “bing” for up trades, and a “bonk” for down trades. So, not only do I get a sense of
frequency, I get a feel for direction. Further, I use a “click” for sideways trades.
Input Values
INPUTS:
j_Key(31),
// Play this sound when trade is up:
j_UpSound("C:\Sounds\Blip.wav"),
// Play this sound when trade is down:
j_DownSound("C:\Sounds\Bonk.wav"),
// Play this sound when trade is sideways:
j_SideSound("C:\Sounds\Click.wav"),
//Play this sound near market close:
j_ClosingSound("C:\Sounds\ClosingBell.wav"),
//Closing Time to Ring the Closing Bell:
j_ClosingTime(1313)
;
Examples
Remember to have a folder on your C:\ drive that matches your inputs, and a wave file matching each
input, otherwise no sound will play.
For instance, if in the second through fifth inputs you use “D:\Sounds\xxx.wav” then the sounds must
be located on your D:\ drive. Be sure that you name the wav file exactly as it is named on your computer.
If the file on your computer is “Blip” remember that it is different from “blip.”
In the original incarnation of this indicator, there were no inputs. I used it to simply play the sounds for
my one trading instrument, the S&P 500. But then I began trading the other futures contracts and the
Forex markets with the same “speed-trading” frequency. When that started, I needed to be able to
differentiate between which chart was binging and where the action was taking place. So, I made the
indicator flexible so I could hear one sound on the S&P and a different sound on the other markets.
I also like the “ClosingBell” to ring 2 minutes before closing time, to remind me to exit any trades I don’t
want to hold overnight. TradeStation signifies 1:13 pm as 1313.
If you need some sound files, just go to the downloads section of MoneyMentor.com
https://www.moneymentor.com/downloads.html and pick from a few that I have made available,
which work well for trading sounds. Keep in mind if you download your own sounds, a small file works
best for fast moving markets. The sound must play very quickly and not interfere with the next sound,
because ticks come in very fast. Make sure you use small sound files. (.wav)
Notice in Figures 18.02 and 18.03 that the Closing Time is different for each contract. Gold closes at
1400 while the EMini closes at 1315. I give myself 2 minutes warning by using the settings above.
CHAPTER 19: What Time Is It?
This indicator helps me keep track of whether the market is moving fast or slowly, and whether the
server is still feeding me data or not.
Introduction
There are times when I am not totally sure whether the market is still open or not. Sometimes the
datafeed (Heaven forbid!) goes down. Sometimes my network goes down. Because of unforeseen
events like these, and to keep me always on my toes, I wrote this little indicator.
All it does is print the time and the current price of the market on the right-hand edge of my chart. It
updates with every tick of the market.
Input Values
As with all my indicators, the parameter that will turn off and on the indicator is the j_Key value.
INPUTS:
j_Key(2047),
j_Price(C),
j_TimeColor(DarkRed)
;
Examples
Here is a chart with the indicator in place. Notice the time and price at the right-hand edge of the data.
Figure 19.1—Time and Price
CHAPTER 20: ShowMe Current Price
Current Version: 11.01
Sometimes when I’m looking at several charts, back and forth, back and forth, I lose track of the
bouncing prices. So many things to see and to process! I must be on the alert for instantaneous reaction
to market conditions.
So, to make it easy for myself, I wrote a little routine to put a colored dot (larger than the little closing
price cursor) so that I could readily find the Current Price.
By default it used to be blue. But, with version 11.01 I have added the capability to have a green colored
dot for upticks and a red colored dot for downticks. (Or, you may select the up and down colors of your
choice.) Actually, I like darkgreen and darkred.
There used to be no inputs for this routine, but now that I allow you to select colors, you must tell me
which colors you like. You may use RGB colors to choose anything you wish. Oh, and it puts the current
price right beside the dot, which also changes with every tick.
I also have an input for how far away to place the dot. That’s called j_BarsDisplace.
INPUT:
j_Key(2047), //Password Key Value
j_UpColor(DarkGreen), //Up Tick Color
j_DnColor(DarkRed), //Down Tick Color
j_BarsDisplace(2); //Bars away to place the dot
CHAPTER 21: Close Trades It’s Friday
There are no inputs to this routine, either. It’s either on the chart or it’s not.
The back-story on this indicator lies again in my need to be always on my toes and ready for the next
trade. In my excitement for trading, I often forget that the day is Friday, and it surprises me when the
market closes for the weekend. So, I made an indicator that writes an alert all over the screen when it’s
Friday.
One of the nicest features of having these indicators is that they have Alerts in them. If you have the
indicator or your chart and set Alerts On, then you will be notified each time one of these patterns
occurs.
Figure 22.2 shows three sample indicators on a chart. You’ll see the words “BBEnglf” indicating
Bullish/Bearish Engulfing pattern. Also shown are the words “EveDoji” to show an Evening Doji pattern.
The other pattern on the chart is “BearHarami” showing the Bearish Harami pattern.
Figure 22.2-Candlestick Indicators all on one chart
These routines each start with a “C_” to denote that they are referring to Candlesticks. Each routine has
as its first input, the j_Key password value. Be sure to use the value I gave you when you first licensed
the product.
Here is the list of Indicators currently available (hyperlinks for ease of use):
• sjh_C_BullEng_BearEng
• sjh_C_BullHar)BearHar
• sjh_C_Doji
• sjh_C_Hammer_HangingMan
• sjh_C_MornDoji_EveDoji
• sjh_C_PierceLine_DkCloud
• sjh_C_ShootingStar
It should be fairly apparent from the names what the routine does; BullEng stands for Bullish Engulfing,
BullHar stands for Bullish Harami. The rest are obvious.
Bullish Engulfing and Bearish Engulfing Patterns
This routine is named sjh_C_BullEng_BearEng. It stands for Bullish Engulfing and Bearish Engulfing
Patterns.
The different candlestick patterns are shown in different colors on a chart. On the chart in Figure 22.2 I
have included all the patterns I have available, rather than show lots of different charts.
INPUTS:
j_Key(2047), //Your individual password (given by me)
Length(14), //Length of Exponential Moving Average of Closes
j_Color(Red) //The color to make the text on the chart
;
Figure 22.4—Bullish Engulfing and Bearish Engulfing Candlestick Patterns
A reversal pattern that can be bearish or bullish, depending upon whether it appears at the end of an
uptrend (bearish engulfing pattern) or a downtrend (bullish engulfing pattern). The first day is
characterized by a small body, followed by a day whose body completely engulfs the previous day's
body.
Bullish Harami, Bearish Harami
INPUTS:
j_Key(2047), //Your individual password (given by me)
Length(14), //Length of Exponential Moving Average of Closes
j_Color(Red) //The color to make the text on the chart
;
Figure 22.7, above, shows you what the candle pattern looks like on a chart.
A Harami is a two day pattern that has a small body day completely contained within the range of the
previous body, and is the opposite color.
Figure 22.4—Bullish Harami and Bearish Harami Candlestick Indicator
Doji
Dojis form when a security's open and close are virtually equal. The length of the upper and lower
shadows can vary, and the resulting candlestick looks like, either, a cross, inverted cross, or plus sign.
Dojis convey a sense of indecision or tug-of-war between buyers and sellers. Prices move above and
below the opening level during the session, but close at or near the opening level.
Hammer, Hanging Man
INPUTS:
j_Key(2047), //Your individual password (given by me)
Length(14), //Length of Exponential Moving Average of Closes
Factor(2), //Multiplier of body size
j_Color(Red) //The color to make the text on the chart
;
Hammer candlesticks form when a security moves significantly lower after the open, but rallies to close
well above the intraday low. The resulting candlestick looks like a square lollipop with a long stick. If this
candlestick forms during a decline, then it is called a Hammer.
Hanging Man candlesticks form when a security moves significantly lower after the open, but rallies to
close well above the intraday low. The resulting candlestick looks like a square lollipop with a long stick.
If this candlestick forms during an advance, then it is called a Hanging Man.
Morning and EveningStar
Doji
INPUTS:
j_Key(2047), //Your individual password (given by me)
Length(14), //Length of Exponential Moving Average of Closes
Percent(5), //Multiplier of body size
j_Color(DarkCyan) //The color to make the text on the chart
;
Morning Doji Star: A three day bullish reversal pattern that is very similar to the Morning Star. The first
day is in a downtrend with a long black body. The next day opens lower with a Doji that has a small
trading range. The last day closes above the midpoint of the first day.
Evening Doji Star: A three day bearish reversal pattern similar to the Evening Star. The uptrend
continues with a large white body. The next day opens higher, trades in a small range, then closes at its
open (Doji). The next day closes below the midpoint of the body of the first day.
INPUTS:
INPUTS:
Length( 9 ) ,
j_Color( DarkMagenta )
;
Piercing Line
A black candlestick followed by a white candlestick that opens lower than the black
candlestick’s low, but closes 50% or more into the black body.
Interpretation: A bottom reversal signal
A long white body followed by a black body. The following black candlestick opens
higher than the white candlestick‘: high and closes at least 50% into the white candlestick’s body.
Interpretation: A bearish reversal signal during an untrend.
Shooting Star
Marked by “SS”, the Shooting Star…..
CHAPTER 23: Day Open/High/Low Lines
Plots horizontal lines at the Open, High and Low of each day.
INPUTS:
j_Key(2047),
OpenColor( Blue),
HighColor( DarkGreen),
LowColor( Red),
DataNum( 1 {DataStream Nbr} ) ,
j_TLSize(2),
j_OpenSession1(0630),
j_CloseSession1(1315),
j_OpenSession2(1500),
j_CloseSession2(0630)
;
You may specify the color and thickness of the horizontal lines over prices on the chart. In the chart in
Figure 23.1 Green designates the highest high of the day, while Red is the lowest low of the day.
Likewise, the Blue bar shows you the Opening price of the day.
Putting a line for the closing price just makes a confusing jumble. I have an indicator we fondly call the
Bouncing Ball—but it’s official name is sjh_SM_CurrentPrice. This ShowMe puts a dot on the current
price at the right hand edge, where trades are taking place.
Writing this page makes me think of another indicator I could write: sjh_SM_AllCloses, which could put
a dot on all the final closes for every day. That way you could combine these two indicators and not
make a messy chart. Glad you thought of it. Thanks.
CHAPTER 24: Days of the Week
Colors bars during each day of the week a different color. I.e. Monday is brown, Tuesday is blue,
Wednesday is green…
You may pick any color you wish through the Input values you select.
While this makes for a colorful chart, on a daily basis this isn’t the best use of this indicator. Sure, if you
memorize the colors associated with each day you can tell at a glance what day of the week it is.
But, wait for the next chart where the symbol is @ES on a 30-minute chart. In this chart you can see the
section that is Monday, the next colored section is Tuesday etc. This way it is pretty handy.
A regular chart just shows you the date on the X-Axis, but this indicator allows you to tell at a glance
what day it is. This comes in really valuable when you are trying to see patterns and to see which day
of the week is the most profitable.
Figure 24.2—On this 30-minute chart you can easily identify the days of the week
Below are the Inputs to the PaintBar indicator. You may specify any of TradeStation’s colors or
INPUTS:
j_Key(2047), //Your Password Key
j_1Color(Blue), //Monday
j_2Color(Red), //Tuesday
j_3Color(Green), //Wednesday
j_4Color(DarkBrown), //Thursday
j_5Color(Magenta), //Friday
j_6Color(Cyan), //Saturday
j_7Color(DarkGray) //Sunday
;
CHAPTER 25: Label the Days of the Week
INDICATOR NAME
: sjh_DaysOfWeek
Sometimes colors just aren’t enough. So, this indicator puts a little letter on the top of each bar, with a
letter designating the day of the week.
It’s kinda hard to see in this little font, but the letter on top of each bar tells the day of the week. The
letters I’ve chosen are:
M Monday
T Tuesday
W Wednesday
H Thursday
F Friday
S Saturday
U Sunday
There is apparently some unpublished limit on the number of text characters you can put on your chart.
Notice that the first chart below is of daily bars, and it works fine. But, when you start using intraday
charts, you must limit then number of days on the chart or it won’t put the little letters on the chart.
This next chart shows an intraday chart (15-minutes) with the day labels successfully placed. However,
if I tried to plot 20 days back, no labels would appear. Hmmm.
xx
CHAPTER 26: Paint DMAV Crossover
INDICATOR NAME
: sjh_DMACrossOver
Paints the bar where the Dynamic Moving Average crosses over. More accurate than eyeballing it.
INPUTS:
j_Key(2047), //user password key
j_Vendor("MC"),//vendor: MC=MultiCharts, TS=TradeStation
j_Indic(" "), //reserved for future use
j_Price1(C), //OHLC
j_Price2(C), //OHLC
j_L1(8), //fastma
j_L2(13), //slowma
j_T1(0.25), //smoothing factor for FastMAV
j_T2(0.25), //smoothing factor for SlowMAV
j_Color1(RGB(000,102,102)), //color of FastMAV plot line
j_Color2(RGB(204,102,102)), //color of SlowMAV plot line
j_Thick1(4), //thickness of FastMAV plot line
j_Thick2(4), //thickness of SlowMAV plot line
j_Precision(2) //decimals of precision for calculations
;
These books are shown in order of publication, from left to right, as Vince developed his theories. It is
also true that as the books progress the concepts become more complex. The first book, “Portfolio
Management Formulas,” does a great job of explaining with a fair amount of simplicity, his overall
concepts. It introduces optimal-f and its accompanying formulae, and the raison d’etre.
Ralph’s optimal-f concept is basically that there is a single fraction which is the best divisor for
compounding your profits. Any other number will either give you less total profits or will blow up in
your face. He explains why being on the wrong side of the bell curve, when figuring this fraction, will
result in large drawdowns and ultimate ruin. He also demonstrates the necessity for calculating the
optimal fraction that will give you the highest returns.
Importantly, Ralph states that one must remember that any attempt to compound a losing system will
not turn it into a winning system. So, you must first have a string of wins, or a hypothetical strategy that
produces a string of wins before computing your optimal-f makes any sense.
Once you have a string of winning and losing trades that results in a net winning portfolio, you can then
set out to compute your optimal-f. If you have trouble with Vince’s explanations, I can give you a lesson
in how it works. I even have a spreadsheet I’ve constructed to calculate Vince’s optimal-f.
Sunny’s Ultimate-F
Now, on to my Ultimate-F. Why and how is it different from Vince’s optimal-f? Glad you asked. The
problem with Vince’s optimal-f is that it is highly likely that you will, at some point on this greatly
compounded equity curve, hit a huge (I mean huge) drawdown that will wipe you out. Especially if you
have been taking any of the profits out of your account to live on. The chart in Figure 28.01 shows an
equity stream trading one contract at a time of the EMini S&P, never trading more than one contract.
Notice the Y-Axis scale on the left side of the chart. It goes from 0 to $500,000, and is scalar, not semi-
log. The top profit trading 1 unit contract with this method is about $450,000.
Figure 28.02—Ralph Vince’s optimal-f Equity Curve
Again, notice the Y-Axis scaling on the chart in figure 28.02. Again, sit is scalar, and you can see the
marked drawdown using Vince’s optimal-f method of compounding. What if you had taken some of
the profits off the table just before that last big spike and then hit a drawdown of a billion dollars?
The chart in figure 28.03 shows my Ultimate-F calculations at work. Notice that while the profit is
astronomically greater than trading unit contracts ($450k vs $18 million) that the drawdown is
negligible.
Figure 28.04—All Three Equity Curves Together on One Chart: Logarithmic
The chart in figure 28.04 is scaled logarithmically. It shows all three methods on one chart. It doesn’t
really have the impact of a scalar chart, as the drawdown for the optimal-f method looks acceptable in
this chart. The spike only shows when you are looking at real dollars. But, at least you can see the
dramatic difference in the end results on this chart.
The chart above, in figure 28.05 shows all three methods on scalar scaling. Here you can see what would
happen in real life with Ralph’s optimal-f compounding method. The only problem is that the half
million in profit from my Ultimate-F method hardly shows on a scalar chart because of the billions of
dollars from the optimal-f method.
I hope you can see the import of the three comparisons. Basically, I’m telling you that trading 1 contract
all the time doesn’t get you very far, very fast. I’m also telling you that using Ralph Vince’s optimal-f will
give you about 90% assurance that you will encounter 100% ruin. And, I’m also saying that I found the
error in Vince’s calculations, and they are implemented in my Ultimate-F spreadsheet, which avoids
most of the heavy drawdown and yet still significantly increases the return.
• Column C: where you will input your trades, either actual or historical through testing. In
column C you will put each trade’s profit or loss, one trade at a time.
• Cell C7: Starting Balance. Here you put the amount of the starting balance either of your
hypothetical account, or your actual account.
• Cell E7: Trial Ultimate-F. This cell is very important. You will substitute several different values
in this cell until you come up with the best fit, and maximum results, for your string of wins and
losses. Do not use any values here that would be less than the margin requirement if you are
trading futures, or the amount to purchase shares of stock if trading equities.
• Cell E8: Minimum Number of Contracts. This cell allows you to start trading with a different
number of contracts than one. Normally, this cell would have a 1 in it. But, if you already know
that you are going to start trading with, say, 5 contracts, because you have enough in your
account to do so, you would put a 5 in this cell.
• Scroll the spreadsheet down until you get at the end of the list of trades you entered. The last
cell in Column C will contain your most recent trade. In that same row, in Column E, will be
then number of contracts to take on your next trade. In the same row, in Column G, will be the
Ultimate-F compounded equity for these trades.
Figure 28.06—Sunny’s Ultimate-F Spreadsheet
The spreadsheet in Figure 28.06 is split, because it is very long. Note that this method, for this
string of real trades, only trades one contract for a long time. After the string of trades becomes
appropriately profitable, the compounding begins. Note in column E that it goes 5, then 6, then 7
contracts. The compounding method is proprietary, but it ends up with $135,880 for the unit
trading total (1 contract at a time) and $211,170 for the compounded result. It is not huge, because
this system was minimally profitable. But, nevertheless, with Ultimate-F compounding you make
$75,290 more than with unit trading. That is, you make 50% more!
Take a look at the chart, to the right of figure 28.06. You can see the red line is the Ultimate-F
compounded results. They go along about the same for the first half of trading. Then it takes off
and the compounding makes impressive results.
CHAPTER 29: Colors and my Color Function
Sometimes I want more colors for my indicators that are possible in the standard TradeStation set of
colors. My function sjh_f_Colors can be used in Inputs or called from within your routines. The calling
sequence is:
• “azure”
• “chartreuse”
• “orange”
• “burntorange”
• “goldenrod”
• “rose”
• “springgreen”
• “violet”
• “solaryellow”
• “solarteal”
• “teal2”
• “lightteal”
• “darkteal”
• “cyanish”
• “darkcyan”
• “greypink”
• “solarpinkish”
• “solartaupe”
• “brickred”
• “lightbrown”
These colors are in this order because it is the order in which I created them. The colors that start with
“solar…” are my favorite colors, with solar which relates to sun, which relates to Sunny!
Of course, the TradeStation legacy colors are always available. This function is provided free of charge
to members of my website, www.moneymentor.com. All others, it’s $45.
Let’s say you are an intermediate trader, and you are using SunnyBands. Very smart of you. Like me you
want to overlay two data streams of different timeframes, with two sets of SunnyBands. (I have a video
on my YouTube channel that teaches you how to do this.) If you lay the two SunnyBands on top of each
other without changing the colors, you’ll have a sea of unreadable indicators. So, I use darkgreen for
the faster timeframe SunnyBand’s outer band color. But I use springgreen for the outer band of the
slower time frame.
Likewise, I use darkteal for the inner bands of the faster data and solarteal for the inner bands of the
slower data.
I like the two charts overlayed. It makes trading decisions easier for me. I can, at a glance, spot where
the 1-minute SunnyBands is within the 5-minute SunnyBands. It’s all about fractals.
Just for your edification, here is what my EMini trading chart looks like.
Figure x.x
6
Color Values
goldUP goldDOWN
hiC hiE
lowC lowE
midC midE
SOUND104 SOUND105
Days of Week
DynamicMovingAverage for Charting
This picture displays the difference between my indicator and those of others. Notice the arrows
pointing to potential areas of whipsaw that other indicators generally lose money on, and my DMA
avoids.
DynamicMovingAverage for RadarScreen
Dynamic Moving Averag
e Strategy
Dynamic Moving Average Histogram
The red and green line, with the black moving average line crossing over it, is the DMAHistogram. The
chart in the upper subgraph is the standard DMA. The lower subgraph shows the DMAHistogram.
SunnyBands
The moving averages in the center are the sjh_DynamicMovingAverages, the purple and the gold
smoothed lines. The gray bands on either side show the input-specified Average True Ranges away from
the DMA. They do a magnificent job of containing the movement of the markets and thus showing the
user likely turning points.
The markets typically don’t move farther than they typically move. So, if you view market movements
by calculating Average True Range, that shows you how far the markets typically move. In my
calculations, I use 1.5 as the multiplier, to show one-and-a-half ATRs away from the DMA average.
When price gets to that extreme, and begins a turn back, that’s a perfect time to take profits, or change
the direction of your trading.
sjh_PHW
PHW stands for “Potential Hourly Wage” which was the genesis of my indicator.
This indicator shows Yellow Dots at significant turning points on the chart. It also calculates the Ideal
Profit and Loss if the program had been able to actually take those trades, and the PHW (which is 40%
of the actual) along with the Buy & Hold amount, the Ideal Number of Trades, and shows the date
ranges over the analysis in question.
sjh_Pennants
Locates areas of congestion. Notice how the market generally has extended moves after a period of
congestion.
sjh_CPC Index
In combination with a Strategy, including the CPC Strategy generates a line in the PrintLog, at the
bottom of the chart, which prints out the CPC Index and all the relevant component statistics.
sjh_RedLiteGreenLite
Works only on RadarScreen. Shows periods where three different time compressions are positioned at
this point in time. When all three are lined up, there’s a high probability of a significant move coming.
sjh_Exits
There is no picture of the Exits on a chart. The important thing to know about this Strategy is that you
can optimize several parameters at once, in combination with your own trading strategy, to find the
best Exits settings. The inputs are shown below.
sjh_AllAverages
sjh_AllAverages comes in both Indicator and Strategy formats. The indicator allows one the facility of
plotting one, two or three moving averages on a chart, from any of the following types:
1 = HarmonicMean
2 = Simple MAV
3 = Exponential MAV
4 = Weighted MAV
5 = sjh_DMA Dynamic Moving Avg
6 = sjh_Solar09 Avg
7 = MACD
8 = KAMA (Kaufman)
The Strategy format for this Indicator allows not only visual inspection, but the independent assessment
using TNP (Total Net Profit) to compare the success of one indicator against another.
It is very convenient to optimize the parameter which chooses the best form of moving average for the
stock, forex, or futures contract you are trading. (Or whatever other instrument you may choose).
sjh_WhatTimeIsIt Indicator
This is something I made for myself to monitor whether or not I’m still receiving data. Sometimes you
sit there and nothing seems to be moving, and then you wonder if your datafeed has gone down. This
is what I use for easing my mind. This indicator prints date, time and current price at the last bar on the
chart. As long as the time is changing, I’m ok. Of course, you need to set Space to the Right to 40 or so.
sjh_DaySessions
When trading the EMini 24-hour contract, but especially when trading FOREX, I need something to tell
me what time of day I’m working in. It is definitely useful to know when trading real-time, but even of
greater important when I’m looking at an historical chart. The Day Session bars are painted blue (or a
color of your choice) and the Extended Session bars are green (or another color of your choice.)
Notice that the “down bars” are red in the daytime and magenta at night.
sjh_Expirations Friday
When trading fast and furiously, I can sometimes forget what day of the week it is, and of especial
import, whether it is RollOver day on my futures contracts. On the chart above, Expiration Friday is
highlighted in magenta bars. But, more importantly, RollOver Thursday is marked in green bars. That’s
the day you’ll change from ESM11 to ESU11 in your trading.
SunnyBars
This strange looking chart is packed with information. You can see the Open, High, Low and Close in
Candlestick formations, but these candles have wider (thicker) bodies depending on how much volume
was present during that bar’s move.
Notice that while the body of the bar changes width with the volume, the extrema (high and low) of
the candle do not change width. That makes it easy to tell when there’s a thinly traded day, and when
there’s a high volume day (or bar).
sjh_PrintStatistics
Maybe it’s just me, but the Strategy Performance Report appears in front of my other charts and it
annoys me. So, I coded an indicator to print all the necessary statistics in the PrintLog window at the
bottom of the Desktop, so I can see what is important, and get the Performance Report off the screen.
This data is all delivered in the PrintLog window at the bottom of the TradeStation Desktop. I much
prefer it to the big, full-of-detail TradeStation Performance Report that stays on top of all your charts.
sjh_Ult
imate-F
Originally based on theories developed by Ralph Vince, this function compounds the number of
contracts to be traded on the next trade. Ralph’s original work had a flaw in it: eventually, after enough
compounding, the system typically hit maximum drawdown and exploded (hit its maximum Risk of
Ruin). I found the error in the math and changed the concept to incorporate my ideas and came up with
a much safer, yet still astounding compounding function. Pictured below are two charts: one that trades
one contract with each trade, and the second that trades compounded quantities based on Ultimate-
F. You can see for yourself the tremendous difference.