Category Trend  Published on 07/03/2015

SinMaChineseTranslate

Description
// Only For beginners .this is  TMA  translate into chinese. use Color of violet and period of 16.More like waves //than sma,smma,ema.
// 
\operatorname{TMA}(price, N)_i = \dfrac{{\sum_{j=i-N+1}^N} {SMA_{j}}}{N}

//N= peroid.

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
// 系统自动的语句------------------------------------------------------------------------------------

namespace cAlgo
{
    // 指标一般都是这个语句----------------------------------------------------------
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

//--isoverlay 是否显示在图表上;utc是服务器时间、ChinaStandardTime北京时间; .none不需要处理权,有(FullAccess、Internet)
    public class SinMa : Indicator
    {
//--公用类------------TriangularMa  是类名称赋值了。
        [Parameter(DefaultValue = 16)]
        public int SinMaPeriod { get; set; }
//--周期输入,及初始值。MaCenterPeriod是周期参数
//若要添加其他自定参量:[Parameter(DefaultValue = 5)] public int LipsPeriods { get; set; }
        [Output("sinma", Color = Colors.Violet)]
        public IndicatorDataSeries sinma { get; set; }
//--输出颜色--输出线的名称,输出线的取值----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
        private TriangularMovingAverage sindata;

//--------------sindata 的名称用于储存计算后的数组--------------------------------------------


        protected override void Initialize()
        {
            sindata = Indicators.TriangularMovingAverage(MarketSeries.Close, SinMaPeriod);
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
            //Print the current value of _triangularMovingAverage to the log
            sinma[index] = sindata.Result[index];

            //显示是通过数组,第一个是0:Print("Current Balance is {0}, Equity is {1}.", Account.Balance, Account.Equity);
            //--若是要提供偏移参看:Jaws[index + JawsShift] = jawsMa.Result[index];

        }

    }
}

 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
// 系统自动的语句------------------------------------------------------------------------------------

namespace cAlgo
{
    // 指标一般都是这个语句----------------------------------------------------------
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

//--isoverlay 是否显示在图表上;utc是服务器时间、ChinaStandardTime北京时间; .none不需要处理权,有(FullAccess、Internet)
    public class SinMa : Indicator
    {
//--公用类------------TriangularMa  是类名称赋值了。
        [Parameter(DefaultValue = 16)]
        public int SinMaPeriod { get; set; }
//--周期输入,及初始值。MaCenterPeriod是周期参数
//若要添加其他自定参量:[Parameter(DefaultValue = 5)] public int LipsPeriods { get; set; }
        [Output("sinma", Color = Colors.Violet)]
        public IndicatorDataSeries sinma { get; set; }
//--输出颜色--输出线的名称,输出线的取值----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
        private TriangularMovingAverage sindata;

//--------------sindata 的名称用于储存计算后的数组--------------------------------------------


        protected override void Initialize()
        {
            sindata = Indicators.TriangularMovingAverage(MarketSeries.Close, SinMaPeriod);
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
            //Print the current value of _triangularMovingAverage to the log
            sinma[index] = sindata.Result[index];

            //显示是通过数组,第一个是0:Print("Current Balance is {0}, Equity is {1}.", Account.Balance, Account.Equity);
            //--若是要提供偏移参看:Jaws[index + JawsShift] = jawsMa.Result[index];

        }

    }
}


metalsing's avatar
metalsing

Joined on 06.03.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: 三角TMA.algo
  • Rating: 0
  • Installs: 2429
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.