Description
This indicator was intended to show price movement (close) from smaller timeframe.
Created by :
rony.sitepu@gmail.com
Change log :
1.0 First Released
1.1 Shifted the line by half a bar
_____________________________________________________________________
Below is showing H1 movement, from daily timeframe
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Collections.Generic;
using System.Reflection;
using System.Globalization;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class indibase : Indicator
{
[Parameter("Inner Timeframe")]
public TimeFrame tf { get; set; }
[Parameter("Search Period", DefaultValue = 100)]
public int searchper { get; set; }
[Parameter("Color hexcode", DefaultValue = "#96FFFFFF")]
public string linecol { get; set; }
int numbar = 0;
int startidx = 0;
Bars innerbar;
double deltabar;
protected override void Initialize()
{
// Initialize and create nested indicators
numbar = Bars.OpenPrices.Count - 1;
startidx = numbar - searchper;
innerbar = MarketData.GetBars(tf);
//load enough bar
var d0 = Bars.OpenTimes[startidx];
var dxt = innerbar[0].OpenTime;
while (dxt > d0)
{
innerbar.LoadMoreHistory();
dxt = innerbar[0].OpenTime;
}
//get delta duration each bar
deltabar = Bars.OpenTimes[1].Subtract(Bars.OpenTimes[0]).TotalHours;
//change bar color
Chart.ColorSettings.BullFillColor = Color.Transparent;
Chart.ColorSettings.BearFillColor = Color.Transparent;
}
public override void Calculate(int index)
{
// Calculate value at specified index
// Result[index] = ...
if (index < startidx)
return;
if (index < numbar)
return;
for (var i = 0; i < innerbar.Count - 1; i++)
{
//draw trendline
var x1 = innerbar.OpenTimes[i].AddHours(-deltabar / 2);
var x2 = innerbar.OpenTimes[i + 1].AddHours(-deltabar / 2);
var y1 = innerbar.ClosePrices[i];
var y2 = innerbar.ClosePrices[i + 1];
Chart.DrawTrendLine(tf.ToString() + x1.ToString(), x1, y1, x2, y2, linecol);
}
numbar++;
}
//=========================
}
}
fundspreader
Joined on 30.01.2017
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Intracandle Movement 1.1.algo
- Rating: 0
- Installs: 1596
- Modified: 13/10/2021 09:54
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.