indicator – Helping you Master EasyLanguage https://easylanguagemastery.com Helping you Master EasyLanguage Wed, 26 Jun 2024 14:04:46 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://easylanguagemastery.com/wp-content/uploads/2019/02/cropped-logo_size_icon_invert.jpg indicator – Helping you Master EasyLanguage https://easylanguagemastery.com 32 32 Evaluating Gap Momentum in Futures Markets https://easylanguagemastery.com/getting-started/evaluating-gap-momentum-in-futures-markets/?utm_source=rss&utm_medium=rss&utm_campaign=evaluating-gap-momentum-in-futures-markets https://easylanguagemastery.com/getting-started/evaluating-gap-momentum-in-futures-markets/#respond Mon, 01 Jul 2024 10:00:00 +0000 https://easylanguagemastery.com/?p=534317

Have you ever wondered if the seemingly random gaps that occur when the market opens could be the key to a powerful trading strategy? Imagine turning these unpredictable moments into a reliable edge in your futures trading. Today, we're diving deep into the gap momentum strategy to uncover its true potential and see if it can revolutionize your trading game.

Gap momentum trading is a fascinating strategy that taps into the often-overlooked phenomenon of market gaps. This technique draws its inspiration from the pioneering work of J. Welles Wilder and Joseph Granville's innovative On-Balance-Volume (OBV) method. Wilder, known for developing several technical analysis tools, was keenly interested in market gaps and their implications. Granville's OBV method, which accumulates volume based on price movements, laid the groundwork for analyzing momentum in a novel way.

By examining the difference between today's open and yesterday's close, traders can accumulate a series of positive and negative gaps to derive a gap ratio. When smoothed with a moving average, this ratio becomes a powerful indicator of market momentum.

In this article, inspired by Perry J. Kaufman's work in "Gap Momentum," published in Technical Analysis of Stocks & Commodities, we will delve into the mechanics of the gap momentum strategy, explore its application in futures markets, and present our findings from extensive testing.

I aim to determine whether this technique can offer a reliable edge in futures trading and provide actionable insights for algorithmic traders looking to enhance their strategies.

Understanding Gap Momentum

Historical Context

To fully appreciate the gap momentum strategy, it's essential to understand its roots. This approach draws heavily from the work of two notable figures in technical analysis: J. Welles Wilder and Joseph Granville. Wilder, a renowned technical analyst, developed several widely used indicators, including the Relative Strength Index (RSI) and the Average True Range (ATR). His fascination with market gaps—those sudden jumps in price that occur when the market opens—led to insights about their potential impact on future price movements.

Joseph Granville, another pioneer in technical analysis, introduced the On-Balance Volume (OBV) method. OBV accumulates volume based on whether prices close higher or lower than the previous day. This cumulative volume can reveal trends only after a period of time from price data alone. Granville's work showed that volume precedes price, meaning significant volume changes often lead to price movements.

Concept Explanation

Building on these foundations, the gap momentum strategy uses opening gaps to gauge market momentum. Here's a step-by-step breakdown of how this works:

  1. Identify the Gap: The gap is simply the difference between today's opening price and yesterday's closing price. If today's open is higher than yesterday's close, it's a positive gap. If it's lower, it's a negative gap.
  2. Calculate the Gap Ratio:
    • Positive Gaps: Sum all positive gaps over a set period (e.g., 20 days).
    • Negative Gaps: Sum all negative gaps (as positive numbers) over the same period.
    • Gap Ratio: Divide the sum of positive gaps by the sum of negative gaps. This ratio reflects the balance of upward versus downward momentum.
  3. Create a Cumulative Series: Starting with zero, add the gap ratio to a cumulative total each day. This running total is the gap momentum indicator.
  4. Smooth the Indicator: Apply a moving average to the gap momentum indicator to smooth out the noise and provide a clearer signal. The length of this moving average can vary, but a common choice is 20 days.

Example Calculation:

Let's walk through a simple example with a 5-day period:

  • Day 1: Open = 102, Close = 100, Gap = 2 (positive)
  • Day 2: Open = 101, Close = 103, Gap = -2 (negative)
  • Day 3: Open = 104, Close = 101, Gap = 3 (positive)
  • Day 4: Open = 102, Close = 104, Gap = -2 (negative)
  • Day 5: Open = 105, Close = 103, Gap = 2 (positive)

Summing the gaps over 5 days:

  • Positive Gaps: 2 + 3 + 2 = 7
  • Negative Gaps: 2 + 2 = 4
  • Gap Ratio: 7 / 4 = 1.75

Each day, we add this ratio to the cumulative series. If we start with zero, the cumulative series over five days will be:

  • Day 1: 0 + 1.75 = 1.75
  • Day 2: 1.75 + 1.75 = 3.5
  • Day 3: 3.5 + 1.75 = 5.25
  • Day 4: 5.25 + 1.75 = 7
  • Day 5: 7 + 1.75 = 8.75

Trading Signals

Once we have our smoothed gap momentum indicator, we can use it to generate trading signals:

  • Buy Signal: When the smoothed gap momentum indicator turns upward, indicating increasing positive gaps.
  • Sell Signal: When the smoothed gap momentum indicator turns downward, indicating increasing negative gaps or decreasing positive gaps.

By following these signals, traders can capture the momentum market gaps indicate. 

Understanding the theory and calculation behind the gap momentum indicator is crucial. In the next section, we'll dive into how to implement this strategy in EasyLanguage and test it on various futures markets to see how it performs.

Implementing the Gap Momentum Strategy

Implementing the gap momentum strategy in EasyLanguage involves several steps, from setting up the inputs and variables to calculating the gap momentum indicator and generating trading signals. Here’s a detailed guide to help you understand and implement this strategy.

Step 1: Defining Inputs and Variables

First, we must define the inputs and variables used in our EasyLanguage script. These include the number of periods to evaluate gaps, the period for calculating the signal average, and the trading bias (long, short, or both).

// Inputs
Inputs:   
   iPeriod(40), // Number of periods to evaluate gaps
   iSignalPeriod(20), // Period for calculating the signal average
   iSignalTrigger(1), // Number of bars to look back on signal trigger
   iLSB(0); // Control trading bias: Long, Short, or Both
// Variables
Variables:   
   vSignal(0); // Calculated signal based on gap ratio

Step 2: Calculating Gap Momentum

We then calculate the gap momentum using a custom function. This function evaluates the gaps over the specified period and computes the gap ratio.

// Function to calculate Gap Momentum
Inputs: 
   iPeriod(NumericSimple), // Number of periods to evaluate gaps
   iSignalPeriod(NumericSimple); // Period for calculating the signal average
Variables: 
   vGap(0), // Difference between current open and previous close
   vUpGaps(0), // Sum of positive gaps
   vDnGaps(0), // Sum of negative gaps
   vGapRatio(0), // Ratio of up gaps to down gaps
   vIndex(0), // Loop index variable
   vSignal(0); // Calculated signal based on gap ratio
vUpGaps = 0;
vDnGaps = 0;
// Loop through the specified period to calculate gaps
for vIndex = 1 to iPeriod
begin
   vGap = open[vIndex] - close[vIndex + 1]; // Calculate the gap
   if (vGap > 0) then 
      vUpGaps = vUpGaps + vGap // Accumulate positive gaps
   else if (vGap < 0) then 
      vDnGaps = vDnGaps - vGap; // Accumulate negative gaps
end;
// Calculate gap ratio
if vDnGaps = 0 then 
   vGapRatio = 1 // Avoid division by zero
else 
   vGapRatio = 100 * vUpGaps / vDnGaps; // Calculate the ratio
// Calculate the signal as the average of the gap 
ratio
vSignal = Average(vGapRatio, iSignalPeriod);
// Return the signal
Gap_Momentum = vSignal;

Step 3: Implementing Trading Logic

After calculating the gap momentum, we implement the trading logic based on the signal generated. This involves buying or selling based on the direction of the gap momentum indicator.

Notice this is a stop-and-reverse strategy. Put another way, it's constantly switching between long and short.

vSignal = Gap_Momentum(iPeriod, iSignalPeriod);
// Trading logic based on the signal
if (marketposition <= 0 and vSignal > vSignal[iSignalTrigger]) then
begin
   Buy to cover all shares next bar on open; // Close short positions
   if (iLSB=1) or (iLSB=0) then
      Buy next bar on open; // Open long positions
end
else if (marketposition >= 0 and vSignal < vSignal[iSignalTrigger]) then
begin
   Sell all shares next bar on open; // Close long positions
   if (iLSB=-1) or (iLSB=0) then
      Sell short next bar on open; // Open short positions if allowed
end;

Step 4: Testing and Optimization

Finally, we test the strategy in various future markets to evaluate its performance. This involves running the script on historical data, which we'll do in the next section.

Testing the Strategy on Futures Markets

I will test this concept on the @ES, @GC, and @CL markets. I like to trade these markets and should provide a decent representation of the Gap Momentum concept.

I'm going to create three charts for each of our three markets to test with the following settings:

  • In-Sample History: 2006-2021
  • Out-of-Sample History: 2022-June 25, 2024
  • Timeframe: Daily Bars
  • Slippage and Commissions: $0
  • Maximum Bars: 200

I will then optimize the following Gap Momentum strategies across the following input ranges:

  • iPeriod: 5 to 60 in steps of 5
  • iSignalPeriod: 5 to 100 in steps of 5
  • iSignalTrigger: 1 to 10 in steps of 1
  • iLSB: -1 to 1 in steps of 1

After I optimize the in-sample historical data, I will apply the best settings to the out-of-sample data. This will give us a more realistic look at the performance.

Results of the Gap Momentum

@ES Market Results

It is not too surprising that the optimizer picked the long side as the best-performing. We see this constantly as the stock index markets have a historical long-side bias.  Below are the optimized results applied to the out-of-sample data segment. 

ES out-of-sample

ES out-of-sample

@GC Market Results

For the gold market, we're taking both long a short trades. However, the long side does appear stronger. This market appears to be the best performing with the Gap Momentum indicator. 

GC out-of-sample

GC out-of-sample


@CL Market Results

The crude oil market is also taking both long and short trades. The first thing I noticed was moving to the out-of-sample did very poorly. Virtually no net profit and huge drawdown.

GC out-of-sample

GC out-of-sample


@ES (Long)

@GC (Long/Short)

@CL (Long/Short)

Net Profit

$29,075

$53,620

$5,060

Profit Factor

1.25

1.56

1.02

Total Trades

87

60

173

Avg.Trade Net Profit

$234

$893

$29

Max Drawdown

$41,637

$25,530

$79,930

NP vs. DD

0.7

2.1

0.1

Summary Results of the Gap Momentum

Keep in mind these are not trading systems! This is a market study to test the potential value of using a Gap Momentum indicator in my trading. 

Overall, I'm not overly impressed with the results, but I will add it to my toolbox as it shows some promise.

Practical Application for Traders

How might you use Gap Momentum?

Understanding the theoretical foundation and implementation of the Gap Momentum strategy is just the beginning. To truly harness its potential, it is crucial to explore practical applications that can be seamlessly integrated into your trading routine. 

The Gap Momentum could be used as a filter for existing strategies. For example, when the gap ratio is climbing, this would be seen as a time to take long trades. If it's falling, this is a time to go short to halt trading. Below are more detailed examples.

Intraday Trading: You could use the Gap Momentum strategy to identify a bias in the market and focus on intraday price movements. If the Gap Momentum is rising, you look for intraday-long opportunities.

Swing Trading: For those who prefer holding positions for several days, the Gap Momentum strategy might help identify short-term trends and potential reversals, providing entry and exit signals based on accumulated gap data.

Risk Management: The strategy can be integrated into a broader framework. With gap momentum signals, traders can set more informed stop-loss levels and manage position sizes to reduce exposure during volatile market conditions.

Supplementing Technical Analysis: Gap Momentum can be used alongside other technical indicators to confirm signals. For example, traders might use it to validate signals from moving averages, RSI, or MACD, enhancing overall decision-making.

Volatility Trading: Traders can use the strategy to take advantage of periods of high volatility, where gaps are more prevalent. By focusing on markets and times when gaps are common, they can exploit these opportunities for potential profits.

Key Takeaways

In this article, we delved into the gap momentum trading. Here are the key takeaways:

  1. Understanding Gap Momentum:
    • Gap momentum trading leverages the differences between today's opening price and yesterday's closing price to gauge market momentum.
    • The strategy draws inspiration from J. Welles Wilder and Joseph Granville’s On-Balance Volume (OBV) method, incorporating their insights into a modern trading approach.
  2. Calculating Gap Momentum:
    • Positive and negative gaps are accumulated over a specified period to calculate a gap ratio.
    • This gap ratio, when smoothed with a moving average, forms the gap momentum indicator used for generating trading signals.
  3. Implementing the Strategy:
    • We provided a detailed EasyLanguage script to calculate the gap momentum indicator and generate buy/sell signals.
    • The strategy involves defining inputs and variables, calculating gaps, computing the gap ratio, smoothing the indicator, and implementing trading logic based on the signal.
  4. Testing and Results:
    • The strategy was tested on various futures markets, including the E-mini S&P 500 (@ES), Gold (@GC), and Crude Oil (@CL).
    • Optimization of input parameters was conducted to evaluate performance, and results were analyzed for both in-sample and out-of-sample data.
  5. Practical Applications:
    • The Gap Momentum strategy might act as a primary single for a trading system. Other stops, target and exits will need to be explored.
    • The Gap Momentum indicator may act as a filter for strategies locating potential bias (long/short) in a given market. This how I plan on using the Gap Momentum indicator in my own trading.

