EM
emeeder
Blocked user by Spotware at 06 May 2014, 00:42
0 follower(s) 0 following 0 subscription(s)
Replies

emeeder
14 Oct 2014, 22:51

There are sample robots in the Cbots section.

I am pretty sure there are a few there that will do what you want.

here is one:

/algos/cbots/show/175


emeeder
14 Oct 2014, 22:29

I copy and pasted your robot into Calgo.

It doesnt crash and it finishes backtesting with no problems.

But i cant get it to trade at all. 1m, 5 m, 1h, 4h

What time frame are you running it on? and are the default settings set at tradeable levels?


emeeder
14 Oct 2014, 16:07

Thanks for the reply.

I think the problem may be in the HMA Indicator.

One of the parameters used to get the in the Weighted MA is calculated in the indicator.

I think maybe it is not building a correct DataSeries() or it is being built in the wrong time frame?

Here is my code, can you see why, when on a 1 minute chart, the higher time frame HMA will always level off towards the end of their time period and then at the start of their time period they adjust to the correct level again.

I am refering to the diff1, diff110M and the diff11H parameters. Any idea how it can be corrected?

Thanks

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None, ScalePrecision = 4)]
    public class HMAMultiTF : Indicator
    {


        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter(DefaultValue = 14)]
        public int Period { get; set; }

        [Output("HMA", Color = Colors.Orange)]
        public IndicatorDataSeries hma { get; set; }

        [Output("HMAFast 10M", Color = Colors.Green)]
        public IndicatorDataSeries hma10M { get; set; }

        [Output("HMAFast 1Hr", Color = Colors.Blue)]
        public IndicatorDataSeries hma1H { get; set; }


        private IndicatorDataSeries diff1, diff110M, diff11H;
        private WeightedMovingAverage wma1, wma110M, wma11H;
        private WeightedMovingAverage wma2, wma210M, wma21H;
        private WeightedMovingAverage wma3, wma310M, wma31H;

        private MarketSeries series1H1, series10M1;


        protected override void Initialize()
        {
            // Chart TF

            diff1 = CreateDataSeries();
            wma1 = Indicators.WeightedMovingAverage(MarketSeries.Close, (int)Period / 2);
            wma2 = Indicators.WeightedMovingAverage(MarketSeries.Close, Period);
            wma3 = Indicators.WeightedMovingAverage(diff1, (int)Math.Sqrt(Period));

            // 10 Minute TF

            series10M1 = MarketData.GetSeries(TimeFrame.Minute10);
            diff110M = CreateDataSeries();

            wma110M = Indicators.WeightedMovingAverage(series10M1.Close, (int)Period / 2);
            wma210M = Indicators.WeightedMovingAverage(series10M1.Close, Period);
            wma310M = Indicators.WeightedMovingAverage(diff110M, (int)Math.Sqrt(Period));

            //1Hr Timeframe

            series1H1 = MarketData.GetSeries(TimeFrame.Hour);
            diff11H = CreateDataSeries();

            wma11H = Indicators.WeightedMovingAverage(series1H1.Close, (int)Period / 2);
            wma21H = Indicators.WeightedMovingAverage(series1H1.Close, Period);
            wma31H = Indicators.WeightedMovingAverage(diff11H, (int)Math.Sqrt(Period));

        }

        public override void Calculate(int index)
        {

            //Chart TimeFrame
            double var1 = 2 * wma1.Result[index];
            double var2 = wma2.Result[index];

            diff1[index] = var1 - var2;
            hma[index] = wma3.Result[index];


            //10Min Timeframe

            var index110M = series10M1.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);

            double var110M = 2 * wma110M.Result[index110M];
            double var210M = wma210M.Result[index110M];

            diff110M[index] = var110M - var210M;
            hma10M[index] = wma310M.Result[index];


            //1Hr Timeframe

            var index1H1 = series1H1.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);

            double var11H = 2 * wma11H.Result[index1H1];
            double var21H = wma21H.Result[index1H1];

            diff11H[index] = var11H - var21H;
            hma1H[index] = wma31H.Result[index];






        }
    }
}

 


emeeder
11 Oct 2014, 06:31

I am assuming you have resolved this issue somehow.

There are quite a few threads on here that show how to add multi Time frame to a Cbot.

MY question is:

How can anyone successfully back test such a cbot??

