amusleh's avatar
Ahmad Noman Musleh
Community Developer | Spotware | Telegram: @algodeveloper
Ahmad Noman Musleh's avatar

Info

Username:amusleh
Name:Ahmad Noman Musleh
Member since: 01 Mar 2021
Country:Turkey

About

None

Signature

Community Developer | Spotware | Telegram: @algodeveloper

Last Algorithm Comments

@Synchronized Crosshair:  25 Apr 2022, 13:04


TheNiatpac, Try new version.

@Custom Renko Chart (Overlay):  06 Feb 2022, 09:01


Hi fxctrader, We can set a different color for it but we don't have any plan to add such a feature, you can add this feature with few lines of code.

@Custom Renko Chart (Overlay):  03 Feb 2022, 10:42


fxctrader, We added the last bar progress, please update to latest version.

@Economic Events On Chart:  01 Feb 2022, 15:40


traderfxmaster007, Please post your question on the forum.

@Pitchfork Drawing:  16 Sep 2021, 10:41


uzairmaster97, The issue of lines not being parallel is caused by weekend bars, if you modify the pattern again it will align itself.

@Pitchfork Drawing:  21 Jul 2021, 09:39


prlozc, This indicator has some internal source code files, which are not included in the main indicator source code file, if you download it you will be able to rebuild the indicator, open it with Visual Studio to see the other source code files.

@Fibonacci Drawing:  11 Jul 2021, 12:36


opit78, You have to download the full indicator file if you want to compile it, and you have to us Visual Studio to modify it. You can't copy/paste the code.

@Pattern Drawing:  17 Jun 2021, 09:22


For3xScalper, What do you mean by tentative date? it just hide the patterns if the time frame doesn't match your defined one.

@Pattern Drawing:  09 May 2021, 09:54


remon, In new version if you change one label color or style all other labels of that pattern will copy the updated label color or style. Regarding cycles, we also linked the cycle lines style and color. What do you mean exactly by visibility per time frame? we already have a time frame visibility option.

@Pattern Drawing:  01 May 2021, 21:23


For3xScalper, You can change the color by selecting the pattern lines, also you can change the default drawing color from indicator settings, in new version which will be released very soon if you change an EV pattern one line color or style all other lines of that pattern color or style will change too.

Last Forum Posts

@window layout:  20 May 2022, 10:37


Hi,

No it's not possible on current multi chart mode, what you can do is create separate detached chart windows and divide your screen to three equal separate columns by using Windows screen partitioner:

@Magic keys bot malfunctioning:  20 May 2022, 10:23


aidanfrankgriffiths said:

Where would I find that?

Hi,

Contact your cBot developer, and ask them to fix the issue, they have the source code.

@cTrader app push notifications from indicator:  20 May 2022, 10:22


Hi,

There is no such functionality on Automate API, but you can use other third part services like Telegram.

@What are Discontinuous Lines in cTrader.:  20 May 2022, 10:20


Hi,

The lines are discontinuous:

Discontinuous outputs can have empty or NAN values, and those NAN values will not be displayed on the chart.

@indicator has stopped working:  20 May 2022, 08:02


Hi,

By commenting I mean remove that line of code by making it a comment, ex:

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

namespace cAlgo
{
    [Indicator("Support and Resistance At Price", IsOverlay = true, AccessRights = AccessRights.None)]
    public class SRAtPrice : Indicator
    {
        private double extremeHigh = 0;
        private double extremeLow = 0;
        private double dayHi = 0;
        private double dayLo = 0;
        private SortedList<double, int> prices = new SortedList<double, int>();
        private IList<Zone> zones = new List<Zone>();

        private const string ExtremeHighName = "ExtremeHigh";
        private const string ExtremeLowName = "ExtremeLow";
        private const string DayHighName = "DayHigh";
        private const string DayLowName = "DayLow";

        [Parameter("Periods", DefaultValue = 100)]
        public int Periods { get; set; }

        [Parameter("Show Extreme H/L", DefaultValue = true)]
        public bool ShowExtremeHL { get; set; }

        [Parameter("Show Day H/L", DefaultValue = true)]
        public bool ShowDayHL { get; set; }

