Internet Access for Android (Chat appp)
-
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 -
@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? -
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:
- Trading strategy parameters (MA periods, RSI period, overbought/oversold levels).
- Moving Average (MA) and Relative Strength Index (RSI) calculations.
- Trading logic checking for buy/sell signals based on MA crossover and RSI levels.
- 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:
- Install Qt Creator.
- Create a new QML project.
- Paste the code into the main.qml file.
- Modify the code to suit your needs.
- Run the project to see the trading signals.
Please consult Qt documentation and QML tutorials for further guidance.