If robot is run in 5 min timeframe. I think the indicators used in the robot that run in a higher time frame ie 1HR. I think these show the same result for the complete hour. And then update at the close of every 1Hr bar. Is this correct??

I think that is why I get terrible results when trying to backtest multi-timeframe robots.

Have you had any luck?

 


emeeder
06 Oct 2014, 22:20

Any idea if backtesting multiple symbols and timeframes will be available soon?

Are there any other options for me available anywhere where i can backtest multiple currency/symbol cbots?

 

 


emeeder
25 Sep 2014, 05:06

I have seen places on the internet that sell price data. Does anyone know a good source?

It looks like we can use our own data now to backtest in Calgo using a .csv file.

Does anyone know if it works good and if it is fast? Is there tick data available anywhere? or is it just 1 minute data?

It would be nice to back test for more years than calgo currently allows. So maybe getting my own data, that i know is reliable, is the way to go.

 

PS: i just refreshed my chart and it looks like data is back to normal for the time frames that were missing. I have been in touch with Spotware as well since last week and they were working on it. I'm pretty sure that it is a Spotware issue, not an IC Markets problem. Can anyone confirm that?

 


emeeder
24 Sep 2014, 22:29 ( Updated at: 21 Dec 2023, 09:20 )

How can a Cbot be programmed to stop trading in such situations??

Here is what my chart looks like:


emeeder
24 Sep 2014, 21:01

Thanks Elogos.

I noticed today is not even feasable to trade. Missing 3 days of data starting prior to 7:34 am UTC this morning. Tick charts seem to be ok, but all my time frame charts have a 3 day gap.

I dont have any trading Cbots running which is probably a good thing.

Is this problem limited to IC Markets?? Or is it a Spotware problem?

I am curious how this would effect a cbot that is running live or demo.

 

Can anyone who is running a Cbot  today and last night let me know the effect of such a Data Loss.

Thanks

 


emeeder
23 Sep 2014, 15:25

Thanks!

That's exactly what i needed.

 


emeeder
22 Sep 2014, 19:32

Thanks for that.

Right now I have this:

 Print("current bar" + (Server.Time - MarketSeries.OpenTime.Last(0)));

 Print("Last bar time: " + (MarketSeries.OpenTime.Last(0) - MarketSeries.OpenTime.Last(1)));

It gives me the data i want to use, but i can not output it as a number because it is in a time stamp format.

22/09/2014 12:24:58.903 | current bar 00:00:40.8500000

I guess my question is how can i use this result and plot it?

This for instance will not work:

Result[index] = (Server.Time - MarketSeries.OpenTime.Last(0));

is there a way that my result (in this case 00:00:40.8500000) can be converted to a number of 40.8500000 (seconds).

and also a number like 00:02:28.7800000 can be converted to a number 148.7800000 (seconds)

Thanks

 


emeeder
17 Sep 2014, 18:33

Thanks,

 

I only have one tick file  tick1.ctb.

I never use the 1tick chart so i am assuming all tick charts use this file for data.

hopefully they can figure it out from there.

 

Thanks


emeeder
17 Sep 2014, 16:47 ( Updated at: 21 Dec 2023, 09:20 )

I have been using the Tick 34 chart recently. I am with ICMarkets.

I have noticed that suddenly it will loose a whol bunch of data resulting in big time gaps on the chart.

in the last 24 hrs i have a 6 day and a 5hr gap in tick data.

 

Is this common behavior for tick charts?

here is a pic of the tick 34 chart. I have marked where the gaps are.


emeeder
21 Aug 2014, 17:19

virtuesoft, Did you get a cbot to work with the supertrend indicator?

 


emeeder
20 Aug 2014, 23:03

This Indicator is similar to teh Supertrend indicator that i am trying to use in a Cbot. I posted a question about it today. The code is there as well.

/forum/cbot-support/1111

Does anyone know what output the Cbot should be looking for to start and stop trades based on the UpTrend or DownTrend outputs?

I mainly want to use this along with other indicators as a Buysafe/Sellsafe indicator.

Thanks to anyone that can help me out.

 

 


emeeder
20 Aug 2014, 19:22

Thanks a lot for the help. :)


emeeder
20 Aug 2014, 18:59

I am trying to figure out the same thing.

What Output should the Cbot be looking for?

