Category Trend  Published on 29/07/2024

Baseline Power

Description

This program is a custom indicator for the cAlgo trading platform, used for developing trading robots and technical indicators for cTrader. The indicator is called "BaselinePower" and is used to plot three moving average lines on a price chart, allowing traders to visualize trends and make informed trading decisions.

Here is a detailed description of the program's features and functionality:

Parameters

The program defines several user-configurable parameters:

  1. Period: The period of the first moving average (default 9).
  2. Ma Type: The type of moving average for the first period (default Weighted).
  3. Period Signal: The period of the second moving average (default 9).
  4. Ma Type: The type of moving average for the second period (default Weighted).
  5. Period Signal2: The period of the third moving average (default 9).
  6. Ma Type: The type of moving average for the third period (default Weighted).

Outputs

The program defines three output data series:

  1. Result: The value of the first moving average.
  2. Signal: The value of the second moving average.
  3. Signal2: The value of the third moving average.

These outputs are plotted as lines on the chart, with specific colors and thicknesses:

  • Result: green line (Lime)
  • Signal: red line (Red)
  • Signal2: golden line (Gold)

Initialization

In the Initialize method, the program initializes three moving average objects:

  1. ma: The first moving average calculated on the closing prices with the specified period and type.
  2. signal: The second moving average calculated on the results of the first moving average.
  3. signal2: The third moving average calculated on the results of the second moving average.

Calculation

In the Calculate method, the program updates the values of the output data series for each index on the chart:

  • The value of Result is updated with the value of the first moving average.
  • The value of Signal is updated with the value of the second moving average.
  • The value of Signal2 is updated with the value of the third moving average.

Usage

This program can be used by traders to:

  1. Track market trends using multiple moving averages.
  2. Identify buy or sell signals when the moving averages cross.
  3. Visualize price dynamics over different periods.

In summary, the "BaselinePower" indicator is a powerful tool for traders who want to analyze price trends using multiple moving averages, offering a clear and configurable visualization directly on the trading chart.

Baseline Power Multi TF here : https://ctrader.com/algos/indicators/show/4408/

Enjoy for Free =) 


Previous account here : https://ctrader.com/users/profile/70920
Contact telegram :  https://t.me/nimi012 
 

 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class BaselinePower : Indicator
    {

        [Parameter("Period", DefaultValue = 7, Group = "Calculation Ma")]
        public int Period { get; set; }
        [Parameter("Ma Type", DefaultValue = MovingAverageType.Weighted, Group = "Calculation Ma")]
        public MovingAverageType MaTypePeriod { get; set; }
        [Parameter("Period Signal", DefaultValue = 7, Group = "Calculation Ma")]
        public int PeriodSignal { get; set; }
        [Parameter("Ma Type", DefaultValue = MovingAverageType.Weighted, Group = "Calculation Ma")]
        public MovingAverageType MaTypePeriodSignal { get; set; }
        [Parameter("Period Signal2", DefaultValue = 7, Group = "Calculation Ma")]
        public int PeriodSignal2 { get; set; }
        [Parameter("Ma Type", DefaultValue = MovingAverageType.Weighted, Group = "Calculation Ma")]
        public MovingAverageType MaTypePeriodSignal2 { get; set; }

        [Output("Result", PlotType = PlotType.Line, LineColor = "Lime", Thickness = 1)]
        public IndicatorDataSeries Result { get; set; }
        [Output("Signal", PlotType = PlotType.Line, LineColor = "Gold", Thickness = 1)]
        public IndicatorDataSeries Signal { get; set; }
        [Output("Signal2", PlotType = PlotType.Line, LineColor = "Red", Thickness = 1)]
        public IndicatorDataSeries Signal2 { get; set; }

        private MovingAverage ma, signal, signal2;

        protected override void Initialize()
        {
            ma = Indicators.MovingAverage(Bars.ClosePrices, Period, MaTypePeriod);
            signal = Indicators.MovingAverage(ma.Result, PeriodSignal, MaTypePeriodSignal);
            signal2 = Indicators.MovingAverage(signal.Result, PeriodSignal2, MaTypePeriodSignal2);
        }

        public override void Calculate(int index)
        {
            Result[index] = ma.Result[index];
            Signal[index] = signal.Result[index];
            Signal2[index] = signal2.Result[index];

        }
    }
}

YE
YesOrNot2

Joined on 17.05.2024

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Baseline Power.algo
  • Rating: 5
  • Installs: 180
  • Modified: 29/07/2024 13:02
Comments
Log in to add a comment.
No comments found.