Login Page - Create Account

Support Board


Date/Time: Thu, 26 Sep 2024 23:31:50 +0000



GetMovAvgType

View Count: 1532

[2013-11-21 05:05:15]
100 - Posts: 147
There is a section of code inside most studies which use variable moving averages.
This list is constant - it always has a simple moving average, wilder's avg, a weighted avg, etc.
Does anyone know where I can find this list in the ACSource folder?
Or how to change the available moving averages in this list?

Any help is much appreciated
-100

[2013-11-21 06:20:09]
crazybears - Posts: 314
Hi

take a look here :

http://www.sierrachart.com/index.php?l=doc/doc_ACSIL_Members_scInputs.html#scInputSetMovAvgType

scstudyfunctions.cpp

scconstants.h
[2013-11-21 09:43:16]
100 - Posts: 147
Thank you very much!

I added code to scstudy func here


/*==========================================================================*/
SCFloatArrayRef MovingAverage_S(SCFloatArrayRef In, SCFloatArrayRef Out, unsigned int MovingAverageType, int Index, int Length)
{
  switch (MovingAverageType)
  {
    case MOVAVGTYPE_EXPONENTIAL:
    return ExponentialMovingAverage_S(In, Out, Index, Length);
    
    case MOVAVGTYPE_LINEARREGRESSION:
    return LinearRegressionIndicator_S(In, Out, Index, Length);
    
    default: // Unknown moving average type
    case MOVAVGTYPE_SIMPLE:
    return SimpleMovAvg_S(In, Out, Index, Length);
    
    case MOVAVGTYPE_WEIGHTED:
    return WeightedMovingAverage_S(In, Out, Index, Length);
    
    case MOVAVGTYPE_WILDERS:
    return WildersMovingAverage_S(In, Out, Index, Length);

    case MOVAVGTYPE_SIMPLE_SKIP_ZEROS:
    return SimpleMovAvgSkipZeros_S(In, Out, Index, Length);

    case MOVAVGTYPE_SMOOTHED:
    return SmoothedMovingAverage_S(In, Out, Index, Length,0);
    
    case MOVAVGTYPE_ADAPTIVE:
    return AdaptiveMovAvg_S(In, Out, Index, Length,0);

  }
}


and to scconstants.h

enum MovAvgTypeEnum
{ MOVAVGTYPE_EXPONENTIAL
, MOVAVGTYPE_LINEARREGRESSION
, MOVAVGTYPE_SIMPLE
, MOVAVGTYPE_WEIGHTED
, MOVAVGTYPE_WILDERS
, MOVAVGTYPE_SIMPLE_SKIP_ZEROS
, MOVAVGTYPE_SMOOTHED
, MOVAVGTYPE_NUMBER_OF_AVERAGES
, MOVAVGTYPE_ADAPTIVE
};

Do I need to add any changes anywhere else to make additions to getmovavgtype ?
Date Time Of Last Edit: 2013-11-21 09:43:57
[2013-11-22 22:04:36]
100 - Posts: 147
*Bump:

Does anyone know how to add moving averages to the getmovavgtype function?
[2013-11-24 05:48:35]
vegasfoster - Posts: 444
You can't change their function, you would have to ask them to add a particular moving average to the function. To do it yourself, you can make your own function and then add the code to each study you want to use it in, which really isn't that difficult to be honest, I put the T3 in just about everything at some point. :)

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

Login

Login Page - Create Account