Description
- The Indicator plots custom timeframe candlesticks over current chart.
Updates:
- 21/03/2016 - Released.
Inputs:
- Timeframe - Defines TimeFrame of custom DataSeries.
- Thickness - Defines thickness of lines.
Screenshot:
Make a Donation
- If you like my work and effort then please consider to make a kind donation thru PayPal or any Credit Card at the top right corner.
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 CustomTFCandlesticks : Indicator
{
[Parameter()]
public TimeFrame Timeframe { get; set; }
[Parameter("Thickness", DefaultValue = 1)]
public double Thickness { get; set; }
private MarketSeries tf;
protected override void Initialize()
{
tf = MarketData.GetSeries(Timeframe);
}
public override void Calculate(int index)
{
int idx1 = tf.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
int idx2 = MarketSeries.OpenTime.GetIndexByTime(tf.OpenTime[idx1]);
int idx3 = idx2 + (index - idx2) / 2;
double open = tf.Open[idx1];
double high = tf.High[idx1];
double low = tf.Low[idx1];
double close = tf.Close[idx1];
var color = open < close ? Colors.Green : Colors.Red;
ChartObjects.DrawLine("top" + idx1, idx2, close, index, close, color, Thickness);
ChartObjects.DrawLine("bottom" + idx1, idx2, open, index, open, color, Thickness);
ChartObjects.DrawLine("left" + idx1, idx2, open, idx2, close, color, Thickness);
ChartObjects.DrawLine("right" + idx1, index, open, index, close, color, Thickness);
ChartObjects.DrawLine("high" + idx1, idx3, high, idx3, Math.Max(open, close), color, Thickness);
ChartObjects.DrawLine("low" + idx1, idx3, low, idx3, Math.Min(open, close), color, Thickness);
}
}
}
whis.gg
Joined on 31.08.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Custom TF Candlesticks.algo
- Rating: 4.29
- Installs: 5427
- Modified: 13/10/2021 09:55
Comments
Hi,
I would like to pay for a modification to your larger Time Frame Candles indicator.
Please contact me on how I can reach you and pay for the service.
Thank you.
Hi
Great indicator. can we change the starting candle of each day? or which hour it starts to calculate?
Do you think can update the product to change the colour of the candle.
Currently red for down bar and green for up bar. If the colour can be change to user preference then it would be more versatile.
Thanks.
Could you send me a screenshot on mail: [belochjiri@hotmail.com], please? I am unable to replicate this behavior on my end.
Question about using the timeframe (Time UTC- 1Min chart)
Once the chosen timeframe is 4H and above,the candle doesn't begin at 00:00 anymore.
Why?
Hi,
I would like to pay for a modification to your larger Time Frame Candles indicator.
Please contact me on how I can reach you and pay for the service.
My email: rider125@live.com.
Thank you.