Indicators

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.
How to install
renko
  0
  0
  73
free  11 Dec 2022
using cAlgo.API;<font></font> using cAlgo.API.Indicators;<font></font> using cAlgo.API.Internals;<font></font> using cAlgo.Indicators;<font></font> using System;<font></font> using System.Collections.Generic;<font></font> using System.Linq;<font></font> using System.Windows.Forms;<font></font> using System.Runtime.InteropServices;<font></font> using System.Diagnostics;<font></font> using cT_MedianRenkoEngine;<font></font> <font></font> namespace cAlgo<font></font> {<font></font>     [Indicator("MedianRenko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]<font></font>     public class MedianRenko : Indicator<font></font>     {<font></font>         [Parameter("Bar Size (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]<font></font>         public double BarSizePips { get; set; }<font></font> <font></font>         [Parameter("Retracement factor (0.01 - 1.00)", DefaultValue = 0.5, MinValue = 0.01, MaxValue = 1.0, Step = 0.01)]<font></font>         public double Retracement { get; set; }<font></font> <font></font>         [Parameter("Maximum Bars", DefaultValue = 300, MinValue = 1)]<font></font>         public int BricksToShow { get; set; }<font></font> <font></font>         [Parameter("Symmetrical Reversals", DefaultValue = true)]<font></font>         public bool SymmetricalReversals { get; set; }<font></font> <font></font>         [Parameter("Reset Open on new trading day", DefaultValue = false)]<font></font>         public bool ResetOpenOnNewTradingDay { get; set; }<font></font> <font></font>         [Parameter("Apply offset to first renko bar", DefaultValue = false)]<font></font>         public bool ApplyOffsetToFirstBar { get; set; }<font></font> <font></font>         [Parameter("Tick offset value", DefaultValue = 0, MinValue = 0)]<font></font>         public int OffsetValue { get; set; }<font></font> <font></font>         [Parameter("Bullish Bar Color", DefaultValue = "SeaGreen")]<font></font>         public string ColorBull { get; set; }<font></font> <font></font>         [Parameter("Bearish Bar Color", DefaultValue = "Tomato")]<font></font>         public string ColorBear { get; set; }<font></font> <font></font>         [Output("Open", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Open { get; set; }<font></font> <font></font>         [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries High { get; set; }<font></font> <font></font>         [Output("Low", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Low { get; set; }<font></font> <font></font>         [Output("Close", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Close { get; set; }<font></font> <font></font>         private MedianRenkoCore core = null;<font></font>         private bool coreOK = true;<font></font> <font></font>         private DateTime lastTime;<font></font> <font></font>         private bool appliedOffset = false;<font></font> <font></font>         private T_OLHCV pOLHCV;<font></font>         private T_OLHCV OLHCV;<font></font>         private T_OLHCV mOLHCV;<font></font>         private T_OLHCV cOLHCV;<font></font>         private T_OLHCV memRates;<font></font>         private T_OLHCV lastBar;<font></font> <font></font>         private List<T_OLHCV> bars = new List<T_OLHCV>();<font></font>         private double barSize;<font></font>         private Colors colorBull, colorBear;<font></font> <font></font>         protected override void Initialize()<font></font>         {<font></font>             core = new MedianRenkoCore();<font></font>             coreOK = core.StatusCheck();<font></font> <font></font>             barSize = BarSizePips * Symbol.PipSize;<font></font> <font></font>             lastTime = new DateTime();<font></font>             lastTime = MarketSeries.OpenTime[MarketSeries.Close.Count - 1];<font></font> <font></font>             lastBar = new T_OLHCV();<font></font>             pOLHCV = new T_OLHCV();<font></font>             OLHCV = new T_OLHCV();<font></font>             mOLHCV = new T_OLHCV();<font></font>             cOLHCV = new T_OLHCV();<font></font>             memRates = new T_OLHCV();<font></font> <font></font>             if (!Enum.TryParse<Colors>(ColorBull, out colorBull))<font></font>             {<font></font>                 colorBull = Colors.SeaGreen;<font></font>             }<font></font>             if (!Enum.TryParse<Colors>(ColorBear, out colorBear))<font></font>             {<font></font>                 colorBear = Colors.Tomato;<font></font>             }<font></font> <font></font>             appliedOffset = false;<font></font>         }<font></font> <font></font>         private bool NewBar(int index)<font></font>         {<font></font>             if (lastTime != MarketSeries.OpenTime[index])<font></font>             {<font></font>                 lastTime = MarketSeries.OpenTime[index];<font></font>                 return true;<font></font>             }<font></font> <font></font>             return false;<font></font>         }<font></font> <font></font>         private static int cc = 0;<font></font>         private void pushBars(T_OLHCV bar, bool display)<font></font>         {<font></font>             int count = bars.Count();<font></font> <font></font>             var newBar = new T_OLHCV();<font></font>             newBar.Copy(bar);<font></font>             newBar.Index = cc++;<font></font> <font></font>             bars.Insert(0, newBar);<font></font>             count++;<font></font> <font></font>             if (display)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font> <font></font>             if (count > BricksToShow)<font></font>             {<font></font>                 if (display)<font></font>                 {<font></font>                     for (int i = BricksToShow - 1; i < count; i++)<font></font>                     {<font></font>                         ChartObjects.RemoveObject("mr_Wick_" + bars[i].Index);<font></font>                         ChartObjects.RemoveObject("mr_Bar_" + bars[i].Index);<font></font>                     }<font></font>                 }<font></font> <font></font>                 bars.RemoveRange(BricksToShow, count - BricksToShow);<font></font> <font></font>                 Open[count - BricksToShow] = double.NaN;<font></font>                 High[count - BricksToShow] = double.NaN;<font></font>                 Low[count - BricksToShow] = double.NaN;<font></font>                 Close[count - BricksToShow] = double.NaN;<font></font>             }<font></font> <font></font>         }<font></font> <font></font>         private void shiftBars(int shift)<font></font>         {<font></font>             int count = bars.Count;<font></font>             int ix = MarketSeries.Close.Count - 2;<font></font> <font></font>             for (int i = 0; i < count && i < BricksToShow; i++)<font></font>             {<font></font>                 var candleColor = (bars[i].Close > bars[i].Open) ? colorBull : colorBear;<font></font> <font></font>                 ChartObjects.DrawLine("mr_Wick_" + bars[i].Index, ix, bars[i].High, ix, bars[i].Low, candleColor, 1, LineStyle.Solid);<font></font>                 ChartObjects.DrawLine("mr_Bar_" + bars[i].Index, ix, bars[i].Close, ix, bars[i].Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>                 Open[ix] = bars[i].Open;<font></font>                 High[ix] = bars[i].High;<font></font>                 Low[ix] = bars[i].Low;<font></font>                 Close[ix] = bars[i].Close;<font></font> <font></font>                 ix--;<font></font>             }<font></font>         }<font></font> <font></font>         private void UpdateLastBar(int ix)<font></font>         {<font></font>             var candleColor = (memRates.Close > memRates.Open) ? colorBull : colorBear;<font></font> <font></font>             ChartObjects.DrawLine("mr_Wick_Live", ix, memRates.High, ix, memRates.Low, candleColor, 1, LineStyle.Solid);<font></font>             ChartObjects.DrawLine("mr_Bar_Live", ix, memRates.Close, ix, memRates.Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>             Open[ix] = memRates.Open;<font></font>             High[ix] = memRates.High;<font></font>             Low[ix] = memRates.Low;<font></font>             Close[ix] = memRates.Close;<font></font> <font></font>         }<font></font> <font></font>         public override void Calculate(int index)<font></font>         {<font></font>             if (ResetOpenOnNewTradingDay)<font></font>             {<font></font>                 if (IsNewSession(MarketSeries.OpenTime[(index > 0) ? (index - 1) : index], MarketSeries.OpenTime[index]))<font></font>                 {<font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font>                     pOLHCV.Clear();<font></font>                     memRates.Copy(mOLHCV);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsRealTime)<font></font>             {<font></font>                 if (!coreOK)<font></font>                 {<font></font>                     ChartObjects.DrawText("TrialOverMsg", "MedianRenko Indicator - Trial period ended. Please purchase a license file at www.az-invest.eu", StaticPosition.Center, Colors.White);<font></font>                     return;<font></font>                 }<font></font> <font></font>                 if (NewBar(index))<font></font>                 {<font></font>                     shiftBars(0);<font></font> <font></font>                     Open[index - BricksToShow - 1] = double.NaN;<font></font>                     High[index - BricksToShow - 1] = double.NaN;<font></font>                     Low[index - BricksToShow - 1] = double.NaN;<font></font>                     Close[index - BricksToShow - 1] = double.NaN;<font></font>                 }<font></font> <font></font>                 OLHCV.Open = MarketSeries.Close[index];<font></font>                 OLHCV.Low = MarketSeries.Close[index];<font></font>                 OLHCV.High = MarketSeries.Close[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = 1;<font></font> <font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font>                 UpdateLastBar(index);<font></font>             }<font></font>             else<font></font>             {<font></font>                 OLHCV.Open = MarketSeries.Open[index];<font></font>                 OLHCV.Low = MarketSeries.Low[index];<font></font>                 OLHCV.High = MarketSeries.High[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = MarketSeries.TickVolume[index];<font></font> <font></font>                 if (ApplyOffsetToFirstBar && !appliedOffset)<font></font>                 {<font></font>                     OLHCV.Open = OffsetValue * Symbol.TickSize + Math.Floor(OLHCV.Open / barSize) * barSize;<font></font>                     appliedOffset = true;<font></font>                 }<font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font> <font></font>                 if (IsLastBar)<font></font>                     UpdateLastBar(index);<font></font>             }<font></font>         }<font></font> <font></font>         private void ProcessMarketData(T_OLHCV ___OLHCV)<font></font>         {<font></font>             int rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 1);<font></font>             while (true)<font></font>             {<font></font>                 if ((rb_return >= 1) && (rb_return <= 4))<font></font>                 {<font></font>                     pushBars(cOLHCV, IsRealTime);<font></font>                     memRates.Copy(mOLHCV);<font></font>                     OLHCV.Copy(memRates);<font></font> <font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font> <font></font>                     rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 0);<font></font>                     continue;<font></font> <font></font>                 }<font></font>                 else if (rb_return == 10)<font></font>                 {<font></font>                     memRates.Copy(mOLHCV);<font></font>                     break;<font></font>                 }<font></font>                 else if (rb_return == -1)<font></font>                 {<font></font>                     return;<font></font>                 }<font></font>                 else<font></font>                 {<font></font>                     throw new Exception("Unhandled return value = " + rb_return);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsLastBar && !IsRealTime)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font>         }<font></font> <font></font>         private bool IsNewSession(DateTime prevTime, DateTime currTime)<font></font>         {<font></font>             if (prevTime.DayOfWeek != currTime.DayOfWeek)<font></font>                 return true;<font></font>             else<font></font>                 return false;<font></font>         }<font></font> <font></font> <font></font>     }<font></font> }<font></font> <font></font>
renko
  0
  0
  105
free  11 Dec 2022
using cAlgo.API;<font></font> using cAlgo.API.Indicators;<font></font> using cAlgo.API.Internals;<font></font> using cAlgo.Indicators;<font></font> using System;<font></font> using System.Collections.Generic;<font></font> using System.Linq;<font></font> using System.Windows.Forms;<font></font> using System.Runtime.InteropServices;<font></font> using System.Diagnostics;<font></font> using cT_MedianRenkoEngine;<font></font> <font></font> namespace cAlgo<font></font> {<font></font>     [Indicator("MedianRenko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]<font></font>     public class MedianRenko : Indicator<font></font>     {<font></font>         [Parameter("Bar Size (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]<font></font>         public double BarSizePips { get; set; }<font></font> <font></font>         [Parameter("Retracement factor (0.01 - 1.00)", DefaultValue = 0.5, MinValue = 0.01, MaxValue = 1.0, Step = 0.01)]<font></font>         public double Retracement { get; set; }<font></font> <font></font>         [Parameter("Maximum Bars", DefaultValue = 300, MinValue = 1)]<font></font>         public int BricksToShow { get; set; }<font></font> <font></font>         [Parameter("Symmetrical Reversals", DefaultValue = true)]<font></font>         public bool SymmetricalReversals { get; set; }<font></font> <font></font>         [Parameter("Reset Open on new trading day", DefaultValue = false)]<font></font>         public bool ResetOpenOnNewTradingDay { get; set; }<font></font> <font></font>         [Parameter("Apply offset to first renko bar", DefaultValue = false)]<font></font>         public bool ApplyOffsetToFirstBar { get; set; }<font></font> <font></font>         [Parameter("Tick offset value", DefaultValue = 0, MinValue = 0)]<font></font>         public int OffsetValue { get; set; }<font></font> <font></font>         [Parameter("Bullish Bar Color", DefaultValue = "SeaGreen")]<font></font>         public string ColorBull { get; set; }<font></font> <font></font>         [Parameter("Bearish Bar Color", DefaultValue = "Tomato")]<font></font>         public string ColorBear { get; set; }<font></font> <font></font>         [Output("Open", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Open { get; set; }<font></font> <font></font>         [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries High { get; set; }<font></font> <font></font>         [Output("Low", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Low { get; set; }<font></font> <font></font>         [Output("Close", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Close { get; set; }<font></font> <font></font>         private MedianRenkoCore core = null;<font></font>         private bool coreOK = true;<font></font> <font></font>         private DateTime lastTime;<font></font> <font></font>         private bool appliedOffset = false;<font></font> <font></font>         private T_OLHCV pOLHCV;<font></font>         private T_OLHCV OLHCV;<font></font>         private T_OLHCV mOLHCV;<font></font>         private T_OLHCV cOLHCV;<font></font>         private T_OLHCV memRates;<font></font>         private T_OLHCV lastBar;<font></font> <font></font>         private List<T_OLHCV> bars = new List<T_OLHCV>();<font></font>         private double barSize;<font></font>         private Colors colorBull, colorBear;<font></font> <font></font>         protected override void Initialize()<font></font>         {<font></font>             core = new MedianRenkoCore();<font></font>             coreOK = core.StatusCheck();<font></font> <font></font>             barSize = BarSizePips * Symbol.PipSize;<font></font> <font></font>             lastTime = new DateTime();<font></font>             lastTime = MarketSeries.OpenTime[MarketSeries.Close.Count - 1];<font></font> <font></font>             lastBar = new T_OLHCV();<font></font>             pOLHCV = new T_OLHCV();<font></font>             OLHCV = new T_OLHCV();<font></font>             mOLHCV = new T_OLHCV();<font></font>             cOLHCV = new T_OLHCV();<font></font>             memRates = new T_OLHCV();<font></font> <font></font>             if (!Enum.TryParse<Colors>(ColorBull, out colorBull))<font></font>             {<font></font>                 colorBull = Colors.SeaGreen;<font></font>             }<font></font>             if (!Enum.TryParse<Colors>(ColorBear, out colorBear))<font></font>             {<font></font>                 colorBear = Colors.Tomato;<font></font>             }<font></font> <font></font>             appliedOffset = false;<font></font>         }<font></font> <font></font>         private bool NewBar(int index)<font></font>         {<font></font>             if (lastTime != MarketSeries.OpenTime[index])<font></font>             {<font></font>                 lastTime = MarketSeries.OpenTime[index];<font></font>                 return true;<font></font>             }<font></font> <font></font>             return false;<font></font>         }<font></font> <font></font>         private static int cc = 0;<font></font>         private void pushBars(T_OLHCV bar, bool display)<font></font>         {<font></font>             int count = bars.Count();<font></font> <font></font>             var newBar = new T_OLHCV();<font></font>             newBar.Copy(bar);<font></font>             newBar.Index = cc++;<font></font> <font></font>             bars.Insert(0, newBar);<font></font>             count++;<font></font> <font></font>             if (display)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font> <font></font>             if (count > BricksToShow)<font></font>             {<font></font>                 if (display)<font></font>                 {<font></font>                     for (int i = BricksToShow - 1; i < count; i++)<font></font>                     {<font></font>                         ChartObjects.RemoveObject("mr_Wick_" + bars[i].Index);<font></font>                         ChartObjects.RemoveObject("mr_Bar_" + bars[i].Index);<font></font>                     }<font></font>                 }<font></font> <font></font>                 bars.RemoveRange(BricksToShow, count - BricksToShow);<font></font> <font></font>                 Open[count - BricksToShow] = double.NaN;<font></font>                 High[count - BricksToShow] = double.NaN;<font></font>                 Low[count - BricksToShow] = double.NaN;<font></font>                 Close[count - BricksToShow] = double.NaN;<font></font>             }<font></font> <font></font>         }<font></font> <font></font>         private void shiftBars(int shift)<font></font>         {<font></font>             int count = bars.Count;<font></font>             int ix = MarketSeries.Close.Count - 2;<font></font> <font></font>             for (int i = 0; i < count && i < BricksToShow; i++)<font></font>             {<font></font>                 var candleColor = (bars[i].Close > bars[i].Open) ? colorBull : colorBear;<font></font> <font></font>                 ChartObjects.DrawLine("mr_Wick_" + bars[i].Index, ix, bars[i].High, ix, bars[i].Low, candleColor, 1, LineStyle.Solid);<font></font>                 ChartObjects.DrawLine("mr_Bar_" + bars[i].Index, ix, bars[i].Close, ix, bars[i].Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>                 Open[ix] = bars[i].Open;<font></font>                 High[ix] = bars[i].High;<font></font>                 Low[ix] = bars[i].Low;<font></font>                 Close[ix] = bars[i].Close;<font></font> <font></font>                 ix--;<font></font>             }<font></font>         }<font></font> <font></font>         private void UpdateLastBar(int ix)<font></font>         {<font></font>             var candleColor = (memRates.Close > memRates.Open) ? colorBull : colorBear;<font></font> <font></font>             ChartObjects.DrawLine("mr_Wick_Live", ix, memRates.High, ix, memRates.Low, candleColor, 1, LineStyle.Solid);<font></font>             ChartObjects.DrawLine("mr_Bar_Live", ix, memRates.Close, ix, memRates.Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>             Open[ix] = memRates.Open;<font></font>             High[ix] = memRates.High;<font></font>             Low[ix] = memRates.Low;<font></font>             Close[ix] = memRates.Close;<font></font> <font></font>         }<font></font> <font></font>         public override void Calculate(int index)<font></font>         {<font></font>             if (ResetOpenOnNewTradingDay)<font></font>             {<font></font>                 if (IsNewSession(MarketSeries.OpenTime[(index > 0) ? (index - 1) : index], MarketSeries.OpenTime[index]))<font></font>                 {<font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font>                     pOLHCV.Clear();<font></font>                     memRates.Copy(mOLHCV);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsRealTime)<font></font>             {<font></font>                 if (!coreOK)<font></font>                 {<font></font>                     ChartObjects.DrawText("TrialOverMsg", "MedianRenko Indicator - Trial period ended. Please purchase a license file at www.az-invest.eu", StaticPosition.Center, Colors.White);<font></font>                     return;<font></font>                 }<font></font> <font></font>                 if (NewBar(index))<font></font>                 {<font></font>                     shiftBars(0);<font></font> <font></font>                     Open[index - BricksToShow - 1] = double.NaN;<font></font>                     High[index - BricksToShow - 1] = double.NaN;<font></font>                     Low[index - BricksToShow - 1] = double.NaN;<font></font>                     Close[index - BricksToShow - 1] = double.NaN;<font></font>                 }<font></font> <font></font>                 OLHCV.Open = MarketSeries.Close[index];<font></font>                 OLHCV.Low = MarketSeries.Close[index];<font></font>                 OLHCV.High = MarketSeries.Close[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = 1;<font></font> <font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font>                 UpdateLastBar(index);<font></font>             }<font></font>             else<font></font>             {<font></font>                 OLHCV.Open = MarketSeries.Open[index];<font></font>                 OLHCV.Low = MarketSeries.Low[index];<font></font>                 OLHCV.High = MarketSeries.High[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = MarketSeries.TickVolume[index];<font></font> <font></font>                 if (ApplyOffsetToFirstBar && !appliedOffset)<font></font>                 {<font></font>                     OLHCV.Open = OffsetValue * Symbol.TickSize + Math.Floor(OLHCV.Open / barSize) * barSize;<font></font>                     appliedOffset = true;<font></font>                 }<font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font> <font></font>                 if (IsLastBar)<font></font>                     UpdateLastBar(index);<font></font>             }<font></font>         }<font></font> <font></font>         private void ProcessMarketData(T_OLHCV ___OLHCV)<font></font>         {<font></font>             int rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 1);<font></font>             while (true)<font></font>             {<font></font>                 if ((rb_return >= 1) && (rb_return <= 4))<font></font>                 {<font></font>                     pushBars(cOLHCV, IsRealTime);<font></font>                     memRates.Copy(mOLHCV);<font></font>                     OLHCV.Copy(memRates);<font></font> <font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font> <font></font>                     rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 0);<font></font>                     continue;<font></font> <font></font>                 }<font></font>                 else if (rb_return == 10)<font></font>                 {<font></font>                     memRates.Copy(mOLHCV);<font></font>                     break;<font></font>                 }<font></font>                 else if (rb_return == -1)<font></font>                 {<font></font>                     return;<font></font>                 }<font></font>                 else<font></font>                 {<font></font>                     throw new Exception("Unhandled return value = " + rb_return);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsLastBar && !IsRealTime)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font>         }<font></font> <font></font>         private bool IsNewSession(DateTime prevTime, DateTime currTime)<font></font>         {<font></font>             if (prevTime.DayOfWeek != currTime.DayOfWeek)<font></font>                 return true;<font></font>             else<font></font>                 return false;<font></font>         }<font></font> <font></font> <font></font>     }<font></font> }<font></font> <font></font>
renko
  0
  0
  61
free  11 Dec 2022
using cAlgo.API;<font></font> using cAlgo.API.Indicators;<font></font> using cAlgo.API.Internals;<font></font> using cAlgo.Indicators;<font></font> using System;<font></font> using System.Collections.Generic;<font></font> using System.Linq;<font></font> using System.Windows.Forms;<font></font> using System.Runtime.InteropServices;<font></font> using System.Diagnostics;<font></font> using cT_MedianRenkoEngine;<font></font> <font></font> namespace cAlgo<font></font> {<font></font>     [Indicator("MedianRenko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]<font></font>     public class MedianRenko : Indicator<font></font>     {<font></font>         [Parameter("Bar Size (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]<font></font>         public double BarSizePips { get; set; }<font></font> <font></font>         [Parameter("Retracement factor (0.01 - 1.00)", DefaultValue = 0.5, MinValue = 0.01, MaxValue = 1.0, Step = 0.01)]<font></font>         public double Retracement { get; set; }<font></font> <font></font>         [Parameter("Maximum Bars", DefaultValue = 300, MinValue = 1)]<font></font>         public int BricksToShow { get; set; }<font></font> <font></font>         [Parameter("Symmetrical Reversals", DefaultValue = true)]<font></font>         public bool SymmetricalReversals { get; set; }<font></font> <font></font>         [Parameter("Reset Open on new trading day", DefaultValue = false)]<font></font>         public bool ResetOpenOnNewTradingDay { get; set; }<font></font> <font></font>         [Parameter("Apply offset to first renko bar", DefaultValue = false)]<font></font>         public bool ApplyOffsetToFirstBar { get; set; }<font></font> <font></font>         [Parameter("Tick offset value", DefaultValue = 0, MinValue = 0)]<font></font>         public int OffsetValue { get; set; }<font></font> <font></font>         [Parameter("Bullish Bar Color", DefaultValue = "SeaGreen")]<font></font>         public string ColorBull { get; set; }<font></font> <font></font>         [Parameter("Bearish Bar Color", DefaultValue = "Tomato")]<font></font>         public string ColorBear { get; set; }<font></font> <font></font>         [Output("Open", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Open { get; set; }<font></font> <font></font>         [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries High { get; set; }<font></font> <font></font>         [Output("Low", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Low { get; set; }<font></font> <font></font>         [Output("Close", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Close { get; set; }<font></font> <font></font>         private MedianRenkoCore core = null;<font></font>         private bool coreOK = true;<font></font> <font></font>         private DateTime lastTime;<font></font> <font></font>         private bool appliedOffset = false;<font></font> <font></font>         private T_OLHCV pOLHCV;<font></font>         private T_OLHCV OLHCV;<font></font>         private T_OLHCV mOLHCV;<font></font>         private T_OLHCV cOLHCV;<font></font>         private T_OLHCV memRates;<font></font>         private T_OLHCV lastBar;<font></font> <font></font>         private List<T_OLHCV> bars = new List<T_OLHCV>();<font></font>         private double barSize;<font></font>         private Colors colorBull, colorBear;<font></font> <font></font>         protected override void Initialize()<font></font>         {<font></font>             core = new MedianRenkoCore();<font></font>             coreOK = core.StatusCheck();<font></font> <font></font>             barSize = BarSizePips * Symbol.PipSize;<font></font> <font></font>             lastTime = new DateTime();<font></font>             lastTime = MarketSeries.OpenTime[MarketSeries.Close.Count - 1];<font></font> <font></font>             lastBar = new T_OLHCV();<font></font>             pOLHCV = new T_OLHCV();<font></font>             OLHCV = new T_OLHCV();<font></font>             mOLHCV = new T_OLHCV();<font></font>             cOLHCV = new T_OLHCV();<font></font>             memRates = new T_OLHCV();<font></font> <font></font>             if (!Enum.TryParse<Colors>(ColorBull, out colorBull))<font></font>             {<font></font>                 colorBull = Colors.SeaGreen;<font></font>             }<font></font>             if (!Enum.TryParse<Colors>(ColorBear, out colorBear))<font></font>             {<font></font>                 colorBear = Colors.Tomato;<font></font>             }<font></font> <font></font>             appliedOffset = false;<font></font>         }<font></font> <font></font>         private bool NewBar(int index)<font></font>         {<font></font>             if (lastTime != MarketSeries.OpenTime[index])<font></font>             {<font></font>                 lastTime = MarketSeries.OpenTime[index];<font></font>                 return true;<font></font>             }<font></font> <font></font>             return false;<font></font>         }<font></font> <font></font>         private static int cc = 0;<font></font>         private void pushBars(T_OLHCV bar, bool display)<font></font>         {<font></font>             int count = bars.Count();<font></font> <font></font>             var newBar = new T_OLHCV();<font></font>             newBar.Copy(bar);<font></font>             newBar.Index = cc++;<font></font> <font></font>             bars.Insert(0, newBar);<font></font>             count++;<font></font> <font></font>             if (display)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font> <font></font>             if (count > BricksToShow)<font></font>             {<font></font>                 if (display)<font></font>                 {<font></font>                     for (int i = BricksToShow - 1; i < count; i++)<font></font>                     {<font></font>                         ChartObjects.RemoveObject("mr_Wick_" + bars[i].Index);<font></font>                         ChartObjects.RemoveObject("mr_Bar_" + bars[i].Index);<font></font>                     }<font></font>                 }<font></font> <font></font>                 bars.RemoveRange(BricksToShow, count - BricksToShow);<font></font> <font></font>                 Open[count - BricksToShow] = double.NaN;<font></font>                 High[count - BricksToShow] = double.NaN;<font></font>                 Low[count - BricksToShow] = double.NaN;<font></font>                 Close[count - BricksToShow] = double.NaN;<font></font>             }<font></font> <font></font>         }<font></font> <font></font>         private void shiftBars(int shift)<font></font>         {<font></font>             int count = bars.Count;<font></font>             int ix = MarketSeries.Close.Count - 2;<font></font> <font></font>             for (int i = 0; i < count && i < BricksToShow; i++)<font></font>             {<font></font>                 var candleColor = (bars[i].Close > bars[i].Open) ? colorBull : colorBear;<font></font> <font></font>                 ChartObjects.DrawLine("mr_Wick_" + bars[i].Index, ix, bars[i].High, ix, bars[i].Low, candleColor, 1, LineStyle.Solid);<font></font>                 ChartObjects.DrawLine("mr_Bar_" + bars[i].Index, ix, bars[i].Close, ix, bars[i].Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>                 Open[ix] = bars[i].Open;<font></font>                 High[ix] = bars[i].High;<font></font>                 Low[ix] = bars[i].Low;<font></font>                 Close[ix] = bars[i].Close;<font></font> <font></font>                 ix--;<font></font>             }<font></font>         }<font></font> <font></font>         private void UpdateLastBar(int ix)<font></font>         {<font></font>             var candleColor = (memRates.Close > memRates.Open) ? colorBull : colorBear;<font></font> <font></font>             ChartObjects.DrawLine("mr_Wick_Live", ix, memRates.High, ix, memRates.Low, candleColor, 1, LineStyle.Solid);<font></font>             ChartObjects.DrawLine("mr_Bar_Live", ix, memRates.Close, ix, memRates.Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>             Open[ix] = memRates.Open;<font></font>             High[ix] = memRates.High;<font></font>             Low[ix] = memRates.Low;<font></font>             Close[ix] = memRates.Close;<font></font> <font></font>         }<font></font> <font></font>         public override void Calculate(int index)<font></font>         {<font></font>             if (ResetOpenOnNewTradingDay)<font></font>             {<font></font>                 if (IsNewSession(MarketSeries.OpenTime[(index > 0) ? (index - 1) : index], MarketSeries.OpenTime[index]))<font></font>                 {<font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font>                     pOLHCV.Clear();<font></font>                     memRates.Copy(mOLHCV);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsRealTime)<font></font>             {<font></font>                 if (!coreOK)<font></font>                 {<font></font>                     ChartObjects.DrawText("TrialOverMsg", "MedianRenko Indicator - Trial period ended. Please purchase a license file at www.az-invest.eu", StaticPosition.Center, Colors.White);<font></font>                     return;<font></font>                 }<font></font> <font></font>                 if (NewBar(index))<font></font>                 {<font></font>                     shiftBars(0);<font></font> <font></font>                     Open[index - BricksToShow - 1] = double.NaN;<font></font>                     High[index - BricksToShow - 1] = double.NaN;<font></font>                     Low[index - BricksToShow - 1] = double.NaN;<font></font>                     Close[index - BricksToShow - 1] = double.NaN;<font></font>                 }<font></font> <font></font>                 OLHCV.Open = MarketSeries.Close[index];<font></font>                 OLHCV.Low = MarketSeries.Close[index];<font></font>                 OLHCV.High = MarketSeries.Close[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = 1;<font></font> <font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font>                 UpdateLastBar(index);<font></font>             }<font></font>             else<font></font>             {<font></font>                 OLHCV.Open = MarketSeries.Open[index];<font></font>                 OLHCV.Low = MarketSeries.Low[index];<font></font>                 OLHCV.High = MarketSeries.High[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = MarketSeries.TickVolume[index];<font></font> <font></font>                 if (ApplyOffsetToFirstBar && !appliedOffset)<font></font>                 {<font></font>                     OLHCV.Open = OffsetValue * Symbol.TickSize + Math.Floor(OLHCV.Open / barSize) * barSize;<font></font>                     appliedOffset = true;<font></font>                 }<font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font> <font></font>                 if (IsLastBar)<font></font>                     UpdateLastBar(index);<font></font>             }<font></font>         }<font></font> <font></font>         private void ProcessMarketData(T_OLHCV ___OLHCV)<font></font>         {<font></font>             int rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 1);<font></font>             while (true)<font></font>             {<font></font>                 if ((rb_return >= 1) && (rb_return <= 4))<font></font>                 {<font></font>                     pushBars(cOLHCV, IsRealTime);<font></font>                     memRates.Copy(mOLHCV);<font></font>                     OLHCV.Copy(memRates);<font></font> <font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font> <font></font>                     rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 0);<font></font>                     continue;<font></font> <font></font>                 }<font></font>                 else if (rb_return == 10)<font></font>                 {<font></font>                     memRates.Copy(mOLHCV);<font></font>                     break;<font></font>                 }<font></font>                 else if (rb_return == -1)<font></font>                 {<font></font>                     return;<font></font>                 }<font></font>                 else<font></font>                 {<font></font>                     throw new Exception("Unhandled return value = " + rb_return);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsLastBar && !IsRealTime)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font>         }<font></font> <font></font>         private bool IsNewSession(DateTime prevTime, DateTime currTime)<font></font>         {<font></font>             if (prevTime.DayOfWeek != currTime.DayOfWeek)<font></font>                 return true;<font></font>             else<font></font>                 return false;<font></font>         }<font></font> <font></font> <font></font>     }<font></font> }<font></font> <font></font>
renko
  0
  0
  84
free  11 Dec 2022
using cAlgo.API;<font></font> using cAlgo.API.Indicators;<font></font> using cAlgo.API.Internals;<font></font> using cAlgo.Indicators;<font></font> using System;<font></font> using System.Collections.Generic;<font></font> using System.Linq;<font></font> using System.Windows.Forms;<font></font> using System.Runtime.InteropServices;<font></font> using System.Diagnostics;<font></font> using cT_MedianRenkoEngine;<font></font> <font></font> namespace cAlgo<font></font> {<font></font>     [Indicator("MedianRenko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]<font></font>     public class MedianRenko : Indicator<font></font>     {<font></font>         [Parameter("Bar Size (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]<font></font>         public double BarSizePips { get; set; }<font></font> <font></font>         [Parameter("Retracement factor (0.01 - 1.00)", DefaultValue = 0.5, MinValue = 0.01, MaxValue = 1.0, Step = 0.01)]<font></font>         public double Retracement { get; set; }<font></font> <font></font>         [Parameter("Maximum Bars", DefaultValue = 300, MinValue = 1)]<font></font>         public int BricksToShow { get; set; }<font></font> <font></font>         [Parameter("Symmetrical Reversals", DefaultValue = true)]<font></font>         public bool SymmetricalReversals { get; set; }<font></font> <font></font>         [Parameter("Reset Open on new trading day", DefaultValue = false)]<font></font>         public bool ResetOpenOnNewTradingDay { get; set; }<font></font> <font></font>         [Parameter("Apply offset to first renko bar", DefaultValue = false)]<font></font>         public bool ApplyOffsetToFirstBar { get; set; }<font></font> <font></font>         [Parameter("Tick offset value", DefaultValue = 0, MinValue = 0)]<font></font>         public int OffsetValue { get; set; }<font></font> <font></font>         [Parameter("Bullish Bar Color", DefaultValue = "SeaGreen")]<font></font>         public string ColorBull { get; set; }<font></font> <font></font>         [Parameter("Bearish Bar Color", DefaultValue = "Tomato")]<font></font>         public string ColorBear { get; set; }<font></font> <font></font>         [Output("Open", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Open { get; set; }<font></font> <font></font>         [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries High { get; set; }<font></font> <font></font>         [Output("Low", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Low { get; set; }<font></font> <font></font>         [Output("Close", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Close { get; set; }<font></font> <font></font>         private MedianRenkoCore core = null;<font></font>         private bool coreOK = true;<font></font> <font></font>         private DateTime lastTime;<font></font> <font></font>         private bool appliedOffset = false;<font></font> <font></font>         private T_OLHCV pOLHCV;<font></font>         private T_OLHCV OLHCV;<font></font>         private T_OLHCV mOLHCV;<font></font>         private T_OLHCV cOLHCV;<font></font>         private T_OLHCV memRates;<font></font>         private T_OLHCV lastBar;<font></font> <font></font>         private List<T_OLHCV> bars = new List<T_OLHCV>();<font></font>         private double barSize;<font></font>         private Colors colorBull, colorBear;<font></font> <font></font>         protected override void Initialize()<font></font>         {<font></font>             core = new MedianRenkoCore();<font></font>             coreOK = core.StatusCheck();<font></font> <font></font>             barSize = BarSizePips * Symbol.PipSize;<font></font> <font></font>             lastTime = new DateTime();<font></font>             lastTime = MarketSeries.OpenTime[MarketSeries.Close.Count - 1];<font></font> <font></font>             lastBar = new T_OLHCV();<font></font>             pOLHCV = new T_OLHCV();<font></font>             OLHCV = new T_OLHCV();<font></font>             mOLHCV = new T_OLHCV();<font></font>             cOLHCV = new T_OLHCV();<font></font>             memRates = new T_OLHCV();<font></font> <font></font>             if (!Enum.TryParse<Colors>(ColorBull, out colorBull))<font></font>             {<font></font>                 colorBull = Colors.SeaGreen;<font></font>             }<font></font>             if (!Enum.TryParse<Colors>(ColorBear, out colorBear))<font></font>             {<font></font>                 colorBear = Colors.Tomato;<font></font>             }<font></font> <font></font>             appliedOffset = false;<font></font>         }<font></font> <font></font>         private bool NewBar(int index)<font></font>         {<font></font>             if (lastTime != MarketSeries.OpenTime[index])<font></font>             {<font></font>                 lastTime = MarketSeries.OpenTime[index];<font></font>                 return true;<font></font>             }<font></font> <font></font>             return false;<font></font>         }<font></font> <font></font>         private static int cc = 0;<font></font>         private void pushBars(T_OLHCV bar, bool display)<font></font>         {<font></font>             int count = bars.Count();<font></font> <font></font>             var newBar = new T_OLHCV();<font></font>             newBar.Copy(bar);<font></font>             newBar.Index = cc++;<font></font> <font></font>             bars.Insert(0, newBar);<font></font>             count++;<font></font> <font></font>             if (display)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font> <font></font>             if (count > BricksToShow)<font></font>             {<font></font>                 if (display)<font></font>                 {<font></font>                     for (int i = BricksToShow - 1; i < count; i++)<font></font>                     {<font></font>                         ChartObjects.RemoveObject("mr_Wick_" + bars[i].Index);<font></font>                         ChartObjects.RemoveObject("mr_Bar_" + bars[i].Index);<font></font>                     }<font></font>                 }<font></font> <font></font>                 bars.RemoveRange(BricksToShow, count - BricksToShow);<font></font> <font></font>                 Open[count - BricksToShow] = double.NaN;<font></font>                 High[count - BricksToShow] = double.NaN;<font></font>                 Low[count - BricksToShow] = double.NaN;<font></font>                 Close[count - BricksToShow] = double.NaN;<font></font>             }<font></font> <font></font>         }<font></font> <font></font>         private void shiftBars(int shift)<font></font>         {<font></font>             int count = bars.Count;<font></font>             int ix = MarketSeries.Close.Count - 2;<font></font> <font></font>             for (int i = 0; i < count && i < BricksToShow; i++)<font></font>             {<font></font>                 var candleColor = (bars[i].Close > bars[i].Open) ? colorBull : colorBear;<font></font> <font></font>                 ChartObjects.DrawLine("mr_Wick_" + bars[i].Index, ix, bars[i].High, ix, bars[i].Low, candleColor, 1, LineStyle.Solid);<font></font>                 ChartObjects.DrawLine("mr_Bar_" + bars[i].Index, ix, bars[i].Close, ix, bars[i].Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>                 Open[ix] = bars[i].Open;<font></font>                 High[ix] = bars[i].High;<font></font>                 Low[ix] = bars[i].Low;<font></font>                 Close[ix] = bars[i].Close;<font></font> <font></font>                 ix--;<font></font>             }<font></font>         }<font></font> <font></font>         private void UpdateLastBar(int ix)<font></font>         {<font></font>             var candleColor = (memRates.Close > memRates.Open) ? colorBull : colorBear;<font></font> <font></font>             ChartObjects.DrawLine("mr_Wick_Live", ix, memRates.High, ix, memRates.Low, candleColor, 1, LineStyle.Solid);<font></font>             ChartObjects.DrawLine("mr_Bar_Live", ix, memRates.Close, ix, memRates.Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>             Open[ix] = memRates.Open;<font></font>             High[ix] = memRates.High;<font></font>             Low[ix] = memRates.Low;<font></font>             Close[ix] = memRates.Close;<font></font> <font></font>         }<font></font> <font></font>         public override void Calculate(int index)<font></font>         {<font></font>             if (ResetOpenOnNewTradingDay)<font></font>             {<font></font>                 if (IsNewSession(MarketSeries.OpenTime[(index > 0) ? (index - 1) : index], MarketSeries.OpenTime[index]))<font></font>                 {<font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font>                     pOLHCV.Clear();<font></font>                     memRates.Copy(mOLHCV);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsRealTime)<font></font>             {<font></font>                 if (!coreOK)<font></font>                 {<font></font>                     ChartObjects.DrawText("TrialOverMsg", "MedianRenko Indicator - Trial period ended. Please purchase a license file at www.az-invest.eu", StaticPosition.Center, Colors.White);<font></font>                     return;<font></font>                 }<font></font> <font></font>                 if (NewBar(index))<font></font>                 {<font></font>                     shiftBars(0);<font></font> <font></font>                     Open[index - BricksToShow - 1] = double.NaN;<font></font>                     High[index - BricksToShow - 1] = double.NaN;<font></font>                     Low[index - BricksToShow - 1] = double.NaN;<font></font>                     Close[index - BricksToShow - 1] = double.NaN;<font></font>                 }<font></font> <font></font>                 OLHCV.Open = MarketSeries.Close[index];<font></font>                 OLHCV.Low = MarketSeries.Close[index];<font></font>                 OLHCV.High = MarketSeries.Close[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = 1;<font></font> <font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font>                 UpdateLastBar(index);<font></font>             }<font></font>             else<font></font>             {<font></font>                 OLHCV.Open = MarketSeries.Open[index];<font></font>                 OLHCV.Low = MarketSeries.Low[index];<font></font>                 OLHCV.High = MarketSeries.High[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = MarketSeries.TickVolume[index];<font></font> <font></font>                 if (ApplyOffsetToFirstBar && !appliedOffset)<font></font>                 {<font></font>                     OLHCV.Open = OffsetValue * Symbol.TickSize + Math.Floor(OLHCV.Open / barSize) * barSize;<font></font>                     appliedOffset = true;<font></font>                 }<font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font> <font></font>                 if (IsLastBar)<font></font>                     UpdateLastBar(index);<font></font>             }<font></font>         }<font></font> <font></font>         private void ProcessMarketData(T_OLHCV ___OLHCV)<font></font>         {<font></font>             int rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 1);<font></font>             while (true)<font></font>             {<font></font>                 if ((rb_return >= 1) && (rb_return <= 4))<font></font>                 {<font></font>                     pushBars(cOLHCV, IsRealTime);<font></font>                     memRates.Copy(mOLHCV);<font></font>                     OLHCV.Copy(memRates);<font></font> <font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font> <font></font>                     rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 0);<font></font>                     continue;<font></font> <font></font>                 }<font></font>                 else if (rb_return == 10)<font></font>                 {<font></font>                     memRates.Copy(mOLHCV);<font></font>                     break;<font></font>                 }<font></font>                 else if (rb_return == -1)<font></font>                 {<font></font>                     return;<font></font>                 }<font></font>                 else<font></font>                 {<font></font>                     throw new Exception("Unhandled return value = " + rb_return);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsLastBar && !IsRealTime)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font>         }<font></font> <font></font>         private bool IsNewSession(DateTime prevTime, DateTime currTime)<font></font>         {<font></font>             if (prevTime.DayOfWeek != currTime.DayOfWeek)<font></font>                 return true;<font></font>             else<font></font>                 return false;<font></font>         }<font></font> <font></font> <font></font>     }<font></font> }<font></font> <font></font>
renko
  0
  0
  65
free  11 Dec 2022
using cAlgo.API;<font></font> using cAlgo.API.Indicators;<font></font> using cAlgo.API.Internals;<font></font> using cAlgo.Indicators;<font></font> using System;<font></font> using System.Collections.Generic;<font></font> using System.Linq;<font></font> using System.Windows.Forms;<font></font> using System.Runtime.InteropServices;<font></font> using System.Diagnostics;<font></font> using cT_MedianRenkoEngine;<font></font> <font></font> namespace cAlgo<font></font> {<font></font>     [Indicator("MedianRenko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]<font></font>     public class MedianRenko : Indicator<font></font>     {<font></font>         [Parameter("Bar Size (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]<font></font>         public double BarSizePips { get; set; }<font></font> <font></font>         [Parameter("Retracement factor (0.01 - 1.00)", DefaultValue = 0.5, MinValue = 0.01, MaxValue = 1.0, Step = 0.01)]<font></font>         public double Retracement { get; set; }<font></font> <font></font>         [Parameter("Maximum Bars", DefaultValue = 300, MinValue = 1)]<font></font>         public int BricksToShow { get; set; }<font></font> <font></font>         [Parameter("Symmetrical Reversals", DefaultValue = true)]<font></font>         public bool SymmetricalReversals { get; set; }<font></font> <font></font>         [Parameter("Reset Open on new trading day", DefaultValue = false)]<font></font>         public bool ResetOpenOnNewTradingDay { get; set; }<font></font> <font></font>         [Parameter("Apply offset to first renko bar", DefaultValue = false)]<font></font>         public bool ApplyOffsetToFirstBar { get; set; }<font></font> <font></font>         [Parameter("Tick offset value", DefaultValue = 0, MinValue = 0)]<font></font>         public int OffsetValue { get; set; }<font></font> <font></font>         [Parameter("Bullish Bar Color", DefaultValue = "SeaGreen")]<font></font>         public string ColorBull { get; set; }<font></font> <font></font>         [Parameter("Bearish Bar Color", DefaultValue = "Tomato")]<font></font>         public string ColorBear { get; set; }<font></font> <font></font>         [Output("Open", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Open { get; set; }<font></font> <font></font>         [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries High { get; set; }<font></font> <font></font>         [Output("Low", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Low { get; set; }<font></font> <font></font>         [Output("Close", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]<font></font>         public IndicatorDataSeries Close { get; set; }<font></font> <font></font>         private MedianRenkoCore core = null;<font></font>         private bool coreOK = true;<font></font> <font></font>         private DateTime lastTime;<font></font> <font></font>         private bool appliedOffset = false;<font></font> <font></font>         private T_OLHCV pOLHCV;<font></font>         private T_OLHCV OLHCV;<font></font>         private T_OLHCV mOLHCV;<font></font>         private T_OLHCV cOLHCV;<font></font>         private T_OLHCV memRates;<font></font>         private T_OLHCV lastBar;<font></font> <font></font>         private List<T_OLHCV> bars = new List<T_OLHCV>();<font></font>         private double barSize;<font></font>         private Colors colorBull, colorBear;<font></font> <font></font>         protected override void Initialize()<font></font>         {<font></font>             core = new MedianRenkoCore();<font></font>             coreOK = core.StatusCheck();<font></font> <font></font>             barSize = BarSizePips * Symbol.PipSize;<font></font> <font></font>             lastTime = new DateTime();<font></font>             lastTime = MarketSeries.OpenTime[MarketSeries.Close.Count - 1];<font></font> <font></font>             lastBar = new T_OLHCV();<font></font>             pOLHCV = new T_OLHCV();<font></font>             OLHCV = new T_OLHCV();<font></font>             mOLHCV = new T_OLHCV();<font></font>             cOLHCV = new T_OLHCV();<font></font>             memRates = new T_OLHCV();<font></font> <font></font>             if (!Enum.TryParse<Colors>(ColorBull, out colorBull))<font></font>             {<font></font>                 colorBull = Colors.SeaGreen;<font></font>             }<font></font>             if (!Enum.TryParse<Colors>(ColorBear, out colorBear))<font></font>             {<font></font>                 colorBear = Colors.Tomato;<font></font>             }<font></font> <font></font>             appliedOffset = false;<font></font>         }<font></font> <font></font>         private bool NewBar(int index)<font></font>         {<font></font>             if (lastTime != MarketSeries.OpenTime[index])<font></font>             {<font></font>                 lastTime = MarketSeries.OpenTime[index];<font></font>                 return true;<font></font>             }<font></font> <font></font>             return false;<font></font>         }<font></font> <font></font>         private static int cc = 0;<font></font>         private void pushBars(T_OLHCV bar, bool display)<font></font>         {<font></font>             int count = bars.Count();<font></font> <font></font>             var newBar = new T_OLHCV();<font></font>             newBar.Copy(bar);<font></font>             newBar.Index = cc++;<font></font> <font></font>             bars.Insert(0, newBar);<font></font>             count++;<font></font> <font></font>             if (display)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font> <font></font>             if (count > BricksToShow)<font></font>             {<font></font>                 if (display)<font></font>                 {<font></font>                     for (int i = BricksToShow - 1; i < count; i++)<font></font>                     {<font></font>                         ChartObjects.RemoveObject("mr_Wick_" + bars[i].Index);<font></font>                         ChartObjects.RemoveObject("mr_Bar_" + bars[i].Index);<font></font>                     }<font></font>                 }<font></font> <font></font>                 bars.RemoveRange(BricksToShow, count - BricksToShow);<font></font> <font></font>                 Open[count - BricksToShow] = double.NaN;<font></font>                 High[count - BricksToShow] = double.NaN;<font></font>                 Low[count - BricksToShow] = double.NaN;<font></font>                 Close[count - BricksToShow] = double.NaN;<font></font>             }<font></font> <font></font>         }<font></font> <font></font>         private void shiftBars(int shift)<font></font>         {<font></font>             int count = bars.Count;<font></font>             int ix = MarketSeries.Close.Count - 2;<font></font> <font></font>             for (int i = 0; i < count && i < BricksToShow; i++)<font></font>             {<font></font>                 var candleColor = (bars[i].Close > bars[i].Open) ? colorBull : colorBear;<font></font> <font></font>                 ChartObjects.DrawLine("mr_Wick_" + bars[i].Index, ix, bars[i].High, ix, bars[i].Low, candleColor, 1, LineStyle.Solid);<font></font>                 ChartObjects.DrawLine("mr_Bar_" + bars[i].Index, ix, bars[i].Close, ix, bars[i].Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>                 Open[ix] = bars[i].Open;<font></font>                 High[ix] = bars[i].High;<font></font>                 Low[ix] = bars[i].Low;<font></font>                 Close[ix] = bars[i].Close;<font></font> <font></font>                 ix--;<font></font>             }<font></font>         }<font></font> <font></font>         private void UpdateLastBar(int ix)<font></font>         {<font></font>             var candleColor = (memRates.Close > memRates.Open) ? colorBull : colorBear;<font></font> <font></font>             ChartObjects.DrawLine("mr_Wick_Live", ix, memRates.High, ix, memRates.Low, candleColor, 1, LineStyle.Solid);<font></font>             ChartObjects.DrawLine("mr_Bar_Live", ix, memRates.Close, ix, memRates.Open, candleColor, 5, LineStyle.Solid);<font></font> <font></font>             Open[ix] = memRates.Open;<font></font>             High[ix] = memRates.High;<font></font>             Low[ix] = memRates.Low;<font></font>             Close[ix] = memRates.Close;<font></font> <font></font>         }<font></font> <font></font>         public override void Calculate(int index)<font></font>         {<font></font>             if (ResetOpenOnNewTradingDay)<font></font>             {<font></font>                 if (IsNewSession(MarketSeries.OpenTime[(index > 0) ? (index - 1) : index], MarketSeries.OpenTime[index]))<font></font>                 {<font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font>                     pOLHCV.Clear();<font></font>                     memRates.Copy(mOLHCV);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsRealTime)<font></font>             {<font></font>                 if (!coreOK)<font></font>                 {<font></font>                     ChartObjects.DrawText("TrialOverMsg", "MedianRenko Indicator - Trial period ended. Please purchase a license file at www.az-invest.eu", StaticPosition.Center, Colors.White);<font></font>                     return;<font></font>                 }<font></font> <font></font>                 if (NewBar(index))<font></font>                 {<font></font>                     shiftBars(0);<font></font> <font></font>                     Open[index - BricksToShow - 1] = double.NaN;<font></font>                     High[index - BricksToShow - 1] = double.NaN;<font></font>                     Low[index - BricksToShow - 1] = double.NaN;<font></font>                     Close[index - BricksToShow - 1] = double.NaN;<font></font>                 }<font></font> <font></font>                 OLHCV.Open = MarketSeries.Close[index];<font></font>                 OLHCV.Low = MarketSeries.Close[index];<font></font>                 OLHCV.High = MarketSeries.Close[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = 1;<font></font> <font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font>                 UpdateLastBar(index);<font></font>             }<font></font>             else<font></font>             {<font></font>                 OLHCV.Open = MarketSeries.Open[index];<font></font>                 OLHCV.Low = MarketSeries.Low[index];<font></font>                 OLHCV.High = MarketSeries.High[index];<font></font>                 OLHCV.Close = MarketSeries.Close[index];<font></font>                 OLHCV.OpenTime = MarketSeries.OpenTime[index];<font></font>                 OLHCV.TickVolume = MarketSeries.TickVolume[index];<font></font> <font></font>                 if (ApplyOffsetToFirstBar && !appliedOffset)<font></font>                 {<font></font>                     OLHCV.Open = OffsetValue * Symbol.TickSize + Math.Floor(OLHCV.Open / barSize) * barSize;<font></font>                     appliedOffset = true;<font></font>                 }<font></font> <font></font>                 ProcessMarketData(OLHCV);<font></font> <font></font>                 if (IsLastBar)<font></font>                     UpdateLastBar(index);<font></font>             }<font></font>         }<font></font> <font></font>         private void ProcessMarketData(T_OLHCV ___OLHCV)<font></font>         {<font></font>             int rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 1);<font></font>             while (true)<font></font>             {<font></font>                 if ((rb_return >= 1) && (rb_return <= 4))<font></font>                 {<font></font>                     pushBars(cOLHCV, IsRealTime);<font></font>                     memRates.Copy(mOLHCV);<font></font>                     OLHCV.Copy(memRates);<font></font> <font></font>                     cOLHCV.Clear();<font></font>                     mOLHCV.Clear();<font></font> <font></font>                     rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 0);<font></font>                     continue;<font></font> <font></font>                 }<font></font>                 else if (rb_return == 10)<font></font>                 {<font></font>                     memRates.Copy(mOLHCV);<font></font>                     break;<font></font>                 }<font></font>                 else if (rb_return == -1)<font></font>                 {<font></font>                     return;<font></font>                 }<font></font>                 else<font></font>                 {<font></font>                     throw new Exception("Unhandled return value = " + rb_return);<font></font>                 }<font></font>             }<font></font> <font></font>             if (IsLastBar && !IsRealTime)<font></font>             {<font></font>                 shiftBars(0);<font></font>             }<font></font>         }<font></font> <font></font>         private bool IsNewSession(DateTime prevTime, DateTime currTime)<font></font>         {<font></font>             if (prevTime.DayOfWeek != currTime.DayOfWeek)<font></font>                 return true;<font></font>             else<font></font>                 return false;<font></font>         }<font></font> <font></font> <font></font>     }<font></font> }<font></font> <font></font>
RSI bigger timeframe
  2
  0
  197
by mfejza
free  08 Dec 2022
RSI on btf with result as slope or step
volume profile zig
  1
  0
  315
free  05 Dec 2022
 per ctraderProfilo del volume
volume profile zig
  0
  0
  203
free  05 Dec 2022
 per ctraderProfilo del volume
Mixer
  2
  0
  257
free  24 Nov 2022
Crown Horeca menghadirkan pilihan beragam mixer roti pilihan untuk mengaduk adonan roti secara kalis sempurna dengan cepat walaupun dalam jumlah besar. Produk mixer kami terbuat dari bahan stainless steel sehingga aman dan kuat untuk proses pengolahan adonan dan memiliki kelebihan yaitu hemat listrik yang bisa didapatkan dengan harga terjangkau.
SupportResistance
  3
  0
  633
by cxc_g
free  23 Nov 2022
//+------------------------------------------------------------------+ //|                                                SupportResistance | //|                                       Copyright © 2016, UCHE OBI | //|                                               Developer:UCHE OBI | //|                                                 Skype:  OBI.UCHE | //|                                      email:ucheceleste@Gmail.com | //+------------------------------------------------------------------+ 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 SupportResistance : Indicator     {         [Parameter(DefaultValue = 10)]         public int range { get; set; }           [Parameter(DefaultValue = 3)]         public int confirmations { get; set; }           [Output("Res", Color = Colors.Black, LineStyle = LineStyle.DotsVeryRare)]         public IndicatorDataSeries resistance { get; set; }         [Output("Sup", Color = Colors.Black, LineStyle = LineStyle.DotsVeryRare)]         public IndicatorDataSeries support { get; set; }           public double res;         public double sup;           private MarketSeries Series;             protected override void Initialize()         {             // Initialize and create nested indicators             Series = MarketSeries;         }           public override void Calculate(int index)         {             // Calculate value at specified index             // Result[index] = ...               var upline = (Series.Close.Maximum(range) + Series.High.Maximum(range)) / 2;             var dnline = (Series.Close.Minimum(range) + Series.Low.Minimum(range)) / 2;             resistance[index] = double.NaN;             support[index] = double.NaN;             if (resbarsconfirmed(upline, index) >= confirmations)             {                 res = upline;                 ChartObjects.DrawLine("resline" + upline.ToString(), Series.OpenTime[index], upline, Series.OpenTime[index - range], upline, Colors.DarkRed, 2, LineStyle.Solid);             }               if (supbarsconfirmed(dnline, index) >= confirmations)             {                 sup = dnline;                 ChartObjects.DrawLine("supline" + dnline.ToString(), Series.OpenTime[index], dnline, Series.OpenTime[index - range], dnline, Colors.DarkBlue, 2, LineStyle.Solid);             }           }         private int resbarsconfirmed(double line, int index)         {             int touches = 0;             for (int i = index; i > index - range; i--)             {                 if (Series.Low[i] < line && Series.High[i] >= line && Series.Close[i] < line)                     touches += 1;                 if (Series.Close[i] > line)                     touches = 0;             }             return touches;         }         private int supbarsconfirmed(double line, int index)         {             int touches = 0;             for (int i = index; i > index - range; i--)             {                 if (Series.High[i] > line && Series.Low[i] <= line && Series.Close[i] > line)                     touches += 1;                 if (Series.Close[i] < line)                     touches = 0;             }             return touches;         }     } }
Alpilean Reviews
  0
  0
  178
free  22 Nov 2022
Alpilean is a weight reduction pill that assists you with consuming fat by focusing on your internal heat level. It works by expanding digestion and controlling your hunger. The fixings in the enhancement help to diminish fat cells and increment the development of brown fat tissue (BAT). BAT has been distinguished to be areas of strength for an in expanding thermogenesis in the body, which is the most common way of consuming calories. Alpilean is the principal weight reduction supplement made in the USA under FDA and GMP-managed offices. The fixings are unadulterated, regular, and tried for security. https://factschronicle.com/alpilean-reviews-27544.html
Double Ema Trend
  1
  0
  332
free  24 Nov 2022
Let me present it briefly. This is the trend for the chart from 2H and above. The Turquoise line is for the current trend if it crosses the Black line. The purpose of the indicator is for you to identify the exact trend