By integrating the Gap Momentum strategy into your trading routine, you can potentially enhance your ability to filter the over all market bias (long/short) allowing you to generate better trading signals.

I plan on adding Gap Momentum as part of my testing process. In particular I'm looking at using it as a Regime Filter.

As always, continuous testing is required.

]]>
https://easylanguagemastery.com/getting-started/evaluating-gap-momentum-in-futures-markets/feed/ 0
Capture The Big Moves! (Updated 2023) https://easylanguagemastery.com/indicators/capture-the-big-moves/?utm_source=rss&utm_medium=rss&utm_campaign=capture-the-big-moves https://easylanguagemastery.com/indicators/capture-the-big-moves/#comments Mon, 03 Jul 2023 10:00:00 +0000 http://systemtradersuccess.com/?p=153

Wouldn’t it be great to have an indicator that will help tell you when you are in a major bull or bear market? Imagine if you had a clear signal to exit the market on January 19, 2008 before the major market crash. Then the same indicator told you when to get back into the market on August 15, 2009. Such an indicator would have also gotten you out of the market during the dot-com crash on November 11, 2000. Well, this indicator I’m going to talk about does just that.

Below you will also find the EasyLanguage code for this indicator. This major trend indicator was inspired by an article entitled, Combining RSI With RSI” by Peter Konner, and it appeared in the January 2011 issue of Technical Analysis of Stocks and Commodities.

How It Works

We will start with a well-known indicator: the Relative Strength Indicator (RSI). The goal is to identify major bull market and bear market regimes. In his article, Peter does this by simply using an RSI indicator on a weekly chart and identifying two unique thresholds. Peter noticed that during bull markets, the RSI rarely goes below the value of 40.

On the other hand, during a bear market, the RSI rarely rises above the value of 60. Thus, when the RSI crosses these thresholds, you can determine the beginning and end of bull/bear markets.

For example, in the bear market during the financial crisis of 2008, the weekly RSI indicator did not rise above 60 until August of 2009. This signaled the start of a new bull trend. The next bear trend will be signaled when the weekly RSI falls below 40.

With these simple rules, you can determine bull and bear markets for the S&P cash index market.

  • Bull Markets RSI Often Above 60
  • Bear Markets RSI Often Below 40

The two images below display a weekly chart. Below the price is a second pane with a 12-period RSI. Why a 12-period RSI? I chose that number because it represents a quarter of a year of trading if you figure four weeks in a month. There was nothing optimized about this number. It just seemed to be a logical starting point. Other lookback values will produce very similar results.

In the image below (click to enlarge), you will see the RSI signal stays above the 40 level during the strong bull market of the 1990s.

In the image below (click to enlarge) you will see the RSI signal stays below the 60 level during the strong bear market in the financial crisis of 2007-2009.

As you can see the RSI appears to do a fairly decent job of dividing the market into bull and bear regimes. You will also notice the RSI indicator paints red when it goes below 40, and only returns to a light blue when it rises above 60. It is these critical thresholds which highlight a significant turning point in the market that may be occurring.

Testing Lookback Periods

I’m curious to see how well this strategy holds up over various lookback periods. A strategy should be robust enough to produce solid results over different lookback periods. To test this aspect of the strategy, I will use TradeStation’s optimization feature to optimize the lookback period over the values 2-24.

The first chart is the lookback period (x-axis) vs. the net profit (y-axis).

Lookback Period vs Net Profit

The above chart shows rising profit as the lookback period increased from 2 to 10. Then the growth slows down. You can make a case for a stable region between 9 and 24; the midpoint is about 16. Feel free to experiment on your own and pick a different value. The main point here is this: all the values produce positive results, and a wide range of values at the upper end of our scale generate excellent results. This makes me believe that this indicator is robust in signaling significant market changes.

Testing Environment

I decided to test the strategy on the S&P cash index going back to 1960. The following assumptions were made:

  • Starting account size of $100,000.
  • Dates tested are from 1960 through August 2020.
  • The number of shares traded will be based on volatility estimation and risking no more than $5,000 per trade.
  • Volatility is estimated with a three times 20-week 40 ATR calculation. This is done to normalize the amount of risk per trade.
  • The P&L is not accumulated to the starting equity.
  • There are no deductions for commissions and slippage.
  • No stops were used.

Results

Applying this to the S&P cash index we get the following overall results.

CaptureBigMovesPerformance_2022_06_13

Capture Big Moves Performance 2022-06-13

Notice the short side loses money. I would guess this tells us over the life of the market, there is a strong upside bias. Below is the equity curve.

Capture Big Moves EQ Graph 2022-06-13

Capture Big Moves EQ Graph 2022-06-13

Using this indicator, we come up with the following turning points for significant bull and bear markets for the US indices. The blowup of the dot-com bubble happened in 2000, and we got out on October 14, 2000. The indicator then told us to go long on May 10, 2003. We then ride this all the way up to the financial crisis getting out of the market on January 12, 2008. Then on June 15, 2009, we went long. Overall, not too bad!

Does It Work Today?

Here is what the strategy looks like when applied to the price chart over the past few years. I also painted the price bars based on the RSI signal. Light blue price bars mean we are in a bull market, and red price bars represent a bear market.

Capture The Big Moves Recent Current Signal 2023-06-29

Capture The Big Moves Recent Current Signal 2023-06-29

The price action of 2019 and 2020 (Covid-19 Event) saw a sharp selloff, resulting in this indicator reacting slowly from a Bull-to-Bear transition. So, this strategy lost money on the long side and short side. Classic whipsaw behavior.

Will these sudden sell-offs and sharp rebounds continue into the future? I really don't know. But let's look at the most recent sell signal in 2022.

Sell Signal March 5, 2022

This signal resulted in booking a profit from the long trade. At the time of this writing in June of 2022, this looks like a reasonable exit point if the market continues to fall over the coming months. But we don't know what will happen at this point.

Buy Signal June 16, 2023

This signal resultsed in a loss on the short side. The downturn in the market which triggered and sell signal that started on March 5, 2022 turned out to be rather shallow.

Capture The Big Moves Recent Signals 2023-06-29

Capture The Big Moves Recent Signals 2023-06-29

How can this be used in your trading?

Perhaps you can use this as a basis for a long-term swing strategy. For example, maybe this is an indicator to let you know when to go long or liquidate your long positions within your 401(k) and other retirement accounts.

Keep in mind that short trades are not profitable. In my opinion, you're better off stepping aside during these short times. That is, close long positions and move to cash without attempting to short. Nothing wrong with being on the sidelines.

The strength of such a system is not in how much money you can make compared to buying and holding. The strength is avoiding drawdowns and providing a mechanism to start buying back into the market, so you don't miss the next bull market.

Or perhaps if you are a discretionary trader, you can use this to focus on taking trades in the primary direction of the indicator. Maybe when the RSI indicator signals a bull market, you may want to view this as another confirmation or green light to pursue whatever investment strategy you prefer. I thought it was an exciting and novel way to look at the RSI indicator.

Of course, we only have 59 signals since 1960. This is hardly a representative sample if we are talking about statistics. However, given the robust nature of the lookback period and the rising equity curve since 1960, this indicator may be worth keeping an eye on.

Where Are We Now?


Bull Market Signal Since June 16, 2023


Recent market behavior as we go into the Summer of 2023 is signaling Bull Market. The signal was triggered on the week of June 16, 2023What do you think? Is a new bull marketing forming? Will it last?


]]>
https://easylanguagemastery.com/indicators/capture-the-big-moves/feed/ 27
Can A Price Pattern Beat an Indicator? https://easylanguagemastery.com/indicators/price-pattern-or-indicator/?utm_source=rss&utm_medium=rss&utm_campaign=price-pattern-or-indicator https://easylanguagemastery.com/indicators/price-pattern-or-indicator/#comments Mon, 27 Sep 2021 10:00:16 +0000 http://systemtradersuccess.com/?p=7696

I've seen people use simple price action patterns in place of inicators. For example,  Larry Connors and Cesar Alvarez really popularized the 2-period RSI. It works really well when createing mean-reversion strategies on the stock index markets. However, can you find a simple price pattern that will work just as well?

Here is an idea, losing streaks, as an indicaor. For example, a two-day losing streak indicator simply buys the market after two consecutive losing days. Lets put it to the test. I’m going to focus on a longer term study of this indicator within the future’s market (ES). Free EasyLanguage code will be provided at the conclusion of this article.

Mean Reversion

As a reminder, the traditional two-period RSI indicator (RSI(2)) is an indicator we have used many times on this website. So I will not spend much time talking about it within this article. Overall, it’s primarily used on the stock index markets such as the S&P, as a method to determine an entry point for a mean reverting trading models. You can read more about the RSI(2) indicator and the trading models built from it by reviewing these articles:

Two-Day Losing Streak Indicator

I’m going to use EasyLanguage in order to build a strategy to test the effectiveness of this indicator. Again, the indicator simply highlights when the market has two consecutive losing days. To build this simple indicator I’m going to assume that a losing day is defined when the market closes below its open. We sell our position when we have just the opposite condition, a two-day winning streak.

The trading rules provided in the original article are:

  • Buy at the open of next day if 2-Day Losing Streak
  • Sell at the open of next day if 2-Day Winning Streak

The EasyLanguage code for the basic strategy will look something like this:

Variables:
BuySignal(false),
SellSignal(false);
BuySignal = ( Close < Open ) And ( Close[1] < Open[1] );
SellSignal = ( Close > Open ) And ( Close[1] > Open[1] );
If ( BuySignal ) then Buy("LE") next bar at market;
If ( SellSignal ) then Sell("LX") next bar at market;

Testing Environment

Because you, the reader might want to build a trading model based upon this indicator, I’m going to break the historical data into two portions. An in-sample portion and out-of-sample portion. I will perform my testing for this article on the in-sample portion only. Thus, when I’m finished with my testing we’ll still have a good amount of data which can be used for out-of-sample testing.

Before getting into the details of the results, let me say this: All the tests within this article are going to use the following assumptions:

  • Starting account size of $25,000
  • In-sample dates are from 1998 through December 31, 2012
  • One contract was traded per signal
  • $30 was deducted per round-trip for slippage and commissions

Baseline Results

Below is the baseline results over our in-sample historical segment. The maximum drawdown is a percentage of our starting equity, which is $25,000. Keep in mind that this study has no stops, thus some positions will hold through some very deep pullbacks before exiting. Again, we are testing the performance of an indicator at this point – not a trading model.

Losing Streak

Baseline

Net Profit

$25,800

Profit Factor

1.17

Total Trades

300

%Winners

63%

Avg.Trade Net Profit

$86.00

Annual Rate of Return

4.89%

Max Drawdown(Intraday)

79%

Longer Losing Streak

The first thing that I noticed in a two-day losing streak may not be deep enough. Two-day pullbacks are somewhat common. As pointed out in the original article, over the past few years a two-day pullback has been a great pattern. Market pullbacks have been shallow and these shallow pullbacks have been great entry points. But what about helping to ensure this indicator will work under different conditions?  Testing three or four days consecutive losing days may generate more profitable and/or tradable results.

For past experience I know, in general, deeper pullbacks may provide a better profit vs risk. That is, the generated signals will be fewer in number but will also provide better rewards. So I modified the code and generated the following results based upon the number of days required in the losing streak before opening a new position. During this testing I did not modify the exit rules. They remained the same with two consecutive winning days acting as the exit trigger.

Losing Streak

Baseline

3 Days

4 Days

Net Profit

$25,800

$32,290

$31,925

Profit Factor

1.17

1.37

1.83

Total Trades

300

177

85

% Winners

63%

64%

71%

Avg.Trade Net Profit

$86.00

$182.43

$375.59

Annual Rate of Return

4.89%

5.72%

5.67%

Max Drawdown (Intraday)

79%

66%

64%

As expected we see the number of trades decreases and the average profit per trade increases as we increase the number of losing days. Deeper pullbacks happen less often, but have larger payouts. The four-day losing streak has only 85 trades so I’m going to use the three-day losing streak during the remainder of my testing. This is a good compromise as a three-day pullback does appear to eliminate many shallow and unproductive pullbacks. Below is the equity graph for the three-day losing streak.

Bull/Bear Regime Filter

The next characteristic to explore is the difference between a bull and bear market. I’ll divide the market into two regimes based upon a 200-day simple moving average. The market will be “bullish” when price is trading above the 200-day SMA. The market will be “bearish” when price is below this moving average. Below is the results of the indicator in each of these regimes.

Losing Streak Regime Streak

Bull Only

Bear Only

Net Profit

$14,542

$29,530

Profit Factor

1.39

1.57

Total Trades

94

94

% Winners

69%

62%

Avg.Trade Net Profit

$154.71

$314.15

Annual Rate of Return

3.16%

5.38%

Max Drawdown (Intraday)

54%

73%

Surprisingly, at least to me, we see better performance with the bear market. Overall, both the bull and bear regimes are profitable. The bear regime does suffer from larger drawdowns but it also has the biggest rewards. Notice that both regimes also have the same number of trades. I checked this a couple of times and it does appear to be correct. Given this result, I will not include a regime filter as we test our final modification I wish to test.

5-Day SMA Exit

