YesOrNot
Information
Username: | YesOrNot |
Member since: | 10 Oct 2022 |
Last login: | 26 Aug 2024 |
Status: | Blocked |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 33 | 29 |
Forum Topics | 4 | 6 |
Jobs | 1 | 0 |
About
Last Algorithm Comments
Thx Jim and Tommy !
Feel free to share formulas, ideas, or even strategies.
I andrea, i just add the description.
Source Code is in the package ?
Great Job !
Hello, do you take into consideration commissions and spreads in your risk and reward calculations? I've briefly reviewed your code, but it doesn't seem like you account for them. (If not, in a scalping strategy, the risk-reward ratio would be completely skewed.)
Hi !
I just see your work, i have try the same thing but other way, can i ask you how you use it ?
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 RenkoDelta : Indicator
{
[Parameter("Min", DefaultValue = 1)]
public double Min { get; set; }
[Parameter("Max", DefaultValue = 2)]
public double Max { get; set; }
[Output("Result1", PlotType = PlotType.Histogram)]
public IndicatorDataSeries Result1 { get; set; }
[Output("Result11", LineColor = "Lime", PlotType = PlotType.Histogram, Thickness = 5)]
public IndicatorDataSeries Result11 { get; set; }
[Output("Result2", LineColor = "Lime", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries Result2 { get; set; }
[Output("Result3", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries Result3 { get; set; }
private IndicatorDataSeries Result;
protected override void Initialize()
{
Result = CreateDataSeries();
}
public override void Calculate(int index)
{
TimeSpan t = Bars.OpenTimes[index] - Bars.OpenTimes[index - 1];
if (t.TotalMinutes > 2880)
Result[index] = t.TotalMinutes - 2880;
else
Result[index] = t.TotalMinutes;
Result1[index] = Bars.ClosePrices.Last(0) > Bars.OpenPrices.Last(0) ? Result[index] : double.NaN;
Result11[index] = Bars.ClosePrices.Last(0) < Bars.OpenPrices.Last(0) ? Result[index] : double.NaN;
Result2[index] = Result[index] > Min && Result[index] < Max && Bars.OpenPrices.Last(0) < Bars.ClosePrices.Last(0) ? -2 : double.NaN;
Result3[index] = Result[index] > Min && Result[index] < Max && Bars.OpenPrices.Last(0) > Bars.ClosePrices.Last(0) ? -2 : double.NaN;
}
}
}
Or you can use it, he work good too :
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 = false, AccessRights = AccessRights.None)]
public class VhfFractalDown : Indicator
{
[Parameter("Vhf Period", DefaultValue = 15, MinValue = 1, Group = "Vertical/Horizontal Filter")]
public int Period { get; set; }
[Parameter("Fractal Period", DefaultValue = 10, MinValue = 1, Group = "Signal")]
public int PeriodFractal { get; set; }
[Parameter("Fractal Shift", DefaultValue = 1, MinValue = 1, Group = "Signal")]
public int FractalShift { get; set; }
[Output("Vhf", LineColor = "DeepSkyBlue")]
public IndicatorDataSeries Vhf { get; set; }
[Output("FractalDown", LineColor = "Orange")]
public IndicatorDataSeries FractalDown { get; set; }
private IndicatorDataSeries min;
private VerticalHorizontalFilter vhf;
protected override void Initialize()
{
min = CreateDataSeries();
vhf = Indicators.VerticalHorizontalFilter(Bars.ClosePrices, Period);
}
public override void Calculate(int index)
{
Vhf[index] = vhf.Result.Last(0);
FractalDown[index + FractalShift] = vhf.Result.Minimum(PeriodFractal);
}
}
}
Let dif Hilo body and fractal down on the indicator, hide the other.
What is a good trend: full candles that follow their path without a reverse rejection.
The indicator I shared with you analyzes the difference between full candles and rejection candles.
Therefore, the output 'dif hilo body' indicates when it follows an upward angle, a strong trend without rejection, and conversely, during a downward angle, the rejection zones become more significant, so the trend decreases.
The fractal Down line shows when the diff Milo line reaches its new minimum, indicating a possible trend reversal or a consolidation zone in view of the trend's continuity.
Have a great day!
RE : Here is a version 2, which allows you to see when the trend ends. There are many possibilities here, such as adding a moving average, Bollinger bands, etc. Worth checking out!
using System;
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class DRKHASHIXCandlePower : Indicator
{
[Parameter("Period Reference", DefaultValue = 100, MinValue = 1, Group = "PeriodReference")]
public int PeriodReference { get; set; }
[Parameter("Period To Check", DefaultValue = 10, MinValue = 1, Group = "PeriodReference")]
public int PeriodToCheck { get; set; }
[Parameter("Fractal Period", DefaultValue = 10, MinValue = 1, Group = "End Trend")]
public int FractalDown { get; set; }
[Parameter("Fractal Shift", DefaultValue = 10, MinValue = 1, Group = "End Trend")]
public int FractalShift { get; set; }
[Output("Candle Power Hilo", LineColor = "DeepSkyBlue")]
public IndicatorDataSeries CandlePowerHilo { get; set; }
[Output("Candle Power Body", LineColor = "Orange")]
public IndicatorDataSeries CandlePowerBody { get; set; }
[Output("LabelHilo", Color = Colors.White, PlotType = PlotType.Points, Thickness = 1)]
public IndicatorDataSeries LabelHilo { get; set; }
[Output("LabelBody", Color = Colors.White, PlotType = PlotType.Points, Thickness = 1)]
public IndicatorDataSeries LabelBody { get; set; }
[Output("Diff Hilo Body", LineColor = "Lime")]
public IndicatorDataSeries DiffHiloBody { get; set; }
[Output("Fractal Down", LineColor = "Red")]
public IndicatorDataSeries Fractal { get; set; }
private IndicatorDataSeries res, min;
protected override void Initialize()
{
res = CreateDataSeries();
min = CreateDataSeries();
}
public override void Calculate(int index)
{
if (index < Math.Max(PeriodReference, PeriodToCheck))
return;
double sumCandleHeightReference = 0;
double sumCandleHeightToCheckHiLo = 0;
double sumCandleHeightToCheckBody = 0;
for (int i = 0; i < PeriodReference; i++)
sumCandleHeightReference += MarketSeries.High[index - i] - MarketSeries.Low[index - i];
for (int i = 0; i < PeriodToCheck; i++)
sumCandleHeightToCheckHiLo += MarketSeries.High[index - i] - MarketSeries.Low[index - i];
for (int i = 0; i < PeriodToCheck; i++)
sumCandleHeightToCheckBody += Math.Max(MarketSeries.Open[index - i], MarketSeries.Close[index - i]) - Math.Min(MarketSeries.Open[index - i], MarketSeries.Close[index - i]);
double averageCandleHeightReference = sumCandleHeightReference / PeriodReference;
double averageCandleHeightToCheckHilo = sumCandleHeightToCheckHiLo / PeriodToCheck;
double averageCandleHeightToCheckBody = sumCandleHeightToCheckBody / PeriodToCheck;
double candlePowerHilo = averageCandleHeightToCheckHilo / averageCandleHeightReference;
double candlePowerBody = averageCandleHeightToCheckBody / averageCandleHeightReference;
CandlePowerHilo[index] = candlePowerHilo;
CandlePowerBody[index] = candlePowerBody;
LabelHilo[index] = candlePowerHilo;
LabelBody[index] = candlePowerBody;
ChartObjects.DrawText("LabelHilo", candlePowerHilo.ToString("F4"), index, CandlePowerHilo[index], VerticalAlignment.Top, HorizontalAlignment.Right, Colors.White);
ChartObjects.DrawText("LabelBody", candlePowerBody.ToString("F4"), index, CandlePowerBody[index], VerticalAlignment.Bottom, HorizontalAlignment.Right, Colors.White);
res[index] = CandlePowerHilo[index] - CandlePowerBody[index];
DiffHiloBody[index] = res[index];
Fractal[index + FractalShift] = DiffHiloBody.Minimum(FractalDown);
}
}
}
Hi, littl add here :
using System;
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class DRKHASHIXCandlePower : Indicator
{
[Parameter("Period Reference", DefaultValue = 100, MinValue = 1)]
public int PeriodReference { get; set; }
[Parameter("Period To Check", DefaultValue = 10, MinValue = 1)]
public int PeriodToCheck { get; set; }
[Output("Candle Power Hilo", LineColor = "FF0070C0")]
public IndicatorDataSeries CandlePowerHilo { get; set; }
[Output("Candle Power Body", LineColor = "FF0070C0")]
public IndicatorDataSeries CandlePowerBody { get; set; }
[Output("LabelHilo", Color = Colors.White, PlotType = PlotType.Points, Thickness = 1)]
public IndicatorDataSeries LabelHilo { get; set; }
[Output("LabelBody", Color = Colors.White, PlotType = PlotType.Points, Thickness = 1)]
public IndicatorDataSeries LabelBody { get; set; }
protected override void Initialize()
{
// Initialize anything here if needed
}
public override void Calculate(int index)
{
if (index < Math.Max(PeriodReference, PeriodToCheck))
return;
double sumCandleHeightReference = 0;
double sumCandleHeightToCheckHiLo = 0;
double sumCandleHeightToCheckBody = 0;
for (int i = 0; i < PeriodReference; i++)
sumCandleHeightReference += MarketSeries.High[index - i] - MarketSeries.Low[index - i];
for (int i = 0; i < PeriodToCheck; i++)
sumCandleHeightToCheckHiLo += MarketSeries.High[index - i] - MarketSeries.Low[index - i];
for (int i = 0; i < PeriodToCheck; i++)
sumCandleHeightToCheckBody += Math.Max(MarketSeries.Open[index - i], MarketSeries.Close[index - i]) - Math.Min(MarketSeries.Open[index - i], MarketSeries.Close[index - i]);
double averageCandleHeightReference = sumCandleHeightReference / PeriodReference;
double averageCandleHeightToCheckHilo = sumCandleHeightToCheckHiLo / PeriodToCheck;
double averageCandleHeightToCheckBody = sumCandleHeightToCheckBody / PeriodToCheck;
double candlePowerHilo = averageCandleHeightToCheckHilo / averageCandleHeightReference;
double candlePowerBody = averageCandleHeightToCheckBody / averageCandleHeightReference;
CandlePowerHilo[index] = candlePowerHilo;
CandlePowerBody[index] = candlePowerBody;
LabelHilo[index] = candlePowerHilo;
LabelBody[index] = candlePowerBody;
ChartObjects.DrawText("LabelHilo", candlePowerHilo.ToString("F4"), index, CandlePowerHilo[index], VerticalAlignment.Top, HorizontalAlignment.Right, Colors.White);
ChartObjects.DrawText("LabelBody", candlePowerBody.ToString("F4"), index, CandlePowerBody[index], VerticalAlignment.Bottom, HorizontalAlignment.Right, Colors.White);
}
}
}
Have A Nice day.
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(AccessRights = AccessRights.None)]
public class LarryWilliamsLargeTradingIndex : Indicator
{
[Parameter(DefaultValue = 8)]
public int Period { get; set; }
[Parameter(DefaultValue = 8)]
public MovingAverageType MaType { get; set; }
[Output("NoValue", LineColor = "Gray", IsHistogram = false, PlotType = PlotType.DiscontinuousLine, Thickness = 2)]
public IndicatorDataSeries NoValue { get; set; }
[Output("BullishValue", LineColor = "Green", IsHistogram = false, PlotType = PlotType.DiscontinuousLine, Thickness = 2)]
public IndicatorDataSeries BullishValue { get; set; }
[Output("BearishValue", LineColor = "Red", IsHistogram = false, PlotType = PlotType.DiscontinuousLine, Thickness = 2)]
public IndicatorDataSeries BearishValue { get; set; }
[Output("Middle", LineColor = "FF737373", Thickness = 1, LineStyle = LineStyle.Dots)]
public IndicatorDataSeries Middle { get; set; }
private MovingAverage ma1;
private MovingAverage ma2;
private AverageTrueRange averageTrueRange;
private IndicatorDataSeries resMa;
private IndicatorDataSeries atr;
private IndicatorDataSeries sourceMa;
protected override void Initialize()
{
sourceMa = CreateDataSeries();
atr = CreateDataSeries();
resMa = CreateDataSeries();
ma1 = Indicators.MovingAverage(sourceMa, Period, MaType);
averageTrueRange = Indicators.AverageTrueRange(Period, MaType);
}
public override void Calculate(int index)
{
// Level
Middle[index] = 50;
// Source of calculation ma
sourceMa[index] = Bars.ClosePrices.Last(0) - Bars.ClosePrices.Last(Period);
// calculation ATR
atr[index] = averageTrueRange.Result[index];
//LarryWilliams Calculation
resMa[index] = ma1.Result[index] / atr[index] * 50 + 50;
//Output
NoValue[index] = resMa[index];
BearishValue[index] = resMa[index] < 50 ? resMa[index] : double.NaN;
BullishValue[index] = resMa[index] > 50 ? resMa[index] : double.NaN;
// Repaint Calculation UNCOMMENT FOR SEE (The color is make in function of < or > 50, It's juste a coloration of previous)
if (resMa[index] > 50)
{
BullishValue[index] = resMa[index];
if (resMa[index - 1] < 50)
BullishValue[index - 1] = resMa[index - 1];
BearishValue[index] = double.NaN;
}
if (resMa[index] < 50)
{
BearishValue[index] = resMa[index];
if (resMa[index - 1] > 50)
BearishValue[index - 1] = resMa[index - 1];
BullishValue[index] = double.NaN;
}
}
}
}
Source code ?
Hi Splash the,
Can you explain me exactly what you wanna make ?
For collaboration my telegram here : https://t.me/nimi012
Hi, any source code avaible ?
Line 26 : you can change the min value to 0 for better functionnality
[Parameter("Sensibility Histo", DefaultValue = 2, MinValue = 0, Group = "---HISTOGRAM---")]
Hi, @crawfordevans499 thank you for your comment!
If it is complicated to understand then I explain to you :
1. The trend force uses a moving average and calculates its degree of inclination with respect to the selected lookback period. so you can know if the ma has a significant curve or not
2. the formula is a trigonometry rule. If you put a lookback 1, you will have the angle on a single period, on lookback 10, you will have the angle between the previous 10th bar and the last one.
3. To understand the result, I invite you to put a lookback of 1, and put the same moving average on the chart, so you can understand how it works, its advantages, and its disadvantages.
Have a nice study =) and why not, tell us what you find ! =D
I forget to say “Champion” !
Hi, Collaboration ?
Look Good !
Source code ?
Hi, can you add the source code ?
.
.
Source Code ?
After reflection, I think this is the best solution for renko
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("Renko Open", "Renko Close", FirstColor = "Green", SecondColor = "Red", Opacity = 0.5)]
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class RenkoOnChart : Indicator
{
[Parameter(DefaultValue = "Renko10")]
public TimeFrame RenkoPips { get; set; }
[Output("Renko Open", LineColor = "Red")]
public IndicatorDataSeries RenkoUp { get; set; }
[Output("Renko Close", LineColor = "Green")]
public IndicatorDataSeries RenkoDown { get; set; }
Bars renko;
IndicatorDataSeries high, low, open, close;
protected override void Initialize()
{
renko = MarketData.GetBars(RenkoPips);
high = CreateDataSeries();
low = CreateDataSeries();
open = CreateDataSeries();
close = CreateDataSeries();
}
public override void Calculate(int index)
{
var indexBase = renko.OpenTimes.GetIndexByTime(Bars.OpenTimes.Last(0));
open[index] = renko.OpenPrices[indexBase];
close[index] = renko.ClosePrices[indexBase];
high[index] = renko.HighPrices[indexBase];
low[index] = renko.LowPrices[indexBase];
RenkoUp[index] = close[index] > open[index] ? high[index] : low[index];
RenkoDown[index] = close[index] < open[index] ? high[index] : low[index];
}
}
}
Hi, First of all thank you for all the codes you post! You do a lot of work !
I fixed the double renko bug. example (50 pips): if a bar makes more than 100 pips and retraces directly, there is an error. There must surely be some bugs. Enjoy
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("Renko Top", "Renko NewLevel", FirstColor = "Red", SecondColor = "Red", Opacity = 0.5)]
[Cloud("Renko NewLevel", "Renko Bottom", FirstColor = "Green", SecondColor = "Green", Opacity = 0.5)]
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class mRenkoLineBreak : Indicator
{
[Parameter("PIPS BoxSize (default 50)", DefaultValue = 50, MinValue = 2)]
public int inpBrickSize { get; set; }
[Output("Renko Top", LineColor = "Gray", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRenkoTop { get; set; }
[Output("Renko Bottom", LineColor = "Gray", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRenkoBottom { get; set; }
[Output("Renko NewLevel", LineColor = "Transparent", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRenkoNewLevel { get; set; }
private double _bricksize;
private IndicatorDataSeries _top, _bottom, _newlevel;
protected override void Initialize()
{
_bricksize = inpBrickSize * Symbol.PipSize;
_top = CreateDataSeries();
_bottom = CreateDataSeries();
_newlevel = CreateDataSeries();
}
public override void Calculate(int i)
{
_top[i] = i > 1 ? _top[i - 1] : Bars.HighPrices[i];
_bottom[i] = i > 1 ? _bottom[i - 1] : Bars.LowPrices[i];
_newlevel[i] = i > 1 ? _newlevel[i - 1] : _top[i];
if (Bars.ClosePrices.Last(0) >= _top[i - 1] + _bricksize)
{
var test = Math.Floor((Bars.ClosePrices.Last(0) - _top[i - 1]) / _bricksize);
_top[i] = (test == 0 || test == 1 ? _top[i - 1] + _bricksize : _top[i - 1] + _bricksize * test );
_bottom[i] = (test == 0 || test == 1 ? _top[i] - _bricksize : _top[i - 1] - _bricksize * test);
_newlevel[i] = _top[i];
}
if (Bars.ClosePrices.Last(0) <= _bottom[i - 1] - _bricksize)
{
var test = Math.Floor((_bottom[i] - Bars.ClosePrices.Last(0)) / _bricksize);
_top[i] = (test == 0 || test == 1 ? _top[i - 1] - _bricksize : _top[i - 1] - _bricksize * test );
_bottom[i] = (test == 0 || test == 1 ? _top[i] - _bricksize : _top[i - 1] - _bricksize * test- _bricksize);
_newlevel[i] = _bottom[i];
}
outRenkoTop[i] = _bottom[i] == _newlevel[i] ? _bottom[i] + _bricksize : _top[i];
outRenkoBottom[i] = _top[i] == _newlevel[i] ? _top[i] - _bricksize : _bottom[i];
outRenkoNewLevel[i] = _newlevel[i];
}
}
}
Hello, great job!
Which libraries available for artificial intelligence and machine learning did you using ?
Accord.NET, ML.NET, AForge.NET, Encog, Deedle, Numl ???