How to do Simple Moving Average on Indicator?

Is there anyone who can program the moving average of the indicator? (Example: SMA on StdDev and others)?

Thanks.
Attachments
No attachments
  • Votes +2
  • Project Extending SQ
  • Type Feature
  • Status New
  • Priority Normal

History

FC
#1

Kenzo105

26.02.2021 13:27

Task created

FC
#2

Kenzo105

26.02.2021 13:27

i have try with this code,

what am I doing wrong?

package SQ.Blocks.Indicators.StdMedia; import SQ.Calculators.StdDevCalculator; import com.strategyquant.datalib.DataSeries; import com.strategyquant.datalib.TradingException; import com.strategyquant.tradinglib.BuildingBlock; import com.strategyquant.tradinglib.Colors; import com.strategyquant.tradinglib.Help; import com.strategyquant.tradinglib.Output; import com.strategyquant.tradinglib.Parameter; import com.strategyquant.tradinglib.ParameterSet; import com.strategyquant.tradinglib.ReturnTypes; import SQ.Calculators.AverageCalculator; import SQ.Internal.IndicatorBlock; @BuildingBlock(name="(StdMedia) StdMedia", display="SDM(#Period#)[#Shift#]", returnType = ReturnTypes.Price) @Help("StdMedia") @ParameterSet(set="Period=14") @ParameterSet(set="Period=20") @ParameterSet(set="Period=30") @ParameterSet(set="Period=40") @ParameterSet(set="Period=50") @ParameterSet(set="Period=14,ComputedFrom=0") @ParameterSet(set="Period=20,ComputedFrom=0") @ParameterSet(set="Period=30,ComputedFrom=0") @ParameterSet(set="Period=40,ComputedFrom=0") @ParameterSet(set="Period=50,ComputedFrom=0") public class StdMedia extends IndicatorBlock { @Parameter public DataSeries Input; @Parameter(defaultValue="14") public int Period; @Output(name = "StdMedia", color = Colors.Red) public DataSeries Value; private AverageCalculator averageCalculator; //------------------------------------------------------------------------ //------------------------------------------------------------------------ //------------------------------------------------------------------------ @Override protected void OnInit() throws TradingException { averageCalculator = new AverageCalculator(AverageCalculator.SMA, Period); } //------------------------------------------------------------------------ @Override protected void OnBarUpdate() throws TradingException { this.Calls++; averageCalculator.onBarUpdate(Strategy.Indicators.StdDev(Input,Period), CurrentBar); Value.set(0, averageCalculator.getValue()); } }



FC
#3

Kenzo105

26.02.2021 13:27
Voted for this task.
JH
#4

Jabezz

29.06.2021 07:01
Voted for this task.
JH
#5

Jabezz

29.06.2021 07:03
This nested indicator function has been requested by me and others previously. It's a big omission from the software in my opinion, unfortunately the devs don't agree.
E
#6

Emmanuel

15.12.2021 19:42
Voted for this task.

Votes: +2

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please