Description
<font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>usando Sistema;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
usando cAlgo.API;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
usando cAlgo.API.Internals;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
usando cAlgo.API.Indicators;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
usando cAlgo.Indicators;</font></font><font></font>
<font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
namespace
cAlgo</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
{</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
[Indicator(IsOverlay =
true
, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
classe pública UTBOT : Indicador</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
{</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
[Parameter(
"Chave"
, DefaultValue = 1)]</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
valor-chave
public
double
{
get
; </font><font style=
"vertical-align: inherit;"
>definir; </font><font style=
"vertical-align: inherit;"
>}</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
[Parameter(
"Período ATR"
, DefaultValue = 10)]</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
public
int
atrperiod {
get
; </font><font style=
"vertical-align: inherit;"
>definir; </font><font style=
"vertical-align: inherit;"
>}</font></font><font></font>
<font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
privado AverageTrueRange xATR;</font></font><font></font>
<font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
[Output(
"UpTrend"
, PlotType = PlotType.DiscontinuousLine, LineColor =
"Green"
)]</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
public
IndicatorDataSeries XATRTrailingStopGreen {
get
; </font><font style=
"vertical-align: inherit;"
>definir; </font><font style=
"vertical-align: inherit;"
>}</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
[Output(
"Contínuos"
, PlotType = PlotType.DiscontinuousLine, LineColor =
"Verde"
)]</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
public
IndicatorDataSeries XATRTrailingStop {
get
; </font><font style=
"vertical-align: inherit;"
>definir; </font><font style=
"vertical-align: inherit;"
>}</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
[Output(
"DownTrend"
, PlotType = PlotType.DiscontinuousLine, LineColor =
"Red"
)]</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
public
IndicatorDataSeries XATRTrailingStopRed {
get
; </font><font style=
"vertical-align: inherit;"
>definir; </font><font style=
"vertical-align: inherit;"
>}</font></font><font></font>
<font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
substituição protegida
void
Initialize()</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
{</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
xATR = Indicators.AverageTrueRange(atrperiod, MovingAverageType.Exponential);</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
}</font></font><font></font>
<font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
substituição pública
void
Calcular(
int
index)</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
{</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
double
nLoss = valor-chave * xATR.Result[index];</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
XATRTrailingStop[index] = (MarketSeries.Close[index] > XATRTrailingStop[index - 1] && MarketSeries.Close[index - 1] > XARTrailingStop[index - 1]) ? </font><font style=
"vertical-align: inherit;"
>Math.Max(XATRTrailingStop[index - 1], MarketSeries.Close[index] - nLoss) : (MarketSeries.Close[index] < XATRTrailingStop[index - 1] && MarketSeries.Close[index - 1] < XATRTrailingStop[index - 1 ]) ? </font><font style=
"vertical-align: inherit;"
>Math.Min(XATRTrailingStop[index - 1], MarketSeries.Close[index] + nLoss) : (MarketSeries.Close[index] > XARTrailingStop[index - 1]) ? </font><font style=
"vertical-align: inherit;"
>MarketSeries.Close[index] - nLoss : MarketSeries.Close[index] + nLoss;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
XATRTrailingStopGreen[índice] = XATRTrailingStop[índice] < MarketSeries.Close[índice] ? </font><font style=
"vertical-align: inherit;"
>XATRTrailingStop[índice] :
double
.NaN;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
XATRTrailingStopRed[índice] = XATRTrailingStop[índice] > MarketSeries.Close[índice] ? </font><font style=
"vertical-align: inherit;"
>XATRTrailingStop[índice] :
double
.NaN;</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
}</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
}</font></font><font></font><font style=
"vertical-align: inherit;"
><font style=
"vertical-align: inherit;"
>
}</font></font><font></font>
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)]
public class UTBOT : Indicator
{
[Parameter("Key", DefaultValue = 1)]
public double keyvalue { get; set; }
[Parameter("ATR Period", DefaultValue = 10)]
public int atrperiod { get; set; }
private AverageTrueRange xATR;
[Output("UpTrend", PlotType = PlotType.DiscontinuousLine, LineColor = "Green")]
public IndicatorDataSeries XATRTrailingStopGreen { get; set; }
[Output("Continuos", PlotType = PlotType.DiscontinuousLine, LineColor = "Green")]
public IndicatorDataSeries XATRTrailingStop { get; set; }
[Output("DownTrend", PlotType = PlotType.DiscontinuousLine, LineColor = "Red")]
public IndicatorDataSeries XATRTrailingStopRed { get; set; }
protected override void Initialize()
{
xATR = Indicators.AverageTrueRange(atrperiod, MovingAverageType.Exponential);
}
public override void Calculate(int index)
{
double nLoss = keyvalue * xATR.Result[index];
XATRTrailingStop[index] = (MarketSeries.Close[index] > XATRTrailingStop[index - 1] && MarketSeries.Close[index - 1] > XATRTrailingStop[index - 1]) ? Math.Max(XATRTrailingStop[index - 1], MarketSeries.Close[index] - nLoss) : (MarketSeries.Close[index] < XATRTrailingStop[index - 1] && MarketSeries.Close[index - 1] < XATRTrailingStop[index - 1]) ? Math.Min(XATRTrailingStop[index - 1], MarketSeries.Close[index] + nLoss) : (MarketSeries.Close[index] > XATRTrailingStop[index - 1]) ? MarketSeries.Close[index] - nLoss : MarketSeries.Close[index] + nLoss;
XATRTrailingStopGreen[index] = XATRTrailingStop[index] < MarketSeries.Close[index] ? XATRTrailingStop[index] : double.NaN;
XATRTrailingStopRed[index] = XATRTrailingStop[index] > MarketSeries.Close[index] ? XATRTrailingStop[index] : double.NaN;
}
}
}
danielpintoadv
Joined on 17.07.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: UT BOT.algo
- Rating: 0
- Installs: 1322
- Modified: 16/07/2022 21:41
Comments
If you're looking for a durable, long-lasting, and all-around top trade then this is the one for you. With a beautiful color, sturdy construction, and take my classes for me, this will last for years to come. You'll be able to keep your items on top and be able to grab them easily.
escreva em português por favor, teu inglês é muito ruim
Explanation on what this does please?
Thanks to your writing, I now find the posed problem to be engaging. I'm sure I'm not the only one who has an interest in them. In what time frame could I expect to see this article finished? I really appreciate the high standard of the articles you post. For sure, this article will shock a lot of people when they read it, and that's the point! The post is appreciated. the backrooms