PanagiotisCharalampous's avatar
PanagiotisCharalampous
26 follower(s) 0 following 1006 subscription(s)
Replies

PanagiotisCharalampous
31 Oct 2018, 16:07

Hi 

selected is a collection of positions matching your regular expression, first you need to get an item from there and then print the label. See below

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

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



        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, 1, "Buy", 400, 600);
        }

        protected override void OnTick()
        {
            var rx = new Regex("\\w+", RegexOptions.IgnoreCase);

            var selected = from position in Positions
                           where rx.IsMatch(position.Label)
                           select position;

            Print(selected.First().Label);
        }


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

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 16:02

Hi Eklon,

Yes, you can find it here.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 15:56

Hi Elkon,

Thanks. Can you also try on 3.3 and let us know if you experience the same problem?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 15:55

Hi swingfish,

We are trying to roll out updates to brokers as soon as they are available. However, this not always possible. Some brokers will be upgraded to 3.3 later on.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 14:49

Hi irmscher9,

You cannot use regex in Find() method. However, you could consider Linq. See below

            var rx = new Regex("your regular expression", RegexOptions.IgnoreCase);

            var selected = from position in Positions
                           where rx.IsMatch(position.Label)
                           select position;

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 12:59

Hi tradingu,

Please contact ICMarkets regarding this.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 12:45

Hi tradingu,

For execution issues, you should contact your broker directly.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 12:18 ( Updated at: 09 Nov 2018, 13:59 )

Hi Peter,

Thanks for bringing this into our attention. We will get in touch with the specific consultant for further clarifications.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 11:26

Hi lec0456,

Send it to community@spotware.com

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 10:35

Hi Elkon,

Which version do you use? 3.0  or 3.3?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 09:49

Hi oneplusoc,

Thank you for the indicator. swingfish if you need to read the start and end points of lines on the chart, you can try something like the following

            foreach (var obj in Chart.Objects)
            {
                if (obj is ChartTrendLine)
                {
                    var line = (ChartTrendLine)obj;
                    Print(line.Y1);
                    Print(line.Time1);
                    Print(line.Y2);
                    Print(line.Time2);
                }
            }

Note that this only works for 3.3.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 09:41

Hi Elkon,

Thank you for your suggestion. This can be easily programmed in a cBot.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Oct 2018, 09:25

Hi lec0456,

Can you send us the indicators so that we can reproduce the issue?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 17:03

Hi Eklon,

We managed to reproduce the behavior. We will fix it in one of the following versions of cTrader.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 12:23

Change this one as well

var stopLossSell = MarketSeries.High.Last(1) + Symbol.PipSize * SL;

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 12:11

Hi jelle2500,

Try this line of code

var SLSell = Math.Round((stopLossSell - Symbol.Bid) / Symbol.PipSize);

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 11:02

Hi lec0456,

We could not reproduce any performance decay in 3.3 on chart scrolling after backtesting. Sometimes is even faster. Do you use any custom indicators?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 10:58

Hi and thanks for posting in our forum. FIX API is enabled by default for all cTrader accounts except if explicitly disabled by the broker. I would suggest to contact the brokers directly before spending your time opening an account.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 10:55

Yes, this works only for version 3.3


@PanagiotisCharalampous

PanagiotisCharalampous
30 Oct 2018, 09:54

Hi swingfish,

Could you please explain which fractals you are talking about?

Best Regards,

Panagiotis


@PanagiotisCharalampous