Advertisement
Maurizio-Ciullo

Hurst Exponential Qta EasyLang

Jun 17th, 2023 (edited)
1,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Study Hurst Exponential Qta EasyLang
  2.  
  3. Inputs: HurstLength(64), ShowSmooth(true), SmoothLength(10);
  4.  
  5. Vars: PriceChange(0),
  6.       MeanPriceChange(0),
  7.       CumulativeChange(0),
  8.       MinChange(999999999),
  9.       MaxChange(-999999999),
  10.       CounterIndex(0),
  11.       DeviationSum(0),
  12.       StandardDeviation(0),
  13.       RescaledRange(0),
  14.       HurstExponent(0);
  15.  
  16. PriceChange = Close / Close[1] - 1;
  17.  
  18. MeanPriceChange = Average(PriceChange, HurstLength);
  19.  
  20. CumulativeChange = 0;
  21. MinChange =  9999999;
  22. MaxChange = -9999999;
  23.  
  24. For CounterIndex = 0 to HurstLength - 1 begin
  25.     CumulativeChange = CumulativeChange + (PriceChange[CounterIndex] - MeanPriceChange);
  26.     MinChange = MinList(MinChange, CumulativeChange);
  27.     MaxChange = MaxList(MaxChange, CumulativeChange);
  28. end;
  29.  
  30. DeviationSum = 0;
  31. For CounterIndex = 0 to HurstLength - 1 begin
  32.     DeviationSum = DeviationSum + Square(PriceChange[CounterIndex] - MeanPriceChange);
  33. end;
  34.  
  35. StandardDeviation = SquareRoot(DeviationSum / (HurstLength - 1));
  36.  
  37. RescaledRange = (MaxChange - MinChange) / StandardDeviation;
  38.  
  39. HurstExponent = Log(RescaledRange) / Log(HurstLength);
  40.  
  41. Plot1(HurstExponent, "HurstExponent", cyan);
  42. Plot3(0.5, "HurstExponent random", LightGray);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement