Replies

hamidreza.taali@gmail.com
02 Nov 2017, 20:29 ( Updated at: 23 Jan 2024, 13:16 )

RE:

afhacker said:

Can you give me your email address? I will invite you to our Slack.

[hamidreza.taali@gmail.com]


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
02 Nov 2017, 19:18 ( Updated at: 21 Dec 2023, 09:20 )

RE:

afhacker said:

Hi Hamid Reza,

There were some bugs in Alert library that I fixed and the new version is available, you can download your indicator which uses the new version of the alert library from here:

https://drive.google.com/open?id=0B93GK1Ip4NSMWldXRTljRTZ1ZEk

thanks.
i am update alert library and indicator. but not working again?

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
31 Oct 2017, 21:24

RE:

afhacker said:

You can download the compiled version of indicator from this link: https://drive.google.com/open?id=0B93GK1Ip4NSMdVVLbThRWjhMZmM

 

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using System.Threading.Tasks;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class IchimokuKinkoHyo : Indicator
    {
        private int alertBarIndex = 0;

        [Parameter(DefaultValue = 9)]
        public int periodFast { get; set; }

        [Parameter(DefaultValue = 26)]
        public int periodMedium { get; set; }

        [Parameter(DefaultValue = 52)]
        public int periodSlow { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementChikou { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementCloud { get; set; }

        [Parameter(DefaultValue = 26)]
        public int Displacementkijunsen { get; set; }

        [Parameter(DefaultValue = 0)]
        public int Displacemenspanb { get; set; }

        [Parameter("Text Color", DefaultValue = "Black")]
        public string TextColor { get; set; }

        [Parameter(DefaultValue = true)]
        public bool Common_cross { get; set; }

        [Parameter(DefaultValue = false)]
        public bool Uncommon { get; set; }

        [Parameter(DefaultValue = true)]
        public bool Common_cross_kumo { get; set; }

        [Output("TenkanSen", Color = Colors.Red)]
        public IndicatorDataSeries TenkanSen { get; set; }

        [Output("Kijunsen", Color = Colors.Blue)]
        public IndicatorDataSeries KijunSen { get; set; }

        [Output("ChikouSpan", Color = Colors.DarkViolet)]
        public IndicatorDataSeries ChikouSpan { get; set; }

        [Output("qualityline", Color = Colors.Black)]
        public IndicatorDataSeries qualityline { get; set; }

        [Output("SenkouSpanB", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanB { get; set; }

        [Output("SenkouSpanA", Color = Colors.Green, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanA { get; set; }

        [Output("Directionline", Color = Colors.Yellow)]
        public IndicatorDataSeries Directionline { get; set; }


        private Colors color = Colors.Black;


        double maxfast, minfast, maxmedium, minmedium, maxslow, minslow, maxbig, minbig;

        protected override void Initialize()
        {
            Alert.Manager.Indicator = this;

            Alert.Manager.WindowTheme = Alert.Manager.Theme.BaseLight;
            Alert.Manager.WindowAccent = Alert.Manager.Accent.Red;

            Enum.TryParse(TextColor, out color);
        }


        public override void Calculate(int index)
        {
            if (IsLastBar)
                DisplaySpreadOnChart();
            if ((index < periodFast) || (index < periodSlow))
            {
                return;
            }

            string signalType = string.Empty;

            maxfast = MarketSeries.High[index];
            minfast = MarketSeries.Low[index];
            maxmedium = MarketSeries.High[index];
            minmedium = MarketSeries.Low[index];
            maxbig = MarketSeries.High[index];
            minbig = MarketSeries.Low[index];
            maxslow = MarketSeries.High[index];
            minslow = MarketSeries.Low[index];

            for (int i = 0; i < periodFast; i++)
            {
                if (maxfast < MarketSeries.High[index - i])
                {
                    maxfast = MarketSeries.High[index - i];
                }
                if (minfast > MarketSeries.Low[index - i])
                {
                    minfast = MarketSeries.Low[index - i];
                }
            }
            for (int i = 0; i < periodMedium; i++)
            {
                if (maxmedium < MarketSeries.High[index - i])
                {
                    maxmedium = MarketSeries.High[index - i];
                }
                if (minmedium > MarketSeries.Low[index - i])
                {
                    minmedium = MarketSeries.Low[index - i];
                }
            }

            for (int i = 0; i < periodSlow; i++)
            {
                if (maxslow < MarketSeries.High[index - i])
                {
                    maxslow = MarketSeries.High[index - i];
                }
                if (minslow > MarketSeries.Low[index - i])
                {
                    minslow = MarketSeries.Low[index - i];
                }
            }
            TenkanSen[index] = (maxfast + minfast) / 2;
            KijunSen[index] = (maxmedium + minmedium) / 2;
            ChikouSpan[index - DisplacementChikou] = MarketSeries.Close[index];
            SenkouSpanA[index + DisplacementCloud] = (TenkanSen[index] + KijunSen[index]) / 2;
            SenkouSpanB[index + DisplacementCloud] = (maxslow + minslow) / 2;
            qualityline[index + Displacementkijunsen] = (maxmedium + minmedium) / 2;
            Directionline[index] = (maxslow + minslow) / 2;

            if (KijunSen[index] == TenkanSen[index] && Common_cross)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Red, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());

                TriggerAlert(TradeType.Sell, index, "Common_cross");
            }
            if (TenkanSen.HasCrossedAbove(KijunSen, 0) && Uncommon)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Green, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());

                TriggerAlert(TradeType.Sell, index, "Uncommon");
            }
            if (KijunSen[index] == TenkanSen[index] && SenkouSpanA[index + DisplacementCloud] == SenkouSpanB[index + DisplacementCloud] && Common_cross_kumo)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Blue, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());

                TriggerAlert(TradeType.Sell, index, "Common_cross_kumo");
            }
        }

        private void DisplaySpreadOnChart()
        {
            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string text = string.Format("{0}", spread);
            ChartObjects.DrawText("spread", "\t" + text, StaticPosition.BottomRight, Colors.Black);
        }

        private void TriggerAlert(TradeType alertType, int index, string msg)
        {
            if (index != alertBarIndex && IsLastBar && IsRealTime)
            {
                alertBarIndex = index;

                Alert.Manager.Trigger(alertType, Symbol, MarketSeries.TimeFrame, Server.Time, msg);
            }
        }
    }
}

thanks a lot.

iam update.

but not work. why?

 

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
31 Oct 2017, 15:05

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using System.Threading.Tasks;



namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class IchimokuKinkoHyo : Indicator
    {

        [Parameter(DefaultValue = 9)]
        public int periodFast { get; set; }

        [Parameter(DefaultValue = 26)]
        public int periodMedium { get; set; }

        [Parameter(DefaultValue = 52)]
        public int periodSlow { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementChikou { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementCloud { get; set; }

        [Parameter(DefaultValue = 26)]
        public int Displacementkijunsen { get; set; }

        [Parameter(DefaultValue = 0)]
        public int Displacemenspanb { get; set; }

        [Parameter("Text Color", DefaultValue = "Black")]
        public string TextColor { get; set; }

        [Parameter(DefaultValue = true)]
        public bool Common_cross { get; set; }

        [Parameter(DefaultValue = false)]
        public bool Uncommon { get; set; }

        [Parameter(DefaultValue = true)]
        public bool Common_cross_kumo { get; set; }

        [Output("TenkanSen", Color = Colors.Red)]
        public IndicatorDataSeries TenkanSen { get; set; }

        [Output("Kijunsen", Color = Colors.Blue)]
        public IndicatorDataSeries KijunSen { get; set; }

        [Output("ChikouSpan", Color = Colors.DarkViolet)]
        public IndicatorDataSeries ChikouSpan { get; set; }

        [Output("qualityline", Color = Colors.Black)]
        public IndicatorDataSeries qualityline { get; set; }

        [Output("SenkouSpanB", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanB { get; set; }

        [Output("SenkouSpanA", Color = Colors.Green, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanA { get; set; }

        [Output("Directionline", Color = Colors.Yellow)]
        public IndicatorDataSeries Directionline { get; set; }


        private Colors color = Colors.Black;


        double maxfast, minfast, maxmedium, minmedium, maxslow, minslow, maxbig, minbig;

        protected override void Initialize()
        {
            Alert.Manager.Indicator = this;

            Alert.Manager.WindowTheme = Alert.Manager.Theme.BaseLight;
            Alert.Manager.WindowAccent = Alert.Manager.Accent.Red;



            Enum.TryParse(TextColor, out color);

        }


        public override void Calculate(int index)
        {
            if (IsLastBar)
                DisplaySpreadOnChart();
            if ((index < periodFast) || (index < periodSlow))
            {
                return;
            }

            string signalType = string.Empty;

            maxfast = MarketSeries.High[index];
            minfast = MarketSeries.Low[index];
            maxmedium = MarketSeries.High[index];
            minmedium = MarketSeries.Low[index];
            maxbig = MarketSeries.High[index];
            minbig = MarketSeries.Low[index];
            maxslow = MarketSeries.High[index];
            minslow = MarketSeries.Low[index];

            for (int i = 0; i < periodFast; i++)
            {
                if (maxfast < MarketSeries.High[index - i])
                {
                    maxfast = MarketSeries.High[index - i];
                }
                if (minfast > MarketSeries.Low[index - i])
                {
                    minfast = MarketSeries.Low[index - i];
                }
            }
            for (int i = 0; i < periodMedium; i++)
            {
                if (maxmedium < MarketSeries.High[index - i])
                {
                    maxmedium = MarketSeries.High[index - i];
                }
                if (minmedium > MarketSeries.Low[index - i])
                {
                    minmedium = MarketSeries.Low[index - i];
                }
            }

            for (int i = 0; i < periodSlow; i++)
            {
                if (maxslow < MarketSeries.High[index - i])
                {
                    maxslow = MarketSeries.High[index - i];
                }
                if (minslow > MarketSeries.Low[index - i])
                {
                    minslow = MarketSeries.Low[index - i];
                }
            }
            TenkanSen[index] = (maxfast + minfast) / 2;
            KijunSen[index] = (maxmedium + minmedium) / 2;
            ChikouSpan[index - DisplacementChikou] = MarketSeries.Close[index];
            SenkouSpanA[index + DisplacementCloud] = (TenkanSen[index] + KijunSen[index]) / 2;
            SenkouSpanB[index + DisplacementCloud] = (maxslow + minslow) / 2;
            qualityline[index + Displacementkijunsen] = (maxmedium + minmedium) / 2;
            Directionline[index] = (maxslow + minslow) / 2;

            if (KijunSen[index] == TenkanSen[index] && Common_cross)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Red, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());
                signalType = "Common_cross";
                Alert.Manager.Trigger(TradeType.Buy, Symbol, MarketSeries.TimeFrame, Server.Time, "Test");
            }
            if (TenkanSen.HasCrossedAbove(KijunSen, 0) && Uncommon)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Green, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());
                signalType = "Uncommon";
                Alert.Manager.Trigger(TradeType.Buy, Symbol, MarketSeries.TimeFrame, Server.Time, "Test");

            }
            if (KijunSen[index] == TenkanSen[index] && SenkouSpanA[index + DisplacementCloud] == SenkouSpanB[index + DisplacementCloud] && Common_cross_kumo)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Blue, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());
                signalType = "Common_cross_kumo";
                Alert.Manager.Trigger(TradeType.Buy, Symbol, MarketSeries.TimeFrame, Server.Time, "Test");
            }

        }

        private void DisplaySpreadOnChart()
        {
            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string text = string.Format("{0}", spread);
            ChartObjects.DrawText("spread", "\t" + text, StaticPosition.BottomRight, Colors.Black);
        }
    }
}


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
13 Oct 2017, 15:26 ( Updated at: 23 Jan 2024, 13:16 )

RE: RE: RE:

afhacker said:

hamidreza.taali@gmail.com said:

afhacker said:

You can use my alert library: [/algos/indicators/show/1425]

thanks a lot.

i have erro for signal type.

Error CS0103: The name 'buy' does not exist in the current context?

 

help me..

 

Can you post your code?

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using System.Threading.Tasks;
using AlertWindow;

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


        [Parameter(DefaultValue = 9)]
        public int periodFast { get; set; }

        [Parameter(DefaultValue = 26)]
        public int periodMedium { get; set; }

        [Parameter(DefaultValue = 52)]
        public int periodSlow { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementChikou { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementCloud { get; set; }

        [Parameter(DefaultValue = 26)]
        public int Displacementkijunsen { get; set; }

        [Parameter(DefaultValue = 0)]
        public int Displacemenspanb { get; set; }

        [Parameter("Text Color", DefaultValue = "Black")]
        public string TextColor { get; set; }

        [Parameter(DefaultValue = true)]
        public bool cross_tenkansenandKijunsen { get; set; }

        [Parameter(DefaultValue = false)]
        public bool cross_tenkansenandKijunsen1 { get; set; }

        [Output("TenkanSen", Color = Colors.Red)]
        public IndicatorDataSeries TenkanSen { get; set; }

        [Output("Kijunsen", Color = Colors.Blue)]
        public IndicatorDataSeries KijunSen { get; set; }

        [Output("ChikouSpan", Color = Colors.DarkViolet)]
        public IndicatorDataSeries ChikouSpan { get; set; }

        [Output("qualityline", Color = Colors.White)]
        public IndicatorDataSeries qualityline { get; set; }

        [Output("SenkouSpanB", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanB { get; set; }

        [Output("SenkouSpanA", Color = Colors.Green, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanA { get; set; }

        [Output("Directionline", Color = Colors.Brown)]
        public IndicatorDataSeries Directionline { get; set; }


        private Colors color = Colors.Black;
        private Alert _alarm;

        double maxfast, minfast, maxmedium, minmedium, maxslow, minslow, maxbig, minbig;

        protected override void Initialize()
        {

            Enum.TryParse(TextColor, out color);
            // The class constructor receives three parameters, Indicator name and symbol code
            // And Maximum number of alerts(it's optional and default value is 12)
            _alarm = new Alert("my ichi", Symbol.Code);
        }


        public override void Calculate(int index)
        {
            if (IsLastBar)
                DisplaySpreadOnChart();
            if ((index < periodFast) || (index < periodSlow))
            {
                return;
            }

            maxfast = MarketSeries.High[index];
            minfast = MarketSeries.Low[index];
            maxmedium = MarketSeries.High[index];
            minmedium = MarketSeries.Low[index];
            maxbig = MarketSeries.High[index];
            minbig = MarketSeries.Low[index];
            maxslow = MarketSeries.High[index];
            minslow = MarketSeries.Low[index];

            for (int i = 0; i < periodFast; i++)
            {
                if (maxfast < MarketSeries.High[index - i])
                {
                    maxfast = MarketSeries.High[index - i];
                }
                if (minfast > MarketSeries.Low[index - i])
                {
                    minfast = MarketSeries.Low[index - i];
                }
            }
            for (int i = 0; i < periodMedium; i++)
            {
                if (maxmedium < MarketSeries.High[index - i])
                {
                    maxmedium = MarketSeries.High[index - i];
                }
                if (minmedium > MarketSeries.Low[index - i])
                {
                    minmedium = MarketSeries.Low[index - i];
                }
            }

            for (int i = 0; i < periodSlow; i++)
            {
                if (maxslow < MarketSeries.High[index - i])
                {
                    maxslow = MarketSeries.High[index - i];
                }
                if (minslow > MarketSeries.Low[index - i])
                {
                    minslow = MarketSeries.Low[index - i];
                }
            }
            TenkanSen[index] = (maxfast + minfast) / 2;
            KijunSen[index] = (maxmedium + minmedium) / 2;
            ChikouSpan[index - DisplacementChikou] = MarketSeries.Close[index];
            SenkouSpanA[index + DisplacementCloud] = (TenkanSen[index] + KijunSen[index]) / 2;
            SenkouSpanB[index + DisplacementCloud] = (maxslow + minslow) / 2;
            qualityline[index + Displacementkijunsen] = (maxmedium + minmedium) / 2;
            Directionline[index] = (maxslow + minslow) / 2;

            if (KijunSen[index] == TenkanSen[index] && cross_tenkansenandKijunsen)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Red, 2, LineStyle.Dots);
                ChartObjects.RemoveObject((index - 1).ToString());
                Notifications.PlaySound("");
            }
            if (KijunSen[index] == TenkanSen[index] && SenkouSpanA[index + DisplacementCloud] == SenkouSpanB[index + DisplacementCloud])
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Blue, 2, LineStyle.Solid);
                ChartObjects.RemoveObject((index - 1).ToString());
                Notifications.PlaySound("");

            }
            if (TenkanSen.HasCrossedAbove(KijunSen, 0) || TenkanSen.HasCrossedBelow(KijunSen, 0) && cross_tenkansenandKijunsen1)
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Green, 1, LineStyle.DotsVeryRare);
                ChartObjects.RemoveObject((index - 1).ToString());
                Notifications.PlaySound("");

            }
            // You should use C# Task for running the code asynchronously
// Signal Type can be buy and sell or long and short(string)
// Server.Time is the time of signal(event) occurrence.
            Task showForm = Task.Factory.StartNew(() => { _alarm.Trigger(SignalType, Server.Time); });

        }
        private void DisplaySpreadOnChart()
        {
            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string text = string.Format("{0}", spread);
            ChartObjects.DrawText("spread", "\t" + text, StaticPosition.BottomRight, Colors.Black);
            ChartObjects.DrawText("gmail", "Email:hamidrtafx@gmail.com", StaticPosition.BottomLeft, Colors.Red);
        }
    }
}

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
12 Oct 2017, 02:11 ( Updated at: 23 Jan 2024, 13:16 )

RE:

afhacker said:

You can use my alert library: [/algos/indicators/show/1425]

thanks a lot.

i have erro for signal type.

Error CS0103: The name 'buy' does not exist in the current context?

 

help me..

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
12 Oct 2017, 02:00 ( Updated at: 23 Jan 2024, 13:16 )

RE:

afhacker said:

You can use my alert library: [/algos/indicators/show/1425]

thank.

but in need alert.dll.

where is your alert.dll file?

 

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
14 Sep 2017, 13:39

RE:

Spotware said:

Dear Trader,

If want your vertical lines to show whenever the red line crosses the blue line, you could try the following code instead

            if (TenkanSen.HasCrossedAbove(KijunSen, 0) || TenkanSen.HasCrossedBelow(KijunSen, 0))
            {
                ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index], Colors.Red, 1, LineStyle.Solid);
            }

Best Regards,

cTrader Team

thanks.

 

but i want just when tankensen=kijansen .

i have not cross.

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
12 Sep 2017, 19:49

i want show verticalline  at arrows  in chart.


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
12 Sep 2017, 19:47 ( Updated at: 21 Dec 2023, 09:20 )


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
12 Sep 2017, 19:40

RE:

Spotware said:

Dear Trader,

If we understood well what you are trying to do, then the following code sample should be helpful for you

            if (TenkanSen[index] == KijunSen[index])
            {            
                 ChartObjects.DrawVerticalLine(index.ToString(), MarketSeries.OpenTime[index].AddDays(-3), Colors.Red, 5, LineStyle.Solid);
            }
            

