multi timeframe in custom indicator
multi timeframe in custom indicator
09 Apr 2023, 17:01
hi
How can I have the results of other time frames for my custom indicator?
Like the AverageTrueRange indicator, whose first parameter can be adjusted to provide the results of other time frames
Replies
AlgoCreators
11 Apr 2023, 15:58
RE:
PanagiotisChar said:
Hi there,
Here you go
var bars = MarketData.GetBars(TimeFrame.Daily); _adx = Indicators.AverageTrueRange(bars, 10, MovingAverageType.Exponential);
Need help? Join us on Telegram
Need premium support? Trade with us
Thanks for the tip you posted but that's not what I meant!
I will explain again:
this is my custom indicator:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Indicators
{
[Indicator(AccessRights = AccessRights.None, IsOverlay = false)]
public class CandleSizeMoving : Indicator
{
[Parameter("Candle Period", DefaultValue = 3)]
public int CandlePeriod { get; set; }
[Parameter("Moving Period", Group = "Moving Average", DefaultValue = 200)]
public int MAPeriod { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
[Output("small", LineColor = "Aqua")]
public IndicatorDataSeries Moving { get; set; }
private MovingAverage MA { get; set; }
protected override void Initialize()
{
MA = Indicators.MovingAverage(Result, MAPeriod, MovingAverageType.Exponential);
}
public override void Calculate(int index)
{
double t_body = 0.0;
for (int i = CandlePeriod; i > 0; i--)
t_body += Math.Abs(Bars.HighPrices[index - i] - Bars.LowPrices[index - i]) / Symbol.PipSize;
Result[index] = t_body / CandlePeriod;
Moving[index] = MA.Result[index];
}
}
}
And I want my indicator to have the ability retrieve OHLCV data for multiple timeframes, like other indicators
@AlgoCreators
PanagiotisChar
11 Apr 2023, 16:03
Hi there,
You need to retrieve the bars as in my example above and use them to do your calculations instead of Bars.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
VEI5S6C4OUNT0
01 Jun 2023, 09:55
Multible Time frames ?
when I was playing with Wiliams Wild Smooth I found that by using simple math it can show what would be on other time frames
For example Use a Simple MA and times by up to the next time frame requiered
1M chart with 15M results over lay like say you want to see a Moving avarage of 21p on a 15m and show this on the 1m
Then set the SMA to 315p ( 21 x 15 = 315 )
there is an indicator that shows the other times as bars but I did not like it as it is just Highs and Lows that I can all ready see with multible charts and monitors.
@VEI5S6C4OUNT0
PanagiotisChar
10 Apr 2023, 08:10
Hi there,
Here you go
Aieden Technologies
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar