Replies

Abhi
03 Mar 2015, 16:41

great one, thanks algotrader. Will try it.


@Abhi

Abhi
03 Mar 2015, 15:20

RE:

Thanks for the reply Spotware, appreciate that you it is not your responsibility to write a CBOT, would you be able to provide some pointers though how I can build it. I am a programmer and use some of my programming knowledge to build the code but need a bit of your hand holding.

 

Spotware said:

Hi Spotware, Do we have an ETA when we will have Protection Settings for Pending Orders.

A lot of the Ctrader users are retail traders and we don't have the luxury to sit in front of the trading software from work. It would be really helpful if we can implement the aforesaid feature.

If the feature is unavailable in the near feature, if you guys can come up with a CBOT code that simulates the feature, that would be great.

Something like a CBOT that monitors any open positions and provide the trailing features based on the user input parameters.

Dear Trader,

This feature will be available in the future. We apologize that we cannot promise an ETA at this point. Currently we do not plan to provide a cBot with such functionality. You can write such cBot yourself or contact professional developers: /consultants//jobs/

 


@Abhi

Abhi
27 Feb 2015, 16:19

RE:

Hi Spotware, Do we have an ETA when we will have Protection Settings for Pending Orders.

A lot of the Ctrader users are retail traders and we don't have the luxury to sit in front of the trading software from work. It would be really helpful if we can implement the aforesaid feature.

If the feature is unavailable in the near feature, if you guys can come up with a CBOT code that simulates the feature, that would be great.

Something like a CBOT that monitors any open positions and provide the trailing features based on the user input parameters.

 

 

Spotware said:

Hello,

We will have Protection Settings for Pending Orders in the future, as we have now for positions. 

 

thanks

 


@Abhi

Abhi
01 Oct 2014, 12:13

RE:

Spotware said:

We recommend you to post a job in Jobs section or contact one of cAlgo consultants.

no worries, I guess that was a very polite hint. :-)

never mind, I sorted it out.


@Abhi

Abhi
01 Oct 2014, 12:13

RE:

Spotware said:

We recommend you to post a job in Jobs section or contact one of cAlgo consultants.

 

no worries, I guess that was a very polite hint. :-)

never mind, I sorted it out.


@Abhi

Abhi
28 Sep 2014, 16:11 ( Updated at: 21 Dec 2023, 09:20 )

Attached Chart


@Abhi

Abhi
28 Sep 2014, 16:10 ( Updated at: 21 Dec 2023, 09:20 )

Attached Chart

 


@Abhi

Abhi
28 Sep 2014, 15:38

RE:

cAlgo_Fanatic said:

Daily High and Low Indicator. Displays horizontal lines that correspond to the daily high and low.

 

Source Code:

using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class DailyHighLow : Indicator
    {
        public override void Calculate(int index)
        {
            DateTime today = MarketSeries.OpenTime[index].Date;
            DateTime tomorrow = today.AddDays(1);

            double high = MarketSeries.High.LastValue;
            double low = MarketSeries.Low.LastValue;

            for (int i = MarketSeries.Close.Count - 1; i > 0; i--)
            {
                if (MarketSeries.OpenTime[i].Date < today)
                    break;

                high = Math.Max(high, MarketSeries.High[i]);
                low = Math.Min(low, MarketSeries.Low[i]);
            }

            ChartObjects.DrawLine("high " + today, today, high, tomorrow, high, Colors.Pink);
            ChartObjects.DrawLine("low " + today, today, low, tomorrow, low, Colors.Pink);
        }
    }
}


 

 

 

 

Hi Spotware team, I managed to do some coding but ran into some issues. My chart time settings are UTC+1 (UK time).

 

I could plot high and low for New York time session between 1 pm and 10 pm but for some reason I cannot plot high and low for the time session between 1 pm and 1:15 pm.

 

Please can you help.

 

 

 

