Topics
06 Jun 2019, 17:34
 1212
 3
16 May 2019, 04:33
 1465
 3
08 May 2019, 00:41
 1203
 3
07 May 2019, 13:26
 1072
 1
26 Apr 2019, 04:45
 1707
 5
24 Apr 2019, 21:34
 1085
 1
Replies

lec0456
06 Jun 2013, 14:07

OK, so I could see why the code is crashing based on this:

http://msdn.microsoft.com/en-us/library/bb382770.aspx

However,  So now it would seem that since June 6th at 6:50 for EUR/USD OpenTime.Kind is set to UTC  instead of unspecified.  

My question is, lets say for a broker that was using Cyprus Time like FXpro, for the times where the DateTimeKind is "unspecified"  is it using Cyprus time or UTC.

To rephrase the question, are the times shown before the change to UTC using Cypus Time and the times shown after using UTC?


@lec0456

lec0456
06 Jun 2013, 09:47

It looks like the MarketSeries.OpenTime has a kind property that was unspecified before but now is set to UTC??  I am checking if its something I can handle from the programers end...


@lec0456

lec0456
06 Jun 2013, 09:41 ( Updated at: 21 Dec 2023, 09:20 )

I'm getting an error

As of June 5th 9:30 UTC time I am getting an error with time  conversions.  This did not happen before:

The complete code for the indicator is here:

/algos/indicators/show/235


@lec0456

lec0456
05 Jun 2013, 21:31

oh, I don't know why, but I removed the instance and added a new one and it worked...


@lec0456

lec0456
05 Jun 2013, 21:27

I put a print statement in an indicator and it is not working.  It used to work??  Please verify this....


@lec0456

lec0456
05 Jun 2013, 12:02

Just don't aggregate solely based on UTC 21:00 because then the daily aggregation will be off in the winter. And thats not good.


@lec0456

lec0456
05 Jun 2013, 12:00

RE:
lec0456 said:

One thing to point out that what you are proposing is using UTC time but aggregating based on New York time.  So that would be UTC +4 in the summer and UTC +5 in the winter or 21:00 UTC or 22:00 UTC.  C# takes care of the the conversions and changes on specific dates using the TimeZone functionality.

I mention that because if people decide to program robots based on say 21:00UTC being the start of the day they will be off in the winter.  They would need to convert to NY time first and use 17:00 to be consistent year round

which is fine, as long as people know


@lec0456

lec0456
05 Jun 2013, 11:59

One thing to point out that what you are proposing is using UTC time but aggregating based on New York time.  So that would be UTC +4 in the summer and UTC +5 in the winter or 21:00 UTC or 22:00 UTC.  C# takes care of the the conversions and changes on specific dates using the TimeZone functionality.

I mention that because if people decide to program robots based on say 21:00UTC being the start of the day they will be off in the winter.  They would need to convert to NY time first and use 17:00 to be consistent year round


@lec0456

lec0456
03 Jun 2013, 18:53

Ok, that sounds like it will fix it!  I've been mentioning the problem to IC markets for awhile and they said a fix was coming.  I'm glad this is being fixed and will not change depending on the broker.


@lec0456

lec0456
29 May 2013, 09:59

Ok, so currently the aggregation periods are set at each individual broker baased on thier time zone setting?  Thats the way it seems, because for exapmle FXpro agregates daily data correctly but IC markets has that extra day.

I hope that daily data will be aggregated the same across all brokers, it would appear to me that the only way to do that is to aggregate based on Cyprus time


@lec0456

lec0456
29 May 2013, 00:10

Also if you start your day at UTC  0:00  you will be starting your day at 10am Sydney time during the summer and 11am during the winter.  You would be cutting the session in 2.  


@lec0456

lec0456
29 May 2013, 00:00

Look at the period separators going from friday to monday on this chart:

http://icmarkets.ctrader.com/c/4rW5n (the week goes from 5th to the 7th to the 8th)

With brokers using UTC it considers monday's trading hours as sunday and therefore creates a period(and a candle).  This error does not happen with brokers using Cyprus time.

http://fxpro.ctrader.com/c/YrW5n  (the week goes from the 5th straight to the 8th) like it should

 

 


@lec0456

lec0456
28 May 2013, 23:31

Are you making a Big Mistake?

I am very concerned by what you are doing!!!  Do you realize that if you move to UTC time instead of the week starting on monday it will start on Sunday @21:00 then create a new day in 2 hours.  So it will look like there is 6 trading days instead of 5!  This screws up volume and Daily candles because you get one day at the start of the week that is bogus. 

Just check one of your brokers using UTC time right now

http://icmarkets.ctrader.com/c/urW5n

Look at the tick volume for a daily chart.  It shows one day with no volume and 5 normal days.  This completely messes up technical analysis on your platform.


@lec0456

lec0456
25 May 2013, 08:03

meant like this: 

var SellPairStopOrder = new StopOrderRequest(TradeType.Sell, TradeVol, PiviotPrice)
		           			{Label="SellPairOrder",
		           			StopLoss=PiviotPrice+(orderTradeSL*Symbol.PipSize),
		           			TakeProfit=PiviotPrice-(orderTradeTP*Symbol.PipSize)+Symbol.Spread,
		           			Expiration = pendingOrderExp};
						Trade.Send(SellPairStopOrder);

when you create the trade you have a color parameter and set it.

var SellPairStopOrder = new StopOrderRequest(TradeType.Sell, TradeVol, PiviotPrice)
		           			{Label="SellPairOrder",
		           			StopLoss=PiviotPrice+(orderTradeSL*Symbol.PipSize),
		           			TakeProfit=PiviotPrice-(orderTradeTP*Symbol.PipSize)+Symbol.Spread,
		           			Expiration = pendingOrderExp,
						Color=Color.Red};
                                                Trade.Send(SellPairStopOrder);

thought it might be cool when having trades executed by different robots or different criteria within a robot, you can easily identifiy a trade.  


@lec0456

lec0456
24 May 2013, 06:18

I am really glad you asked this question and that it was answered in the way it was.  I followed the link and read a very important requirement for the price channel.

 It said, "The Price Channel formula does not include the most recent period. Price Channels are based on prices prior to the current period. A 20-day Price Channel for October 21 would be based on the 20-day high and 20-day low ending the day before, October 20. A channel break would not be possible if the most recent period was used."

I had created a price channel indicator like the one posted by "adaled".  it used the maximun and minimum fuctions.  But this is incorrect because they use the current period in there calculations.  Actually, there is a sample indicator included with the installation of cAlgo called Sample Price Channels, it calculates the channel correctly like described on the Stock Charts.Com website:

 

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class SamplePriceChannels : Indicator
    {
        [Parameter(DefaultValue = 20)]
        public int Periods { get; set; }

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

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

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

        public override void Calculate(int index)
        {
            double upper = double.MinValue;
            double lower = double.MaxValue;

            for (int i = index - Periods; i <= index - 1; i++)
            {
                upper = Math.Max(MarketSeries.High[i], upper);
                lower = Math.Min(MarketSeries.Low[i], lower);
            }

            Upper[index] = upper;
            Lower[index] = lower;
            Center[index] = (upper + lower) / 2;
        }
    }
}




@lec0456

lec0456
22 May 2013, 00:41

Actually, for my purposes I used the Server.time function in the OnPositionClosed and it worked what I was trying to do.


@lec0456

lec0456
22 May 2013, 00:37

Hmm, my question is if I use price as deltaY and time period as deltaX would I be calculating the correct angle using that formula?


@lec0456

lec0456
21 May 2013, 17:15 ( Updated at: 11 Mar 2016, 14:16 )

ok


@lec0456

lec0456
21 May 2013, 17:15 ( Updated at: 11 Mar 2016, 14:16 )

ok


@lec0456

lec0456
21 May 2013, 02:46 ( Updated at: 11 Mar 2016, 14:16 )

I noticied an issue that should be investigated.  While backtesting testing a robot, I made changes to a custom indicator used in the robot.  The backtest results did not refledt the changes but seemed to use cached data.  Once I changed the dates of the backtest then the new results were displayed.  Please verifiy this behavior


@lec0456