The 5-Day SMA Exit closes a position once price closes above a 5-day simple moving average. This exit is often used with the RSI(2) system and it’s worth testing here as well. Below are the results of this test vs our baseline. As a reminder, the Baseline column represents the 3-day losing streak with a 2-day exit.

Losing Streak Exit Test

Baseline

SMA Exit

Net Profit

$32,290

$43,475

Profit Factor

1.37

1.68

Total Trades

177

205

% Winners

64%

67%

Avg.Trade Net Profit

$182.43

$212.07

Annual Rate of Return

5.72%

6.95%

Max Drawdown (Intraday)

66%

30%

The power of a good exit! By changing the exit to our 5-day simple moving average we have significantly improved the performance. All metrics have improved. Notice the significant reduction in drawdown. This is huge.

So how does this hold up against the 2-period RSI indicator? Let’s see…

RSI(2) vs Losing Streak

Below is the results of using a two-period RSI with a threshold of 10 vs our 3-day losing streak. Both methods exit when price crosses the 5-day SMA.

Losing Streak vs RSI(2)

Baseline

RSI(2)

Net Profit

Cell

$45,960

Profit Factor

1.68

1.68

Total Trades

205

183

% Winners

67%

68%

Avg.Trade Net Profit

$212.07

$251.15

Annual Rate of Return

6.95%

7.19%

Max Drawdown (Intraday)

30%

68%

So which one is better? They are very similar in most of the metrics. The maximum drawdown is a lot higher with the RSI(2) system. Again, neither of these tests utilize a stop.

Overall, these are very interesting results. It looks like a simple price pattern could be used as an effective replacement for a short-term indicator. I encourage you to perform your own testing to see if this simple price pattern indicator could be used in your own trading. Maybe you can test what happens if you combine the price pattern with the RSI.  Below you will find the EasyLanguage code for code used in this study.

]]>
https://easylanguagemastery.com/indicators/price-pattern-or-indicator/feed/ 3
Will A Synthetic VIX Help Your Trading? https://easylanguagemastery.com/indicators/will-a-synthetic-vix-help-your-trading/?utm_source=rss&utm_medium=rss&utm_campaign=will-a-synthetic-vix-help-your-trading https://easylanguagemastery.com/indicators/will-a-synthetic-vix-help-your-trading/#comments Mon, 24 May 2021 10:00:00 +0000 http://easylanguagemastery.com/?p=18022

On a recent discussion on our EasyLanguage Mastery FaceBook group, a reader pointed out an interesting indicator called, VIX Fix. The VIX Fix was designed by Larry Williams to overcome the limitations of the VIX. What would that be? It's only available for the S&P 500, Nasdaq Composite, and DJIA. But what about the other markets?

Larry created a simulated or synthetic VIX to be used on other markets. This indicator was originally published in Active Trader, 2007. Below is the formula:

VIX Fix = (Highest (Close,22) – Low) / (Highest (Close,22)) * 100

The formula uses the price of the market to estimate volatility. To calculate it, you find the highest close of the past 22 bars and then subtract the low of the current bar. The result is divided by the highest close of the last 22 bars. Finally, the result is multiplied by 100 to scale the indicator readings. Williams chose the 22-day period because, like the VIX, it represents the maximum number of trading days in a month.

What does it look like?

I coded up this indicator and placed it on a chart of the S&P. I then added the Synthetic VIX and the real VIX. Thus, we can now compare the real VIX vs our synthetic VIX. The chart below is of the S&P futures (in green). Below it is our Synthetic VIX (in red). Finally, at the bottom is the real VIX (in orange).

So the Synthetic VIX looks like a fairly good representation. You can see that our Synthetic VIX follows the traditional VIX closely. We see VIX extremes tend to coincide with price lows. This makes sense as fear rises as the market plunges. As pointed out in the original article, fear is a strong emotion so you can clearly see buying opportunities as the Synthetic VIX spikes. Selling opportunities are a bit more difficult to discern.

Let's build a simple strategy based on the Synthetic VIX just to see how well it can capture buy and sell short opportunities.

Normalizing With Percent Rank

Before we build our strategy I want to first normalize the Synthetic VIX values. You will notice they are unbound, thus it's a bit more difficult to determine buy and sell signals. To fix this I'm going to use TradeStation's built-in function called, Percent Rank. This function can be used to evaluate the relative standing of a value within a data set. It does this by ranking today's Synthetic VIX value compared to the recent past.

Using the Percent Rank function generates a ranged value in the form of a percentage between 0 and 100. This makes it easier to locate our buy/sell signals.

VixFix = VIX_Fix( 22 );
Intportion( percentrank(VixFix, VixFix, 44 ) * 100);

In the code above, we are first computing our Synthetic VIX value by using our custom function, VIX_Fix with a look back of 22. Next, we use the Percent Rank function to rank the current Synthetic VIX value against the last 44 values. I chose 44 because it's simply a doubling of the default 22 lookback period of our Synthetic VIX function. Thus, our percent ranking of today's Synthetic VIX value will be ranked against the past 44 values in our data set. The percent rank is a percentage as a decimal number. I then multiply this number by 100 and drop the fraction (IntPortion function) to give us an integer between 0 and 100.

System Rules

  • Go long when the ranked Synthetic VIX value is above 95%.
  • Go short when the ranked Synthetic VIX value is below 5%.

Environmental Settings

I coded the above rules in EasyLanguage and tested it on the E-mini S&P futures market going back to 1998. Before getting into the details of the results let me say this: All the tests within this article are going to use the following assumptions:

  • Starting account size of $25,000
  • Dates tested are from January 1, 2000 through December 31, 2018
  • One contract was traded for each signal
  • The P&L is not accumulated to the starting equity
  • No deductions for slippage and commissions
  • There are no stops

We can see this indicator does pick the low points in price rather well. While there are some well-timed short trades in the image above, overall the sell side signals are not great. You can see that by looking at the performance report below. This fact is not too surprising when you have a long bias in the S&P.

Looking at this type of indicator it reminds me of the 2-Period RSI strategy I've worked on in other articles because we are doing something similar. That is, looking to fade price extremes. But with the 2-period RSI strategy, we used a short term exit based upon price crossing a 5-day moving average. Let's try that here.

SellSignal = Close > Average( Close, 5 );
CoverSignal = Close < Average( Close, 5 );
If ( SellSignal ) then Sell next bar at market;
If (CoverSignal ) then Buytocover next bar at market;

Below is an example of the short trades and it does a decent job of locating short-term opportunities.

This simple indicator worked well enough to actually show a small profit on the short side which is difficult to do on the S&P. This tells me that this indicator may very well be helpful in building a profitable trading system.

I've not tested this indicator on other markets such as gold or oil. Nor have I experimented much with testing other filters and exits. But I'm pleased with what I've seen given the first few tests on the S&P. So, can you use this in your trading? It may be worth your time to perform some tests.

