Replies

yisrgg
01 Jun 2022, 08:54

RE: RE: RE: RE: RE:

amusleh said:

fcomanjoncabeza said:

amusleh said:

fcomanjoncabeza said:

amusleh said:

Hi,

I tested your cBot code on cTrader 4.2 .NET 6 compiled and it works fine on multiple symbols, it opens both the position and the stop order on 4 different symbols running simultaneously. 

Thank you for the quick reply. Does that mean that this is a problem restricted to the Spotware cTrader (Public beta) 4.2.4 version only? Could you please confirm that the problem appears in that version? Thank you

Hi,

I tested it on Spotware cTrader Beta 4.2.4 and it worked fine.

|nteresting. How do think that the logs attached above can be explained?

Hi,

I see "aborted by timeout" errors on your logs, are you sure you used the same posted code? because the aborted by timeout only happens if your cBot hang for more than 5 seconds while platform try to stop it .

 

Hello,

 

yes, that is exactly the same code. The "aborted by timeout" error occurs after stopping the bot, and not while it is running and has not yet been stopped.


@yisrgg

yisrgg
30 May 2022, 10:24

RE: RE: RE:

amusleh said:

fcomanjoncabeza said:

amusleh said:

Hi,

I tested your cBot code on cTrader 4.2 .NET 6 compiled and it works fine on multiple symbols, it opens both the position and the stop order on 4 different symbols running simultaneously. 

Thank you for the quick reply. Does that mean that this is a problem restricted to the Spotware cTrader (Public beta) 4.2.4 version only? Could you please confirm that the problem appears in that version? Thank you

Hi,

I tested it on Spotware cTrader Beta 4.2.4 and it worked fine.

|nteresting. How do think that the logs attached above can be explained?


@yisrgg

yisrgg
30 May 2022, 10:21

RE:

amusleh said:

Hi,

I tested your cBot code on cTrader 4.2 .NET 6 compiled and it works fine on multiple symbols, it opens both the position and the stop order on 4 different symbols running simultaneously. 

Thank you for the quick reply. Does that mean that this is a problem restricted to the Spotware cTrader (Public beta) 4.2.4 version only? Could you please confirm that the problem appears in that version? Thank you


@yisrgg

yisrgg
19 Dec 2018, 18:04

Thank you very much for your answer. Now I would like to get the price level of an added horizontal line in the OnChartObjectAdded method. Is it possible?

Thank you very much in advance.


@yisrgg

yisrgg
08 Oct 2018, 13:15

RE:

Panagiotis Charalampous said:

Hi fcomanjoncabeza,

For a line to stay on the chart you need to make it interactive. See how below.

            var line = Chart.DrawHorizontalLine("Test", Symbol.Bid, Color.AliceBlue);
            line.IsInteractive = true;

Best Regards,

Panagiotis

Thank you very much. Do you have any alternative for the API version 3.0?

Kind regards


@yisrgg

yisrgg
27 Sep 2018, 19:27

RE:

Panagiotis Charalampous said:

Hi fcomanjoncabeza,

Here it is

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

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()
        {
            Chart.ObjectAdded += OnChartObjectAdded;
            var highPrice = MarketSeries.High.LastValue;
            var openTime = MarketSeries.OpenTime.LastValue;
            var text = Chart.DrawText("text1", "High is here", openTime, highPrice, Color.Red);
            text.VerticalAlignment = VerticalAlignment.Bottom;
            text.HorizontalAlignment = HorizontalAlignment.Center;
        }

        void OnChartObjectAdded(ChartObjectAddedEventArgs obj)
        {
            Print("Object Added: " + obj.ChartObject.ObjectType.ToString());
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

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

Best Regards,

Panagiotis

Thank you very much. But I still get the same error as, when I tried writing my own robot: Error CS0246: The type or namespace name 'ChartObjectAddedEventArgs' could not be found (are you missing a using directive or an assembly reference?) Any idea why?

Thank you very much in advance.


@yisrgg

yisrgg
16 Dec 2016, 13:19

What do you mean? Can you give us a detailed explanation? Can you provide us with some pictures?


@yisrgg

yisrgg
16 Dec 2016, 13:13

Hello. That's very easy:

int BarsAgo;

//Last closed bar open price
double OpenPrice = MarketSeries.Open.Last(BarsAgo);

//Last closed bar close price
double ClosePrice = MarketSeries.Close.Last(BarsAgo);

//Last closed bar high price
double HighPrice = MarketSeries.High.Last(BarsAgo);

//Las closed bar low price
double LowPrice = MarketSeries.Low.Last(BarsAgo);

If you would like to get those prices for a different symbol from the one on the chart:

int n;
MarketSeries YourSymbol = MarketData.GetSymbol(Symbol);

//Open price n bars ago
double OpenPrice = YourSymbol.Open.Last(n);

//Close price n bars ago
double ClosePrice = YourSymbol.Close.Last(n);

//High price n bars ago
double HighPrice = YourSymbol.High.Last(n);

//Low price n bars ago
double LowPrice = YourSymbol.Low.Last(n);

If n=0, then you will get the information for the actual bar. If n=1, you will get the information for the last closed bar. And so on.


@yisrgg

yisrgg
16 Dec 2016, 12:54

If you don't describe your problem, how may we help you?

Kind regards


@yisrgg

yisrgg
12 Apr 2016, 21:05

RE:

Waxy said:

I'm sorry, but you asked for this:

I would like to get the MarketSeries of the current chart timeframe

Also about GetSeries, I think it's not possible to get timeframe tick data.

Any idea how to get close and open prices from different pairs. I need to programm a multi-pair robot.

Thank you very much in advance.


@yisrgg

yisrgg
07 Apr 2016, 10:32

RE:

Waxy said:

Hello fcomanjoncabeza

Even easier, just do:

var _CurrentTF = MarketSeries.TimeFrame;

 

Hello Waxy. Thank you ver much for your help. The problem with your answer is, that I can only use one symbol. The symbol of the chart. But I would like to use/write two symbols. That's why I use "MarketData.GetSeries". I can choose a Symbol for that MarketSeries, but I must also choose a timeframe, and the timeframes I am allowed to choose between do not include tick charts.

Do you understand what I mean?

Thank you very much for your help.


@yisrgg

yisrgg
02 Apr 2016, 14:48

Hello. You cannot get the exchange rate of the USD by itself. To get an exchange rate you need two assets, for example EUR and USD, EUR and Deutsche Bankd Stocks... Then you can get the exchange rate. When you buy or sell something (currency, stock, future contract...), you are exchanging one thing for another, in case you are buying USD with EUR you are giving EUR and getting USD. But you can neither give (sell) nor get (buy) USD without getting or giving somehting else (as long as you don't give USD for free. In that case, please contact me ;) )

Have a nice day


@yisrgg

yisrgg
02 Apr 2016, 14:40

Hello.

I have previously learnt to programm in MQL4. Anyway, I started with this C# course. But I see now that it will be available until the 4th of April 2016 only. That's a bit too soon. I would recommend you to learn C#, since it is the programming language cAlgo uses. Then you could apply those basics to cAlgo and use the API Reference to guide you. You'll learn by yourself and just by using waht you need and want to use. I think that's the best way to learn a programming language, learn by using.

On the other hand, if you don't have any idea about financial markets, stocks, forex, futures, options, etc, I recommend you to have a look at this course. Once you have started with that, if you like it, you'll find yourself the next step to take, what topics or ideas you'd like to explore or know more about...

If there is anything else I can do for you, just let me know.

Have a nice day.


@yisrgg