cW22Trader's avatar


Member since: 16 Mar 2021





Last Algorithm Comments

@Pseudo Point and Figure:  19 Sep 2021, 19:04

Improved version with some bug-fixes and calculaton method more like point & figure or Renk.

@Time Segmented Volume:  06 Aug 2021, 01:08

Removed unused reference to "AdaptiveLaguerreMA".

Last Forum Posts

@Monthly bars are missing:  22 Jun 2022, 00:57

Why are there some monthly bars missing with Pepperstone? Where did May 2022 go? Could that have anything to do with time/date settings?

@Multi-timeframe robots/indicators:  28 Jan 2022, 22:53

Marin0ss said:

Hi Ctrader team,

Is it possible to refer to Open/Close/High/Low values & Indicator results from a different Range Bar chart?

Like running Ra100 Chart while getting values from Ra500 for example, just like referring values in a higher TF?

If not yet possible; any plans to implement this already?

Thanks in advance!

I think this is possible at least with Renko. This should be the same with Range bars.

But be carefull when using OHLC data of "higher" or larger TF. On historical data of e.g. on a chart it will use future data of the higher TF. E.g. a Ra100 bar just closed and your indicator algo gets triggered and you also get the data from the Ra500 bar using this API "Ra500bar.OpenTimes.GetIndexByTime(Ra100bar.OpenTimes[index])". The Ra500 bar may not be closed yet but since on historical data you only have access to completed OHLC data, you would use future data of that Ra500 bar which produces unrealistic results.

@cTrader Team: please correct me if I'm wrong...

Kind regards

@Multi-timeframe robots/indicators:  03 Oct 2021, 18:57

Hi Panagiotis,

PanagiotisCharalampous said:

Hi cW22Trader,

How could the indicator already know the high and low value (sma period = 1) at 9 pm of the previous day (see 1. screen shot)?

Because you are retrieving data for historical bars that have already been closed. All the bars you retrieve are closed bars. When you get data using GetIndexByTime(), you don't get the bar as it was at the specific point of time, but the completed bar where the requested time falls in.

If you are looking to find the bar state at the specific point of time, then this functionality is not offered by the API. You will need to develop something yourself.

Best Regards,


Join us on Telegram and Facebook  

I understand that the API does not offer intermediat data of a past bar of a different time frame. Unfortunately, this makes it impossible to run in backtest since the data form a different time frame is futur data.

E.g. on a 1h chart with an indicator using data form the 4h time frame and simply displays the OHLC data as static text on chart, every time a new 4h bar starts it already shows the future high and low of the next 4h in visual backtesting. I would expect that the last bar of the 4h time frame "builds up" during the next 4h in visual backtesting and only stores the open, high, low and close of that bar once it is complete just like it does in real-time mode.

Kind regards

@Multi-timeframe robots/indicators:  08 Sep 2021, 23:28


Why is the historical data wrong when using a different time frame and retrieving the index by GetIndexByTime? How could the indicator already know the high and low value (sma period = 1) at 9 pm of the previous day (see 1. screen shot)? If I a reduce dataIndex by 1 it is correct but is this how you should use GetIndexByTime? If you leave the indicator on the chart for a while, the values calculated while the chart was open behave different then the ones calculated from historical data during initializaiton of the indicator (see 2. screen shot). The last 3 bars all have different low values (red line) but all others (calculated during init) alway have 2 same values (this was done on 1m chart with tf parameter set to 2m).