// Start of the code here

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.CentralEuropeanStandardTime, AccessRights = AccessRights.None)]
    public class AbhiCharts : Indicator
    {

        protected DateTime today, tomorrow;
        protected int ORMinute;

        protected TimeSpan NewYorkStartTime, NewYorkEndTime;
        protected TimeSpan NewYorkORStartTime, NewYorkOREndTime;


        protected double High_NewYorkStartTime, Low_NewYorkEndTime;
        protected double High_NewYorkORStartTime, Low_NewYorkOREndTime;


        protected DateTime plot_NewYorkStartTime, plot_NewYorkEndTime;


        protected int NewYorkStartHour, NewYorkEndHour;
        protected int NewYorkORStartHour, NewYorkOREndHour;

        protected override void Initialize()
        {
            ORMinute = 15;
            NewYorkStartHour = 14;
            NewYorkEndHour = 23;


            NewYorkStartTime = new TimeSpan(NewYorkStartHour, 0, 0);
            NewYorkEndTime = new TimeSpan(NewYorkEndHour, 0, 0);
            NewYorkORStartTime = new TimeSpan(NewYorkStartHour, 0, 0);
            NewYorkOREndTime = new TimeSpan(NewYorkStartHour, ORMinute, 0);




        }

        public override void Calculate(int index)
        {

            today = MarketSeries.OpenTime[index].Date;
            tomorrow = today.AddDays(1);


            plot_NewYorkStartTime = today.Date.AddHours(NewYorkStartHour);
            plot_NewYorkEndTime = today.Date.AddHours(NewYorkEndHour);


            High_NewYorkStartTime = MarketSeries.High.LastValue;
            Low_NewYorkEndTime = MarketSeries.Low.LastValue;
            High_NewYorkORStartTime = MarketSeries.High.LastValue;
            Low_NewYorkOREndTime = MarketSeries.Low.LastValue;

            for (int i = MarketSeries.Close.Count - 1; i > 0; i--)
            {
                if (MarketSeries.OpenTime[i].Date < today)
                    break;

                if ((MarketSeries.OpenTime[i].TimeOfDay >= NewYorkStartTime) && (MarketSeries.OpenTime[i].TimeOfDay <= NewYorkEndTime))
                {
                    High_NewYorkStartTime = Math.Max(High_NewYorkStartTime, MarketSeries.High[i]);
                    Low_NewYorkEndTime = Math.Min(Low_NewYorkEndTime, MarketSeries.Low[i]);
                }


                if ((MarketSeries.OpenTime[i].TimeOfDay >= NewYorkORStartTime) && (MarketSeries.OpenTime[i].TimeOfDay <= NewYorkOREndTime))
                {
                    High_NewYorkORStartTime = Math.Max(High_NewYorkORStartTime, MarketSeries.High[i]);
                    Low_NewYorkOREndTime = Math.Min(Low_NewYorkOREndTime, MarketSeries.Low[i]);

                }
            }


            ChartObjects.DrawLine("High " + today, plot_NewYorkStartTime, High_NewYorkStartTime, plot_NewYorkEndTime, High_NewYorkStartTime, Colors.Red);
            ChartObjects.DrawLine("Low " + today, plot_NewYorkStartTime, Low_NewYorkEndTime, plot_NewYorkEndTime, Low_NewYorkEndTime, Colors.Green);
            ChartObjects.DrawText("TextHigh " + today, string.Format("{0}", High_NewYorkStartTime), index, High_NewYorkStartTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Red);
            ChartObjects.DrawText("TextLow " + today, string.Format("{0}", Low_NewYorkEndTime), index, Low_NewYorkEndTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Green);

            ChartObjects.DrawLine("HighOR " + today, plot_NewYorkStartTime, High_NewYorkORStartTime, plot_NewYorkEndTime, High_NewYorkORStartTime, Colors.Yellow);
            ChartObjects.DrawLine("LowOR " + today, plot_NewYorkStartTime, Low_NewYorkOREndTime, plot_NewYorkEndTime, Low_NewYorkOREndTime, Colors.Yellow);
            ChartObjects.DrawText("TextHighOR " + today, string.Format("High: {0}", High_NewYorkORStartTime), index, High_NewYorkORStartTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Yellow);
            ChartObjects.DrawText("TextLowOR " + today, string.Format("Low: {0}", Low_NewYorkOREndTime), index, Low_NewYorkOREndTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Yellow);



            //string text = string.Format("MarketSeries.OpenTime[i].TimeOfDay : {0}", MarketSeries.OpenTime[i].TimeOfDay);

            //ChartObjects.DrawText("Diff", text, StaticPosition.TopLeft, Colors.Lime);




        }
    }
}