Best Regards,

cTrader Team

thankyou but i can't get my result.

i want to draw vertical line for example 3 days ago  and draw it for all.

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
11 Sep 2017, 21:42

RE:

Spotware said:

Dear Trader,

See an example below on how to draw a vertical line on a specific date e.g. 3 days ago

ChartObjects.DrawVerticalLine("cross.T&k", Server.Time.AddDays(-3), Colors.Red, 2, LineStyle.Solid);

Best Regards,

cTrader Team

thanks.
 

but i want all verticalline for 3days ago.

your cod just show one verticalline.

my code:

if (KijunSen[index] == TenkanSen[index])
            {
                ChartObjects.DrawVerticalLine("cross.T&k", index, Colors.Red, 2, LineStyle.Solid);

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
09 Sep 2017, 21:23

thankyou.

im do it.

 

i need help for me chartobjext.

 

my code is:

 ChartObjects.DrawVerticalLine("cross.T&k", index, Colors.Red, 2, LineStyle.Solid);

i need index & time Simultaneous for my chart.

for example:

index  for 3 days ago?

what is code for index and time?


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
08 Sep 2017, 13:51

RE:

Spotware said:

Dear Trader,

Can you please provide the full cBot or Indicator that does not build so that we can advise what the problem is?

Best Regards,

cTrader Team

yes . i can.

 

but my problem for cross kijen an tenkan in my code...

 


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
07 Sep 2017, 20:49

RE:

Spotware said:

Dear Trader,

You can find examples on how to use the functions in the links above. HasCrossedAbove and HasCrossedBelow functions can be used for all indicators. See also below a small example checking if the simple moving average indicator has crossed above the exponential moving average indicator

var sma = Indicators.SimpleMovingAverage(MarketSeries.Close, 5);
var ema = Indicators.ExponentialMovingAverage(MarketSeries.Close, 5);
var crossedAbove = sma.Result.HasCrossedAbove(ema.Result, 5);

Let us know if you need any further explanation.

Best Regards,

cTrader Team

 

var kijunsen = Indicators.IchimokuKinkoHyo.kijunsen(MarketSeries.close, 26);
            var TenkanSen = Indicators.IchimokuKinkoHyo.TenkanSen(MarketSeries.close, 9);
            var CrossedAbove = KijunSen.HasCrossedAbove(TenkanSen.result, 9);

 

my code is but eror for build.

 

help me.please.


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
06 Sep 2017, 01:30

MY EDIT CODE TOP AND ADD CODE IS:

 

  if (TenkanSen[index] == KijunSen[index])
            {
                ChartObjects.DrawVerticalLine("vLine", dt1, Colors.Red, 5, LineStyle.Solid);
            }

 

BUT NOT SHOW DrawVerticalLine MY CHART?why?


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
06 Sep 2017, 01:28

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class IchimokuKinkoHyo : Indicator
    {
        [Parameter(DefaultValue = false)]
        public bool ShowAlarm { get; set; }

        [Parameter(DefaultValue = 9)]
        public int periodFast { get; set; }

        [Parameter(DefaultValue = 26)]
        public int periodMedium { get; set; }

        [Parameter(DefaultValue = 52)]
        public int periodSlow { get; set; }

        [Parameter(DefaultValue = 103)]
        public int periodbig { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementChikou { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementCloud { get; set; }

        [Parameter(DefaultValue = 26)]
        public int Displacementkijunsen { get; set; }

        [Parameter("star", DefaultValue = "▲")]
        public string star_s { get; set; }

        [Output("TenkanSen", Color = Colors.Red)]
        public IndicatorDataSeries TenkanSen { get; set; }

        [Output("Kijunsen", Color = Colors.Blue)]
        public IndicatorDataSeries KijunSen { get; set; }

        [Output("ChikouSpan", Color = Colors.DarkViolet)]
        public IndicatorDataSeries ChikouSpan { get; set; }

        [Output("qualityline", Color = Colors.White)]
        public IndicatorDataSeries qualityline { get; set; }

        [Output("qualityline103", Color = Colors.Brown)]
        public IndicatorDataSeries qualityline103 { get; set; }

        [Output("SenkouSpanB", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanB { get; set; }

        [Output("SenkouSpanA", Color = Colors.Green, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries SenkouSpanA { get; set; }

        [Output("Down Point", Color = Colors.Orange, PlotType = PlotType.Points, Thickness = 5)]
        public IndicatorDataSeries DownPoint { get; set; }

        double maxfast, minfast, maxmedium, minmedium, maxslow, minslow, maxbig, minbig;
        public override void Calculate(int index)
        {
            if (IsLastBar)
                DisplaySpreadOnChart();
            if ((index < periodFast) || (index < periodSlow))
            {
                return;
            }

            maxfast = MarketSeries.High[index];
            minfast = MarketSeries.Low[index];
            maxmedium = MarketSeries.High[index];
            minmedium = MarketSeries.Low[index];
            maxbig = MarketSeries.High[index];
            minbig = MarketSeries.Low[index];
            maxslow = MarketSeries.High[index];
            minslow = MarketSeries.Low[index];

            for (int i = 0; i < periodFast; i++)
            {
                if (maxfast < MarketSeries.High[index - i])
                {
                    maxfast = MarketSeries.High[index - i];
                }
                if (minfast > MarketSeries.Low[index - i])
                {
                    minfast = MarketSeries.Low[index - i];
                }
            }
            for (int i = 0; i < periodMedium; i++)
            {
                if (maxmedium < MarketSeries.High[index - i])
                {
                    maxmedium = MarketSeries.High[index - i];
                }
                if (minmedium > MarketSeries.Low[index - i])
                {
                    minmedium = MarketSeries.Low[index - i];
                }
            }

            for (int i = 0; i < periodbig; i++)
            {
                if (maxbig < MarketSeries.High[index - i])
                {
                    maxbig = MarketSeries.High[index - i];
                }
                if (minbig > MarketSeries.Low[index - i])
                {
                    minbig = MarketSeries.Low[index - i];
                }
            }
            for (int i = 0; i < periodSlow; i++)
            {
                if (maxslow < MarketSeries.High[index - i])
                {
                    maxslow = MarketSeries.High[index - i];
                }
                if (minslow > MarketSeries.Low[index - i])
                {
                    minslow = MarketSeries.Low[index - i];
                }
            }
            TenkanSen[index] = (maxfast + minfast) / 2;
            KijunSen[index] = (maxmedium + minmedium) / 2;
            ChikouSpan[index - DisplacementChikou] = MarketSeries.Close[index];

            SenkouSpanA[index + DisplacementCloud] = (TenkanSen[index] + KijunSen[index]) / 2;
            SenkouSpanB[index + DisplacementCloud] = (maxslow + minslow) / 2;
            qualityline[index + Displacementkijunsen] = (maxmedium + minmedium) / 2;
            qualityline103[index + Displacementkijunsen] = (maxbig + minbig) / 2;
            var dt1 = DateTime.Now.AddHours(-40);
            /*   if(TenkanSen[index] == KijunSen[index] && ShowAlarm)
            {
            
                Notifications.PlaySound(alarmFile)
            
            }
            */
            if (TenkanSen[index] == KijunSen[index])
            {
                ChartObjects.DrawVerticalLine("vLine", dt1, Colors.Red, 5, LineStyle.Solid);
            }
        }
        private void DisplaySpreadOnChart()
        {
            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string text = string.Format("{0}", spread);
            ChartObjects.DrawText("Label", "Spread:", StaticPosition.TopLeft, Colors.Yellow);
            ChartObjects.DrawText("spread", "\t" + text, StaticPosition.TopLeft, Colors.White);
        }
    }
}


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
05 Sep 2017, 23:55

RE:

Spotware said:

Dear Trader,

You can find examples on how to use the functions in the links above. HasCrossedAbove and HasCrossedBelow functions can be used for all indicators. See also below a small example checking if the simple moving average indicator has crossed above the exponential moving average indicator

var sma = Indicators.SimpleMovingAverage(MarketSeries.Close, 5);
var ema = Indicators.ExponentialMovingAverage(MarketSeries.Close, 5);
var crossedAbove = sma.Result.HasCrossedAbove(ema.Result, 5);

Let us know if you need any further explanation.

Best Regards,

cTrader Team

thank for answer.
 

but i cant edit my code for cross tekensen&kijunsen .

can you edit my code for cross ?please..

 

thanks


@hamidreza.taali@gmail.com

hamidreza.taali@gmail.com
04 Sep 2017, 12:27

RE:

Spotware said:

Dear Trader,

Thanks for posting in our forum. You might find the following functions useful.

HasCrossedAbove and HasCrossedBelow can be used for checking if two dataseries have crossed each other in the respective direction. ChartObjects class contains functions to draw different objects on your charts. SendEmail function can be used to send emails and notifications when some events occur.

Let us know if the above information is helpful for you.

Best Regards,

cTrader Team

thanks.

 

do you have example indicator for cross?

im used.


@hamidreza.taali@gmail.com