Click here to Login





                                                   Rising moving average

  0

0
Barbecue
2015-08-04 20:25:15


Hello,
what is the best way to check if a moving average is rising ? The problem I'm trying to solve is that even though I buy above a moving average, when I check the trades, some of them have a flat or a declining moving average. I would like to filter out those or even add the declining condition to a sell rule.

Thanks a lot !



QuantShare
2015-08-05 03:09:58

  0

Best Answer
There are several ways to do this. Here are some examples:

sm = sma(20);
rule1 = sm > sm[1]; // SMA higher than previous bar SMA
rule2 = perf(sm, 10) > 0; // SMA increased in the past 10 bars
rule3 = LinearReg_Slope(sm, 10) > 0; // 10 bar linear slope of SMA is positive



Barbecue
2015-08-05 14:44:30

  0

Thanks for the reply !

Any suggestion on which of the three approaches is less CPU intensive during backtesting/optimizations ?

Thanks !



QuantShare
2015-08-06 04:04:48

  0

No one should be CPU intensive. The first one is the fastest one.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Fractal Adaptive Moving Average - FRAMA
GMMA - Guppy Multiple Moving Average
Moving Average States Indicator
Multiple Time Frames Trading System - Price / Moving Average Cros...
Derivative Moving Average Strategy

How-to Lessons
How to create a moving average of an indicator
How to calculate the average of a time series using the money man...
How to create a volatility-based Stop - Dynamic stop based on the...
How to create a hatched area in a chart
How to plot arrows below/above candlesticks on a chart

Related Forum Threads
delay in moving average
Displaced moving average
coding a moving average
Volume Adjusted Moving Average
Displaced Moving Average?

Blog Posts
Trading System: Moving average crossover and few others buy and s...
Custom Indicator: Moving average spread
Using Average True Range to Measure Intraday Volatility
Trend Following and Moving Averages
The average maximum drawdown metric









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.