Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Recommended Posts

Does anyone have Center of Gravity Bands coded in Tradestation or MultiCharts?

It would be much appreciated for your help.

Thanks

 

 

 

 

here's John Ehlers' original CG doc and code.

it is an oscillator.

I have not heard of the bands.

 

 

 

attachment.php?attachmentid=10043&stc=1&d=1238815633

Ehlers (CG Oscillator).doc

CG.thumb.png.6fc25bdb3a19a5d63c9fea9d1f97519b.png

Edited by Tams

Share this post


Link to post
Share on other sites
here's John Ehlers' original CG doc and code.

it is an oscillator.

I have not heard of the bands.

 

Tams,

 

Do you have the oscillator indicator for MT4 by any chance.

 

Many regards,

email

Share this post


Link to post
Share on other sites
here's John Ehlers' original CG doc and code.

it is an oscillator.

I have not heard of the bands.[q]

 

Tams,

Do you have the oscillator indicator for MT4 by any chance.

Many regards,

email

 

sorry, I don't use MT4.

Share this post


Link to post
Share on other sites

P.S.

 

the CG logic is simple enough, and MT4 is not that difficult, if you read through the MT4 manual, I am sure you can get the indicator coded.

 

 

.

Share this post


Link to post
Share on other sites
P.S.

 

the CG logic is simple enough, and MT4 is not that difficult, if you read through the MT4 manual, I am sure you can get the indicator coded.

 

Tams,

 

Thanks for your input.

Share this post


Link to post
Share on other sites
Thanks Tams, I had the oscillator, but would love to have the bands that go with it.

I have attached two pictures of it.

Thanks again.

 

I don't think John Elhers' Center of Gravity Oscillator is related to your Center of Gravity Bands.

Share this post


Link to post
Share on other sites
You guys would get a lot more help if you posted the code you need translated... :)

 

I agree...

 

some people would post a link and expect others to look for "it".

 

as a practice, I skip over the lazy requests.

 

;-)

Share this post


Link to post
Share on other sites

Hi all.

 

I'm also searching for an easylanguage implementation of the center of gravity bands, also known as Hurst bands.

I have the following code which works well in proprealtime.

I tried to translate it in tradestation, it looks easy, but the results are wrong.

My problem is the DPO function used in the prorealtime code.

I substituted it using the detrend function in tradestation but it's not the same.

So I'm not able to go on.

Anyone can help?

 

 

REM VIDEO [ame=http://www.youtube.com/watch?v=zD_zIkEymE0]YouTube - Center of Gravity[/ame]

REM The gravity center from Mustafa Belkhayate

k=p3 // Variable p3= 65

 

de48=DPO[k*2](close)

if de48=de48[1] and de48[1]=de48[2] and de48[2]<>de48[3] then

flag=1

endif

n=(k*2)-4

p=(n/2)-1

d100=DPO[n](close)

moy100=close-d100

co=(moy100-moy100[1]+(close[p])/n)*n

if flag[1]=1 and flag[2]=0 then

hh=co[1]

endif

if flag[1]=1 then

co=hh

endif

n=p3 mod 2

p=(p3-n)/2

p3=(2*p)+1

once x=0

w=abs((p-x)/p)

w=w*w*w

w=(1-w)

w=w*w*w

x=x+1

if barindex=p3 then

a=0

b=0

e=0

for i=1 to p3

z=barindex-i+1

a=a+w[z]

b=b+w[z]*(i)

e=e+(i)*(i)*w[z]

next

endif

if barindex>p3 then

c=0

d=0

for i=1 to p3

z=barindex-i+1

c=c+co[p3+p-i]*w[z]

d=d+co[p3+p-i]*w[z]*(i)

next

endif

alpha=(a*d-b*c)/(a*e-b*b)

beta=(c*e-b*d)/(a*e-b*b)

lowess=alpha*(p+1)+beta

if barindex < p3*2 then

lowess=undefined

endif

 

zz = close - lowess

zzsigma = STD[p3](zz)

bb1 = lowess + zzsigma

bb2 = lowess +1.618* zzsigma

bb3 = lowess +2* zzsigma

bl1 = lowess - zzsigma

bl2 = lowess - 1.618* zzsigma

bl3 = lowess - 2* zzsigma

 

return lowess, bb1, bb2, bb3, bl1, bl2, bl3

Share this post


Link to post
Share on other sites
Hi all.

 

I'm also searching for an easylanguage implementation of the center of gravity bands, also known as Hurst bands.

I have the following code which works well in proprealtime.

I tried to translate it in tradestation, it looks easy, but the results are wrong.

My problem is the DPO function used in the prorealtime code.

I substituted it using the detrend function in tradestation but it's not the same.

So I'm not able to go on.

Anyone can help?

...

 

do you have the code for DPO ?

Share this post


Link to post
Share on other sites

unfortunately not, i searched for it without sucess.

The prorealtime platform, describing how DPO works, says it does exactly what the tradestation detrend function do.

But if you plot the DPO you can see two big differences compared to the detrend

1) it is shifted on the left by LEN/2 bars (where LEN is the input length)

2) it is normalized so that it moves form -100 to 100

 

here is an example of the DPO and hurst bands on prorealtime.

hurst_DPO.jpg.6090d18953b2df43657259e77cddd712.jpg

Share this post


Link to post
Share on other sites
Thanks for your input, would you mind posting what you have for easylanguage so far, to see if we can help?

thanks

This is the tradestatione code

 

A function:

---------

Inputs: p3(numericsimple), XX(numericsimple), HurstM(numericRef),HurstH(numericRef),HurstL(numericref);

 

Variables: k(0), de48(0), n(0), p(0), d100(0), moy100(0), co(0), hh(0), x(0), w(0), aa(0),b(0),e(0), z(0),

alpha(0), bbeta(0), flag(0), p33(0), ii(0),cc(0), dd(0);

 

k=p3;

de48=Detrend( CLOSE, k*2);

 

if de48=de48[1] and de48[1]=de48[2] and de48[2]<>de48[3] then flag=1;

n=(k*2)-4;

p=(n/2)-1;

d100=Detrend(close,n);

moy100=close-d100;

 

co=(moy100-moy100[1]+(close[p])/n)*n;

//co=(moy100-moy100[1]+div(close[p],n))*n;

 

if flag[1]=1 and flag[2]=0 then hh=co[1];

if flag[1]=1 then co=hh;

n=mod(p3,2);

p=(p3-n)/2;

p33=(2*p)+1;

 

//once x=0

w=absvalue((p-x)/p);

//w=absvalue( div(p-x,p) );

 

w=w*w*w;

w=(1-w);

w=w*w*w;

x=x+1;

if barnumber=p33 then

begin

aa=0;

b=0;

e=0;

for ii=1 to p33 begin

z=barnumber-ii+1;

aa=aa+w[z];

b=b+w[z]*(ii);

e=e+(ii)*(ii)*w[z];

end;

end;

if barnumber>p33 then

begin

cc=0;

dd=0;

for ii=1 to p33 begin

z=barnumber-ii+1;

cc=cc+co[p33+p-ii]*w[z];

dd=dd+co[p33+p-ii]*w[z]*(ii);

end;

end;

//alpha=(aa*dd-b*cc)/(aa*e-b*b);

alpha=div((aa*dd-b*cc),(aa*e-b*b));

 

//bbeta=(cc*e-b*dd)/(aa*e-b*b);

bbeta=div((cc*e-b*dd),(aa*e-b*b));

 

HurstM=alpha*(p+1)+bbeta;

if barnumber<p33*2 then

begin

HurstM=0;

HurstH=0;

HurstL=0;

end;

 

HurstH=HurstM+xx;

HurstL=HurstM-xx;

 

AA_BandeHurst=0;

--------------------

 

and its indicator:

-------------

inputs: p3(83), XX(0.75);

 

Variables: HurstM(0), HurstH(0), HurstL(0);

 

Value1= AA_BandeHurst(p3, XX, HurstM, HurstH, HurstL);

 

Plot1( HurstM, "HurstM" ) ;

 

Plot2( HurstH, "HurstH" ) ;

 

Plot3( HurstL, "HurstL" ) ;

-----------

 

I also attach 2 images on the same bund future contract daily where I show the bad results on tradestation and the nice hurst bands on prorealtime.

 

And here is the prorealtme code creating this bands

I shifted the upper and the lower band only by 0.75 so the bands are not "perfect".

But the most important thing is the central line.

-----

 

k=p3 //(input value)

de48=DPO[k*2](close)

if de48=de48[1] and de48[1]=de48[2] and de48[2]<>de48[3] then

flag=1

endif

n=(k*2)-4

p=(n/2)-1

