Posts Tagged ‘Sponsored_Indicator’

Sponsored Indicator: Cumulative Moving Average for Think or Swim

July 17, 2009

An anonymous donor requested a cumulative moving average indicator for Think or Swim that could start at a given date (on a daily chart) or start at a chosen time on a specific day for intraday charts. This donor suggested that I share it with everyone else, so here it is!

Basically, the code line:

CMA = totalSum(price)/barNumber()

can be used to get a quick cumulative average of all values on a chart. Kind of like a VWAP, but it’s not weighted by volume at all–each bar’s price value is weighted equally. But what if you want to start at some place inside the chart? You can use “if” statements to assign a new variable that contains “double.nan” if a bar is before your start date/time, and contains price values after the start conditions are met. Then you “totalsum” that variable. You also have to keep track of the bar number when you start recording data, since the first bar isn’t bar#1 anymore.

The indicator I wrote is smart enough to ignore the start time automatically if you are using a daily chart. Here’s a CMA on a daily chart of ES starting on the low day on Mar 6, 2009:

CumMovAvg_Daily

Here’s what it looks like if you start on July 14 2009 at 1030 ET on a 15 min chart:

CumMovAvg_Intraday

I also figured out a way to automatically reset the indicator each day for true intraday traders. If you enable this option, it ignores the start date and only cares about the start time (1030 ET in this example):

CumMovAvg_Reset

This indicator is provided free to all through the generosity of a donor (look for “Cumulative_Mov_AvgSTUDY.ts” over on my Google site). Thank you to all of my donors and customers–you are helping me slowly build to a point where I can develop code full time. For now I’m still very much buried under my day job and a few custom software projects, hence the dearth of updates here. Thanks for reading!

Sponsored Indicator: DaVinci Trade Rate

April 16, 2009

I was commissioned to create an indicator for a donor. After this indicator was developed, the donor generously allowed me to share it with the blog at large.

The sponsor is DaVinci Trading. When they have a website, I will post a link, but for now, they just have a name. 🙂 As this is a sponsored indicator, please include the full name and source code (including the credits) if you share this script with anyone. Thanks!

The DaVinci Trade Rate is designed to track trade speed on tick charts. Here’s a picture of it in action:

2009-04-16-tos_charts_thumb1

This is a 133 tick chart, so each candle is made up of 133 ticks on the tape. The DaVinci Trade Rate is showing a 3 bar exponential average of the speed of each bar, in bars per minute. As an example:

If a bar opened, and then 10 seconds later a new bar opened, the first bar traded at a rate of 6 bars per minute: 60 seconds per minute / 10 seconds per bar = 6 bars per minute.

Then, an exponential average of these speeds is calculated to smooth out the one-off spikes. (Default is 3; If you put in a period of 1, you get the actual calculations with no averaging.) There is also an option in the indicator to watch the volume rate per minute instead of just bar rate. If you want to see both, put the indicator on a chart twice and set each to a different setting. Green and red colors correspond to the candle color (up or down), while yellow indicates speed below the threshold value.

The theory of how to use this (so far) is two fold:

1. In times where the trade rate / volume rate is very slow, trade is likely to be choppy and erratic. If you set the threshold value to what you consider to be the minimum speed for your timeframe, then when the speed is below that value it helps to filter out times when the markets are likely to be dead and drifting.

2. If you set the threshold higher, when a large spike in trade rate / volume rate is seen, this can indicate either the start of a new trend, or the climax of an old trend depending on the context.

Look again at the summary plot above. See where the speed is yellow and getting slower, then POW! Huge green spike. The yellow shows trading slowing down as we approached the (then) high of the day. The spike happened as we plowed through it, and price fell back down. It seems that buy stops got run, and then new shorts piled on. It turns out that this was a great place to initiate a short position–to fade the spike. It was an extremely high rate-of-liquidity point, both in number of trades and volume. It didn’t turn out to be the high of the day, but it was a swing high.

This can be a bit subjective, but I noted 7 spikes in the DaVinci Trade Rate from today, indicated by grey ovals on this chart of the NQ:

2009-04-16-tos_charts

You can see how most spikes indicated a local top or bottom. The spike near 9:45 CT was a bit early, but it was also sloppy, with a gradual increase first rather than an extreme spike. Another near 13:15 CT was not confirmed by the volume, but I don’t know yet if that is important. The last one during casino hour at the end of the day actually indicated a breakdown, at least for a few minutes. This thing probably goes haywire in the first and the last half hour of trade, so I wouldn’t trade from it then anyway. Note that 15:00 CT is the market close, but the futures trade for another 15 minutes–with wild abandon today.

Please try this out and post any feedback or testing results you may have! I think that we all become better traders by sharing insights.

To get started with the DaVinci Trade Rate, you can download the script file at my Google site!