Click here to Login

                                                   How to find divergences ?


2017-03-18 09:09:32

How to program finding divergences between price and an indicator reading?
Please advise


2017-03-20 05:45:16


There are several ways to do this. For example, you can compare the N-bar rate of return.

a = sma(30);
div = perf(a, 10) > 5 and perf(close, 10) < -5;

2017-03-20 19:20:35


I see . Thanks. Out of curiosity what are other ways to check for divergences.
Also is there any way to localize a peak on an indicator such as MACD ?

Please advise

2017-03-21 04:34:28


Yes there are other ways. You can for example calculate the slope of each indicator (LinearReg_Slope) and compare it.

To localize a peak you need to access future bars.
However, if you want to detect highest high values of an indicator, please use the "hhv" function.

a = hhv(close, 20); // Highest close over the last 20-bars

No more messages


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"


Trading Items
How far are the close prices from the support line
Minimum Variance Optimization with Solver V1.1- AMM
Trading Rules using Trend Indicators
Scale-in Trading Strategy
Predict financial and stock markets with textual analysis

How-to Lessons
How to download a trading item from the Sharing Server
How to download Portfolio123 data into QuantShare
How to draw distances on a chart?
How to download new quotes when selecting a chart
How to get trading orders from a portfolio programmatically

Related Forum Threads
How do I find the close price for an entry matching a custom DB
How to find historical ETF data
how to draw Flag (Bullish) on chart?
How to browse and search the blog?
How can I view signals rejected by the simulator?

Blog Posts
How to create and backtest thousands of trading rules in less tha...
Let me Show You How to Create Hundreds of Profitable Trading Syst...
How to Download Trading Data for Certain Securities Only
How to create a trading system, screen and composite using earnin...
Fundamental analysis: How to track economic indicators in the For...

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
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.