MACD Divergence.
Forums › ProRealTime English forum › ProScreener support › MACD Divergence.
- This topic has 8 replies, 4 voices, and was last updated 4 years ago by
robertogozzi.
-
-
09/28/2020 at 4:18 PM #14572009/28/2020 at 5:03 PM #145732
Here you have an indicator I did long time ago to find MACD divergences. The variables:
- N: Number of bars the indicator lookback to find the divergences
- a: Periods for the first average to calculate MACD line
- b: Periods for the second average to calculate MACD line
You can create a Proscreener with it but I cannot help you there because I don´t do Proscreeners.
Good luck mate
09/28/2020 at 9:34 PM #14578009/29/2020 at 9:18 AM #145813ITF file can only be imported and opened within the platform. Read this simple how-to tutorial to do it: How to import and export codes from ProRealTime platform?
09/30/2020 at 8:53 PM #146014Thanks for the effort Tempus. Really appreciate you trying to help me.
I am a zero case when it comes to programming or computing so I just don’t know how to make use of the great information you provided.
So if Nicolas or anyone else can provide a solution to the following I will be forever grateful. I work 14 hr. days so I can only look at charts and study fundamentals over the weekend.
So help required is for the following:
- MACD (12,26,9) divergence – bullish and bearish and hidden
- within the last 20 days
To share my strategy it is as follows: Divergence moves happen to be big. So if it is a bullish divergence and the fundamentals are good ie profits are up or less debt etc. etc.. then I will buy that stock.
The purpose of the screener is to identify stocks that have MACD divergence and then study the fundamentals over the weekend and place the trade
SIMPLE STRATEGY and I like that.
10/01/2020 at 9:41 AM #146061If you have successfully imported the MACD divergence indicator that TempusFugit has nicely shared with us, copy/paste the below screener code into a new ProScreener and you’ll get the last 20 days divergences:
123ignored, divergence = CALL "0Divergencias MACD"[20, 12, 26]screener[divergence<>0](divergence)10/12/2020 at 11:10 AM #147141Some progress in the sense that:
- I have been able to upload the code kindly provided by Tempus on proscreener
- I have been able to add the 2 lines Nicolas has kindly provided.
However when I run the code I get an error which I have attached.
It says:
Syntax error: line45, character 1
Characters Missing. Suggestions:
-“eof”
The code is as follows:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647/// Detector de divergencias///Por jose7674///La variable N es el numero de barras hacia atras que utilizamos para encontrar una divergencia///MACD 5-131miMACD = exponentialAverage[a](close) – exponentialAverage[b](close)cero = 0////Comenzamos el detectorIF (BarIndex > 10+1+N) THENIF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THENextremum2=miMACD[1]extremum1=highest[N](miMACD)preciomax2=close[1]preciomax=Highest[N](close)ENDIFIF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THENextremum22=miMACD[1]extremum11=lowest[N](miMACD)preciomin2=close[1]preciomin=lowest[N](close)ENDIFREM aseguramos que el maximo actual es inferior al maximo de las N barras previasIF(extremum2<extremum1 AND preciomax2>preciomax[1]) THENsignal = -1ELSEsignal = 0ENDIFIF(extremum22>extremum11 AND preciomin2<preciomin[1]) THENsignal = 1ENDIFENDIFReturn cero as “0”, signal as “Divergencia”ignored, divergence = CALL “0Divergencias MACD”[20, 12, 26]screener[divergence<>0](divergence)With deep gratitude looking forward to further assistance from you kind sirs.
10/12/2020 at 12:05 PM #147145> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
🙂Comment out line 44, RETURN must always be the last line. Moreover screeners don’t support it.
10/12/2020 at 12:10 PM #147147I think you should delete all but the last two lines, since when CALLing an indicator you don’t need to embed its code.
Nicolas’code is a working screener by itself, not lines to be appended to the indicator.
-
AuthorPosts