@Abhi

Abhi
28 Sep 2014, 15:36

Session High And Low

Hi Spotware team, I managed to do some coding but ran into some issues. My chart time settings are UTC+1 (UK time).

 

I could plot high and low for New York time session between 1 pm and 10 pm but for some reason I cannot plot high and low for time session between 1 pm and 1:15 pm.

 

Please can anybody help.

 

 

 

// Start of the code here

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.CentralEuropeanStandardTime, AccessRights = AccessRights.None)]
    public class AbhiCharts : Indicator
    {

        protected DateTime today, tomorrow;
        protected int ORMinute;

        protected TimeSpan NewYorkStartTime, NewYorkEndTime;
        protected TimeSpan NewYorkORStartTime, NewYorkOREndTime;


        protected double High_NewYorkStartTime, Low_NewYorkEndTime;
        protected double High_NewYorkORStartTime, Low_NewYorkOREndTime;


        protected DateTime plot_NewYorkStartTime, plot_NewYorkEndTime;


        protected int NewYorkStartHour, NewYorkEndHour;
        protected int NewYorkORStartHour, NewYorkOREndHour;

        protected override void Initialize()
        {
            ORMinute = 15;
            NewYorkStartHour = 14;
            NewYorkEndHour = 23;


            NewYorkStartTime = new TimeSpan(NewYorkStartHour, 0, 0);
            NewYorkEndTime = new TimeSpan(NewYorkEndHour, 0, 0);
            NewYorkORStartTime = new TimeSpan(NewYorkStartHour, 0, 0);
            NewYorkOREndTime = new TimeSpan(NewYorkStartHour, ORMinute, 0);




        }

        public override void Calculate(int index)
        {

            today = MarketSeries.OpenTime[index].Date;
            tomorrow = today.AddDays(1);


            plot_NewYorkStartTime = today.Date.AddHours(NewYorkStartHour);
            plot_NewYorkEndTime = today.Date.AddHours(NewYorkEndHour);


            High_NewYorkStartTime = MarketSeries.High.LastValue;
            Low_NewYorkEndTime = MarketSeries.Low.LastValue;
            High_NewYorkORStartTime = MarketSeries.High.LastValue;
            Low_NewYorkOREndTime = MarketSeries.Low.LastValue;

            for (int i = MarketSeries.Close.Count - 1; i > 0; i--)
            {
                if (MarketSeries.OpenTime[i].Date < today)
                    break;

                if ((MarketSeries.OpenTime[i].TimeOfDay >= NewYorkStartTime) && (MarketSeries.OpenTime[i].TimeOfDay <= NewYorkEndTime))
                {
                    High_NewYorkStartTime = Math.Max(High_NewYorkStartTime, MarketSeries.High[i]);
                    Low_NewYorkEndTime = Math.Min(Low_NewYorkEndTime, MarketSeries.Low[i]);
                }


                if ((MarketSeries.OpenTime[i].TimeOfDay >= NewYorkORStartTime) && (MarketSeries.OpenTime[i].TimeOfDay <= NewYorkOREndTime))
                {
                    High_NewYorkORStartTime = Math.Max(High_NewYorkORStartTime, MarketSeries.High[i]);
                    Low_NewYorkOREndTime = Math.Min(Low_NewYorkOREndTime, MarketSeries.Low[i]);

                }
            }


            ChartObjects.DrawLine("High " + today, plot_NewYorkStartTime, High_NewYorkStartTime, plot_NewYorkEndTime, High_NewYorkStartTime, Colors.Red);
            ChartObjects.DrawLine("Low " + today, plot_NewYorkStartTime, Low_NewYorkEndTime, plot_NewYorkEndTime, Low_NewYorkEndTime, Colors.Green);
            ChartObjects.DrawText("TextHigh " + today, string.Format("{0}", High_NewYorkStartTime), index, High_NewYorkStartTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Red);
            ChartObjects.DrawText("TextLow " + today, string.Format("{0}", Low_NewYorkEndTime), index, Low_NewYorkEndTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Green);

            ChartObjects.DrawLine("HighOR " + today, plot_NewYorkStartTime, High_NewYorkORStartTime, plot_NewYorkEndTime, High_NewYorkORStartTime, Colors.Yellow);
            ChartObjects.DrawLine("LowOR " + today, plot_NewYorkStartTime, Low_NewYorkOREndTime, plot_NewYorkEndTime, Low_NewYorkOREndTime, Colors.Yellow);
            ChartObjects.DrawText("TextHighOR " + today, string.Format("High: {0}", High_NewYorkORStartTime), index, High_NewYorkORStartTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Yellow);
            ChartObjects.DrawText("TextLowOR " + today, string.Format("Low: {0}", Low_NewYorkOREndTime), index, Low_NewYorkOREndTime, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Yellow);



            //string text = string.Format("MarketSeries.OpenTime[i].TimeOfDay : {0}", MarketSeries.OpenTime[i].TimeOfDay);

            //ChartObjects.DrawText("Diff", text, StaticPosition.TopLeft, Colors.Lime);




        }
    }
}


