Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
FLD (Hurst) For Ninjatrader
Updated January 27, 2021
Top Posters
looks_one
Robx
with 3 posts (2 thanks)
looks_two
elopezh
with 2 posts (6 thanks)
looks_3
Skid
with 1 posts (2 thanks)
looks_4
agrock
with 1 posts (1 thanks)
Best Posters
looks_one
elopezh
with 3 thanks per post
looks_two
Skid
with 2 thanks per post
looks_3
lolu
with 1 thanks per post
looks_4
Robx
with 0.7 thanks per post
trending_up
5,055 views
thumb_up
12 thanks given
group
8 followers
forum
8 posts
attach_file
9 attachments
FLD (Hurst) For Ninjatrader
December 3rd, 2018, 04:01 PM
Madrid + SPAIN
Experience: Advanced
Platform: NinjaTrader,AmiBroker,TOS
Trading: Commodities Futures, Options, Stocks
Posts: 19 since Apr 2014
Thanks Given: 18
Thanks Received: 6
Hi,
I´m looking for the FLD (Future Line of Demarcation) Indicator used in Hurst strategies.
It´s a kind of Displaced forward Moving Average of the cycle, usually for 20 periods. I can´t locate in NinjaTrader Indicators
Some Help, please?
Thx,
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
December 16th, 2018, 09:11 PM
Hammond LA
Experience: Advanced
Platform: NinjaTrader
Broker: Ninja Trader
Trading: NQ, ES and SPY options
Posts: 202 since Aug 2009
Thanks Given: 536
Thanks Received: 316
There are two indicators and some programming in this thread.
If you do what you love, you'll never work a day in your life. Allow your passion to become your purpose.
January 5th, 2019, 01:22 PM
Madrid + SPAIN
Experience: Advanced
Platform: NinjaTrader,AmiBroker,TOS
Trading: Commodities Futures, Options, Stocks
Posts: 19 since Apr 2014
Thanks Given: 18
Thanks Received: 6
Hi,
Yes but are for NT7. There are a couple of indicators based on Hurst cycles with FLD for AMIBroker very interesting, so i´m looking something similar for NT8.
Thanks
February 12th, 2020, 04:48 PM
Oviedo Asturias/Espańa
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL
Posts: 5 since Dec 2018
Thanks Given: 1
Thanks Received: 9
Robx
Hi,
Yes but are for NT7. There are a couple of indicators based on Hurst cycles with FLD for AMIBroker very interesting, so i´m looking something similar for NT8.
Thanks
Hello,
ATTACHED FILES FOR THE nt8 VERSION
jhlHurstExponent.cs
jhlFractalDimension.cs
jhlMAX.cs
jhlMIN.cs
jhl.Utility.cs
February 12th, 2020, 06:21 PM
Lagos, Nigeria
Market Wizard
Experience: Intermediate
Platform: NinjaTrader, SierraChart
Trading: Euro Currency & Oil
Frequency: Daily
Duration: Hours
Posts: 2,552 since Jun 2009
Thanks Given: 1,049
Thanks Received: 1,678
elopezh
jhl.Utility.cs threw up the attached compilation errors on my NT8 8.0.20.1 64-bit . I've not compiled the other .cs files. Are these indicators for NT8 ?
Lolu
February 13th, 2020, 06:10 AM
Oviedo Asturias/Espańa
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL
Posts: 5 since Dec 2018
Thanks Given: 1
Thanks Received: 9
lolu
jhl.Utility.cs threw up the attached compilation errors on my
NT8 8.0.20.1 64-bit . I've not compiled the other
.cs files. Are these indicators for NT8 ?
Lolu
Good morning Lolu,
I'm sorry for the mistake. They're actually for version 7;
April 4th, 2020, 05:19 AM
Madrid + SPAIN
Experience: Advanced
Platform: NinjaTrader,AmiBroker,TOS
Trading: Commodities Futures, Options, Stocks
Posts: 19 since Apr 2014
Thanks Given: 18
Thanks Received: 6
Yeah, they were NT7. If someone find them for NT8 we appreciate it.
Best,
December 9th, 2020, 03:44 PM
Medellín
Posts: 1 since May 2017
Thanks Given: 0
Thanks Received: 1
Hi,
Here is a version for NT8. I put together all classes (FractalDimension, MINN, MAXX) in a single file for ease of use. The indicator has been tested and it seems to be OK.
Code
#region Using declarations
using System;
using System.ComponentModel.DataAnnotations;
using System.Windows.Media;
using NinjaTrader.Gui;
#endregion
// This namespace holds indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class HurstCoefficient : Indicator
{
#region Fields
private FractalDimension fd;
#endregion
#region Properties
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
public int Period { get; set; }
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Smooth period", GroupName = "NinjaScriptParameters", Order = 1)]
public int SmoothPeriod { get; set; }
#endregion
private Series<double> Hurst
{
get { return this.Values[0]; }
}
private Series<double> HurstSmooth
{
get { return this.Values[1]; }
}
protected override void OnBarUpdate ()
{
if (this.CurrentBar < this.Period) return;
this.Hurst[0] = -(this.fd.SetValue(this.Input[0], this.CurrentBar) - 2.0);
this.HurstSmooth[0] = this.EMA(this.Hurst, this.SmoothPeriod)[0];
}
protected override void OnStateChange ()
{
if (this.State == State.SetDefaults)
{
this.Description = Custom.Resource.NinjaScriptIndicatorDescriptionHurstCoefficient;
this.Name = Custom.Resource.NinjaScriptIndicatorNameHurstCoefficient;
this.BarsRequiredToPlot = 0;
this.Calculate = Calculate.OnBarClose;
this.DrawOnPricePanel = false;
this.IsSuspendedWhileInactive = true;
this.Period = 30;
this.SmoothPeriod = 14;
this.AddPlot(new Stroke(Brushes.Red, 1), PlotStyle.Dot, "Hurst");
this.AddPlot(new Stroke(Brushes.DodgerBlue, 1), PlotStyle.Line, "HurstSmooth");
}
else if (this.State == State.DataLoaded)
{
this.fd = new FractalDimension(this.Period);
}
}
}
public class FractalDimension
{
#region Fields
private int period;
private int bars;
private int lastBar = -1;
private MINN min;
private MAXX max;
private double[] value;
private double c1;
private double c2;
#endregion
#region Constructors
public FractalDimension (int period)
{
this.period = Math.Max(1, period);
this.min = new MINN(this.period);
this.max = new MAXX(this.period);
this.value = this.min.value;
}
#endregion
public double SetValue (double curVal, int barNum)
{
double min, delta = this.max.SetValue(curVal, barNum) - (min = this.min.SetValue(curVal, barNum));
if (barNum != this.lastBar)
{
this.lastBar = barNum;
if (this.bars < this.period)
{
if (++this.bars > 1)
{
this.c1 = Math.Pow(1 / (this.bars - 1), 2);
this.c2 = Math.Log(2 * (this.bars - 1));
}
}
}
if (this.bars < 2 || (delta <= double.Epsilon && -delta <= double.Epsilon))
return 1;
double length = 0, yPrev = (curVal - min) / delta;
for (int i = 1; i < this.bars; ++i)
{
double y = (this.value[(barNum - i) % this.period] - min) / delta;
length += Math.Sqrt(Math.Pow(y - yPrev, 2) + this.c1);
yPrev = y;
}
return 1.0 + (Math.Log(length) + Math.Log(2.0)) / this.c2;
}
}
public class MINN
{
#region Fields
private int period;
private int lowBar;
private int lastBar = -1;
private double low = double.MaxValue;
#endregion
#region Constructors
public MINN (int period)
{
this.period = Math.Max(period, 1);
this.value = new double[this.period];
}
#endregion
#region Properties
public double[] value { get; private set; }
#endregion
public double SetValue (double curVal, int barNum)
{
if (barNum == this.lastBar)
// Intrabar (tick) update
return Math.Min(this.value[barNum % this.period] = curVal, this.low);
if (this.lastBar < 0)
{
// First call, initialization
this.lastBar = barNum;
return this.value[barNum % this.period] = curVal;
}
// New bar (either first tick of new bar, or COBC = false)
if (this.value[this.lastBar % this.period] <= this.low)
{
this.low = this.value[this.lastBar % this.period];
this.lowBar = this.lastBar;
}
if (barNum - this.lowBar >= this.period)
{
this.low = double.MaxValue;
int i = barNum - (this.lastBar - this.lowBar);
for (int index = i % this.period; i < barNum; index = ++i % this.period)
{
if (this.value[index] <= this.low)
{
this.low = this.value[index];
this.lowBar = i;
}
}
}
this.lastBar = barNum;
return Math.Min(this.value[barNum % this.period] = curVal, this.low);
}
}
public class MAXX
{
#region Fields
private double[] value;
private int period;
private int hiBar;
private int lastBar = -1;
private double hi = double.MinValue;
#endregion
#region Constructors
public MAXX (int period)
{
this.period = Math.Max(period, 1);
this.value = new double[this.period];
}
#endregion
public double SetValue (double curVal, int barNum)
{
if (barNum == this.lastBar)
// Intrabar (tick) update
return Math.Max(this.value[barNum % this.period] = curVal, this.hi);
if (this.lastBar < 0)
{
// First call, initialization
this.lastBar = barNum;
return this.value[barNum % this.period] = curVal;
}
// New bar (either first tick of new bar, or COBC = false)
if (this.value[this.lastBar % this.period] >= this.hi)
{
this.hi = this.value[this.lastBar % this.period];
this.hiBar = this.lastBar;
}
if (barNum - this.hiBar >= this.period)
{
this.hi = double.MinValue;
int i = barNum - (this.lastBar - this.hiBar);
for (int index = i % this.period; i < barNum; index = ++i % this.period)
{
if (this.value[index] >= this.hi)
{
this.hi = this.value[index];
this.hiBar = i;
}
}
}
this.lastBar = barNum;
return Math.Max(this.value[barNum % this.period] = curVal, this.hi);
}
}
}
Attached Thumbnails
Attached Files
Elite Membership required to download: HurstCoefficient.cs
January 27th, 2021, 03:59 AM
Brooklyn, NY, USA
Posts: 2 since Jul 2020
Thanks Given: 1
Thanks Received: 0
agrock
Hi,
Here is a version for NT8. I put together all classes (FractalDimension, MINN, MAXX) in a single file for ease of use. The indicator has been tested and it seems to be OK.
Hey thanks for the upload... but I'm getting this error in NT8. Any ideas why?
Last Updated on January 27, 2021