Center of Gravity by Ehlers
Forums › ProRealTime English forum › ProBuilder support › Center of Gravity by Ehlers
- This topic has 8 replies, 5 voices, and was last updated 6 years ago by supertiti.
-
-
02/06/2017 at 10:31 PM #24166
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
02/07/2017 at 12:23 PM #24201Hy ML,
Here it is from french website of Sohocool, Ehlers Center of Gravity1234567891011121314151617// Centre de gravité John Ehlers by Sohocoolsum = 0wgt = 0b=(customclose) // défaut =medianpriceFOR i = 0 TO n - 1sum = sum + (1 + i) * b[i]wgt = wgt + b[i]NEXTIF wgt <> 0 THENcG =( - sum / wgt) + ( (n+1)/2)ENDIFRETURN cg as"centre gravité", cg[1] as "trigger", 0 as "zero"// Variable :// n = 10 par defaut3 users thanked author for this post.
02/07/2017 at 8:51 PM #24272Thanks a lot!!! 🙂
1 user thanked author for this post.
01/16/2018 at 11:20 AM #59634Bonjour 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))
01/16/2018 at 12:02 PM #59643Please speak English in the english forum and also to write code, please use the <> “insert PRT code” button.
Thank you.
01/16/2018 at 12:49 PM #59644Hello
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
screener COG12345678910111213141516171819202122232425262728293031323334// Centre de gravité John Ehlers by Sohocooln = 10sum = 0wgt = 0b=(customclose) // défaut =medianpriceFOR i = 0 TO n - 1sum = sum + (1 + i) * b[i]wgt = wgt + b[i]NEXTIF wgt <> 0 THENcg =( - sum / wgt) + ( (n+1)/2)ENDIFcentregravite = cgtrigger = cg[1]centregraviteJmoinsun = centregravite[1]triggerJmoinsun = trigger[1]myAdaptativeMA = CALL "Adaptative MA"(close)myAdaptativeMApreced = myAdaptativeMA[1]// cas du crosiement en JC1 = cg CROSSES OVER cg[1]// cas du croisement en J-1, bougie J > MMA que ce soit clôture ou lowC2 = centregraviteJmoinsun CROSSES OVER triggerJmoinsun// bougie J > MMA que ce soit clôture ou lowC3 = CLOSE > myAdaptativeMA and low >=myAdaptativeMA and close>=open// et low bougie J-1 < MMAC4 = Low[1]<= myAdaptativeMAprecedSCREENER ((C1 AND C3 AND C4) OR (C2 AND C3 AND C4))01/16/2018 at 1:48 PM #5964801/16/2018 at 6:13 PM #5967001/17/2018 at 11:31 AM #59703 -
AuthorPosts