Description
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Pulsar : Indicator
{
[Parameter("Brick Size", DefaultValue = 0.0001, Step = 1E-05)]
public double brickSize { get; set; }
[Output("Result1", LineColor = "DimGray")]
public IndicatorDataSeries Result1 { get; set; }
private double price, level, previousLevel, result;
private bool bullish, bearish;
private double step;
protected override void Initialize()
{
previousLevel = Math.Round(Bars.ClosePrices.LastValue, 4);
bullish = true;
bearish = false;
}
public override void Calculate(int index)
{
price = Bars.ClosePrices[index];
step = brickSize * 10000;
level = Math.Round((price / step), 4) * step;
if (level > previousLevel)
if (price < level)
level = level - brickSize;
if (level < previousLevel)
if (price > level)
level = level + brickSize;
result = Math.Round((level - previousLevel) * 10, 4) / 10;
if (bullish)
{
if (result == -brickSize)
level = level + brickSize;
if (result == -2 * brickSize || result < -2 * brickSize)
{
bullish = false;
bearish = true;
}
}
if (bearish)
{
if (result == brickSize)
level = level - brickSize;
if (result == 2 * brickSize || result > 2 * brickSize)
{
bullish = true;
bearish = false;
}
}
result = Math.Round((level - previousLevel) * 10, 4) / 10;
Result1[index] = result;
previousLevel = level;
}
}
}
srm_bcn
Joined on 01.09.2019
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Pulsar.algo
- Rating: 0
- Installs: 1109
- Modified: 13/10/2021 09:54
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.
Many users have no any for roblox roblox free robux thanks for the share this post.