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

PanagiotisCharalampous
29 Nov 2017, 15:19

Hi mto1995,

The best way to do this is to use the expiration time parameter as below

PlaceStopOrder(TradeType.Buy, Symbol, 1000, 1.2, "order", 0, 0, Server.Time.AddMinutes(1));

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
29 Nov 2017, 11:57

Dear Trader,

You can use the ClosePositionAsync method. See below

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
 
namespace cAlgo.Robots
{
    [Robot()]
    public class PCAccountStophit : Robot
    {
 
        [Parameter(DefaultValue = "Account Stop Hit cBot")]
        public string cBotLabel { get; set; }
 
        [Parameter()]
        public DataSeries SourceSeries { get; set; }
 
 
        [Parameter("TargetBalance", DefaultValue = 10000)]
        public double TargetBalance { get; set; }
 
 
        protected override void OnStart()
        {
 
        }
 
        protected override void OnBar()
        {
 
            // Some condition to close all positions
            if (Account.Equity <= TargetBalance)
                foreach (var position in Positions)
                    ClosePositionAsync(position);
        }
 
 
 
    }
}
 

Let me know if this helps you.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
29 Nov 2017, 10:35

Hi oneplusoc,

Have you tried this one /algos/indicators/show/1577?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Nov 2017, 17:23

Hi sweetman_dave,

Thanks for the additional information. We will try to reproduce this, even though I monitored the application for quite a while but could not see any issue. I will forward your issue to the quality assurance team for further investigation.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Nov 2017, 15:54

Hi sweetman_dave,

Thanks for reporting this. From what I understand from the screenshot this happens on cTrader Web. Can you please confirm?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Nov 2017, 15:14

Hi mto1995,

If you want to place a Buy order above the market price then you need to place a Stop Order, not a Limit Order. See below

        protected override void OnTick()
        {
            if (Positions.Count == 0 && PendingOrders.Count == 0)
            {
                PlaceStopOrder(TradeType.Buy, Symbol, 10000, (Symbol.Ask + 0.001), "e", 5, 10);
            }

        }

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Nov 2017, 14:59

Hi denn,

It could be anything, so I don't want to make any guesses at the moment. I will wait for your stripped down version to check this.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Nov 2017, 09:26

Hi jalmir.coelho@gmail.com,

You can find the position id by accessing the Position.Id parameter. See below

                if (position.Id.ToString() == "21260940")
                    ClosePosition(position);

You can store the value of pips in a variable as shown below

var pips = position.Pips;

Let me know if these are the answers you were looking for.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Nov 2017, 09:08

RE:

enrico.pedersini said:

Hi Panagiotis,
my first implementation was sending a ping request (filling the timestamp field with local ticks) with connect API and reading the ping response message. But I notice that the timestamp of the ping response is every time exactly the same i sent. Maybe i'm missing something...? I'll receck my code later this evening.

Thank you, regards.

Hi Enrico,

Please check and let us know. If this is the case, we shall investigate further.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 17:40

Dear leohermoso,

Thanks for reporting this. We will investigate and resolve the issue.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 17:00 ( Updated at: 21 Dec 2023, 09:20 )

Dear Trader,

Thanks for posting in our forum. You can find the FIX ID in the Symbol's information panel in cTrader. See below

I hope this helps.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 16:32

Hi Enrico,

The latency showed in cTrader is the one way latency between cTrader -> cTrader Proxy -> cServer and is split into two parts, cTrader -> Proxy and Proxy->cServer. The way you have implemented it is that you measure the round trip of a message which will take definitely longer. It will be better to measure your latency by sending a ping message to the server and compare the timestamp of the request and the timestamp of the response.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 14:57

Hi nezanderio,

We have investigated the issue and we cannot reproduce it internally. Can you please let us know your browser, your operating system and your broker to investigate this further? 

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 12:00

Ηι denn,

Thanks for the additional information but it would be more helpful to have a complete cBot that reproduces the error. It doesn't need to be your cBot, just a sample cBot with all the necessary functionality to reproduce the issue. This way we will be able to debug the code and see what happens. Also let me know which broker do you use.

Best Regards,

Panagiotis 


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 11:48

Hi jalmir.coelho@gmail.com,

You can close loop and close positions based on certain conditions as below.

            foreach (var position in Positions)
            {
                //Put here any condition required to close the position
                if (position.Pips < -1)
                    ClosePosition(position);
            }

If you need access to historical trades, use the History collection.

Let me know if the above information helps.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 11:30

Hi Mikro,

Have a look at nested indicators. I believe that they can help you solve your issue. Let me know if this helpful.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Nov 2017, 10:23

Dear jelle2500,

Thanks for posting in our forum. If you need professional assistance with developing your cBot, you can also post a job in the Jobs section or find a cAlgo professional in the Consultants section. 

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Nov 2017, 10:16

Hi denn,

Can you send us the full cBot code so that we can check this as well? 

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Nov 2017, 10:05

Hi Mikro,

You should reverse the inputs in the GetIndexByDate function. See below

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

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

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

        private MarketSeries series24h;


        protected override void Initialize()
        {
            series24h = MarketData.GetSeries(TimeFrame.Daily);
        }

        public override void Calculate(int index)
        {
            var index24h = GetIndexByDate(series24h, MarketSeries.OpenTime[index]);           
            if (index24h != -1)
            {
                DaxDailyHigh[index] = series24h.High[index24h];
            }
        }


        private int GetIndexByDate(MarketSeries series, DateTime time)
        {
            for (int i = series.Close.Count - 1; i > 0; i--)
            {
                if (time == series.OpenTime[i])
                {
                    return i;
                }
                else if (series.OpenTime[i] < time)
                {
                    return i;
                    //return last value prev. to desired
                }
            }
            return -1;
        }
    }
}

Let me know if this helps,

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Nov 2017, 09:41

Hi Mikro,

This is not possible currently. But why don't you split your indicator to two (one with moving averages and one with trade direction) and use them both on the same chart? 

Best Regards,

Panagiotis

 


@PanagiotisCharalampous