Algo Trading Guy (@AlgoTradingGuy) header
Algo Trading Guy (@AlgoTradingGuy) profile picture

Sharing how to not blow up your account with algo trading

Joined January 2023
Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)Photo by Algo Trading Guy (@AlgoTradingGuy)
After 9 months and 50,000+ lines of code I've finally done it. Introducing @SpectralAlphaX my no-code algo trading platform! Skip wasting years struggling with scripts and build, test & validate algos with a few clicks! Create algorithms without writing a line of code. - Custom charts with exotic bars - Carefully curated indicators and tools - No-code trading logic builder Research, backtest and optimise without running any scripts. - Measure your signals predictive power - Backtest on 10+ years of historical data - Find robust parameter values Validate your algorithms on unseen data with a few clicks. - Run walk forward analysis - Monte Carlo performance and drawdowns - Paper trading on live data without taking any risks
4
4
41
6,066
I finally cracked it! MT5 communicating with my servers Each EA loaded on a market can now: - Update live data - Send historical data Any algos built on that market will be recalculated automatically and the net position sent back to the terminal to be executed.
2
15
2,444
Soon you could be building trading algorithms just by explaining your idea to an AI!? This is how it'll work in @SpectralAlphaX It's a fully no-code platform, currently you only have to point and click to build, validate and deploy algos. In the background, it creates configurations that my engine understands how to run: - Trading signal - Market regime filtering - Stops fixed and trailing - Risk reduction - Drawdown protection - Position sizing For each one of those sections, i'm training an LLM to understand the prompt and transform it to a form my engine will be able to run. For example: "Help my build a trailing stop that uses the stops indicator with 4x the distance." output: Another example: "Build a chart that uses 1H bars and filter by 40pips volatility" output: Another: "Build a chart that only closes the bar at 9am, 230pm, 5pm and 730pm." Output: So far testing looks promising. Afterwards you can make fine adjustments using the UI, the old fashioned way. Eventually every aspect of the algo can be controlled with just a simple prompt. Even better yet, just being able to describe your idea, the AI will use the documentation it has learnt to come up with the best way to build it. Remember the the goal is to be running 100s of different algos, on all markets and timeframes. Not searching for a single holy grail algo that doesn't exist.
8
919
This is coming soon to @SpectralAlphaX I'm currently building the LLM to take a prompt of the strategy you'd like to run, on what market, using what risk etc. and it automagically creates it for you. You can tweak the parameters and settings manually afterwards. The LLM is trained on all the Guides and Documentation I have written, so maybe... MAYBE it will be like i'm sitting next to you helping you build your algo!?
One of the biggest barriers in quant finance is the need to learn a programming language (or even script). The future will remove this and it is coming sooner than you think. Portfolio123 is in the early stages of using LLMs so that literally anyone with a good idea can quickly design a sophisticated quantitative portfolio. It is still useful even if you know a programming language or script as it can speed up model design. Let the AI do the heavy lifting and refine/tweak/modify afterwards. I think Quantopian would have been a success story if it had come out 14 years later and integrated with LLMs. I also think now is the time for forward looking VCs to keep a close eye on companies like Portfolio123. What will happen when financial savvy people without programming skills can talk to their computers and build strategies and models that used to require someone with a programming degree?
7
1,062
To everyone that runs algos on MT4/MT5: When you are off desk, how do you check up on your algos? Can you control them when mobile?
7
6
2,382
So the results are in: MT4/5 is the winner! Here's how it will be integrated: - Load a prebuilt EA on to the 1-min chart per asset - The EA starts saving live + historical data - Every few seconds get the net position of all algos - Figure out the optimal actions to take to copy the net position for the asset. - Additional functions like dead-man switch, man in the loop and manual execution. Let me know if any other features would be useful. Afterwards, I'll build the cTrader interface.
This week I'm building the integrations for trading terminals. Which one first?
86%MT4/MT5
5%cTrader
5%API (oanda)
5%MatchTrader / TradeLocker
21 votes • Final results
1
3
1,218
I have noticed a common problem with new traders on my platform: They get stuck building their own algos because there are too many options! So I am warming to the idea of building an AI that can take descriptive instructions like: "Build a trend following algo on brent oil, using 30pip range bars. The peaks and valleys of a low pass filter are the signals. Use the standard deviation of the LP filter to prevent whipsaws. Use 4xATR(100) as the stop and use $100 risk per trade." The AI will then translate these instructions and interact with my platform to create the algo. Users can then fine tune the logic etc. directly afterwards. Also ask the AI for feedback on their Walk Forward Analysis results and what steps to take next etc. Rather than having the users dedicate lots of time to reading the docs, the guides and tutorial videos. Would that be useful??
3
11
2,145
As the AI would have my entire knowledge base as the context users could explain the problem with their algo like, my mean reversion gets destroyed in trending markets etc. The AI could suggest improvements based on the guides and examples.
2
514
This week I'm building the integrations for trading terminals. Which one first?
86%MT4/MT5
5%cTrader
5%API (oanda)
5%MatchTrader / TradeLocker
21 votes • Final results
1
1
1
1,695
This I'm week building the Risk module. Bringing @SpectralAlphaX one step closer to trading live through broker terminals. So far: - Fixed lot size per trade. - Fixed $ risk per trade, using stops. - Optimal risk based on a fraction of Optimal F. - Splitting optimal by Long / Short side. Anything else I should add? Let me know!
2
594
Took me 50% longer than I planned. But I've just pushed the Phantom Trading module to the platform. So many edge cases to consider! Now can build skipping rules on the algo's Equity, Drawdown and Balance. Also control the Long / Short side independently. Add all the indicators to the book's series. I also implemented running a factional size during drawdown, but it proved complex to run both (skipped and small) trades at the same time. So instead, I leave it to the downstream execution engine to handle, if an algo is currently skipping trades, execute a reduced size. Make sure to try it out! And let me know how you get on.
Equity Curve Trading is now live! - Protect your account equity - Skip trades during drawdowns - Stop trading when the edge is lost - Re-enter skipped profitable trades - Control Long / Short trades independently Try it out now. Link in bio.
9
1,260
Day 4 of Equity Curve Trading in @SpectralAlphaX My main goals: - I want to run short term algos. - I want to run 100s of algos, all the time, across all markets. - I don't want to be at my desk 24/7 checking each one if they have lost their edge. I've found equity curve trading a good solution for this. As always there is no free lunch! So it's hard to get right. Today I have just finished building the main functions: - Turn off the algos when equity is in drawdown. - Keep track of the equity AS IF you traded the position. - Match the hidden positions once the equity starts recovering. And here is what it looks like. Let’s break it down. It’s a toy trend-following example using a low pass filter. It gets absolutely whipsawed a few times. You can see this in the original grey equity curve. The equity curve trading is simple: - Skip trades if short term LP is below the long term LP. - Match open position once short crossed over long. On two occasions a deep drawdown was avoided. The last big trade was captured, once the equity started rising. Here’s how to build it:
2
9
1,036
The trade list shows all the trades that were skipped.
1
397
You can also plot the skipped trades on the chart. They will be greyed out.
1
334
Here's a great idea from @theswansjr I just finished. Reduce you position size during drawdown periods rather than stop trading completely. Here's how to implement it using @SpectralAlphaX
Replying to @AlgoTradingGuy
Here are two ideas: Partial Position Scaling: Instead of halting trading entirely during drawdowns, implement partial position sizing (e.g., reduce to 50% of the usual size). This allows for continued participation while managing risk. Equity Curve-Based Indicators: Provide the option for users to apply standard technical indicators (e.g., moving averages, Bollinger Bands) to the equity curve. These indicators can generate trading signals, enabling dynamic adjustments to strategy engagement based on performance trends.
5
958
Day 3: logic builder for equity curve trading. With long term trend following, you can miss out on big trades if using the drawdown protection. So being able to enter the currently open (skipped) position is important. Is there anything else I should add?
1
2
527
Next steps in building the Drawdown protection module: Adding indicators to the book's series: Equity, Drawdown and Balance. Each of these can be further split by Long and Short side.
This week I'm working on Equity Curve Trading. It works by stopping the execution of an algo when it is in a deep drawdown. The trades and performance are still calculated on paper. When the equity starts recovering the, execution is turned on again. Pros: - Improves risk/adjusted returns. - Algos automatically stop when they lose their edge. - Operationally easier to run a portfolio of 100s of algos. Cons: - Almost always reduces absolute returns. Have you tried equity curve trading in your algos? Let me know!
1
1
4
1,160
And here it is, Low pass filter added to the Equity curve. Seems like when the equity is below the LP filter, it's a good time to turn off the algo 😉
1
5
279
This week I'm working on Equity Curve Trading. It works by stopping the execution of an algo when it is in a deep drawdown. The trades and performance are still calculated on paper. When the equity starts recovering the, execution is turned on again. Pros: - Improves risk/adjusted returns. - Algos automatically stop when they lose their edge. - Operationally easier to run a portfolio of 100s of algos. Cons: - Almost always reduces absolute returns. Have you tried equity curve trading in your algos? Let me know!
12
6
1
74
8,922
So first step is to split your equity/balance/drawdown by Long and Short sides. Because why turn off an algo, if it still works on one side and not the other? The bottom graph shows the drawdowns for each side. Initially the long side recovers. Then the short side in the last trade. Still this is not enough. The flat periods distort the on/off signals. So next step is to compress the flat periods into one continuous curve.
2
4
713
Day 2 Updates: It's important to understand that this kind of protection needs to be baked into the algo itself. As this changes it's behaviour. For example: A short trade that closes a long now no longer triggers, as the short side is in drawdown. This creates a different equity path. The protection logic needs to be inside the algo event loop not added afterwards. Simple to understand, hard to implement. As you need to track both sets of trades, the ones actually executed as well as the ones skipped!
1
278