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

PanagiotisCharalampous
14 Aug 2024, 10:13

RE: RE: RE: RE: RE: Calling DLL functions help.

rick2010 said: 

rick2010 said: 

PanagiotisCharalampous said: 

rick2010 said: 

PanagiotisCharalampous said: 

Hi there,

cBots are based on .Net. Therefore you can only call dll files based on managed code. If your dll is based on managed code, you should be able to use it.

Best regards,

Panagiotis

Thanks for the reply. I figured that was the case. I got a DLL written in managed C/C++. I need to be able to call this DLL from the cBot. I guess the only way to do that is to create a .Net DLL proxy that will call my C++ DLL?

Check the article below. It should help 

https://learn.microsoft.com/en-us/dotnet/framework/interop/consuming-unmanaged-dll-functions

Thanks

I created a .NET DLL wrapper class that calls my unmanaged C++ DLL functions ok. I added the code below to the cBot and it compiles fine in cTrader but when I run the cBot it says it can't find the DLL even though the DLL is in the same directory?

    internal static class NativeMethods {
    
        [DllImport("Client.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern bool connClient(uint id, char[] username, char[] password);
    }

13/08/2024 22:06:42.127 | Info | CBot instance [Client_CBOT, EURUSD, h1] started.
13-08-2024 22:06:42.908 | Error | Crashed in OnStart with DllNotFoundException: Unable to load DLL 'Client.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)

Any ideas? Do I have to use the .NET DLL wrapper… doesn't make sense to do that when cBot is built in .NET?

Make sure your dll is copied to the output directory. Check the Copy Local property and make sure is set to true

 


@PanagiotisCharalampous

PanagiotisCharalampous
14 Aug 2024, 10:08

RE: RE: HTTP requests with cBot Cloud instance

zinger6673 said: 

PanagiotisCharalampous said: 

Hi there,

No, internet access is not permitted for cBots executed on the cloud.

Best regards,

Panagiotis

Thanks for the reply, If internet access is not permitted then why does it say here https://help.ctrader.com/ctrader-algo/synchronisation/requirements-for-cbots/#api-features that we can connect to a WebSocket server as long its port 25345. Is this article outdated or is it possible?
 

using System;using cAlgo.API;namespace cAlgo.Robots {    [Robot(AccessRights = AccessRights.None, AddIndicators = true)]    public class TESTlistenonly : Robot {        public WebSocketClient client;        public string uri;                protected override void OnStart() {            Print("attempting connection");            client = new WebSocketClient();            var uri = new Uri("wss://server:25345/");            client.Connect(uri);            Print("WebSocket connection opened");        }    }}

I have my own server running on port 25345 and it works on local execution but on the cloud it says this

There was no mention of web sockets in the initial post. Yes, it's possible to use web sockets through port 25345. Does your server listen to this port?


@PanagiotisCharalampous

PanagiotisCharalampous
14 Aug 2024, 10:05

Hi there,

You are doing nothing wrong. cBots running locally require cTrader to be running.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
14 Aug 2024, 10:03

Hi there,

There is no such feature at the moment.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 15:54

Hi there,

As per the message, you are overriding an obsolete member. You should use the Position.Closed event instead.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 15:52

Hi there,

Can you share the code so that we can reproduce this issue?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 12:15

RE: RE: Total P&L

facchinm92 said: 

PanagiotisCharalampous said: 

Hi there,

This field is not available at the moment. It will be added in a future update.

Best regards,

Panagiotis

by any chance can you tell me when it will be released approximately? and if the platform will update automatically or will I have to search for it on the site

Hi there,

The platform will update automatically but I do not have a date for the update.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 06:35

Hi there,

This field is not available at the moment. It will be added in a future update.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 05:11

Hi there,

You can find all the information you need in the link below

https://help.ctrader.com/fix/

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 05:06

Hi there,

If you are looking to delete your demo accounts, you can  use the link below. Please make sure you have closed all your positions and canceled all your orders before deleting your accounts.

https://id.ctrader.com/my/settings/accounts

You can use the link below to delete your cTrader ID. Note that in order to delete your cTrader ID, all your accounts need to be deleted first.

https://id.ctrader.com/my/settings/credentials 

Best regards, 

Panagiotis
 


@PanagiotisCharalampous

PanagiotisCharalampous
13 Aug 2024, 05:05

RE: RE: What's the sanest way to access a completed bar?

karatedog said: 

PanagiotisCharalampous said: 

…we cannot change something that works and thousands of cBots are built on it…

Though this post is a bit old, I disagree with the statement as I see the opposite being true all the time.

You are not really changing something that has thousands of working code relying on it, you create a new one and cleverly separate the two so people have time to adapt to the new version (and you give help and hints on the way to assist them). Otherwise you are locking yourself to a fixed path and I'm sure what was good and mainstream 10 years ago is outdated today. You cannot maintain v1.0 compatibility forever.

Most of the programming languages do this between major versions but Python is a good example with its change between v2.x and v3.x. As a trading language example Tradingview uses code version annotation in their Pine script to allow them completely revamp the code if they want to.

Hi there,

The argument was about changing OnBar() method, not adding something new. Since then we have added OnBarClosed() method for this purpose.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 11:16

RE: RE: Web Pending Orders

ctid6390262 said: 

 

 

 

PanagiotisCharalampous said: 

Hi there,

Can you share screenshots/videos so that we can understand what are you referring to?

Best regards,

Panagiotis

 

So here is market order with the Lot and TP/SL Lines which are moveable 

But when I select limit the lines vanish

Thanks, this feature will be added in the next update of cTrader Web


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 08:55

Hi there,

Can you share screenshots/videos so that we can understand what are you referring to?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 08:50

Hi eynt,

You need to understand how cTrader and trading works. The event is not triggered late. It's triggered as soon as the message arrives from the server. There will always be latency between the price closing the position and the execution of the order. You can't know that something happened before it happened.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 05:24

Hi there,

Spotware cTrader is used for demonstration purposes only and the settings are not kept up to date. If you wish to backtest on realistic market data, it is better to use your broker's demo account.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 05:20

RE: RE: RE: RE: RE: RE: RE: Load more History on Backtest

eynt said: 

When is v5.2 expected to be released?

Thanks

We do not have an ETA unfortunately


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 05:20

RE: RE: RE: RE: RE: RE: RE: RE: How can I know when the stop loss is triggered

eynt said: 

It makes a lot of sense if cTrader cant provide accurate real time data.

Is there a way via code to tell cTrader at OnTick to check *now* from the broker the positions status instead of waiting for the Positions.Closed event to be triggered?

 

Thanks

Broker is using the cTrader platfrom. The positions information is stored in cTrader Server. cTrader Desktop gets its information from cTrader Server. This information is available on Positions collection. There is no other source of positions. There is no way to know that a position has closed before the Positions.Closed event is triggered.


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 05:15

RE: Daily Limit on loss and Win

firemyst said: 

There is a way to do it, but you have to code it into your bots. Here's an example:

//Get historical tradePosition p1 = args.Position;//Running Totals_runningTotalsPipsGainedLost += p1.Pips;_runningTotalsNetGainLoss += p1.NetProfit//Stop the bot if the running net gain/loss pips falls below our specified amountif (_runningTotalsPipsGainedLost < StopBotWhenPipLossesFallBelow){	//stop bot	Stop();}//Stop the bot if the running net gain/loss total falls below our specified amountif (_runningTotalsNetGainLoss < StopBotWhenLossesFallBelow){	//stop bot	Stop();}

Note that this only works on each individual bot instance for each bot.

If you want the running totals to be across all instances of a particular bot, then you need to set static variables that are public that all bot code would have access to.

Have your bots check that value every time they start, and before entering any positions. If that global static amount is below a certain threshold, either stop your bot, or don't allow it to enter a new position.

 

 

I assume that the trader wants to block trading for the entire account.


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 05:12

Hi there,

As per the message, email notifications are disabled for cloud execution.

Best regards,

Panagiotis

 


@PanagiotisCharalampous

PanagiotisCharalampous
12 Aug 2024, 05:09

RE: RE: How to upload my algos to cloud?

leonwijeyesinghe said: 

PanagiotisCharalampous said: 

Hi there,

You can read about synchronization in the link below

https://help.ctrader.com/ctrader-algo/synchronisation/

Best regards,

Panagiotis

Hello,

I've looked through, but can't see the actual instructions on how to upload.  Can you please display the exact section?

Thanks

Hi there,

You just need to enable synchronization in settings. As soon as you do, cTrader will upload your cBots to the cloud. 
 

Best regards,

Panagiotis


@PanagiotisCharalampous