@Abhi

Abhi
26 Sep 2014, 00:26

Please ignore my previous comment. Your suggestion works after I restarted Ctrader. Many thanks,


@Abhi

Abhi
25 Sep 2014, 21:58

RE:

Spotware said:

There is an overload of AverageTrueRange method that accepts MarketSeries object:

/api/reference/internals/iindicatorsaccessor/averagetruerange-9d2b

We can recommend you to contact one of our Partners or post a job in Development Jobs section.

Many thanks for the help, greatly appreciated. The overloaded method works for one symbol only at run time although I can call ATR indicator on multiple symbols at compile time. 

The chart symbol (on where I am calling my custom indicator) and the marketseries symbol need  to match for me to display the ATR value.

 

So if I call ATR on multiple symbols, the chart does not display the ATR for all the symbols until I comment out  the rest of the symbols. 

 

Below is the code:

 

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.CentralEuropeanStandardTime, AccessRights = AccessRights.None)]
    public class AbhiRadarscreen : Indicator
    {

        protected MarketSeries series_EURUSD, series_USDJPY;
        protected AverageTrueRange ATR_EURUSD, ATR_USDJPY;
        protected string DisplayText;


        protected override void Initialize()
        {

        }

        public override void Calculate(int index)
        {
            series_EURUSD = MarketData.GetSeries("EURUSD", TimeFrame.Daily);
            ATR_EURUSD = Indicators.AverageTrueRange(series_EURUSD, 22, MovingAverageType.Exponential);

            //series_USDJPY = MarketData.GetSeries("USDJPY", TimeFrame.Daily);
            //ATR_USDJPY = Indicators.AverageTrueRange(series_USDJPY, 22, MovingAverageType.Exponential);



            DisplayText = string.Format("Symbol\t\t\tAverage True Range\n");
            DisplayText = DisplayText + string.Format("EURUSD\t\t{0}\n", ATR_EURUSD.Result.LastValue * 10000);
            //DisplayText = DisplayText + string.Format("USDJPY\t\t{0}\n", ATR_USDJPY.Result.LastValue * 10000);
            ChartObjects.DrawText("DisplayText", DisplayText, StaticPosition.TopLeft, Colors.Lime);

        }
    }
}


@Abhi

Abhi
24 Sep 2014, 21:37

RE: RE: Multi-symbol robots and indicators

Spotware said:

Abhi said:

Hi Spotware Team, nice improvements. I still cannot run average true range indicator on multiple symbols.

 

Please could you let us know when the feature will be available or if there is a way to get around the problem.

 

Thanks in advance.

 

Regards,

Abhi

Please specify what you mean by saying that. You can use multi-symbol data in code of your indicator. You can also add ATR to several charts.

I want to show ATR for multiple symbols on a single chart. The  method call "Indicators.AverageTrueRange(int period , MovingAverageType.Exponential)" can be only called for a single symbol in a chart. Is there anyway to call ATR on multiple symbols and show up on a chart like you showed for RelativeStrengthIndex in this forum on previous posts.

 

Does it make sense now.


@Abhi

Abhi
23 Sep 2014, 22:16

Multi-symbol robots and indicators

Hi Spotware Team, nice improvements. I still cannot run average true range indicator on multiple symbols.

 

Please could you let us know when the feature will be available or if there is a way to get around the problem.

 

Thanks in advance.

 

Regards,

Abhi


@Abhi