Traderfofever's avatar
Traderfofever
Traderfofever's avatar

Info

Username:Traderfofever
Name:Traderfofever
Member since: 07 Aug 2017

About

None

Signature

None

Last Algorithm Comments

@MACD Crossover with Colors (v2):  07 May 2018, 10:55


Hi,my friend, thank you for your work, and could you please publish another version which will show arrows on the chart when crossover issued? That will be perfect:)   Best Regards!

Last Forum Posts

@why merge cALGO with cTRADER:  30 May 2018, 11:13


Panagiotis Charalampous said:

Hi GoldnOil1050,

If cTrader crashes, then the solution is to fix the crashes, not split the applications. Please report to us when the crashes happen so that we can fix them. Beyond that, your answer does not provide any other reason why you cannot use two instances of cTrader, one for trading and one for developing your cBots. Honestly, there is nothing different here than running cTrader and cAlgo in parallel. Even if one instance crashes the other one stays intact. 

Best Regards,

Panagiotis

I like the new version, thank you for the work:)

@MACD Crossover On Chart:  05 May 2018, 16:03


Reference: /algos/indicators/show/1023

Looks like the image below:

@MACD Crossover On Chart:  05 May 2018, 15:47


  • Based on the original MACD Crossover indicator from cTrader.
  • When MACD cross signal line, there will be an arrow on the chart.
  • When MACD cross signal Line, there will be a popup alert(Optional).

If you know how to code it, please help:)

@Alerts for trend lines!!!:  18 Apr 2018, 05:07


Please add alerts to trend lines!!!

@How to add a pop-up alert to this indicator?:  10 Oct 2017, 09:31


afhacker said:

Try this: /algos/show/1425

Thank you, I will try this:)

@How to add a pop-up alert to this indicator?:  10 Oct 2017, 08:45


Could you please help me add a pop-up alert to this indicator? For example, when the color of dots changes, there will be a pop-up alert with sound, just like the built-in price alert. Thank you:)

using System;
using cAlgo.API;
using System.Runtime.InteropServices;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SuperProfit : Indicator
    {
        // Alert
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);

        [Parameter(DefaultValue = 35)]
        public int DllPeriod { get; set; }

        [Parameter(DefaultValue = 1.7)]
        public double Period { get; set; }

        [Parameter(DefaultValue = MovingAverageType.Weighted)]
        public MovingAverageType MaType { get; set; }

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

        [Parameter(DefaultValue = 5)]
        public int StopLoss { get; set; }

        [Parameter(DefaultValue = 20)]
        public int TakeProfit { get; set; }

        [Output("Up", PlotType = PlotType.Points, Thickness = 4)]
        public IndicatorDataSeries UpSeries { get; set; }

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


        private DateTime _openTime;

        private MovingAverage _movingAverage1;
        private MovingAverage _movingAverage2;
        private MovingAverage _movingAverage3;
        private IndicatorDataSeries _dataSeries;
        private IndicatorDataSeries _trend;


        protected override void Initialize()
        {
            _dataSeries = CreateDataSeries();
            _trend = CreateDataSeries();

            var period1 = (int)Math.Floor(DllPeriod / Period);
            var period2 = (int)Math.Floor(Math.Sqrt(DllPeriod));

            _movingAverage1 = Indicators.MovingAverage(Price, period1, MaType);
            _movingAverage2 = Indicators.MovingAverage(Price, DllPeriod, MaType);
            _movingAverage3 = Indicators.MovingAverage(_dataSeries, period2, MaType);

        }

        public override void Calculate(int index)
        {
            if (index < 1)
                return;

            _dataSeries[index] = 2.0 * _movingAverage1.Result[index] - _movingAverage2.Result[index];
            _trend[index] = _trend[index - 1];

            if (_movingAverage3.Result[index] > _movingAverage3.Result[index - 1])
                _trend[index] = 1;
            else if (_movingAverage3.Result[index] < _movingAverage3.Result[index - 1])
                _trend[index] = -1;

            if (_trend[index] > 0)
            {
                UpSeries[index] = _movingAverage3.Result[index];

                if (_trend[index - 1] < 0.0)
                {
                    UpSeries[index - 1] = _movingAverage3.Result[index - 1];

                    if (IsLastBar)
                    {
                        var stopLoss = MarketSeries.Low[index - 1] - StopLoss * Symbol.PipSize;
                        var takeProfit = MarketSeries.Close[index] + TakeProfit * Symbol.PipSize;
                        var entryPrice = MarketSeries.Close[index - 1];

                        if (MarketSeries.OpenTime[index] != _openTime)
                        {
                            _openTime = MarketSeries.OpenTime[index];
                            DisplayAlert("Buy signal", takeProfit, stopLoss, entryPrice);
                        }
                    }
                }

                DownSeries[index] = double.NaN;
            }
            else if (_trend[index] < 0)
            {
                DownSeries[index] = _movingAverage3.Result[index];

                if (_trend[index - 1] > 0.0)
                {
                    DownSeries[index - 1] = _movingAverage3.Result[index - 1];

                    if (IsLastBar)
                    {
                        var stopLoss = MarketSeries.High[index - 1] + StopLoss * Symbol.PipSize;
                        var takeProfit = MarketSeries.Close[index] - TakeProfit * Symbol.PipSize;
                        var entryPrice = MarketSeries.Close[index - 1];

                        if (MarketSeries.OpenTime[index] != _openTime)
                        {
                            _openTime = MarketSeries.OpenTime[index];
                            DisplayAlert("Sell signal", takeProfit, stopLoss, entryPrice);
                        }
                    }
                }

                UpSeries[index] = double.NaN;
            }

        }

        protected void DisplayAlert(string tradyTypeSignal, double takeProfit, double stopLoss, double entryPrice)
        {
            string entryPricetext = entryPrice != 0.0 ? string.Format(" at price {0}", Math.Round(entryPrice, 4)) : "";
            string takeProfitText = takeProfit != 0.0 ? string.Format(", TP on  {0}", Math.Round(takeProfit, 4)) : "";
            string stopLossText = stopLoss != 0.0 ? string.Format(", SL on {0}", Math.Round(stopLoss, 4)) : "";

            var alertMessage = string.Format("{0} {1} {2} {3} {4}", tradyTypeSignal, entryPricetext, takeProfitText, stopLossText, Symbol.Code);

            MessageBox(new IntPtr(0), alertMessage, "Trade Signal", 0);

        }
    }
}

@Why the chart becomes so slow?:  25 Sep 2017, 15:27


Panagiotis Charalampous said:

Hi Trader4ever,

I tried your indicator but I didn't experience any performance degradation. Can you please share a screenshot of your chart. It could be that something else causes the slow down.

Best Regards,

Panagiotis

I am so sorry I didn't make myself clear. It depends on the LineStyle!

@Why the chart becomes so slow?:  24 Sep 2017, 19:05


I just modified the Sample SMA a little to change the PlotType to Histogram, then the chart became very slow. Could anyone please tell me what happened and how to deal with it? Thank you!

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
    public class SMAHistogram : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter(DefaultValue = 20)]
        public int Periods { get; set; }

        [Output("Main", PlotType = PlotType.Histogram, Color = Colors.White, Thickness = 1)]
        public IndicatorDataSeries Result { get; set; }

        public override void Calculate(int index)
        {
            double sum = 0.0;

            for (int i = index - Periods + 1; i <= index; i++)
            {
                sum += Source[i];
            }
            Result[index] = sum / Periods;
        }
    }
}

@More official information and tutorials about coding for cTrader and cAlgo:  22 Sep 2017, 20:31


Panagiotis Charalampous said:

Hi Trader4ever,

Thanks for posting this suggestion. Since the issue was raised, I would like to inform the community that some major changes are in the works. You might have noticed some change in the community the last couple of months and more things are to be expected. A new community platform is planned as well as more initiatives are considered towards making your life easier. Revamping our supportive material is one of the major pillars of this big project. And all of this is just a part of major changes coming in the platform soon, some of them already announced in the Coming Soon section. 

Having said the above, we would be happy to hear your suggestion for specific changes and additions in our supportive material.

Best Regards,

Panagiotis

Thank you! I am so glad to hear that!

@Please post all the source code of cTrader's standard indicators:  22 Sep 2017, 20:29


Spotware said:

Dear Trade4ever,

Thanks for posting your suggestion in the forum. Unfortunately we cannot open source cTrader built-in Indicators.

Best Regards,
cTrader Team

OK. Thank you anyway:)

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.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.