# All John Ehlers Indicators... - page 5

1139

How to make an EA using COG?

Hello guys, I need some advice, I want to make an EA using this center of gravity indicator.

I want to use it as a function so I could call it anywhere in my EA.

If it's not too much, i'd prefer to start it with

double COG(int timeframe, int period, int shift)[/code]

I'm a newbie in programmer's world, and I find some difficulties in it.

Please someone help me, thank you.

[code]

//+------------------------------------------------------------------+

//| Center of Gravity.mq4 |

//+------------------------------------------------------------------+

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 Red

extern int Per=10;

extern int CountBars=300;

//---- buffers

double val1[];

double val2[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

string short_name;

//---- indicator line

IndicatorBuffers(2);

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,val1);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,val2);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Center of Gravity |

//+------------------------------------------------------------------+

int start()

{

if (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+Per+1);

SetIndexDrawBegin(1,Bars-CountBars+Per+1);

int i,cnt,counted_bars=IndicatorCounted();

double value1,sum,sum1;

//----

if(Bars<=38) return(0);

//---- initial zero

if(counted_bars<Per)

{

for(i=1;i<=0;i++) val1[CountBars-i]=0.0;

for(i=1;i<=0;i++) val2[CountBars-i]=0.0;

}

//----

i=CountBars-Per-1;

while(i>=0)

{

sum = 0.0;

for (cnt=0; cnt<=Per-1; cnt++)

{

sum = sum + (High+Low)/2;

}

sum1=0.0;

for (cnt=0; cnt<=Per-1; cnt++)

{

sum1=sum1+((High+Low)*(cnt+1)/2);

}

value1=sum/sum1;

val1=value1;

if (i>0) val2=value1;

i--;

}

return(0);

} //+------------------------------------------------------------------+

[Deleted]
1310

Moderator
124514

Just found it on the other forum.

Many MetaStock formulas.

Page #6 with formulas. To get the other page so change 206 to the other number, for example to get the page #2 with formulas so use 202 in web address instead of 206.

May be, usefull for the people who will convert some indicators to MT4.

49

106

cattus:
Hi Mystified.

As I understand your postulates are that the main difference between the data of a physical sources and the data of market sources is the emotion component. But I think all the efforts of the people that study the financial markets and the coders are into the knowledge of that the emotional component exist and the evolution of all these efforts are to translate all the components (including emotionals) into the indicators or techniques that permit us to understand how the markets works and how to predict movements. I think the indicators of Ehlers are good if they show us that they are efficient in order to work with the market data.

Hmmmm.... the Synthetic cycle generator(2) you used is an indicator of MetaStock ? Is it a drawing only?

Hi Mr Cattus,

Thank's for your Share Chart and Indicator, looks very nice.

Refering your chart, can I get The Systhetic cycle generator(2) from you Sir' ???

Thank's for your kindness and helping me.

Best regards,

Paulinge

49

Paulinge:
Hi Mr Cattus,

Thank's for your Share Chart and Indicator, looks very nice.

Refering your chart, can I get The Systhetic cycle generator(2) from you Sir' ???

Thank's for your kindness and helping me.

Best regards,

Paulinge

Hi Paulinge.

The chart was attached by mystified (post #40). I asked him if the indicator he attached is a drawing or a real indicator. Sorry.

Regards.

cattus

[Deleted]
279

Hi,

Does anybody know where I could find some documentation on how to use the different Ehler filters and indicators?

Daniel

[Deleted]
dvarrin:
Hi,

Does anybody know where I could find some documentation on how to use the different Ehler filters and indicators?

Daniel

buy his book "welcome to my trading room", o find it for free online as a pdf ... i saw it somewhere so it's out there