Description
reswtewrtgqeawrhqer
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
{
[Cloud("Fast MA", "Slow MA", FirstColor = "LawnGreen")]
[Indicator(AccessRights = AccessRights.None, IsOverlay = true)]
public class MovingAverageCrossOverExperto : Indicator
{
[Parameter("Fast Period", DefaultValue = "45")]
public int fastPeriod{ get; set; }
[Parameter("Slow Period", DefaultValue = "100")]
public int slowPeriod{ get; set; }
[Parameter("Moving Average Type", DefaultValue = MovingAverageType.WilderSmoothing)]
public MovingAverageType MaType { get; set; }
[Output("Fast MA", LineColor = "LawnGreen")]
public IndicatorDataSeries Fast_MA { get; set; }
[Output("Slow MA", LineColor = "Coral")]
public IndicatorDataSeries Slow_MA { get; set; }
public MovingAverage SlowMa;
public MovingAverage FastMa;
protected override void Initialize()
{
FastMa = Indicators.MovingAverage(Bars.ClosePrices, fastPeriod, MaType);
SlowMa = Indicators.MovingAverage(Bars.ClosePrices, slowPeriod, MaType);
}
public override void Calculate(int index)
{
Fast_MA[index] = FastMa.Result[index];
Slow_MA[index] = SlowMa.Result[index];
if(Bars.ClosePrices[index] >= FastMa.Result[index])
{
if(Bars.ClosePrices[index] >= Bars.OpenPrices[index])
Chart.SetBarColor(index, Color.LawnGreen);
else if(Bars.ClosePrices[index] < Bars.OpenPrices[index])
Chart.SetBarColor(index, Color.Green);
}
else if(Bars.ClosePrices[index] < FastMa.Result[index])
{
if(Bars.ClosePrices[index] <= Bars.OpenPrices[index])
Chart.SetBarColor(index, Color.Red);
else if(Bars.ClosePrices[index] > Bars.OpenPrices[index])
Chart.SetBarColor(index, Color.Coral);
}
}
}
}
IN
info.creativeclicks
Joined on 14.11.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Moving Average Cross Over Experto.algo
- Rating: 0
- Installs: 658
- Modified: 14/11/2022 18:01
Warning! Running cBots downloaded from this section may lead to financial losses. Use them at your own risk.
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
Why are you copy pasting my indicator? What's so cool about doing it?
This is the original one Moving Average Cross Over