Replies

PanagiotisCharalampous
26 May 2020, 11:46

Hi CuteLittleMay,

We need more information about this issue. Please can you please let us know the following.

1. What do you mean you changed cTrader ID? Did you create a new cTrader ID or did you just changed your email address? If you created a new cTrader ID, did your broker reassign your trading account to your new cTrader ID?

2. Please provide some screenshots of the issues you report so that we can understand what you see.

3. Please tell us your broker, your strategy name and provide the public link to your strategy.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 09:40

Hi Yuval,

In order to help you, we need to have the indicator code.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 09:34

Hi Yuval,

No there is not. If you want the source code to be available on the new computer then you will need to install the files one by one.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 09:22

Hi Yuval,

What do you mean when you say export?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 09:09

Hi noppapon,

There is no option to open a new chart using cTrader Automate API.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:51

Hi Yuval,

You don't need to create a position, you can retrieve it from Positions property.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:20

Hi beneditobvn,

In order for somebody to help you, you need to provide the following.

1. The complete cBot code

2. cBot parameters and backtesting settings and dates that will allow us to reproduce this problem

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:17

Hi Yuval,

You can use MarketData.GetBars(). to get bar data for another symbol. There you can find the close prices as well.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:14

Hi tobioluwatoki,

There was one build error which I fixed in the code below

using System;
using System.Collections.Generic;
using System.IO;
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.FullAccess)]
    //AccessRights.FullAccess

    public class MT2cTrader : Robot
    {

        [Parameter("Orders Input File Path", DefaultValue = "C:\\Users\\trader\\AppData\\Roaming\\MetaQuotes\\Terminal\\69420FB8433504FEA0FA029C390238DB\\MQL4\\Files\\TradeCopy.csv")]
        // C:\\Users\\trader\\CSV\\TradeCopy.csv

        public string orders_input_file { get; set; }

        [Parameter("Slippage", DefaultValue = 3.5)]
        public double slippage { get; set; }


        [Parameter("Delimiter", DefaultValue = ";")]
        public string delimiter { get; set; }

        protected override void OnStart()
        {

        }

        private bool debug = true;

        protected override void OnTick()
        {
            //todo, check M.D.
            //price = marketDepth.AskEntries[0].Price; 
            //volume = marketDepth.AskEntries[0].Volume;

            string[] lines = new String[0];

            try
            {
                lines = File.ReadAllLines(orders_input_file);

            } catch (Exception e)
            {
                Print("Exception: " + e.Message);

                return;
            }

            List<string> existing_positions = new List<string>();

            foreach (string line in lines)
            {

                OrderData order = new OrderData(line.Split(delimiter.Length > 0 ? delimiter[0] : ','), MarketData);
                existing_positions.Add(order.label);

                if (debug)
                    Print(line);

                if (order.isCorrect() && (Positions.Find(order.label) == null))
                    ExecuteMarketOrder(order.type, order.symbol, order.lot, order.label, order.sl, order.tp, slippage);
            }

            for (int pos = 0; pos < Positions.Count; pos++)
                if (!existing_positions.Contains(Positions[pos].Label))
                    ClosePosition(Positions[pos]);
        }

    }

    public class OrderData
    {

        private const long mt_lot_coefficient = 100000;
        //corrected_100000_july1
        public Symbol symbol;
        public TradeType type;
        public long lot;
        public int sl;
        public int tp;
        public string label;
        private bool initialized_properly = true;

        public OrderData(string[] raw_pieces, MarketData market_data)
        {
            try
            {
                this.label = raw_pieces[0].Trim();
                this.symbol = market_data.GetSymbol(raw_pieces[1].Trim());
                this.setType(Convert.ToInt32(raw_pieces[2].Trim()));
                this.lot = Convert.ToInt64(this.parseDouble(raw_pieces[3]) * mt_lot_coefficient);
                double price = this.parseDouble(raw_pieces[4]);
                this.sl = this.getPipDistance(price, this.parseDouble(raw_pieces[5]));
                this.tp = this.getPipDistance(price, this.parseDouble(raw_pieces[6]));
            } catch (Exception e)
            {
                return;
            }

            {
                this.initialized_properly = false;
            }
        }

        public bool isCorrect()
        {
            return this.initialized_properly;
        }

        private double parseDouble(string value)
        {
            return double.Parse(value.Trim().Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
        }





        private void setType(int mt_type)
        {
            this.type = mt_type == 0 ? TradeType.Buy : TradeType.Sell;
        }

        private int getPipDistance(double basic_price, double close_price)
        {
            return Convert.ToInt32(Math.Round(Math.Abs(basic_price - close_price) / this.symbol.PipSize));
        }

    }

}

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:09

Hi Yuval,

You can consider writing information in files instead so that the information is not lost after the cBot is restarted.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:07

Hi Wojtek,

No there is no fix yet.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:05

Hi giogferrarizze,

In order for somebody to help you, you need to provide the following.

1. The complete cBot code

2. cBot parameters and backtesting settings and dates that will allow us to reproduce this problem

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
26 May 2020, 08:02

Hi 4TRADERZFX,

Can you please post the complete error message you are receiving?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 15:29

Hi victor.major,

This will be fixed in v3.8. The beta will be released soon. The problem is that when you assign the values to backtesting Close values are set as Source instead of Open. Please try changing the source manually to Open and let me know if this resolves the problem.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 14:59

Hi Vadivelan,

Yes this is correct.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 14:04

Hi Yuval,

No it does not. You need to close the positions using Close() method before you call Stop()  method.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 12:54

Hi Yuval,

You can consider some kind of a condition that will break the loop, like the number of bars.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 12:50

Hi there,

1. There is no difference between kClose > kPreviousClose and isRisingK

2. The period in HasCrossedBelow() indicates how many periods backwards does the method needs to check for a crossover.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 08:51

Hi cgatting,

You will need to provide more information of you want somebody to help you like

  1. What is the cBot suppose to do?
  2. What is it doing instead?
  3. What would you expect the fix to change?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
25 May 2020, 08:47

Hi VertoTrading,

Can you please provide a complete cBot code that builds so that we can check?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous