Hello people,
This is my first thread on ff. After many experiences with manual trading, I decided to start building a bot. Ever since AI came along, I’ve been trying and trying, and I’m still trying.
A few days ago, I had an idea, and with the help of AI, I wrote a simple Python code for a bot that learns by itself and trades XAUUSD.
I’ve attached the code.
We can test and improve it together. I’m not a programmer, so please excuse me if the code isn’t perfect.
Right now, I’m in the process of testing this script. I want to let it run for a week to see how it performs on a demo account.
How the script is working?
The script watches each bar, checks your conditions, decides to trade or not, and records all info for future improvement
Each new candle:The script reads all key market data (candle size, volume, ADX, ATR, EMA ).
Checks trading rules:It checks if all your BUY or SELL conditions are true at that moment.
Decision:
If yes: marks a signal (had_signal = 1), enters a trade (entered = 1), and logs the trade data.
If no: records the context and why no trade was made (had_signal = 0, entered = 0).
Logs everything:Saves every observation (trade or not) so the strategy can learn over time what patterns led to good or bad outcomes.
P.S.: Try this on a demo account.
This is my first thread on ff. After many experiences with manual trading, I decided to start building a bot. Ever since AI came along, I’ve been trying and trying, and I’m still trying.
A few days ago, I had an idea, and with the help of AI, I wrote a simple Python code for a bot that learns by itself and trades XAUUSD.
I’ve attached the code.
We can test and improve it together. I’m not a programmer, so please excuse me if the code isn’t perfect.
Right now, I’m in the process of testing this script. I want to let it run for a week to see how it performs on a demo account.
How the script is working?
The script watches each bar, checks your conditions, decides to trade or not, and records all info for future improvement
Each new candle:The script reads all key market data (candle size, volume, ADX, ATR, EMA ).
Checks trading rules:It checks if all your BUY or SELL conditions are true at that moment.
Decision:
If yes: marks a signal (had_signal = 1), enters a trade (entered = 1), and logs the trade data.
If no: records the context and why no trade was made (had_signal = 0, entered = 0).
Logs everything:Saves every observation (trade or not) so the strategy can learn over time what patterns led to good or bad outcomes.
P.S.: Try this on a demo account.
Attached File(s)