You can download a copy of this indicator within our EasyLanguage Mastery Insider subscriber's area. Not a member? It's free when you join our email list! So worth it! 🙂

Also, join the discussion on our private Facebook Group. Discussions on this indicator and other conversations are happening right now. So join us!

]]>
https://easylanguagemastery.com/indicators/will-a-synthetic-vix-help-your-trading/feed/ 6
A Flexible Trailing Stop Function https://easylanguagemastery.com/development-tools/a-flexible-trailing-stop-function/?utm_source=rss&utm_medium=rss&utm_campaign=a-flexible-trailing-stop-function https://easylanguagemastery.com/development-tools/a-flexible-trailing-stop-function/#comments Mon, 17 Feb 2020 11:00:24 +0000 http://systemtradersuccess.com/?p=2882

The Anatomy of a Stop

A stop can be defined by specifying four basic parameters, illustrated in Figure 1 below:

Price Reference: The price from which the stop is offset (white line) to create a stop value.

Stop Offset: The distance from the Price Reference to the stop value.

Price Trigger: The value of price that will trigger the stop. Usually this is the low or the high of a price bar. However, more sophisticated stops can be created by setting the trigger to a custom function of price, such as Average(Low, 3) to make the stop less vulnerable to isolated tall tails.

Reset Padding: The distance the stop should be reset away from the Price Trigger when the stop has been hit. Resetting the stop level serves two purposes: (1) it is much easier to see when a stop is hit, especially when the price trigger comes very close to but not quite touches the stop level, and (2) if a trade is re-entered in the same direction after stopping out, this reset padding can serve as the initial stop loss.

With these parameters defined, the following stop values can be calculated:

Stop Value: The value of the stop (yellow line). The stop is hit when the Price Trigger touches or crosses the Stop Value.

Ratchet Stop Value: The value of the ratchet stop (red line) is the Stop Value when it is constrained to move only in the direction toward the price action. The ratchet stop is hit when the Price Trigger touches or crosses the Ratchet Stop Value.

Fig. 1. Chandelier 5% Ratchet Trailing Stop (red line).

Fig. 1. Chandelier 5% Ratchet Trailing Stop (red line).

In this case, the Price Reference is the high of the bar, shown in white. The Stop Value is the yellow line, a distance of 5% below the Price Reference. The red line is the ratchet stop, which is the Stop Value constrained to always move in a direction closer to the price and never away from the price (unless the stop is hit and reset). The Price Trigger is the low of the bar. The cyan dots indicate the points at which the Price Trigger has crossed below the Ratchet Stop Value, triggering the stop.

Generating Many Stops from a Single Function (or Method)

By manipulating the four basic parameters that define a stop, a multitude of different stops can be generated:

Price Reference can be defined to be the highlow, or average price of a bar. It could also be defined as some custom function of price, such as a Linear Regression function of price.

Stop Offset can be defined in terms of pointsprice percentageATR units, or some custom function of price or volatility.

Trigger Price is usually set to the last trading price or the closing price for the bar. However, an alternative definition based on a custom formula of price, such as Average (Avgprice, 2), can be used to make the stop less vulnerable to tall tails and isolated bars extending beyond historical support or resistance.

Stop Directional Constraints can allow the stop to vary up and down, as in a yo-yo stop, or can force the stop to move only in a direction toward the current price, as in a ratchet stop.

Each unique type of stop could be coded into a separate function. However, since much of the code in each of these functions would be duplicated it makes sense to create a single unified stop generating function that could specify any type of stop by manipulating its input parameters. This would serve to reduce coding errors and encourage consistency when using stops in indicators and strategies. There is, however, an even greater motivation for using such a function. When used to generate stops within strategies, the optimizer could vary not only the value of the stop, but the type of stop as well, to determine which type of stop extracts the greatest profit from a trading system. It is with these goals in mind that the superfunction (or method), StopsFlexible was created. This single function (or method) can be used to create almost any type of stop desired.

Advantages of Using Function: StopsFlexible

  1. Coding duplication is markedly reduced, lessening the possibility of errors and making code maintenance more efficient.
  2. When used in a chart, the type of stop can be varied by simply changing an input parameter. This is more convenient than manually locating and inserting a new indicator from a large collection of stop indicators.
  3. Indicators using function StopsFlexible can display the differences in behavior of several different types of stops simultaneously, giving the user a graphical representation of each on the chart and visually revealing their unique behaviors. Such a graphical comparison assists in the selection of the most appropriate stop without the need for formal backtesting.
  4. When used in a strategy, optimization can exercise many types of stops using StopsFlexible, not just a single type of stop. In this manner, the best type of stop can be determined for the trading system being tested rather than only varying the “distance” of a single type of stop from the price reference.
  5. Blended Stops can easily be created. For example, one blended stop could be the sum of 1% of price plus 1.5 ATR units. Optimization can test blended stops efficiently to determine if the unique characteristics of blended stops can extract more profit from a trading system than traditional stops.

Advantages of Converting the Function: StopsFlexible to a Method

The function StopsFlexible is a series function, not a simple function. Therefore, when called by an indicator or strategy formatted, “Update each tick”, the function MUST execute with every tick, even if it is desirable to re-calculate only once per bar. Bracketing the call to the function with If BarStatus(1) = 2 condition, will NOT prevent a series function from executing with each tick, since this is the behavior of all series function within EasyLanguage. Since the calculation in StopsFlexible needs to occur only once per bar, the inefficiency forced upon the programmer by using a series function can be eliminated by recoding the function as a Method. Method calls, in contrast to series function calls, CAN be restricted to occur only once per bar when the indicator or strategy must be formatted to “Update each tick”. This technique is used in the current version of indicator StopsFlexible, bracketing the method StopsFlexible call by an If BarStatus(1) = 2 condition.

More Sophisticated Stops

Reference Point for a Stop. Although the reference point for a trailing stop is usually defined as the high of the bar for long trades, there is nothing that prevents an alternative definition. For example, the reference point could be the Low rather than the High of the bar. This would make the stop less sensitive to unusually tall bars or tall tails which might pull the stop up abruptly and cause a trade to stop out of a continuing trend prematurely. An alternative approach to make the stop movement less sensitive to bars with “tall tails” would be to define a chandelier stop to be based on the reference point of Average(high, length) or MinList(high, high[1]) rather than simply the high of the bar. More sophisticated stops may be created by referencing them to custom functions of price, such as linear regression or Kaufman Adaptive Moving Average of the price. 

Stop Offset Variations. In addition to stop offsets being based on points, price percentage, and ATR units, other offset definitions are possible. For example, blended stops formed by adding a price percentage offset and an ATR unit offset can be created, inheriting some of the characteristics of each. Such blended stops can be optimized to extract additional profit from trading systems. Stops can also be made to react dynamically to the acceleration of price movement by tightening the stop to capture additional profit in the event of rapid price thrust before a significant price retracement can occur. Stops can also use custom volatility functions, such as Standard Error, in place of the standard ATR unit, as illustrated below:

