Center of Gravity by Ehlers

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #24166 quote
    ML
    Participant
    Average

    Hi Nicolas!

    Have you ever converted in Prorealtime language the center of gravity J Ehlers indicator? Below a mt4 link:

    https://www.mql5.com/en/code/7068

    Thanks a lot!

     

    ML

    #24201 quote
    supertiti
    Participant
    Master

    Hy ML,
    Here it is from french website of Sohocool, Ehlers Center of Gravity

    
    //  Centre de gravité John Ehlers by Sohocool
    
    sum = 0
    wgt = 0
    b=(customclose)  // défaut =medianprice
    FOR i = 0 TO n - 1
    sum = sum + (1 + i) * b[i]
    wgt = wgt + b[i]
    NEXT
    IF wgt <> 0 THEN
    cG =( - sum / wgt)  + ( (n+1)/2)
    ENDIF
    
    RETURN cg as"centre gravité", cg[1] as "trigger", 0 as "zero"
    
    // Variable :
    // n = 10 par defaut  
    
    Nicolas, Pietro Fontana and GraHal thanked this post
    #24272 quote
    ML
    Participant
    Average

    Thanks a lot!!! 🙂

    Pietro Fontana thanked this post
    #59634 quote
    laurent31
    Participant
    New

    Bonjour Nicolas

    J’ai repris le code pour le transformer en screener, avec une modification, détecter les croisements en date J et en J-1.

    Le screener me renvoit plus de 600 résultats

    Merci pour votre aide

     

    // conditions strictes de Iliesco, seule adaptation : croisement en J et J – 1
    //Signal d’achat : Croisement à la hausse du CGO, Cours situé au-dessus de la MM = intégralité de la journée de cotation qui coïncide avec le croisement se déroule au-dessus de la MMA (plus bas de la bougie au-dessus de la MMA) ; privilégier clôture supérieure à ouverture, doji accepté, mais pas de bougie rouge ; Cours le plus bas de la séance qui précède le signal soit en-dessous de la MMA

    // Centre de gravité John Ehlers by Sohocool
    n = 10
    sum = 0
    wgt = 0
    b=(customclose) // défaut =medianprice
    FOR i = 0 TO n – 1
    sum = sum + (1 + i) * b[i]
    wgt = wgt + b[i]
    NEXT
    IF wgt <> 0 THEN
    cg =( – sum / wgt) + ( (n+1)/2)
    ENDIF
    centregravite = cg
    trigger = cg[1]
    centregraviteJmoinsun = centregravite[1]
    triggerJmoinsun = trigger[1]

    myAdaptativeMA = CALL “Adaptative MA”(close)
    myAdaptativeMApreced = myAdaptativeMA[1]

    // cas du crosiement en J
    C1 = cg CROSSES OVER cg[1]

    // cas du croisement en J-1, bougie J > MMA que ce soit clôture ou low
    C2 = centregraviteJmoinsun CROSSES OVER triggerJmoinsun

    // bougie J > MMA que ce soit clôture ou low
    C3 = CLOSE > myAdaptativeMA and low >=myAdaptativeMA and close>=open

    // et low bougie J-1 < MMA
    C4 = Low[1]<= myAdaptativeMApreced
    C5 = Low[2]<= myAdaptativeMApreced[1]

    SCREENER ((C1 AND C3 AND C4) OR (C2 AND C3 AND C5))

    Capture-screener.jpg Capture-screener.jpg
    #59643 quote
    robertogozzi
    Moderator
    Legend

    Please speak English in the english forum and also to write code, please use the <> “insert PRT code” button.

    Thank you.

    #59644 quote
    laurent31
    Participant
    New

    Hello

    I copied the code of COG to transform to a screener (see code, crosses for the day and the day before).

    But the result is not correct : 600 cases, only the first are correct (verify the conditions)

    Why the screener sends so lot of cases?

    Thanks for your help

    //  Centre de gravité John Ehlers by Sohocool
    n = 10
    sum = 0
    wgt = 0
    b=(customclose)  // défaut =medianprice
    FOR i = 0 TO n - 1
    sum = sum + (1 + i) * b[i]
    wgt = wgt + b[i]
    NEXT
    IF wgt <> 0 THEN
    cg =( - sum / wgt)  + ( (n+1)/2)
    ENDIF
    centregravite = cg
    trigger = cg[1]
    centregraviteJmoinsun = centregravite[1]
    triggerJmoinsun = trigger[1]
    
    myAdaptativeMA = CALL "Adaptative MA"(close)
    myAdaptativeMApreced = myAdaptativeMA[1]
    
    // cas du crosiement en J
    C1 = cg CROSSES OVER cg[1]
    
    // cas du croisement en J-1, bougie J > MMA que ce soit clôture ou low
    C2 = centregraviteJmoinsun CROSSES OVER triggerJmoinsun
    
    // bougie J > MMA que ce soit clôture ou low
    C3 = CLOSE > myAdaptativeMA and low >=myAdaptativeMA and close>=open
    
    // et low bougie J-1 < MMA
    C4 = Low[1]<= myAdaptativeMApreced
    
    
    SCREENER ((C1 AND C3 AND C4) OR (C2 AND C3 AND C4))
    
    Capture-screener-1.jpg Capture-screener-1.jpg
    #59648 quote
    Nicolas
    Keymaster
    Legend

    Screener conditions must be in brackets, not in parenthesis:

    SCREENER [(C1 AND C3 AND C4) OR (C2 AND C3 AND C4)]
    #59670 quote
    laurent31
    Participant
    New

    Thanks Nicolas

    A small mistake but a big effect !

    #59703 quote
    supertiti
    Participant
    Master

    @ Laurent31

    Le screener me sort : la fonction adaptive ma n’existe pas ?

    une idée ?

    merci

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Center of Gravity by Ehlers


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ML @ml Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/06/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...