I have tried the results of these outputs  UpTrend/DownTrend/_upBuffer/_downBuffer being equal to 0 or 1 or -1 but none of those seem to work? I changed the 'private' to 'public' when i tried using the _upBuffer and _downBuffer parameters. But that did not work anyways.

Is it a True or False result i am looking for??

Can anyone have a look at the code below and maybe assist me with this?

Thanks a lot!

 

 

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class Supertrend : Indicator
    {
        [Parameter(DefaultValue = 10)]
        public int Period { get; set; }

        [Parameter(DefaultValue = 3.0)]
        public double Multiplier { get; set; }

        [Output("UpTrend", Color = Colors.Green, PlotType = PlotType.Points, Thickness = 3)]
        public IndicatorDataSeries UpTrend { get; set; }

        [Output("DownTrend", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 3)]
        public IndicatorDataSeries DownTrend { get; set; }

        private IndicatorDataSeries _upBuffer;
        private IndicatorDataSeries _downBuffer;
        private AverageTrueRange _averageTrueRange;
        private int[] _trend;
        private bool _changeofTrend;

        protected override void Initialize()
        {
            _trend = new int[1];
            _upBuffer = CreateDataSeries();
            _downBuffer = CreateDataSeries();
            _averageTrueRange = Indicators.AverageTrueRange(Period, MovingAverageType.WilderSmoothing);
        }

        public override void Calculate(int index)
        {
            // Init
            UpTrend[index] = double.NaN;
            DownTrend[index] = double.NaN;

            double median = (MarketSeries.High[index] + MarketSeries.Low[index]) / 2;
            double atr = _averageTrueRange.Result[index];

            _upBuffer[index] = median + Multiplier * atr;
            _downBuffer[index] = median - Multiplier * atr;


            if (index < 1)
            {
                _trend[index] = 1;
                return;
            }

            Array.Resize(ref _trend, _trend.Length + 1);

            // Main Logic
            if (MarketSeries.Close[index] > _upBuffer[index - 1])
            {
                _trend[index] = 1;
                if (_trend[index - 1] == -1)
                    _changeofTrend = true;
            }
            else if (MarketSeries.Close[index] < _downBuffer[index - 1])
            {
                _trend[index] = -1;
                if (_trend[index - 1] == -1)
                    _changeofTrend = true;
            }
            else if (_trend[index - 1] == 1)
            {
                _trend[index] = 1;
                _changeofTrend = false;
            }
            else if (_trend[index - 1] == -1)
            {
                _trend[index] = -1;
                _changeofTrend = false;
            }

            if (_trend[index] < 0 && _trend[index - 1] > 0)
                _upBuffer[index] = median + (Multiplier * atr);
            else if (_trend[index] < 0 && _upBuffer[index] > _upBuffer[index - 1])
                _upBuffer[index] = _upBuffer[index - 1];

            if (_trend[index] > 0 && _trend[index - 1] < 0)
                _downBuffer[index] = median - (Multiplier * atr);
            else if (_trend[index] > 0 && _downBuffer[index] < _downBuffer[index - 1])
                _downBuffer[index] = _downBuffer[index - 1];

            // Draw Indicator
            if (_trend[index] == 1)
            {
                UpTrend[index] = _downBuffer[index];
                if (_changeofTrend)
                {
                    UpTrend[index - 1] = DownTrend[index - 1];
                    _changeofTrend = false;
                }
            }
            else if (_trend[index] == -1)
            {
                DownTrend[index] = _upBuffer[index];
                if (_changeofTrend)
                {
                    DownTrend[index - 1] = UpTrend[index - 1];
                    _changeofTrend = false;
                }
            }
        }
    }
}

 


emeeder
22 Jul 2014, 21:08

I also would really appreciate these indicators. especially the HAMA.

I tried the Heiken Ashi Smoothed indicator, but it is a memory hog and has lots of extra coding in it.

Can someone make these for Ctrader?

Thanks


emeeder
15 Jun 2014, 03:42

I was having this same issue about 3 weeks ago. Just getting back to making a cbot today again and i notice it is still an issue. Errors when i click "Manage References".

How can I resolve it? Which folders in AppData can I safely delete? (without deleting any of my own cbots or indicators)

When i uninstall calgo will my custom indicators still be there after reinstall?

Please clarify.

Thanks a lot.

 


emeeder
10 May 2014, 02:19

Nevermind. I figured it out. Simply change "null" in the source code to "StopLoss" and and click rebuild.