Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Internet Access for Android (Chat appp)

Internet Access for Android (Chat appp)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 257 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SlayH
    wrote on 31 Oct 2024, 05:17 last edited by
    #1

    Hello Everyone

    I have created a chat app using QML and C++ for the backend Logic.
    It works fine when I am using it on desktop, I have also built it for WASM and people from different countries have used it through githup pages.

    I try to built it for Android, for some reason I can't login when using the emulator.

    [https://github.com/HSley13/chatApp_client](github link)

    A little bit of help would be much appreciated.
    Thanks

    J 1 Reply Last reply 31 Oct 2024, 06:15
    0
    • S SlayH
      31 Oct 2024, 05:17

      Hello Everyone

      I have created a chat app using QML and C++ for the backend Logic.
      It works fine when I am using it on desktop, I have also built it for WASM and people from different countries have used it through githup pages.

      I try to built it for Android, for some reason I can't login when using the emulator.

      [https://github.com/HSley13/chatApp_client](github link)

      A little bit of help would be much appreciated.
      Thanks

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 31 Oct 2024, 06:15 last edited by
      #2

      @SlayH Did you add needed permissions (https://developer.android.com/develop/connectivity/network-ops/connecting?hl=de)?
      Did you do any debugging and error handling to see where exactly and for what reason it fails?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 31 Oct 2024, 13:02
      0
      • I Offline
        I Offline
        Immanuel
        wrote on 31 Oct 2024, 10:01 last edited by
        #3

        Here's a basic Forex trading strategy using QML (Qt Modeling Language):

        qml
        import QtQuick 2.12
        import QtQuick.Controls 2.12
        import QtQuick.Layouts 1.12
        
        // Define trading strategy parameters
        property real maShortPeriod: 50
        property real maLongPeriod: 200
        property real rsiPeriod: 14
        property real overboughtLevel: 70
        property real oversoldLevel: 30
        
        // Define trading signals
        property bool buySignal: false
        property bool sellSignal: false
        
        // Moving Average calculation
        function calculateMA(period, data) {
            var sum = 0;
            for (var i = 0; i < period; i++) {
                sum += data[i].close;
            }
            return sum / period;
        }
        
        // RSI calculation
        function calculateRSI(period, data) {
            var gain = 0;
            var loss = 0;
            for (var i = 0; i < period; i++) {
                var diff = data[i].close - data[i-1].close;
                if (diff > 0) {
                    gain += diff;
                } else {
                    loss -= diff;
                }
            }
            var avgGain = gain / period;
            var avgLoss = loss / period;
            return 100 - (100 / (1 + avgGain / avgLoss));
        }
        
        // Trading logic
        function checkSignals(data) {
            var shortMA = calculateMA(maShortPeriod, data);
            var longMA = calculateMA(maLongPeriod, data);
            var rsi = calculateRSI(rsiPeriod, data);
            
            if (shortMA > longMA && rsi < oversoldLevel) {
                buySignal = true;
                sellSignal = false;
            } else if (shortMA < longMA && rsi > overboughtLevel) {
                buySignal = false;
                sellSignal = true;
            } else {
                buySignal = false;
                sellSignal = false;
            }
        }
        
        // Example usage
        Rectangle {
            width: 800
            height: 600
            
            // Load historical data
            ListModel {
                id: historicalData
                // Load data from CSV or database
            }
            
            // Call trading logic function
            Component.onCompleted: checkSignals(historicalData)
            
            // Display trading signals
            Text {
                text: "Buy Signal: " + buySignal
                anchors.top: parent.top
                anchors.left: parent.left
            }
            
            Text {
                text: "Sell Signal: " + sellSignal
                anchors.top: parent.top
                anchors.right: parent.right
            }
        }
        

        This QML code defines:

        1. Trading strategy parameters (MA periods, RSI period, overbought/oversold levels).
        2. Moving Average (MA) and Relative Strength Index (RSI) calculations.
        3. Trading logic checking for buy/sell signals based on MA crossover and RSI levels.
        4. Example usage loading historical data and displaying trading signals.

        Note:

        • This is a simplified example and should be expanded to include more features, error handling, and risk management.
        • QML is primarily used for UI development, not trading strategy implementation. Consider using a programming language like Python or C++ for production-ready trading strategies.
        • Always backtest and validate trading strategies before using them in live markets.

        To use this code:

        1. Install Qt Creator.
        2. Create a new QML project.
        3. Paste the code into the main.qml file.
        4. Modify the code to suit your needs.
        5. Run the project to see the trading signals.

        Please consult Qt documentation and QML tutorials for further guidance.

        1 Reply Last reply
        0
        • J jsulm
          31 Oct 2024, 06:15

          @SlayH Did you add needed permissions (https://developer.android.com/develop/connectivity/network-ops/connecting?hl=de)?
          Did you do any debugging and error handling to see where exactly and for what reason it fails?

          S Offline
          S Offline
          SlayH
          wrote on 31 Oct 2024, 13:02 last edited by
          #4

          @jsulm Yes I did add the needed permission in the AndroidManifest.xml file but still didn't work

          1 Reply Last reply
          0

          2/4

          31 Oct 2024, 06:15

          • Login

          • Login or register to search.
          2 out of 4
          • First post
            2/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved