Replies

amiscell
21 May 2014, 13:47

RE: RE:

amiscell said:

Then should this be at least consistent across cAlgo and cTrader? if I look at UTC+5, the first candle is at 2:00 on cTrader, and 3:00 on cAlgo.

Sorry - never mind, after further checks I verified it is consistent.


@amiscell

amiscell
21 May 2014, 13:39

RE:

Then should this be at least consistent across cAlgo and cTrader? if I look at UTC+5, the first candle is at 2:00 on cTrader, and 3:00 on cAlgo.


@amiscell

amiscell
18 Apr 2014, 15:05

Just #3 would do at the minimum


@amiscell

amiscell
07 Apr 2014, 17:49

RE:

That's brilliant, thanks!


@amiscell

amiscell
05 Apr 2014, 07:44

RE: RE:

I can confirm that if I set a flag from the OnPositionClosed event to then close the positions in the OnTick event instead of closing them directly within OnPositionClosed, the bug goes away.

So in conclusion there is generally a problem with closing positions within the OnPositionClosed event.


@amiscell

amiscell
04 Apr 2014, 18:57

RE:

I think I have pinpointed it down to closing trades in the OnTradeClosed function. I suspect that the trade being closed is still in the collection when the callback is invoked, and as I iterate through the collection, I attempt to close the same trade, which then closes twice generating the double entry in the history. I have tried adding a line to check that the id of the position being closed is not the same as the one closing. but it didn't seem to make a difference.

        void OnPositionsClosed(PositionClosedEventArgs obj)
        {
            Position position = obj.Position;

            if (IsPositionInScope(position) && (position.NetProfit > 0))
            {
                foreach (Position p in Positions)
                {
                    if (p.Id != position.Id)
                    {
                        ClosePosition(p);
                    }
                }
            }
        }

 


@amiscell

amiscell
04 Apr 2014, 14:28

RE:

Hi,

1 - yes, it is consistently reproducible.

2 - I use  PlaceStopOrder

3 - Either from OnTick, or from  OnPositionsOpened

4 - I can't send the actual cBot, but the best I can do is try to put together some code that reproduces the issue without sending the whole cBot (I can't guarantee that's easy to do, but I will try)


@amiscell

amiscell
03 Apr 2014, 19:54

RE:

Please right click on the image and "open image in new tab" to see it in its original size, otherwise it will be hard to read the numbers.

 


@amiscell

amiscell
03 Apr 2014, 19:51 ( Updated at: 21 Dec 2023, 09:20 )

Hi,

I have identified a major backtesting bug, which causes huge discrepancies between backtesting and demo. One example is given by the attached picture.

Note how in events, there are 9 fills in total, one of which at 8:30 (highlighted).
Then look at the positions below. There are 10 open positions, and 2 were opened at 8:30 (duplicated opened position, although there was only 1 fill!).

It would be great if you could take a look at why pending orders may cause duplicated positions to be opened in back-testing, as this makes it completely unreliable.


@amiscell

amiscell
07 Mar 2014, 18:03

RE:

amiscell said:

I think I worked it out - It's $78 / Million traded - to include both legs.

 

Is the commission setting meant to be for one leg or both legs of the trade?

For instance, for IC Markets:

Opening Price€100,000 x 1.3000 
= USD $130,000 
x (3 / 100,000)$3.90

Closing Price€100,000 x 1.3100 
= USD $131,000 
x (3 / 100,000)$3.93

Total Commission on Trade$7.83

Is the commission setting 39 per Million, or 78 per Million?

 


@amiscell

amiscell
03 Feb 2014, 16:25

RE:

cAlgo_Fanatic said:

Currently no. Market range can be implemented for Stop Order Requests in the future. Limit Orders don't have any slippage.

Is slippage on stop orders this still in the plans?


@amiscell

amiscell
03 Feb 2014, 14:13

RE: Towel

Hi Jeex,

Trying to save some time since you already looked at it. What drove you to the conclusion that this robot would never make it on live?

Cheers

jeex said:

We just threw the towel... This EA is a lab rat. It will only work in a lab, not in real time. So we stopped developing on this project. It's a complete and utter waste of time. Although the maker has done a nice job in analysing how to skim the momentum, this robot can never win from spread, commission and slippage.

 


@amiscell

amiscell
03 Feb 2014, 14:05

RE:

Is this still in the plans?

 

cAlgo_Fanatic said:

It will be implemented in the future. We cannot give a time estimate at the moment.

 


@amiscell

amiscell
23 Jan 2014, 19:24

New algo protection feature

Hi,

I noticed you implemented the .algo file protection feature. Can .algo files be decompiled at all?
If they are indeed protected, are they encrypted or obfuscated?

Thanks


@amiscell

amiscell
18 Dec 2013, 03:01

Solved!

Thanks, Jeex! This is fabulous, problem solved!

I am posting the working code for the sample for others to see. Needless to say, the sample doesn't make sense as it's adding up currency, it's just meant to show how to make this work :)

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC)]
    public class Test : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        MarketSeries series1;
        MarketSeries series2;
        MarketSeries series3;

        protected override void Initialize()
        {
            series1 = MarketData.GetSeries("USDJPY", this.TimeFrame);
            series2 = MarketData.GetSeries("AUDUSD", this.TimeFrame);
            series3 = MarketData.GetSeries("USDCAD", this.TimeFrame);
        }

        public override void Calculate(int index)
        {
            int index1 = series1.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime[index]);
            int index2 = series2.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime[index]);
            int index3 = series3.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime[index]);

            Result[index] = series1.Close[index1] + series2.Close[index2] + series3.Close[index3];

            if (double.IsNaN(series1.Close[index1]))
                Print("Nan: Series 1");

            if (double.IsNaN(series2.Close[index2]))
                Print("Nan: Series 2");

            if (double.IsNaN(series3.Close[index3]))
                Print("Nan: Series 3");
        }
    }
}

 


@amiscell

amiscell
15 Dec 2013, 16:59

Great job, thanks!


@amiscell

amiscell
29 Nov 2013, 17:46

RE: RE:

Spotware said:

amiscell said:

Hi,

Since the latest release, (1.13) I noticed that the platform itself generates a lot of noise in the logging output such as the one below. How can I disable this so that I can see just my own messages?


01/04/2011 01:00:30 | Placing Limit Order to Sell 20k GBPUSD (Price: 1.61474, ExpireTime: 04/12/2013 00:00)
01/04/2011 01:00:30 | Placing Limit Order to Buy 20k GBPUSD (Price: 1.59382, ExpireTime: 04/12/2013 00:00)
01/04/2011 01:00:30 | → Placing Limit Order to Sell 20k GBPUSD (Price: 1.61474, ExpireTime: 04/12/2013 00:00) SUCCEEDED, PendingOrder OID1
01/04/2011 01:00:30 | → Placing Limit Order to Buy 20k GBPUSD (Price: 1.59382, ExpireTime: 04/12/2013 00:00) SUCCEEDED, PendingOrder OID3
01/04/2011 02:10:30 | Placing Limit Order to Sell 20k GBPUSD (Price: 1.61474, ExpireTime: 04/12/2013 00:00)
01/04/2011 02:10:30 | Placing Limit Order to Buy 20k GBPUSD (Price: 1.59382, ExpireTime: 04/12/2013 00:00)

It is not possible at the time being. We may implement this in the future.

 

I am not sure why this was introduced without thinking that it will completely impair debugging. I used to love this dev environment, but now I am no longer able to track what is going on in my code as I have millions of these lines that show information I don't need to see and I am spending 20% of my time looking for that one line I need to see. The sooner it's fixed the better in my view this is quite a serious step backwards.

 


@amiscell