Figure 2. 6 StdErr Trailing Stop vs 1.5 ATR Trailing Stop.

Figure 2. 6 StdErr Trailing Stop vs 1.5 ATR Trailing Stop.

Why choose Standard Error? The goal here is to tighten the stop whenever the price moves in a very well behaved trend for at least n-bars. Well behaved, in this case, means a consistent trend with low volatility. The StdError(Price, N) function measures the degree to which price deviates from a linear regression line through the most recent “n” price bars. Notice that the minimums of the StdError function above (yellow arrows) correspond to intervals when the price moved in a consistent trend with low volatility for a period of at least 6 bars. A high standard error indicates that the price action is not moving consistently along a straight linear regression line, and maximums in the standard error typically occur at points where the trend abruptly changes direction. You can also see at each relative minimum in the StdError function value, the 6 StdError Trailing Stop tightened while the 1.5 ATR Trailing Stop remained about the same distance from the price. The StdError Trailing Stop can squeeze a few more dollars out of a trend trade, as shown in the three instances illustrated above, as it will tighten further after a consistent price move has occurred.

Trigger Reference Modification. Instead of using the last trade price or the low of the bar as a trigger for a stop, a custom trigger reference could be created as an input parameter to StopsFlexible. The screen shot to the right shows a Trigger Reference (white line) defined as Average(AvgPrice, 2). This moving average must hit the stop level to trigger the stop. Note that the bar crossing the ratchet trailing stop (red line) did NOT trigger the stop. This is an example of a custom trigger reference that makes the stop less sensitive to isolated bars extending just below or above a historical level of support or resistance. Such a trigger definition might be useful when using a stop order for a breakout entry, either long or short. It prevents an isolated tall tail from triggering a stop prematurely and protects to some extent against stop running and head fakes by larger traders.

StopsFlexible Indicator Input Parameters

HighRef is the Price Reference for the high stop (positioned above the price). LowRef is the Price Reference for the low stop (positioned below the price). Length is used to delay changes in the price reference by “Length” bars by adjusting the HighRef and LowRef values to MaxList(high, Length) and MinList(low, Length), respectively. UseKAMA is used to apply a KAMA (Kaufman Adaptive Moving Average) filter to HighRef and LowRef values. Default value is false.

EffRatioLength, FastAvgLength, and SlowAvgLength are all parameters that determine the degree of KAMA filtering. StopOffset is the offset to the bar used to calculate the stop for the current bar. Usually should be set = 1 (since strategy orders use the format: Buy/Sell NEXT bar at Value Limit). TradeDir indicates if stops will be displayed below the price (+1), above the price (-1), or both (0). Similarly, AlertDir indicates if the corresponding low (+1), high (-1), or both (0) stops will generate an alert.

ATRLengthJATRLength, and StdErrLength are the lengths used to calculate the Average True Range, Jurik Average True Range, and Standard Error.

StopPtsStopPctStopATRStopJurikATR, and StopStdErr are the multipliers used for the stop offset expressed in points, price percentage, ATR units, Jurik ATR units, and standard error units, respectively. All specified values are calculated and added together to form the final stop value. For example, to create a pure 2 ATR stop, StopATR should be 2 and all other values 0. To create a stop that is a blend of 1 ATR unit and 1%, set StopATR = 1, StopPct = 1 and all other values to 0. HighRefTrig and LowRefTrig are the price references triggering the stop. Normally, HighRefTrig = high and LowRefTrigger = low indicating the high or low of the bar will trigger stops above and below the price, respectively. SmoothTrigRef is the length of the simple moving average applied to the HighRefTrig and LowRefTrig values. ResetPtsResetPctResetATRResetJATR, and ResetStdErr are the amounts the stop will be offset each time it is hit. Moving the stop value when hit makes it easier to determine if a stop that comes very close to the low or high of a bar was hit or not. 

ShowRefShowStopsShowRatchetShowRefTrigger, and ShowStopTriggered are set to true or false to indicate whether these values are to be displayed on the chart. PlotWidth indicates the width of all lines plotted. UsePlotWidth indicates whether the PlotWidth value will be used, or if the user will be free to specify line formatting manually. ShowHitsOffsetATR is the amount of vertical offset (in ATR units) the ShowMe dot, indicating a stop has been hit, will be displayed. This offset moves the dot away from the price action to make it more easily visible. If ShowHitsOffsetATR = 0, then the dot appears at the HighRefTrig or LowRefTrig value. NOTE: The Jurik moving average function used to calculate the Jurik Average True Range is disabled in StopsFlexible, as this is a third party add-in that must be purchased from Jurik Research. Those users that have purchased this add-in may uncomment out the appropriate section of code.

Downloads

The download package is a zip file that contains the following three EasyLanguage files:

  1. StopFlexable Indicator
  2. StopFlexable Function
  3. StopFlexable Method

StopFlexable Zip File 

— by Mark Krisburg from HighTick Trading. Do you have a custom indicator or function you would like to use, but don’t have the programming experience to create it? We provide custom programming services, as well as a variety of useful add-on functions and screening tools to find profitable trades in any market condition, while controlling risk.

]]>
https://easylanguagemastery.com/development-tools/a-flexible-trailing-stop-function/feed/ 7
Testing the Sell RSI Indicator​ https://easylanguagemastery.com/indicators/testing-the-sell-rsi-indicator/?utm_source=rss&utm_medium=rss&utm_campaign=testing-the-sell-rsi-indicator https://easylanguagemastery.com/indicators/testing-the-sell-rsi-indicator/#respond Mon, 29 Apr 2019 10:00:47 +0000 http://easylanguagemastery.com/?p=19741

In the February 2019 issue of Technical Analysis of Stock & Commodities appeared an article called, "Sell Relative Strength Index" by Howard Wang. He proposed a modified RSI indicator. He calls it the Sell RSI or sRSI for short. 

This indicator is attempting to quantify the strength of sell-offs vs. the size of accumulated profit. The idea is to generate a more timely exit than a standard RSI. Within the article, there is an excellent daily price graph demonstrating where exit signals generated for QQQ. Naturally, I would like to test sRSI to see if it has an advantage over some of my other exit techniques. So, lets put it to the test.

Testing The Buy/Sell Signals on Stock Indexes

First, I created a simple EasyLanguage strategy to test the buy and sell-short signals generated by this indicator. While the article implies this indicator is for generating sell signals, the author did highlight buy signals as well. So, let's measure how well both buy and sell-short signals do on some of the markets I like to trade.

Strategy Rules:

Based upon the charts in the article, buy/sell signals are generated when the sRSI calculation moves away from the centerline (yellow), which has a value of zero. The indicator code provided by the author defines a .05 buffer around the centerline. If the sRSI value is >= .05 the indicator is colored green. If the sRSI value is <= -.05, the indicator is colored red. Otherwise, the indicator is colored yellow.

Based on this, I’ve created the following Long/Short rules.

  • Buy when the sRSI values rise above .05
  • Sellshort when the sRSI value falls below -.05

There is only one input parameter, the length of the lookback period, and I used a value of 20. Below are the equity curves for @ES, @NQ, @YM and @EMD on a daily chart.

@ES

@NQ

@YM

@EMD

The indicator does OK on most of the indexes but not so great on @YM. I also noticed it was the short side that consistently lost money. This is not too surprising as shoring the stock index futures is more challenging to do. The long bias in the index markets over the decades makes trading on the long side a bit easier. Maybe a lot easier!

Overall, not too impressive. 

Testing Exit Signal on Stock Indexes

The title of this new indicator is "Sell RSI" so, let's use the signals from this indicator as a sell trigger.

In a previous article, I tested different exit methods of the Largurre RSI trading model, which does a fantastic job on the stock index markets. The Largurre RSI nails entry points, and the sRSI is supposed to do well on the exit. So let's test it. Before we do, you may want to review the previous article, Testing Laguerre RSI Entry and Exits, and the different exits we tested.

Testing Environment

Before getting into the details of the results, below are the testing assumptions used.

  • Starting account size of $100,000
  • In-sample dates are from 1998 through November 30, 2016
  • Commissions & Slippage not deducted
  • One contract traded per signal
  • Markets traded: ES

So, I coded the new sRSI exit and tested it with our Largurre RSI trading model. Below is a table that features the results for each of the different exits. Our new sRSI is the item tested, Type 6

Type 1

Type 2

Type 3

Type 4

Type 5

Type 6

Net Profit

$71,275

$24,888

($27,275)

$71,775

$85,625

$34,550

Profit Factor

1.82

1.23

0.80

1.67

2.39

1.42

Total Trades

119

118

119

118

183

107

%Winners

72%

62%

38%

72%

77%

38%

Avg.Trade Net Profit

$598.95

$210.91

($229.20)

$608.26

$467.90

$322.90

Return on Capital

71%

25%

(27%)

72%

85%

85%

Max Drawdown

$34,348

$62,475

$43,400

$41,838

$17,925

$38,950

As an exit indicator, the sRSI does really poor. Type 5 is a simple moving average exit which produces the best results. 

At this point, I stopped testing it for the stock index futures as it does not appear to hold much value. Of course, I may be misusing it, or it may do well with other markets and trading styles. However, for me, the sRSI as an entry or exit trigger does not look promising.

Sell RSI On Other Common Markets

Let's look at a few other markets. Let try gold, oil, U.S. bonds, Soybeans, and the euro. In this test, I'm going long with a buy signal and shorting on the sell signal. Thus, this is a stop-and-reverse type test.

 Below are the equity curve charts.

@GC

@CL

@S

@US

@EC

Conclusion

The Sell RSI indicator does not seem to hold much promise from the stock index futures. However, the @EC (Euro Futures) and @S (Soybeans) may hold some promise and may be worth exploring further. Again, this is using the default value of 20 for the lookback on the sRSI indicator for this test.

]]>
https://easylanguagemastery.com/indicators/testing-the-sell-rsi-indicator/feed/ 0
Equity Curve Indicators https://easylanguagemastery.com/indicators/equity-curve-indicators/?utm_source=rss&utm_medium=rss&utm_campaign=equity-curve-indicators https://easylanguagemastery.com/indicators/equity-curve-indicators/#comments Mon, 18 Jun 2012 10:00:15 +0000 http://eminiedges.com/wp/?p=188

The following two indicators are written in EasyLanguage and can be used in TradeStation and most likely, Multicharts. Presented here are two simple indicators to help you visualize your trading system open equity and daily equity. More importantly, the Open Equity Indicator has the ability to send you email notifications when a new position is opened, a current position is closed and upon the close of each bar. Email messages are designed to be sent for intra-day trading systems for those rare occasions when you must be away from your computer for short periods of time.

Daily Equity Curve Indicator

This indicator displays the “Daily” equity of any trade. Unlike the Open Equity Curve Indicator (see below) this indicator will keep a daily running total of your P&L. By default a green plot indicates a positive P&L and a red plot a negative P&L. This indicator does not take into account slippage or commissions. Furthermore, this indicator does not access your real trading account. It’s simply the theoretical equity curve of your system. The colors of the plot can be changed to your liking.

Open Equity Curve Indicator

This indicator displays the “open” equity of any trade. By default a green plot indicates a positive P&L and a red plot a negative P&L. This indicator does not take into account slippage or commissions. Just as the other indicator (see above) it does not access your trading account to get this information. It’s simply the theoretical equity curve of the trading system. The colors of the plot can be changed to your liking. This indicator also has the ability to send you email notifications. This feature is described below.

Email Notification

The Open Equity Curve Indicator also has the ability to send an email message when any of these events takes place:

  • Bar Close
  • New Position Opened
  • Current Position Closed
  • Number of Contracts Changes

When the email feature is activated, an email message is sent to any email address informing you of the number of contracts you have open and the open equity value. An email message is sent at the close of each bar. For example, on a 5-minute chart, every five minutes you will receive an email. If for some reason you stop receiving email messages you may want to call TradeStation to check your live account and/or to take your account flat. The email notification feature is designed to alert you when there maybe potential internet problems with your trading platform. However, it is highly recommended you never leave your trading system unattended.

Below is an image of the Equity Curve Open Indicator. You can see the first three inputs deal with the color of the equity curve plot. The next two inputs indicate the times when email alerts should be sent. In this example, email alerts will be sent between 7:45am and 11:05am Central.

The “Alerts” tab must also be configured properly in order to take advantage of the email alerts feature. For a more complete description on how to enable this feature, please watch the video near the bottom of this article.

Below is an example of the type of email message which will be generated and sent by the Open Equity Curve Indicator. In this example a new position has been opened. You can see on the Info: line it states a new position has been opened with one contract.

TradeStation : Chart Analysis Alert for @ECM12 by Intraday Open Equity(Green,Red,White,true,Yellow,Black,745,1105,”Contracts”,”Closed Equity:”)
Info: — OPEN TRADE — 05/29/2012 08:40 Contracts1 Closed Equity:262.50 Open Equity:0.00
Source: Intraday Open Equity(Green,Red,White,true,Yellow,Black,745,1105,”Contracts”,”Closed Equity:”)
Occurred: 5/29/2012 8:35:00 AM
Price: 1.2523

If you have any suggestions to improve this indicator, please leave your ideas in the comments below.

]]>
https://easylanguagemastery.com/indicators/equity-curve-indicators/feed/ 9