Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 18:55:56 +0000



Arnaud Legoux Moving Average

View Count: 3629

[2020-08-16 02:35:50]
User223734 - Posts: 101
Dear Sir,

Can you add the above moving average studies?
[2020-08-16 09:54:51]
Sierra_Chart Engineering - Posts: 14236
We will look into this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-08-16 19:50:04]
SC Support Tom - Posts: 450
I found the article (attached) in which this MA was introduced. It looks simple enough. I will read the article and get back to you tomorrow.
attachment76848896-ALMA-Moving-Average.pdf - Attached On 2020-08-16 19:49:58 UTC - Size: 280.07 KB - 489 views
Attachment Deleted.
[2020-08-17 00:02:23]
User90125 - Posts: 715
+1
[2020-08-17 00:42:31]
User223734 - Posts: 101
I have used the Alma in other trading platform, it is useful, I hope Sierra can add it in studies!
[2020-08-17 09:15:52]
Ackin - Posts: 1865
I have used the Alma in other trading platform, it is useful, I hope Sierra can add it in studies!
ALMA has been part of UserContributeStudies for several years
imagealma.png / V - Attached On 2020-08-17 09:15:46 UTC - Size: 142.62 KB - 348 views
[2020-08-17 10:25:16]
Sierra Chart Engineering - Posts: 104368
We will implement our own version.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-08-17 10:53:53]
User223734 - Posts: 101
Dear Ackin,

I have try the Alma in UserContributeStudies but it can't work in Sierra 2150 version , may I know which software version you are using?

Dear Sierra Chart Engineering,

May I know when Sierra has its own Alma version?
[2020-08-17 11:10:12]
Ackin - Posts: 1865
Sierra Chart Engineering [Direct Messages] - Posts: 88685 | Ending Date: 2021-04-05
We will implement our own version.
Nice





User223734: may I know which software version you are using?
Currently 2144



btw UserContributedStudies
Custom Study does not work anymore on newest Sierra Chart Release (16/08/2020)
Frostation [Direct Messages] - Posts: 7 | Ending Date: 2021-05-04
It seems that the newest Sierra Release no longer supports custom study "UserContributedStudies_64.scsf_ECIVwap".

After updating the study simply does not load within the Chartbook. I then had to revert to a previous known version. I can confirm that the study works correctly on version 2118.

Can it be advised if this may be an issue that will be fixed on the next release?



[2020-08-17 11:39:44]#2
Sierra Chart Engineering [Direct Messages] - Posts: 88685 | Ending Date: 2021-04-05
Update to the latest prerelease:
Software Download: Fast Update


so try SCH ver 2153
Date Time Of Last Edit: 2020-08-17 11:44:21
[2020-08-17 18:54:50]
Sierra Chart Engineering - Posts: 104368
In regards to post # 8, update to the latest prerelease of Sierra Chart:
Software Download: Fast Update
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-08-18 02:19:57]
SC Support Tom - Posts: 450
The article that I posted in Post #3 does not adequately explain the ALMA formula. Specifically, nowhere in the article does it define the quantity NORM in Table 3. I will need for this term to be defined before I am able to proceed.
Date Time Of Last Edit: 2020-08-18 02:22:36
[2020-08-18 02:59:01]
User223734 - Posts: 101
Dear SC Support Tom,

Hope you can find a solution to proceed soon!
[2020-08-18 15:57:06]
SC Support Tom - Posts: 450
Regarding Post #11, I now understand what the undefined term NORM means. However, I believe that there is a mistake in the formula. The article claims that ALMA is based on a Gaussian filter, and so I would expect to see a factor of 2 next to sigma^2 in the exponent. It is not there.

Also, I found this implementation of ALMA that disagrees with the formula in the article in Post #3.

https://www.tradingview.com/script/rqxaTb6E-ALMA-Function-FN-Arnaud-Legoux-Moving-Average/

This one contains the factor of 2, but it has what I believe is an even more serious error, namely the placement of the sigma^2 in the exponent. A Gaussian distribution is supposed to get wider as sigma increases, and narrower as sigma decreases. The function in this code does the opposite.

I will not be able to implement this study in Sierra Chart without finding an authoritative source that gives the correct formula. Any information on that front would be appreciated.
Date Time Of Last Edit: 2020-08-18 15:57:55
[2020-08-18 18:16:08]
cmet - Posts: 537
Research on quantitative forecasting in food prices:

https://www.cjournal.cz/files/308.pdf

The formula cited in that paper is in the attached image. It is the same as post #3.

Below is a version written for Tradestation in 2010, shortly after the ALMA was introduced. No evidence of its accuracy but was written by a very respected coder on ForexFactory.

{Function; ALAverage}
inputs:
Price (numericseries),
Window(numericsimple),
Sigma(numericsimple),
Offset(numericsimple);

variables: m(0),s(0),Wtd(0), WtdSum(0),CumWt(0), k(0);

m = Floor(Offset * (Window - 1));
s = Window/Sigma;

WtdSum = 0;
CumWt = 0;

for k = 0 to Window - 1 begin
Wtd = ExpValue(-((k-m)*(k-m))/(2*s*s));
WtdSum = WtdSum + Wtd * Price[Window - 1 - k] ;
CumWt = CumWt + Wtd;
end ;

ALAverage = WtdSum / CumWt ;

Date Time Of Last Edit: 2020-08-18 18:27:24
imageALMA Formula.png / V - Attached On 2020-08-18 18:15:38 UTC - Size: 7.96 KB - 350 views
[2020-08-20 03:44:54]
SC Support Tom - Posts: 450
The references in Post #14 use the same formulas as the references that I gave in Posts #3 and #11.


Research on quantitative forecasting in food prices:

https://www.cjournal.cz/files/308.pdf

The formula cited in that paper is in the attached image. It is the same as post #3.

Yes, this is the formula that looks like it is missing a factor of 2 in the denominator of the exponent. That is, I would expect to see 2*sigma^2 in the denominator of the exponent if this is a Gaussian filter. The absence of the 2 means that the weights are squares of Gaussian weights.


Below is a version written for Tradestation in 2010, shortly after the ALMA was introduced. No evidence of its accuracy but was written by a very respected coder on ForexFactory.


{Function; ALAverage}

inputs:

Price (numericseries),

Window(numericsimple),

Sigma(numericsimple),

Offset(numericsimple);



variables: m(0),s(0),Wtd(0), WtdSum(0),CumWt(0), k(0);



m = Floor(Offset * (Window - 1));

s = Window/Sigma;



WtdSum = 0;

CumWt = 0;



for k = 0 to Window - 1 begin

Wtd = ExpValue(-((k-m)*(k-m))/(2*s*s));

WtdSum = WtdSum + Wtd * Price[Window - 1 - k] ;

CumWt = CumWt + Wtd;

end ;



ALAverage = WtdSum / CumWt ;

This uses the same formula as the code in the link that I provided in Post #13, and it has even bigger problems than just a missing 2. In this formula, the width of the distribution increases as sigma decreases, and the width decreases as sigma increases. That is the exact opposite of what is supposed to happen. This formula would make more sense if s = Window/Sigma were replaced with s = Sigma/Window.

Unfortunately, I am no closer to being able to implement this study.
[2020-08-20 04:38:55]
cmet - Posts: 537
The indicator was originally written for Ninjatrader 7.0. Here is a version that Arnaud Legoux uploaded himself to Futures.io in 2010 shortly after he joined in 2009 (when the indicator was created).

https://futures.io/local_links.php?linkid=381

Requires an Elite Membership there to access but since he wrote the formula and posted that, it is likely to be the original.
Date Time Of Last Edit: 2020-08-20 04:40:35
imagealma.PNG / V - Attached On 2020-08-20 04:38:20 UTC - Size: 63.36 KB - 323 views
[2020-08-20 04:52:21]
SC Support Tom - Posts: 450
Regarding Post #16:


The indicator was originally written for Ninjatrader 7.0. Here is a version that Arnaud Legoux uploaded himself to Futures.io in 2010 shortly after he joined in 2009 (when the indicator was created).

https://futures.io/local_links.php?linkid=381

Requires an Elite Membership there to access but since he wrote the formula and posted that, it is likely to be the original.

If I can get my hands on that code, I will regard that as the authoritative version and implement it into Sierra Chart.
[2020-08-24 16:34:00]
cmet - Posts: 537
The original Ninjatrader study released for free on Legoux's website:

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// Copyright 2010 Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// ALMA (Arnaud Legoux MA)
/// </summary>
[Description("ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino")]
public class ALMA : Indicator
{
  
private int iWindowSize = 9;
private double iM_Sigma = 6.0;
    private double iP_Sample = 0.5;

    private double[] aALMA;    
    
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.LightSkyBlue), PlotStyle.Line, "ALMA_Plot"));
CalculateOnBarClose  = true;
Overlay        = true;
PriceTypeSupported  = false;
      BarsRequired = 3;
      
      aALMA = new double[iWindowSize];
      
      ResetWindow();
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
      if (CurrentBar < iWindowSize)
        return;
        
              
      int pt = 0;
      
      double agr = 0;
      double norm = 0;
      
      for (int i = 0; i < iWindowSize; i++)
{
        if (i < iWindowSize - pt)
{
          agr += aALMA[i] * Close[iWindowSize - pt - 1 - i];
          norm += aALMA[i];
        }
      }
        
      // Normalize the result
      if (norm != 0) agr /= norm;
      
      // Set the approrpiate bar.
      ALMA_Plot.Set(agr);      
}
    
   #region helper
  
    private void ResetWindow()
{
      
      
      double m = (int)Math.Floor(iP_Sample * (double)(iWindowSize - 1));
      
      
      double s = iWindowSize;
      s /= iM_Sigma;
      
      for (int i = 0; i < iWindowSize; i++)
{
        aALMA[i] = Math.Exp(-((((double)i)-m)*(((double)i)-m))/(2*s*s));
      }
    }  
    
    #endregion
#region Properties
[Browsable(false)]  // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()]    // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries ALMA_Plot
{
get { return Values[0]; }
}

[Description("Sample point. Where in terms of the window should we take the current value (0-1)")]
[Category("Parameters")]
public double SamplePoint
{
get { return iP_Sample; }
set { iP_Sample = Math.Min(Math.Max(0.0, value), 1.0); }
    }

[Description("ALMA period. Must be an odd number.")]
[Category("Parameters")]
public int WindowSize
{
get { return iWindowSize; }
set {
        iWindowSize = Math.Min(Math.Max(1, value), 50);
        // Only odd sizes
        if ((iWindowSize & 1) == 0)
        {
          iWindowSize++;
        }
        //ResetWindow();
  }
    }
    
[Description("Precision / Smoothing")]
[Category("Parameters")]
public double Sigma
{
get { return iM_Sigma; }
set {
         iM_Sigma = Math.Min(Math.Max(0.01, value), 50.0); //ResetWindow();
        }
    }
#endregion
}
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private ALMA[] cacheALMA = null;

private static ALMA checkALMA = new ALMA();

/// <summary>
/// ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino
/// </summary>
/// <returns></returns>
public ALMA ALMA(double samplePoint, double sigma, int windowSize)
{
return ALMA(Input, samplePoint, sigma, windowSize);
}

/// <summary>
/// ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino
/// </summary>
/// <returns></returns>
public ALMA ALMA(Data.IDataSeries input, double samplePoint, double sigma, int windowSize)
{
checkALMA.SamplePoint = samplePoint;
samplePoint = checkALMA.SamplePoint;
checkALMA.Sigma = sigma;
sigma = checkALMA.Sigma;
checkALMA.WindowSize = windowSize;
windowSize = checkALMA.WindowSize;

if (cacheALMA != null)
for (int idx = 0; idx < cacheALMA.Length; idx++)
if (Math.Abs(cacheALMA[idx].SamplePoint - samplePoint) <= double.Epsilon && Math.Abs(cacheALMA[idx].Sigma - sigma) <= double.Epsilon && cacheALMA[idx].WindowSize == windowSize && cacheALMA[idx].EqualsInput(input))
return cacheALMA[idx];

ALMA indicator = new ALMA();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.SamplePoint = samplePoint;
indicator.Sigma = sigma;
indicator.WindowSize = windowSize;
indicator.SetUp();

ALMA[] tmp = new ALMA[cacheALMA == null ? 1 : cacheALMA.Length + 1];
if (cacheALMA != null)
cacheALMA.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheALMA = tmp;
Indicators.Add(indicator);

return indicator;
}

}
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ALMA ALMA(double samplePoint, double sigma, int windowSize)
{
return _indicator.ALMA(Input, samplePoint, sigma, windowSize);
}

/// <summary>
/// ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino
/// </summary>
/// <returns></returns>
public Indicator.ALMA ALMA(Data.IDataSeries input, double samplePoint, double sigma, int windowSize)
{
return _indicator.ALMA(input, samplePoint, sigma, windowSize);
}

}
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ALMA ALMA(double samplePoint, double sigma, int windowSize)
{
return _indicator.ALMA(Input, samplePoint, sigma, windowSize);
}

/// <summary>
/// ALMA (contact@arnaudlegoux.com) by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino
/// </summary>
/// <returns></returns>
public Indicator.ALMA ALMA(Data.IDataSeries input, double samplePoint, double sigma, int windowSize)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

return _indicator.ALMA(input, samplePoint, sigma, windowSize);
}

}
}
#endregion

[2020-08-25 13:15:06]
SC Support Tom - Posts: 450

The original Ninjatrader study released for free on Legoux's website:

Excellent, I will work from this code.
[2020-08-26 08:38:43]
SC Support Tom - Posts: 450
I have completed the programming of this study based on the code provided in post #18. I am about to submit it to Sierra Chart Engineering.
Date Time Of Last Edit: 2020-08-26 08:46:35
[2020-09-19 00:33:09]
User223734 - Posts: 101
When Sierra Chart will have Alma?
[2020-09-19 00:51:00]
cmet - Posts: 537
It's already in there.

Moving Average > Arnaud Legoux

Incidentally, the output is identical to the ALMA in User Contributed Studies.
Date Time Of Last Edit: 2020-09-19 00:52:31
[2020-09-19 02:04:46]
User223734 - Posts: 101
I can't find it? I am using 2146 version.

From Moving Average, it is only available "Adaptive' and "Adaptive Binary Wave" , after that it is "Block" , "Double Exponential"......
[2020-09-19 03:58:01]
User90125 - Posts: 715
Upgrade your SC version then. It's there in the latest build.
Date Time Of Last Edit: 2020-09-19 03:59:30
[2020-09-20 05:21:24]
Sierra Chart Engineering - Posts: 104368
Yes update Sierra Chart to the current version to find the study.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account