Topics
11 Jul 2017, 07:28
 0
 2346
 2
03 Oct 2016, 09:00
 3969
 5
21 Sep 2016, 12:51
 1950
 2
15 Sep 2016, 16:29
 4573
 12
02 Aug 2016, 17:45
 4467
 11
24 Jun 2016, 07:25
 2718
 2
14 May 2016, 14:28
 3721
 4
01 Apr 2016, 07:50
 5
 834
 1
01 Apr 2016, 07:49
 128
 1331
 3
31 Dec 2015, 06:57
 3150
 3
15 Sep 2015, 17:35
 2422
 3
Replies

cloesd
09 Dec 2016, 14:20

RE:

cloesd said:

After some testing I'm starting to believe the Positions.Opened method doesn't work during backtest.

Positions opened during a backtest simply don't trigger the postions.Opened event, can anyone confirm?

 

Solved!

The probem turns out to be me using

if (position.comment.contains("something") =! true)

{

 

}

 

 

inside the code. Deleting this makes it work 100%.

 

Positons.Opened works perfectly.

 


@cloesd

cloesd
09 Dec 2016, 12:50

After some testing I'm starting to believe the Positions.Opened method doesn't work during backtest.

Positions opened during a backtest simply don't trigger the postions.Opened event, can anyone confirm?


@cloesd

cloesd
07 Oct 2016, 14:35

RE:

tmc. said:

Hi, you need to put the class in same namespace. Then you should send the algo as parameter in which it should be printed. See sample below.

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        private TestClass testClass;

        protected override void OnStart()
        {
            testClass = new TestClass();
        }

        protected override void OnTick()
        {
            testClass.Test(this);
        }
    }

    public class TestClass
    {
        private int x = 4;

        public void Test(Algo algo)
        {
            algo.Print(x);
        }
    }
}

If you need any further help, feel free to contact me via email.

 

 

Thanks heaps!


@cloesd

cloesd
07 Oct 2016, 13:48

RE: RE:

cloesd said:

cloesd said:

 I'm having trouble implementing simple custom classes:

Below is my code, I simply want to test making a seperate class and printing out a variable from that class in the ontick field.

 

It compiles fine, but causes error when run:

03/10/2016 16:50:24.446 | Crashed in OnTick with NullReferenceException: Object reference not set to an instance of an object.

 

I am quite new to this kind of programming .

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


namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        public testcass testie;

        protected override void OnStart()
        {
            testcass testie = new testcass();
        }

        protected override void OnTick()
        {
            testie.test();
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}


public class testcass : Robot
{

    private int x = 4;



    public void test()
    {
        Print(x);
    }


}

 

Anyone please help, This has put on hold a rather big project I've got planned.

Will offer the first reply, a copy of the finished algo free via email.

 


@cloesd

cloesd
06 Oct 2016, 18:32

RE: RE:

marcus.nielsen said:

And marcus.nielsen said:

Yes, demo works all right, but live does not.

And no matter what proxy is there. Mine is Duesseldorf-1. So this is either an issue with live servers or a deliberate activity that results in slowdown.

I am wondering why noone from Spotware writes anything about it. This is pretty serious issue and ICM posted just a short message that Spotware is experiencing technical issues. That's all no other info, no ETA nothing... Will move to different broker soon if this is not resolved next week.

Absolutely unusable.


@cloesd

cloesd
06 Oct 2016, 15:11

Also, I've noticed the latencies are different between the demo account and the live account. (connected to Sydney 6, and Sydney 5).

The demo always connects to Sydney 5, the live always connects to Sydney 6.

Sydney 5 seems to execute near instantly, Sydney 6 sometimes takes 10 seconds.

Is there any way to adjust which proxy to connect to?

 

 


@cloesd

cloesd
06 Oct 2016, 15:01

I have had this problem as well. After pressing 'purchase' I have to wait almost 10 seconds sometimes to see the order go through. This makes scalping impossible. This is a very very major issue. Doesn't occur on the demo account, only on the live account.

 

I'm with IC markets too.


@cloesd

cloesd
06 Oct 2016, 14:58

RE:

cloesd said:

 I'm having trouble implementing simple custom classes:

Below is my code, I simply want to test making a seperate class and printing out a variable from that class in the ontick field.

 

It compiles fine, but causes error when run:

03/10/2016 16:50:24.446 | Crashed in OnTick with NullReferenceException: Object reference not set to an instance of an object.

 

I am quite new to this kind of programming .

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


namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        public testcass testie;

        protected override void OnStart()
        {
            testcass testie = new testcass();
        }

        protected override void OnTick()
        {
            testie.test();
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}


public class testcass : Robot
{

    private int x = 4;



    public void test()
    {
        Print(x);
    }


}

 

Anyone please help, This has put on hold a rather big project I've got planned.


@cloesd

cloesd
21 Sep 2016, 13:03

RE:

cloesd said:

I've written an algo to help me position trades better for grid systems.

 

(eg. Place an order every 10 pips). The problem is the pips are very different for different pairs. The big problem is GBP/JPY. but really all JPY pairs.

 

If I set it to place a trade every 20 pips, it works perfectly for most pairs, EXCEPT JPY pairs. In JPY pairs, it places all the orders in the same place ontop of each other. (Well maybe there's a tiny space in between them).

 

Is there some way to fix this easily? I want the 'spacing' between the trades to be equal.

 

 

I was thinking of sampling the EURUSD 'ATR' and then comparing it to the ATR of the position, and thne scaling it to be the same as EURUSD.


So GBP/JPY ATR is much higher than EURUSD because of pipsize difference, but we can scale it to get a uniform reference. Is this the best way.


Answered my own question;

 

Use 'pipsize' as scaling factor.

 

eg.

 

EURUSD pipsize = 0.0001

GBP/JPY pipsize = 0.01

 

So to get the same 'spacing', multiply 'pips between each order' by (0.01 / 0.0001).


@cloesd

cloesd
21 Sep 2016, 07:49

RE:

 

 

cloesd said:

Hi,

 

Sorry for late reply: 

 

Please see image for details. I will submit to spotware feedback aswell:

 

http://imgur.com/a/5MMb9

 

 

As you can see price hit the target 3 minutes before I got an alert. By the time I got the alert and looked at the trade, trade was already long gone.

It seems to only occur during times of high 'load' like during news releases, or during market opening minutes.

 

 

 

 


@cloesd

cloesd
21 Sep 2016, 07:45

Hi,

 

Sorry for late reply: 

 

Please see image for details. I will submit to spotware feedback aswell:

 

http://imgur.com/a/5MMb9

 

 

As you can see price hit the target 3 minutes before I got an alert. By the time I got the alert and looked at the trade, trade was already long gone.

It seems to only occur during times of high 'load' like during news releases, or during market opening minutes.

 

 

 


@cloesd

cloesd
25 Aug 2016, 13:24

RE:

cloesd said:

I'm developing a bot that needs to deal with aggregated positions. The bot is designed to 'support' manual trading by

automatically closing positions, opening positions and controlling risk on manually opened trades.

 

Sometimes I will open a grid of 10 positions on one symbol each of them small size like 0.05lots.

 

I want to be able to get things like 'total margin used' and 'net profit' for that 'aggregated' postions. What's the best way to do this? Is there any inbuilt functions?

 

I was thinking of using a 2D  array, and putting something in onTick that will periodically check all open positions and 'collect' them by symbol and store things like net profit for each symbol. Then when the symbol is closed it will delete that entry. But this seems like complex way to do it. 

 

Is there any other suggestion on how to implement this?

Another idea is using classes.

If I create a class called 'aggregated position' that stores symbol name, netprofit and margin used.

 

Then the challenge is how to create the objects for each 'symbol' that's open, and where to store all objects so they can be searched on tick or on bar with something like if (GBPUSD.netprofit > 25)


@cloesd

cloesd
23 Aug 2016, 22:30

RE:

I went with the first answer.

Thanks for all replies.

 

 


@cloesd

cloesd
03 Aug 2016, 11:04

RE:

lucian said:

Try to open the account in cAlgo.

Didn't work.


Good news is it's very much in profit.

 

Bad news is i still can't close it.


@cloesd

cloesd
02 Aug 2016, 19:07

RE: Close Position

kricka said:

If the above suggestions do not work try Close Positions 1.0 cBot.

Download; Close Positions 1.0

How does the bot work? I'm afraid because it's not on Cbots websites it's linking to some other website.

In any case I don't think this problem can be solved client side. Hoping for a Ctrader reply, or other people who've had this problem.


@cloesd

cloesd
02 Aug 2016, 19:04

RE:

cyfer said:

The forum is formatting the code in a very wrong way 

The code is 

////////////////////////////

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CTDN_Close_ALL : Robot
    {
        protected override void OnStart()
        {

        }

        protected override void OnTick()
        {
            if (Positions.Count != 0)
            {
                var Trades = Positions.FindAll("");
                foreach (var Trade in Trades)
                {
                    ClosePosition(Trade);

                }
            }
        }

        protected override void OnStop()
        {

        }
    }
}

//////////////////////////////////////////////

There should be no bold or italic of any of that nonsense 

 

I tried this.


It seems to be flooding the server with requests to close the trade, but the server is saying it's already closed

 

The error actually occured when Ctrader mysteriously DC'd mid-way through the trade. 

I believe what's happening is my broker thinks the trade IS still open. But Ctrader's servers seem to think it's closed.

I've asked my broker to check on their end and they say that they can see the trade IS still open.

 


@cloesd

cloesd
02 Aug 2016, 17:56

I got similar bug.


"Failed to close position with error "POSITION NOT OPEN"..

But position is still open.


This recent Ctrader is causing some scary problems. I'm stuck in trade. Lukcily it's positive now, but I can't exit trade. This is very dangerous.


@cloesd

cloesd
02 Aug 2016, 17:46

RE:

cloesd said:

Hi. 

As I'm writting I am currently stuck in trade. I can't close it because it says "POSITION_NOT_OPEN".


BUT in positions I can still see the trade, and my equity is moving. All the stoplosses are reset. I cannot exit the trade. At the moment it is in profit, but I want to exit trade asap.

 

IMAGE

 

Need help quickly.

 


@cloesd

cloesd
16 Sep 2015, 06:36 ( Updated at: 13 Oct 2015, 01:37 )

This post was removed by moderator because it duplicates another post. /forum/calgo-support/6645?page=1#2

 


@cloesd

cloesd
15 Sep 2015, 17:36

RE:

 

ALSO:

I've already tried changing the trigger to:

triggerprice = MarketSeries.Open.Last(2);

(incase it was picking up the new bar somehow, but still doesn't work).


@cloesd