d100=DPO[n](close)

moy100=close-d100

co=(moy100-moy100[1]+(close[p])/n)*n

if flag[1]=1 and flag[2]=0 then

hh=co[1]

endif

if flag[1]=1 then

co=hh

endif

n=p3 mod 2

p=(p3-n)/2

p3=(2*p)+1

once x=0

w=abs((p-x)/p)

w=w*w*w

w=(1-w)

w=w*w*w

x=x+1

if barindex=p3 then

a=0

b=0

e=0

for i=1 to p3

z=barindex-i+1

a=a+w[z]

b=b+w[z]*(i)

e=e+(i)*(i)*w[z]

next

endif

if barindex>p3 then

c=0

d=0

for i=1 to p3

z=barindex-i+1

c=c+co[p3+p-i]*w[z]

d=d+co[p3+p-i]*w[z]*(i)

next

endif

alpha=(a*d-b*c)/(a*e-b*b)

beta=(c*e-b*d)/(a*e-b*b)

lowess=alpha*(p+1)+beta

if barindex<p3*2 then

lowess=undefined

endif

lowess1=lowess+xx

lowess2=lowess-xx

Segno=SGN(lowess-lowess[1])

return lowess as "H media", lowess1 coloured by (Segno) as "UpperBand", lowess2 coloured by (Segno) as "LowerBand"

-----------

hurst_prorealtime.jpg.5dc2b5fc7ec84b013caeacc7d806c313.jpg

hurst_tradestation.thumb.jpg.2cde97f8fdd6891a5206c478f77039ad.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Date: 30th April 2024. Market News – Cautiousness ahead of Fed, NFP & Earnings. Economic Indicators & Central Banks:   Trading remains quiet in a very busy week of data, earnings, supply, NFP and the Fed. Treasury yields and Wall Street posted small gains on the day but overall reain steady. It looks like fatigue has set in for the bears after knocking bonds and stocks sharply lower on the month. European equity futures are also steady, while the USD rose slightly against the G7 amid speculation the Fed may take a more hawkish tone when announcing its policy decision on Wednesday. German retail sales bounced 1.8% m/m in March. Sales were still down -2.7% y/y, but the rebound at the end of the first quarter is encouraging and suggests that higher wages and lower inflation are boosting consumption trends. German import price inflation was higher than expected. With the Euro lower against the Dollar, import price inflation is set to continue to nudge higher. French GDP expanded 0.2% q/q in the Q1 of the year. Japan’s unemployment unexpectedly was at 2.6% in March 2024, the same pace as in the prior month. Financial Markets Performance:   The USDIndex recovered slightly but holds below 105.90. After the assumed MoF intervention to support the Yen USDJPY was knocked down to an intraday low of 154.54 from a new 34-year high of 160.17. Soft Commodities: Top losers are Cocoa (-11.15%) and Wheat (-9.84%). Gains are led by Sugar (3.74%), Cotton (1.57%) and Rapeseed (1.25%). Metals: Top gainers are Platinum (3.70%) and Copper (2.12%). Biggest losers are Steel Rebar (-0.81%) and Silver (-0.50%). In addition, there was a slight change on Gold (-0.14%). Energies: Top commodity gainers are Natural gas (6.78%). Biggest losers are Natural Gas UK GBP (-4.89%), Natural Gas EU Dutch TTF (-3.85%) and Crude Oil WTI (-1.22%). In addition, there was a slight change on Brent Crude Oil (-1.09%). Market Trends:   Stocks were modestly higher with gains of 0.39% on the Dow, with the S&P500 and NASDAQ advancing 0.32% and 0.35%, respectively. Tesla rallied as much as 15% after receiving the green light for full self-driving technology in China, while Trump Media jumped 12% to boost gains on Wall Street. Earnings releases this week from the biggest US players include Amazon, McDonald’s, Apple and Coca-Cola. Meanwhile, Paramount is expected to post its earnings after today’s close. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Andria Pichidi Market Analyst HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • $JANX Janux Therapeutics stock nice breakout with volume 353% above normal, https://stockconsultant.com/?JANX
    • $OGN Organon stock range breakout watch, https://stockconsultant.com/?OGN
    • $WSM Williams-Sonoma stock attempting to move higher off the 280.46 double support area, https://stockconsultant.com/?WSM
    • $SMR NuScale Power stock breakout watch, https://stockconsultant.com/?SMR
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.