Troubles with new version

Created at 17 May 2024, 13:28
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RM

rmarquez.trading

Joined 05.04.2024

Troubles with new version
17 May 2024, 13:28


Hi,

I updated my ctrader to use the cloud feature. I  have a cbot that makes requests to an external api and also sends messages to telegram through their api. However the cbot does not make requests, does this update support this?

Thank you in advance. 


@rmarquez.trading
Replies

Hildeguard
17 May 2024, 18:31 ( Updated at: 18 May 2024, 06:36 )

I have the same issue, see https://ctrader.com/forum/calgo-support/43776

I have not figured out any solution, yet, but i am highly interested.


@Hildeguard

PanagiotisCharalampous
18 May 2024, 06:37

Hi there,

Can you share the cBot code so that we can check?

Best regards,

Panagiotis


@PanagiotisCharalampous

Hildeguard
18 May 2024, 09:10 ( Updated at: 19 May 2024, 05:16 )

RE: Troubles with new version

PanagiotisCharalampous said: 

Hi there,

Can you share the cBot code so that we can check?

Best regards,

Panagiotis

 

public class MyTeleBot
   {
       public string Token { get; set; }
       public long ChatId { get; set; }

       public MyTeleBot(string token, long chatId)
       {
           UseTls12();
           Token = token;
           ChatId = chatId;
       }

       public string Send(string message, params object[] args)
       {
           var formattedMessage = string.Format(message, args);
           var myurl = string.Format("https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}&parse_mode=HTML", Token, ChatId, formattedMessage);
           return myurl;
       }
       
       private void UseTls12()
       {
           // Required for SSL/TLS connection with Telegram
           // Will work only on .Net 4.5 or higher
           // Using number to avoid compilation error
           System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
       }
   }

 

and for example onStart or onBar or onTick:
string sendthis = MyTeleBot.Send("{2} | Started this-Bot on {0} with {1}-TF", SymbolName, TimeFrame, Server.Time);
var respo = Http.Get(sendthis);

Print(respo.IsSuccessful);  // -> gives False when Bot started in Cloud and True when Bot started locally


@Hildeguard