Description
The indicator should be attached to 1-minute charts for the best historical candle accuracy.
It is displayed as an overlay on the main chart so, you may want to change the chart properties to "line chart" and the "Bear Outline" color to black for better clarity of displayed bars.
The indicator is a very powerful tool, capable of creating many charting types, which are very popular among traders. With the proper settings, you can display the following charting types (to name but a few):
- Median Renko (Settings: Retracement factor = 0.5 , Symmetrical reversals = Yes)
- Standard Renko with wicks (Settings: Retracement factor = 1.00 , Symmetrical reversals = Yes)
- Turbo Renko (Settings: Retracement factor = 0.25 , Symmetrical reversals = Yes)
- Hybrid Renko (Settings: Retracement factor = 0.25 , Symmetrical reversals = No)
- PointO (Settings: Retracement factor = 1.00 , Symmetrical reversals = No)
All charting types display wicks and contain reference points (MedianRenko Open, Low, High, Close) for use by other indicators as well as cAlgo robots.
This is a 14-day trial version. Lifetime license can be purchased >> here <<
Latest version always available on OneDrive
Available Inputs
- Bar Size (number of pips)
- Retracement factor (0.01 to 1.00)
- Symmetrical reversals (Yes / No)
- Reset Open on each new trading day (Yes /No)
- Apply offset to first renko bar (Yes / No)
- Tick offset value (0 to ...)
- Maximum Bars
- Bullish Bar Color
- Bearish Bar Color
Referencing the indicator from a cAlgo robot
// // Declare and create an instance of MedianRenko indicator // private MedianRenko mr_indi; protected override void OnStart() { object[] parameterValues = { 10, // Bar size 0.5, // Retracement factor 100, // Show number of bars true, // Symmetrical reversals true, // Reset Open on new trading day false, // Apply offset to first renko bar 0, // Tick offset value "Green", // Bullish bar color "Red" // Bearish bar color }; mr_indi =Indicators.GetIndicator<MedianRenko>(parameterValues); // // Start processing... // protected override void OnTick() { // // Example: check if last 2 completed bars are bullish // bool lastTwoBarsBullish = (mr_indi.Open.Last(1) < mr_indi.Close.Last(1)) && (mr_indi.Open.Last(2) < mr_indi.Close.Last(2)); // // Trading logic goes here... // }
Attaching other indicators to the Median Renko Ultimate chart
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using cT_MedianRenkoEngine;
namespace cAlgo
{
[Indicator("MedianRenko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class MedianRenko : Indicator
{
[Parameter("Bar Size (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]
public double BarSizePips { get; set; }
[Parameter("Retracement factor (0.01 - 1.00)", DefaultValue = 0.5, MinValue = 0.01, MaxValue = 1.0, Step = 0.01)]
public double Retracement { get; set; }
[Parameter("Maximum Bars", DefaultValue = 300, MinValue = 1)]
public int BricksToShow { get; set; }
[Parameter("Symmetrical Reversals", DefaultValue = true)]
public bool SymmetricalReversals { get; set; }
[Parameter("Reset Open on new trading day", DefaultValue = false)]
public bool ResetOpenOnNewTradingDay { get; set; }
[Parameter("Apply offset to first renko bar", DefaultValue = false)]
public bool ApplyOffsetToFirstBar { get; set; }
[Parameter("Tick offset value", DefaultValue = 0, MinValue = 0)]
public int OffsetValue { get; set; }
[Parameter("Bullish Bar Color", DefaultValue = "SeaGreen")]
public string ColorBull { get; set; }
[Parameter("Bearish Bar Color", DefaultValue = "Tomato")]
public string ColorBear { get; set; }
[Output("Open", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]
public IndicatorDataSeries Open { get; set; }
[Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
public IndicatorDataSeries High { get; set; }
[Output("Low", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]
public IndicatorDataSeries Low { get; set; }
[Output("Close", Color = Colors.DimGray, Thickness = 0, PlotType = PlotType.Points)]
public IndicatorDataSeries Close { get; set; }
private MedianRenkoCore core = null;
private bool coreOK = true;
private DateTime lastTime;
private bool appliedOffset = false;
private T_OLHCV pOLHCV;
private T_OLHCV OLHCV;
private T_OLHCV mOLHCV;
private T_OLHCV cOLHCV;
private T_OLHCV memRates;
private T_OLHCV lastBar;
private List<T_OLHCV> bars = new List<T_OLHCV>();
private double barSize;
private Colors colorBull, colorBear;
protected override void Initialize()
{
core = new MedianRenkoCore();
coreOK = core.StatusCheck();
barSize = BarSizePips * Symbol.PipSize;
lastTime = new DateTime();
lastTime = MarketSeries.OpenTime[MarketSeries.Close.Count - 1];
lastBar = new T_OLHCV();
pOLHCV = new T_OLHCV();
OLHCV = new T_OLHCV();
mOLHCV = new T_OLHCV();
cOLHCV = new T_OLHCV();
memRates = new T_OLHCV();
if (!Enum.TryParse<Colors>(ColorBull, out colorBull))
{
colorBull = Colors.SeaGreen;
}
if (!Enum.TryParse<Colors>(ColorBear, out colorBear))
{
colorBear = Colors.Tomato;
}
appliedOffset = false;
}
private bool NewBar(int index)
{
if (lastTime != MarketSeries.OpenTime[index])
{
lastTime = MarketSeries.OpenTime[index];
return true;
}
return false;
}
private static int cc = 0;
private void pushBars(T_OLHCV bar, bool display)
{
int count = bars.Count();
var newBar = new T_OLHCV();
newBar.Copy(bar);
newBar.Index = cc++;
bars.Insert(0, newBar);
count++;
if (display)
{
shiftBars(0);
}
if (count > BricksToShow)
{
if (display)
{
for (int i = BricksToShow - 1; i < count; i++)
{
ChartObjects.RemoveObject("mr_Wick_" + bars[i].Index);
ChartObjects.RemoveObject("mr_Bar_" + bars[i].Index);
}
}
bars.RemoveRange(BricksToShow, count - BricksToShow);
Open[count - BricksToShow] = double.NaN;
High[count - BricksToShow] = double.NaN;
Low[count - BricksToShow] = double.NaN;
Close[count - BricksToShow] = double.NaN;
}
}
private void shiftBars(int shift)
{
int count = bars.Count;
int ix = MarketSeries.Close.Count - 2;
for (int i = 0; i < count && i < BricksToShow; i++)
{
var candleColor = (bars[i].Close > bars[i].Open) ? colorBull : colorBear;
ChartObjects.DrawLine("mr_Wick_" + bars[i].Index, ix, bars[i].High, ix, bars[i].Low, candleColor, 1, LineStyle.Solid);
ChartObjects.DrawLine("mr_Bar_" + bars[i].Index, ix, bars[i].Close, ix, bars[i].Open, candleColor, 5, LineStyle.Solid);
Open[ix] = bars[i].Open;
High[ix] = bars[i].High;
Low[ix] = bars[i].Low;
Close[ix] = bars[i].Close;
ix--;
}
}
private void UpdateLastBar(int ix)
{
var candleColor = (memRates.Close > memRates.Open) ? colorBull : colorBear;
ChartObjects.DrawLine("mr_Wick_Live", ix, memRates.High, ix, memRates.Low, candleColor, 1, LineStyle.Solid);
ChartObjects.DrawLine("mr_Bar_Live", ix, memRates.Close, ix, memRates.Open, candleColor, 5, LineStyle.Solid);
Open[ix] = memRates.Open;
High[ix] = memRates.High;
Low[ix] = memRates.Low;
Close[ix] = memRates.Close;
}
public override void Calculate(int index)
{
if (ResetOpenOnNewTradingDay)
{
if (IsNewSession(MarketSeries.OpenTime[(index > 0) ? (index - 1) : index], MarketSeries.OpenTime[index]))
{
cOLHCV.Clear();
mOLHCV.Clear();
pOLHCV.Clear();
memRates.Copy(mOLHCV);
}
}
if (IsRealTime)
{
if (!coreOK)
{
ChartObjects.DrawText("TrialOverMsg", "MedianRenko Indicator - Trial period ended. Please purchase a license file at www.az-invest.eu", StaticPosition.Center, Colors.White);
return;
}
if (NewBar(index))
{
shiftBars(0);
Open[index - BricksToShow - 1] = double.NaN;
High[index - BricksToShow - 1] = double.NaN;
Low[index - BricksToShow - 1] = double.NaN;
Close[index - BricksToShow - 1] = double.NaN;
}
OLHCV.Open = MarketSeries.Close[index];
OLHCV.Low = MarketSeries.Close[index];
OLHCV.High = MarketSeries.Close[index];
OLHCV.Close = MarketSeries.Close[index];
OLHCV.OpenTime = MarketSeries.OpenTime[index];
OLHCV.TickVolume = 1;
ProcessMarketData(OLHCV);
UpdateLastBar(index);
}
else
{
OLHCV.Open = MarketSeries.Open[index];
OLHCV.Low = MarketSeries.Low[index];
OLHCV.High = MarketSeries.High[index];
OLHCV.Close = MarketSeries.Close[index];
OLHCV.OpenTime = MarketSeries.OpenTime[index];
OLHCV.TickVolume = MarketSeries.TickVolume[index];
if (ApplyOffsetToFirstBar && !appliedOffset)
{
OLHCV.Open = OffsetValue * Symbol.TickSize + Math.Floor(OLHCV.Open / barSize) * barSize;
appliedOffset = true;
}
ProcessMarketData(OLHCV);
if (IsLastBar)
UpdateLastBar(index);
}
}
private void ProcessMarketData(T_OLHCV ___OLHCV)
{
int rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 1);
while (true)
{
if ((rb_return >= 1) && (rb_return <= 4))
{
pushBars(cOLHCV, IsRealTime);
memRates.Copy(mOLHCV);
OLHCV.Copy(memRates);
cOLHCV.Clear();
mOLHCV.Clear();
rb_return = core.ProcessMedianRenko(barSize, Retracement, SymmetricalReversals, ___OLHCV, ref pOLHCV, ref mOLHCV, ref cOLHCV, 0);
continue;
}
else if (rb_return == 10)
{
memRates.Copy(mOLHCV);
break;
}
else if (rb_return == -1)
{
return;
}
else
{
throw new Exception("Unhandled return value = " + rb_return);
}
}
if (IsLastBar && !IsRealTime)
{
shiftBars(0);
}
}
private bool IsNewSession(DateTime prevTime, DateTime currTime)
{
if (prevTime.DayOfWeek != currTime.DayOfWeek)
return true;
else
return false;
}
}
}
arturzas
Joined on 15.06.2016
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: MedianRenko.algo
- Rating: 5
- Installs: 9439
- Modified: 13/10/2021 09:54
Comments
Update to version 1.10
I fixed the bug that caused the platform to close when the 14 day trial period ran out and also
added some chart synchronization options outlined below:
Reset Open on new trading day - This is an optional feature, which ensures daily (or session) reference consistency. This is used to reflect the true daily (or session) open, high, low and close values. To use this function, set this parameter to Yes. As a result in some cases, you will see a gap between the previous session’s close and open of the current one.
Apply offset to first renko bar & Tick offset value - These parameters enable (when Apply offset to first renko bar set to Yes) or disable (when Apply offset to first renko bar set to No) the normalization of the first renko bar’s opening price using the Tick offset value.
In practice, this pair of parameters is used to define the opening price of the first bar on the renko chart.
For example, if we have 10 pip renko bar and we set:
- Appy offset to first renko bar = Yes
- Tick offset value = 0
The renko chart will open at the 00 price level and consecutive bars will follow as presented below:
EURUSD 10 pip renko chart:
1st bar -> open 1.40100, close 1.40200
2nd bar -> open 1.40200, close 1.40300
3rd bar -> open 1.40300, close 1.40400
4th bar -> open 1.40500, close 1.40600
Hi, All you need to do to remove the indicator is to open cAlgo and delete the indicator or do this manually:
1) Open your Windows Documents folder and go into cAlgo/Sources/Indicators
2) Delete the MedianRenko folder and MedianRenko.algo file.
Hello
I use this indy over 14-day trial version and I don't need to use any more but
it alway show massage box to license purchase and when click "OK" or close box
my ctrader program will close also. Now I can't use my ctrader program so how to fix it ?
I need to use normal my ctrader program.
esta com erro no link da versao de teste