Description
Indicator Bulls Bears Impulse displays in a separate window a pulse graph showing the market switches from bullish to bearish, and vice versa.
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(0)]
[Cloud("Bulls Impulse", "Bears Impulse", FirstColor = "Green", SecondColor = "Red", Opacity = 0.1)]
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class mBullsBearsImpulse : Indicator
{
[Parameter("Periods (13)", DefaultValue = 13)]
public int inpPeriods { get; set; }
[Output("Bulls Impulse", LineColor = "Green", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outBullsImpulse { get; set; }
[Output("Bears Impulse", LineColor = "Red", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outBearsImpulse { get; set; }
private MovingAverage _pricesmooth;
private IndicatorDataSeries _bulls, _bears;
protected override void Initialize()
{
_pricesmooth = Indicators.MovingAverage(Bars.ClosePrices, inpPeriods, MovingAverageType.Exponential);
_bulls = CreateDataSeries();
_bears = CreateDataSeries();
}
public override void Calculate(int i)
{
_bulls[i] = Bars.HighPrices[i] - _pricesmooth.Result[i];
_bears[i] = Bars.LowPrices[i] - _pricesmooth.Result[i];
outBullsImpulse[i] = _bulls[i] + _bears[i] > 0 ? +1 : -1;
outBearsImpulse[i] = _bulls[i] + _bears[i] < 0 ? +1 : -1;
}
}
}

mfejza
Joined 25.01.2022
- Type: free
- Language: C#
- Trading Platform: cTrader Automate
- Filename: mBullsBearsImpulse.algo
- Rating: 0
- Downloads: 271
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Comments
Only logged in users can post a comment
Comments not found