        [Parameter("Required Hits", DefaultValue = 0)]
        public int RequiredHits { get; set; }

        [Parameter("Zone Size", DefaultValue = 2)]
        public int ZoneSize { get; set; }

        [Parameter("Max Lines In Zone", DefaultValue = 1)]
        public int MaxLinesInZone { get; set; }

        [Output("Extreme H/L Style", Color = Colors.Red, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries ExtremeHLStyle { get; set; }

        [Output("Day H/L Style", Color = Colors.Blue, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries DayHLStyle { get; set; }

        [Output("S/R Style", Color = Colors.Orange, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries SRStyle { get; set; }

        public override void Calculate(int index)
        {
            if (this.IsLastBar)
            {
                var currentOpenDate = this.MarketSeries.OpenTime[index].Date;
                var earliest = index - this.Periods;
                for (var i = index; i >= earliest; i--)
                {
                    if (i >= 0)
                    {
                        var high = this.MarketSeries.High[i];
                        var nextHigh = this.MarketSeries.High[i + 1];
                        var low = this.MarketSeries.Low[i];
                        var nextLow = this.MarketSeries.Low[i + 1];
                        this.extremeHigh = Math.Max(high, this.extremeHigh);
                        this.extremeLow = this.extremeLow == 0 ? low : Math.Min(low, this.extremeLow);

                        if (this.TimeFrame < TimeFrame.Minute)
                        {
                            if (this.MarketSeries.OpenTime[i].Date == currentOpenDate)
                            {
                                this.dayHi = Math.Max(high, this.dayHi);
                                this.dayLo = this.dayLo == 0 ? low : Math.Min(low, this.dayLo);
                            }
                        }

                        if (nextHigh <= high)
                        {
                            this.AddOrUpdatePrice(high);
                        }

                        if (nextLow >= low)
                        {
                            this.AddOrUpdatePrice(low);
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                this.zones.Clear();
                var rangePipSize = (this.Symbol.PipSize * (double)this.ZoneSize);
                for (var i = this.extremeLow + rangePipSize; i < this.extremeHigh - rangePipSize; i += rangePipSize + this.Symbol.PipSize)
                {
                    this.zones.Add(new Zone 
                    {
                        Start = i,
                        End = i + rangePipSize,
                        LinesRendered = 0
                    });
                }

                //this.ChartObjects.RemoveAllObjects();

                foreach (var price in this.prices.Keys)
                {
                    this.RenderSRIfRequred(price, this.prices[price]);
                }

                if (this.ShowExtremeHL)
                {
                    this.DrawExtremeHigh();
                    this.DrawExtremeLow();
                }

                if (this.TimeFrame < TimeFrame.Minute && this.ShowDayHL)
                {
                    this.DrawDayHigh();
                    this.DrawDayLow();
                }
            }
        }

        private void RenderSRIfRequred(double price, int count)
        {
            if (count < this.RequiredHits)
            {
                return;
            }

            foreach (var range in this.zones)
            {
                if (price >= range.Start && price <= range.End)
                {
                    if (range.LinesRendered != this.MaxLinesInZone)
                    {
                        range.LinesRendered++;
                        this.DrawSR(price);
                    }
                    return;
                }
            }
        }

        private void AddOrUpdatePrice(double priceValue)
        {
            if (this.prices.ContainsKey(priceValue))
            {
                this.prices[priceValue]++;
            }
            else
            {
                this.prices.Add(priceValue, 1);
            }
        }

        private void DrawExtremeHigh()
        {
            this.DrawExtreme(ExtremeHighName, this.extremeHigh);
        }

        private void DrawExtremeLow()
        {
            this.DrawExtreme(ExtremeLowName, this.extremeLow);
        }

        private void DrawDayHigh()
        {
            this.DrawDay(DayHighName, this.dayHi);
        }

        private void DrawDayLow()
        {
            this.DrawDay(DayLowName, this.dayLo);
        }

        private void DrawExtreme(string name, double level)
        {
            var attribute = this.GetAttributeFrom<OutputAttribute>("ExtremeHLStyle");
            this.ChartObjects.DrawHorizontalLine(name, level, attribute.Color, attribute.Thickness, attribute.LineStyle);
        }

        private void DrawDay(string name, double level)
        {
            var attribute = this.GetAttributeFrom<OutputAttribute>("DayHLStyle");
            this.ChartObjects.DrawHorizontalLine(name, level, attribute.Color, attribute.Thickness, attribute.LineStyle);
        }

        private void DrawSR(double level)
        {
            var attribute = this.GetAttributeFrom<OutputAttribute>("SRStyle");
            this.ChartObjects.DrawHorizontalLine(string.Format("SR {0}", level), level, attribute.Color, attribute.Thickness, attribute.LineStyle);
        }

        private T GetAttributeFrom<T>(string propertyName)
        {
            var attrType = typeof(T);
            var property = this.GetType().GetProperty(propertyName);
            return (T)property.GetCustomAttributes(attrType, false).GetValue(0);
        }

        private class Price
        {
            internal double Value { get; set; }
            internal int Count { get; set; }
        }

        private class Zone
        {
            internal double Start { get; set; }
            internal double End { get; set; }
            internal int LinesRendered { get; set; }
        }
    }
}

@indicator has stopped working:  19 May 2022, 14:45


dokinya said:

amusleh said:

Hi,

We were able to reproduce the issue with your indicator, we are investigating now what's causing it, please be patient and wait for our reply.

is there anyway i can downgrade the platform? 

Hi,

There is no way to downgrade, for this particular indicator you can comment the "this.ChartObjects.RemoveAllObjects();" line and it will work on version 4.2.

@indicator has stopped working:  19 May 2022, 09:56


Hi,

We were able to reproduce the issue with your indicator, we are investigating now what's causing it, please be patient and wait for our reply.

@Sending 2 email alerts sequentially:  19 May 2022, 09:34


Hi,

It depends on your email server that how many emails it allows you to send on a unit of time (seconds/milliseconds).

To avoid this issue you can place a delay after sending the first email, use Thread.Sleep, example:

            try
            {
                Notifications.SendEmail(EmailAddress1, EmailAddress1, "cTrader 5 Wick Alert", emailmsg);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Invalid email address", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (EmailAddress2 != "")
            {
                // 2 seconds delay
                Thread.Sleep(2000);
                // Call refresh data is required after suspending the main thread
                RefreshData();
                
                try
                {
                    Notifications.SendEmail(EmailAddress1, EmailAddress2, "cTrader 5 Wick Alert", emailmsg);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Invalid email address", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

@Different timeframes for macdcrossover:  19 May 2022, 09:29


Hi,

To use an indicator on a different time frame you have to first pass that time frame bars series as source to indicator and then use that time frame index values to access the indicator output values, here is an example for MACD:

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

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None)]
    public class MACDMTF : Indicator
    {
        private MacdCrossOver _macd;
        private Bars _bars;

        [Parameter("Selected Time Frame")]
        public TimeFrame SelectedTimeFrame { get; set; }

        [Parameter("Long Cycle", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("Short Cycle", DefaultValue = 12)]
        public int ShortCycle { get; set; }

        [Parameter("Signal Periods", DefaultValue = 9)]
        public int SignalPeriods { get; set; }

        [Output("Histogram", LineColor = "Yellow", IsHistogram = true, PlotType = PlotType.Histogram, Thickness = 2)]
        public IndicatorDataSeries Histogram { get; set; }

        [Output("MACD", LineColor = "Blue", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries MACD { get; set; }

        [Output("Signal", LineColor = "Red", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries Signal { get; set; }

        protected override void Initialize()
        {
            _bars = MarketData.GetBars(SelectedTimeFrame);

            _macd = Indicators.MacdCrossOver(_bars.ClosePrices, LongCycle, ShortCycle, SignalPeriods);
        }

        public override void Calculate(int index)
        {
            var timeFrameIndex = _bars.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);

            Histogram[index] = _macd.Histogram[timeFrameIndex];
            MACD[index] = _macd.MACD[timeFrameIndex];
            Signal[index] = _macd.Signal[timeFrameIndex];
        }
    }
}
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.