Kind regards

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 TimeFrameMA : Indicator
        [Parameter("Time Frame", DefaultValue = "Daily")]
        public TimeFrame Timeframe { get; set; }

        [Parameter("MA Periods", DefaultValue = 3, MinValue = 1)]
        public int Periods { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MAType { get; set; }

        [Output("High", Thickness = 3)]
        public IndicatorDataSeries High { get; set; }

        [Output("Low", Thickness = 3, LineColor = "Red")]
        public IndicatorDataSeries Low { get; set; }

        private Bars data;
        private MovingAverage maH, maL;

        protected override void Initialize()
            data = MarketData.GetBars(Timeframe);
            maH = Indicators.MovingAverage(data.HighPrices, Periods, MAType);
            maL = Indicators.MovingAverage(data.LowPrices, Periods, MAType);

        public override void Calculate(int index)
            var indexData = data.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
            if (indexData > 0)
                High[index] = maH.Result[indexData];
                Low[index] = maL.Result[indexData];

@How to save Optimization results:  04 Aug 2021, 12:32

Use this every time PositionsOnClosed is called:

private double peak;
private List<double> drawdown = new List<double>();

private double CalcMaxDrawDown()
    peak = Math.Max(peak, Account.Balance);

    drawdown.Add((peak - Account.Balance) / peak * 100);

    var maxDrawdown = drawdown[drawdown.Count - 1];

    return maxDrawdown;

@Multi Time Frame OnBar Events:  03 Aug 2021, 00:27

Thanks for the answer.

Unfortunately, this example does not use any indicators it is code for an indicator. But how does it work in a bot using an indicator (e.g. an EMA)?

@Multi Time Frame OnBar Events:  29 Jul 2021, 22:17

Could you also provide a simple example with an indicator used for multiple symbols at the same time?

Is it still initialized in OnStart? Do I need one per symbol or is this handled automatically?

Kind regards

@Save and load optimization settings/parameters/runs:  16 Mar 2021, 18:24

Have the possibility to save and load optimization settings similar to the cBot parameters and to load default settings from the current active sttings for parameters which are not selected for optimization.

If possible it would also be nice to save the whole optimization runs somehow.

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.
Cumulative Delta Volume
free  12 Jun 2022
This is an cumulative volume indicator based of the version by LonesomeTheBlue on TradinbView: Here is how to use it:  
Moving Average Ribbon
free  05 Jun 2022
This is a moving average ribbon which only shows the average, the max and the min value. This way any number of moving averages can be shown without recompiling the code.
free  07 Feb 2022 This oscillator is based of a mathematical model creted by Cristian PÄ‚UNA and Ion LUNGU for the cyclicality of the price evolution. For more detail refer to the following paper:
King Market Structure
free  22 Jan 2022
This indicator shows the trend direction based on major swing levels (higher lows on uptrend, lower highs on down trend) and switches direction when they get broken. A pullback starts when price went at least a certain amount back (ATR x multi) and lasts for a minimum of bars.
free  09 Jan 2022
This is the cTrader version of an indicator found on TradingView with some minor changes (up and down bars have slightly different colors):
Pivot Super Trend
free  29 Nov 2021
This is a modifed version of the super trend indicator based on pivot points (fractals). The idear comes form an indicator found in tradingview with a slight modification for the calculation of the center line (any exponetial moving average period insted of a fixed 1/3). Trigger arrows are genereted on trend continuation when price goes above the center line and then drops back below it in down trends or when price drops below the center line and then goes back above it in up trends. Can be usfull for short- and long-term trading depending on the settings.
TF SSL Channel
free  11 Oct 2021
This is a version of the SSL Channel indicator which workes on higher time frames. It does not work on Tick charts! Based on this indicator.
free  19 Sep 2021
This is a pseudo point anf figure indicator which can be plotted on normal time charts. The box size can either be a fix number in pips or fluctuate based on volatility (ATR). The reversal amount is typically three times the box size but can also be set to any other number. It is also possible to use high and lows prices for calculating the movement while using only closing prices there will be less movement.
free  05 Sep 2021
Adaptive moving average converted from Tradingview by LuxAlgo. Can be use like every other moving average. See link below for more information.  
TX Color
free  04 Sep 2021
This is a generalized version of the T3 indciator by Tim Tillson. It is based on an indicator published by user jani: In this version it is possible to set any order since the coefficients are caluculated based on the binomial formula. Setting the order to 6 will produce the same result as the orginal indicator by Tim Tillson.
free  29 Aug 2021
This is Jurik's "noise free" version of RSI, with no added lag. See for more information. Use this indicator just like the normal RSI. The code was converted from tradingview (author: LazyBear).
Chandelier Exit
free  06 Aug 2021
This is a volatility-based indicator which identifies stop loss exit points.
HLC Trend
free  05 Aug 2021
Simple indicator which identifies trends based on a comparison of the MA value of close - MA value of high and the MA value of low - MA value of close.
Time Segmented Volume
free  06 Aug 2021
This indicator is very similar to the on-balance volume indicator. Here is how to use this indicator:
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.