Join Now or Login or connect with

Trading Software Trading objects Features Blog Search

This is a trading object shared by a member. You can use this object as well as hundreds of others with QuantShare - Trading Software.
Click on the Like button or on one of the share buttons to share this object and spread the word about QuantShare.
QuantShare is an advanced trading software for stock, forex, futures, ETF and options markets. It is the best and the most complete EOD trading software software and it is FREE (beta version).

Moving Average: Rule-based

by The trader, 204 days ago
Share |

Probably the most popular trading indicator is the moving average. It is widely used in technical analysis and several other indicators use it in their calculation. For each bar, the moving average indicator calculates the average price of a time-series over the preceding N-bars.
The function name is 'rbsma', which stands for 'rule-based simple moving average'. This type of moving average does not calculate an average value of the last N-bars, but for N-bars that satisfy a specific rule.

Here is an example:
Let us say we want to calculate the average close price of for the last five Monday bars. We then should take the last five bars (bars that occurred on Monday) and calculate the average. Then repeat the process for all the available trading bars.

To do this with the 'rbsma' function, you will need to type:
rbsma(close, DayOfWeek() == 1, 5, 25);
The first parameter is the close price series.
The second parameter is the filter rule. It instructs the application to take into consideration only bars whose 'DayOfWeek' value is equal to one, which is Monday.
The third parameter is the number of occurrences to use in the moving average calculation.
The last parameter value defines the maximum number of bars to look for. A low value could result in the 'rbsma' function not finding the five occurrences where the filter rule passed. This could result in the calculation of a moving average with less than five values.
This doesn't mean that that you should put a very high value in this parameter to avoid this kind of problem. A high value generally needs more computation time and more time to calculate the function.

Here are some other examples:
rbsma(close, rsi(14) > 50, 20, 50);
This moving average rule returns the average close price for bars where the security price relative strength index indicator is above 50.

rbsma(volume, close > ref(close, 1), 20, 50);
This moving average rule returns the average volume for bars where the stock or security price closed higher than yesterday's value.

rbsma(volume, close > ref(close, 1), 20, 50) > rbsma(volume, close < ref(close, 1), 20, 50)
This is a moving average rule that returns one on bars where the average volume for the last 20 occurrences where the security price closed higher is greater than the average volume for the last 20 occurrences where the security price closed lower.

To use the 'rbsma' function as a classic moving average, you just need to set the rule formula to '1'.
rbsma(close, 1, 14, 14) is equal to sma(close, 14)

This function can also be modified to return another rule-based indicator; that is, an indicator that uses bars that pass a specific rule.


Share This ->
Share |


You have to log in to bookmark this object
What is this?
Additional Information





Related Trading Objects



Country
Page 1
Wilder Volatility Index - Average True ..
by Brian Brown, uploaded one month ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 4 Notes Report an item
Wilder Volatility Index - Average True ..
by Brian Brown, uploaded one month ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 1 Notes Report an item
Geometric Moving Average Indicator
by Brian Brown, uploaded one month ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 0 Notes Report an item
Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object






Market
Page 1
Fibonacci Trading Indicator - Support a..
by QuantShare, uploaded today
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 0 Notes Report an item
Fibonacci Trading with the Retracement ..
by QuantShare, uploaded yesterday
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 0 Notes Report an item
Williams AD - Accumulation Distribution..
by QuantShare, uploaded one week ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 1 Notes Report an item
Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object






Style
Page 1
Fibonacci Trading Indicator - Support a..
by QuantShare, uploaded today
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 0 Notes Report an item
Fibonacci Trading with the Retracement ..
by QuantShare, uploaded yesterday
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 0 Notes Report an item
Williams AD - Accumulation Distribution..
by QuantShare, uploaded one week ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 1 Notes Report an item
Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object






Reviews
You must log in first

Join now
and get instant access for free to the trading software, the Sharing server and the Social network website.
Click here


Related objects
Show All
How far are the close prices from the support line (by The trader, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 10 Notes Report an item
Yahoo EOD historical quotes (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 417 Notes Report an item
ETF Symbols (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 47 Notes Report an item
StockTwits (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 13 Notes Report an item
Ticker Symbols List of the National Stock Exchange, NSE, India (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 368 Notes Report an item
News data for US companies from Google RSS feed (by The trader, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 9 Notes Report an item
Simple pattern detection rules using close and open prices (by bug man, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 39 Notes Report an item
Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

Technical Analysis


Fundamental Analysis


Trading Objects

 14 0 0 - Short Selling Data
  3 0 0 - NSX - Daily short selling data
  5 0 0 - NASDAQ and Boston stock exchanges - Daily short sale data
  4 0 0 - Nigerian Stock Exchange
  9 0 0 - NYSE Arca - Daily short sale data
  2 0 0 - Chande's & Kroll's R2 Indicator
  5 0 5 - Chande's TrendScore
  3 0 0 - McClellan Oscillator and Summation Index
  4 0 0 - Earnings Whispers: Whisper Report
  2 0 0 - Business Outlook Survey
More trading objects...


Recent Posts

Pivot Tables in QuantShare Trading Software
Posted 9 days ago

How to create market indicators using the composite function - Part 1
Posted 17 days ago

Optimize a trading strategy using the Sharpe ratio
Posted 24 days ago

How to create a trading indicator that uses stock news
Posted 31 days ago

How to create your own technical analysis indicators
Posted 38 days ago

Show All

Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object


contactus
About | Privacy | Terms of Use | Manual
Copyright © 2010 QUANTSHARE.COM