When run bot it gives error: PlatformNotSupportedException: Operation is not supported on this platform.

Created at 21 Jan 2023, 20:51
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!
MongolTrader's avatar

MongolTrader

Joined 12.02.2015

When run bot it gives error: PlatformNotSupportedException: Operation is not supported on this platform.
21 Jan 2023, 20:51


I want to try run below code. But it gives error. This code is  connect to mysql database server and retrive my sample data from mysql database. But it not run. Please check where is matter?

///////////////////////////////////////////

20/01/2023 08:00:00.645 | Crashed in OnBar with PlatformNotSupportedException: Operation is not supported on this platform.

20/01/2023 08:00:00.645 | CBot instance [Db, EURUSD, t2] crashed with error "Crashed in OnBar with PlatformNotSupportedException: Operation is not supported on this platform."

///////////////////////////////////////

Source Code: 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using MySql.Data.MySqlClient;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.FullAccess)]
    public class Db : Robot
    {
        
        protected override void OnStart()
        {


           // System.Diagnostics.Debugger.Launch();

        }

        protected override void OnBar()
        {

            string connstring = "server=localhost; uid=root; pwd=root; database=myfxdata";
            MySqlConnection con = new MySqlConnection(connstring);
            con.ConnectionString= connstring;
            con.Open();
            string sql = "select * from pricersi";
            MySqlCommand cmd = new MySqlCommand(sql, con);
            MySqlDataReader reader = cmd.ExecuteReader();


            while (reader.Read())
            {
                Print("Price:{0} Rsi: {1}", reader["price"], reader["rsi"]);
            }
            
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}


@MongolTrader
Replies

... Deleted by UFO ...