Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Study Hurst Exponential Qta EasyLang
- Inputs: HurstLength(64), ShowSmooth(true), SmoothLength(10);
- Vars: PriceChange(0),
- MeanPriceChange(0),
- CumulativeChange(0),
- MinChange(999999999),
- MaxChange(-999999999),
- CounterIndex(0),
- DeviationSum(0),
- StandardDeviation(0),
- RescaledRange(0),
- HurstExponent(0);
- PriceChange = Close / Close[1] - 1;
- MeanPriceChange = Average(PriceChange, HurstLength);
- CumulativeChange = 0;
- MinChange = 9999999;
- MaxChange = -9999999;
- For CounterIndex = 0 to HurstLength - 1 begin
- CumulativeChange = CumulativeChange + (PriceChange[CounterIndex] - MeanPriceChange);
- MinChange = MinList(MinChange, CumulativeChange);
- MaxChange = MaxList(MaxChange, CumulativeChange);
- end;
- DeviationSum = 0;
- For CounterIndex = 0 to HurstLength - 1 begin
- DeviationSum = DeviationSum + Square(PriceChange[CounterIndex] - MeanPriceChange);
- end;
- StandardDeviation = SquareRoot(DeviationSum / (HurstLength - 1));
- RescaledRange = (MaxChange - MinChange) / StandardDeviation;
- HurstExponent = Log(RescaledRange) / Log(HurstLength);
- Plot1(HurstExponent, "HurstExponent", cyan);
- Plot3(0.5, "HurstExponent random", LightGray);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement