MACD Divergence.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #145720 quote
    Alps007
    Participant
    New

    Hello Pro-coders

    Really hope someone can help me with this simple request.

    I require proscreener to provide MACD divergence results  over the last 10 days.

    Is there a way to do this?

    Kind Regards

    Alps

    #145732 quote
    TempusFugit
    Participant
    Veteran

    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

    0Divergencias-MACD.itf
    #145780 quote
    Alps007
    Participant
    New

    Thank you Tempus,

    That file.. which application am I using to open it. It does not open in word or notepad.

    thanks

    Alps

    #145813 quote
    Nicolas
    Keymaster
    Master

    ITF 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?

    #146014 quote
    Alps007
    Participant
    New

    Thanks 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:

    1. MACD (12,26,9) divergence – bullish and bearish and hidden
    2. 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.

    #146061 quote
    Nicolas
    Keymaster
    Master

    If 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:

    ignored, divergence = CALL "0Divergencias MACD"[20, 12, 26]
    
    screener[divergence<>0](divergence)
    #147141 quote
    Alps007
    Participant
    New

    Some progress in the sense that:

    1. I have been able to upload the code kindly provided by Tempus on proscreener
    2. 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:

    /// Detector de divergencias
    ///Por jose7674
    
    ///La variable N es el numero de barras hacia atras que utilizamos para encontrar una divergencia
    
    ///MACD 5-131
    miMACD = exponentialAverage[a](close) – exponentialAverage[b](close)
    
    cero = 0
    
    ////Comenzamos el detector
    
    IF (BarIndex > 10+1+N) THEN
    
    IF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THEN
    extremum2=miMACD[1]
    extremum1=highest[N](miMACD)
    
    preciomax2=close[1]
    preciomax=Highest[N](close)
    ENDIF
    
    IF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THEN
    extremum22=miMACD[1]
    extremum11=lowest[N](miMACD)
    
    preciomin2=close[1]
    preciomin=lowest[N](close)
    ENDIF
    
    REM aseguramos que el maximo actual es inferior al maximo de las N barras previas
    IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN
    signal = -1
    ELSE
    signal = 0
    ENDIF
    
    IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN
    signal = 1
    ENDIF
    
    ENDIF
    
    Return 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.

    #147145 quote
    robertogozzi
    Moderator
    Master

    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.

    #147147 quote
    robertogozzi
    Moderator
    Master

    I 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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

MACD Divergence.


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Alps007 @alps007 Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by robertogozzi
5 years, 5 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 09/28/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...