“Initial Balance” Rotation Strategy: Part 3 – Signal

Posted in RTL by astoeckley on January 17, 2011

(This is a continuation in our blog series on creating a trading system from start to finish. Want to see more? Click here for our main RTL support page, which links to the articles in this series and many more tutorials. Questions? Click here for the RTL Community Forum where you can get help on your programming.)


Today we look at creating the actual trading signals based on the 200% Initial Balance rotational strategy previously outlined. In the last segment, we created a custom indicator to display these levels on the chart. Today, we use the same math from the custom indicator to build the signal. The advantage of first creating the indicator is to make sure our math is correct. Added to the chart, this indicator also lets us easily verify that the signal is triggered at the moments we would expect. So if you haven’t already, refer to Part 2 of this series for an explanation of the math involved, and how to setup the RTL tokens to study the 200% IB range.

Creating the signal is actually quite straightforward now that we are sure about the tokens and their settings and relationships.

Just as we had two indicators for each of the 200% IB High and 200% IB Low, we will also have two separate signals for the “buy at the low” and “sell at the high” entries.

Using either the RTL button on your toolbar or the File > New menu, create a New Signal.

We know that the 200% IB calculation is going to be the same as in our indicator, so the first thing you can do is copy/paste or type the indicator code into the the new signal window. We will start with the code for the 200% IB High:

Note: Because a signal requires a comparison between values, which this indicator code does not have, you will see an error in the title bar of this window after you press Save. This is because we are not yet done with the algorithm and have yet to turn it into a trading signal.

Next, we compare the current price to the level calculated using a “relational operator.” There is some room for variation here, but lets assume, for starters, that we want the signal to indicate a “sell” whenever price reaches the 200% IB High level. We will state that if the highest price of a bar/candle penetrates the 200% IB High, we signal a short entry. This occurs if the High (with RTL token “Hi”) is equal to or greater than this IB level:

Press “Save” again. If you already have a chart open to which you want to add this signal, use the Send To button, as we did last time with the custom indicator. You will choose “Signal Marker” from the options.

Alternately, you can add this to any chart in the same way you would add an indicator. Right-click on a chart and choose Add > Technical Indicator or press the Insert key on your computer keyboard to bring up the same window. Select the Signal Marker indicator and configure it as desired:

Press Add and Close and the 200% IB High signal is now on your chart. Where it is placed will depend on the “Location” setting you chose. Any bars that meet the condition of the signal will show the signal, so in our example so far, you may get multiple bars in a row that trigger the signal:

Because we have the custom indicator also on our chart (the blue line), we can quickly verify that the signal is indeed triggering in the right places.

However, we may wish to reduce the actual number of signals. One way to do this is by editing the signal.

To edit the signal quickly, you can double-click on any marker to bring up the marker’s settings. You can then press the Edit button to open the RTL window.

If you omit the “>” sign and save the signal, then the chart will only show a marker when a bar’s high exactly equals the 200% IB High level:

As you can see, this removed some of the markers from the chart, but we still see several consecutive markers for bars that fluctuated back and forth at the 200% IB High level. I demonstrate this here to make two points:

  1. A slight variation in your RTL code or the relational operator can make a big difference in your signal, so attention to detail is critical.
  2. You can quickly experiment with your code and try different algorithms without closing the RTL window; the markers update every time you press Save.

This code, without the “>”, is very limiting. It requires that the high of a bar exactly equal the 200% IB High level.

There is a more robust way to limit a signal from only displaying once on the chart. This method requires two additional tokens, making the RTL a bit more complicated. We will introduce this technique in the next blog post in this series. For now, I recommend you keep the original relational operator, “>=”, in your code.

Adding Conditions

We now have a signal that accurately displays when a bar passes above the 200% IB High. This is the only condition for the signal, currently.

Often, you will want a signal that triggers based on multiple conditions that must be met. We will add two such conditions to our signal based on the time of day.

The IB, by definition, is not complete until after the first hour of trading. Any signals that might appear during the first hour are not truly 200% IB signals. So we want a condition that prevents signals at that time.

Additionally, many traders don’t want to enter such a rotational trade too late in the day. The idea is that such a price extreme late in the day might continue until the end. Or,there may also not be much time left in the day to see a true rotation and make decent profit.

So we will add two conditions: one to limit the signal to times after the first hour, and another to limit it to times before the last hour. In the Eastern time zone, this means the time is after 10:30 am but before 3 pm. Addtional conditions use the “AND” operator.

This is easy to do by adding the following code to our signal:

AND TIME >1030 AND TIME < 1500

All times for the TIME token are in military format.

Adjusting Entry Level

Just because this strategy uses 200% IB levels does not necessarily mean that a trader will always enter exactly at these levels. Some traders like to get in a bit early, as clearly the market often reverses a few ticks away from this level. Other traders may want to wait until the market passes through the level by a few ticks. Whatever the preference, we can add this to our signal. In backtesting, we can determine the best entry point, but for now we will hard-set it into the RTL code.

Consider the following variation for our signal:

HI >= (SESST_HI + (SESST_HI – SESST_LOW))-1

We have enclosed the prior math into parenthesis, and then subtracted 1 point from this. The signal will now trigger when we get within 1 point of the 200% IB High. You could change this to 0.5 or even add 1 instead of subtracting 1 to change where the signal forms around the 200% IB High level. Later, we will change this to a variable and let MarketDelta tell us what is the best option here.

Putting it all together

Here is our final signal code for the 200% IB High:

You would then create the mirror image of this signal in the same way for the 200% IB Low, using the same math as we used in our custom indicator from last time.

0 Responses to “Initial Balance” Rotation Strategy: Part 3 – Signal

No comments.


Add a Comment