Hurst Cycles System

Can someone guide me where can I get some help for coding Hurst Cycle Trading system that covers phasing, FLD, VTL and drawing sine-waves/semicircles (I am not talking about AFL code for Hurst Channel and Hurst Exponent, they are available).
Thank you

Then please visit this forum. Also a book is available on the subject.

1 Like

HI Cougar, thank you for your reply. But that forum you suggested is of Sentient Trader users. I am looking for link/guide or help from amibroker programmers/traders.

@rvdesh please be specific, the subject is ambiguous.

The topic is very specific "Hurst Cycle Trading System that covers phasing, FLD, VTL and drawing sine-waves/semicircles". I will be more specific once I get to know someone who has done related work in Amibroker.

@rvdesh, Hurst defines the calculation for these, so you should be able to easily do them yourself.

FLD is essentially a centred moving average. VTL is a bit more complex. And as Hurst defined the principles of Variability, drawing the sine waves / semi-circles is a bit more difficult.

I just build a series of phasing diamonds.

Of course the best thing to do is post your own code and ask for help when you are stuck.

Hi snoopy.pa30,
Thank you for your time. I am thorough with Hursts Trading System. I am not that good at coding and hence was seeking help or resources. Notwithstanding, your point is taken. I will start a step at a time from now and try coding!!

Good morning to all forum lads. I came across the Hurst Cycle theme by chance (but I was late) and a chart in TradingView that I found interesting to have and noticed in one of the layouts I use. I also provide the relevant code link in the pine editor, as well as the name of the indicator to test in the TradingView charts for anyone who wanted to help.
The indicator name is "HCCC_LB"

The code I prepared is the one below, but it's not what you'll see on the TradingView charts. I believe that the problem lies in rows 22, 23 and 31, 32, 33, 34. Basically I need 2 solutions as the others are the same.

Where I want help, I write it in the code.

I would appreciate any help and thank everyone in advance.

_SECTION_BEGIN( "Price" );

GraphXSpace = 5;
SetChartBkColor(ParamColor("ChartBkColor", colorLightGrey));
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorGrey40, styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );


_SECTION_BEGIN("Hurst Cycle Channel");

scl_t = Param( "Short Cycle Length Period", 10, 2, 150, 1 ); // Short Cycle Length
mcl_t = Param( "Medium Cycle Length Period", 30, 2, 150, 1 ); // Medium Cycle Length
scm = Param( "Short Cycle Multiplier Period", 1, 1, 150, 1 ); // Short Cycle Multiplier
mcm = Param( "Medium Cycle Multiplier Period", 3, 1, 150, 1 ); // Medium Cycle Multiplier
src = ParamField("Price field",3); // Source input(close)
scl = scl_t/2; 
mcl = mcl_t/2;

// In the next 2 series I don't know what to write in afl to render rma correctly. 
ma_scl = Wilders( src, scl); // try to translate the  rma(src, scl) of Pine Editor with Wilders. That's right?
ma_mcl = Wilders( src, mcl);

scm_off = scm*atr(scl);
mcm_off = mcm*atr(mcl);

// in next 4 lines I don't know how to correctly attribute to afl the action nz(...... etc) of Pine Editor in above [link](
sct = ma_scl+ scm_off ;
scb = ma_scl- scm_off ;
mct = ma_mcl+ mcm_off;
mcb = ma_mcl- mcm_off;

scc = ColorRGB(232,232,232);  mcc = ColorRGB(232,232,232); 
sccm = ColorRGB(80,80,80);    mccm = ColorRGB(0,72,0); // darkgreen ++
sccf = colorRed; mccf = colorGreen;

sctl = plot(sct,"ShortCycleTop", scc ,styleline);
scbl = plot(scb, "ShortCycleBottom", scc, styleline);
plot( (sct+scb)/2,"ShortCycleMedian", sccm, styleline);
mctl = plot(mct, "MediumCycleTop",mcc, styleline);
mcbl = plot(mcb, "MediumCycleBottom",mcc, styleline);
plot( (mct+mcb)/2,"MediumCycleMedian", mccm, styleLine, 0,0,0,0,1);

PlotOHLC( sct, sct, scb, scb, "", ColorBlend( colorBrown, GetChartBkColor(), 0.8 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
PlotOHLC( mct, mct, mcb, mcb, "", ColorBlend( colorDarkGreen, GetChartBkColor(), 0.8 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );


@chrismet for the NZ() function, if you have a recent version of Amibroker (6.49.1) you can do the same as the Pine code (passing an array to NZ)

  1. AFL: Nz() function now accepts scalars and arrays in ValueIfNull argument (previously only scalar was accepted)

FWIW, re the RMA, many sites report that RMA is essentially the same as SMMA and the Wilders.
From a Python Medium article (members only) I see that the SMMA and Wilders array are initialized in a different way, but the resulting curve in the long run seems to be equivalent (I did not check the TV code).

1 Like

That rma is just AMA() function in AmiBroker.

function rma(x, y) {
  return AMA(x, 1/y);

Plot( C, "Price", colorDefault, styleBar );

Plot( rma(C, 15), "rma (just AMA)", colorYellow, styleline );

And this one

sct = nz(ma_scl[scl_2], src)+ scm_off
scb = nz(ma_scl[scl_2], src)- scm_off
mct = nz(ma_mcl[mcl_2], src)+ mcm_off
mcb = nz(ma_mcl[mcl_2], src)- mcm_off

In AmiBroker it would be translated to this one

Version( 6.49.1);

sct =  Nz(Ref(ma_scl,-scl_2), src)+ scm_off;
scb =  Nz(Ref(ma_scl,-scl_2), src)- scm_off;
mct =  Nz(Ref(ma_mcl,-mcl_2), src)+ mcm_off;
mcb =  Nz(Ref(ma_mcl,-mcl_2), src)- mcm_off;

Or in lower versions just

sct =  Ref(ma_scl,-scl_2)+ scm_off;
scb =  Ref(ma_scl,-scl_2)- scm_off;
mct =  Ref(ma_mcl,-mcl_2)+ mcm_off;
mcb =  Ref(ma_mcl,-mcl_2)- mcm_off;

Dear gentlemen @Beppe and @fxshrat, who are always in a good mood to offer and help, thank you very much for the response and excellent information.

The function for replacing rma did not provide any significant change that could be easily seen by eye on the graph.

But the last solution ("Or in lower versions just" with my problem in Nz, and because I don't have a new version of AB, approached the chart with the same indicator in Trading View, extremely well.

Thank you again.