The idea is that the machine would learn what level to put stops at, and where to put take profits. For example, the machine gets input about security ABC and learns the best place to put a stop. It then modifies this stop, based on the risk (volatility maybe?) of other positions it is taking.

The point is that a machine learning algorithm would analyze its risk and learn where to put stops based on its strategy (any sort of basic strategy, this not what my question is about). It would find that it, for example, has an expectancy of +2% per trade that it takes. Unfortunately, it also learns that it can only reach such a high expectancy when it places its stops and take profits very far from the current price. This makes the trades take significantly longer than is optimal. The machine would then modify its risk management to optimize its expectancy to the optimal amount of time that it is holding positions. It is trying to find the best way to place stops to have a short position holding time, while still trying to achieve a high expectancy.

The formula to evaluate the success of an expectancy on certain holding period would be something like this:

Expectancy / Average_Holding_Period = Evaluated_Expectancy

Where the program is attempting to optimize Evaluated_Expectancy

Does a system exist that works like this? If not, would it be easy to create, and would it be effective?

  • 1
    wouldn't that just be called a trading strategy? There are millions of them out there, mostly in opaque financial institutions Commented Mar 17, 2021 at 11:16
  • 1
    well changing the risk management is then part of the strategy Commented Mar 17, 2021 at 13:04
  • 2
    The Martingale strategy needs enough time as well as enough money, and in both cases “enough” means “infinite”.
    – Mike Scott
    Commented Mar 17, 2021 at 16:19
  • 2
    @Mteam888 But if you use the Martingale for a limited amount of time, whatever the limit is, there’s a chance that you’ll be forced to stop before you’ve recouped your losses and thus make a truly colossal loss.
    – Mike Scott
    Commented Mar 17, 2021 at 18:14
  • 1
    @Mteam888 for a classic Martingale strategy (coin flip, 50% chance of winning, double your bet each time you lose), the chance of being wiped out doesn't go down to thousandths of a percent until 14 iterations. By that time, you've bet a total of 32766 times your initial bet. If it takes you that long to be wiped out, your winnings would have been meaningless to you anyway: Let's say you start with $50k. If you want your chances of a wipeout to be in the thousandths of a percent, your first bet (and therefore your winnings from each successful run) can't be more than $1.52
    – user70548
    Commented Mar 18, 2021 at 9:34

1 Answer 1


You are assuming that the "machine learning" correction will occur before a total wipeout, but you have not proven that this is how it will happen. The risk of total failure remains the same as with a 'non-modified' Martingale system.

You say in a comment "okay, but total wipeout before losses are recouped is very unlikely" - by the same token, profits from such a system would also be small. Go back to the gambler's roulette wheel and look at the core problem of a Martingale system [for ease of math let's assume no green 0's, and thus each bet is perfectly even odds]:

  1. Bet $10 on red, and you have a 50% chance of winning $20, and a 50% chance of losing everything.

  2. Then if you lose, bet $20: 50% chance of getting $40 [after your first loss of $10, and with your new $20 bet, this would be a net win of $10], and a 50% chance of losing everything.

  3. Then if you lose that, bet $40, then bet $80, then bet $160, etc., every time doubling your bet so that at each moment, you have a 50% chance of winning a net $10 based on the value of your original bet in step 1.

The problem is that very soon, if you are incredibly unlucky, you could be $1,000's "in the hole", and you would need to risk the same amount of money just to come back with the same net profit of $10. Probability of being wiped out would be quite low - but the impact would be catastrophic.

It is difficult for humans to 'intuit' what the chance of an "unlikely" risk actually is - typically we will discount an "unlikely" event as "near-impossible", because large numbers can be hard to wrap our heads around. If you had a $160k line of credit, and you followed the Martingale system until you maxed out your credit, you would "win" the net $10 payout 32,767 times out of 32,768 times. ie: you would only lose 0.003% of the time. Sounds impossibly unlikely, right?

Well if everyone in the US [let's say 350M people] did this, then 10,681 people would lose their houses, and everyone else would win $10. Yes the chance is low - but the results are disastrous. Wrapping this system in the idea that "machine learning tweaking" will save you, might just be an attempted veneer to justify that the Martingale itself is an acceptable risk.

  • Thank you for your post, the martingale section of my question is not really applying to my question. I was just saying that was my thought process. I am going to edit that out.
    – mteam88
    Commented Mar 17, 2021 at 20:56
  • Also, this answer does not really answer my question. Can you look into if there are any machine learning systems that do what I am explaining? How easy would it be to create on of these programs (I know Python, and have coded machine learning programs before)
    – mteam88
    Commented Mar 17, 2021 at 20:59
  • I have never connected a python program to a stock market trader system though.
    – mteam88
    Commented Mar 18, 2021 at 12:25
  • @Mteam888 You appear to be severely underestimating the risk of doing what you plan. I say this because (a) you appear not to understand that yes there is a link between 'Martingale System'-thinking and your proposal [ie: your original phrasing reveals the link that you now dismiss]; and (b) you think learning a few more blocks of Python might be enough additional skill for you to make a profitable trading system using "machine learning". If you could do that successfully, you could cash out the code today and buy a few dozen yachts from the money a Wall St. firm would pay you for it. Commented Mar 18, 2021 at 13:15
  • (a) Martingale has nothing to do with what I want to know. I was thinking about risk because I was thinking about Martingale. There is no connection to the actual system (the system is not using the Martingale Strategy). (b) I could supposedly code a program that is profitable and only works on small amounts of money. If you do not believe that it is possible to make money with a strategy that only I could code, you are not answering my question objectively at all. I personally think that It is possible, and that it has been done, and that it works in backtesting and in waking forward.
    – mteam88
    Commented Mar 18, 2021 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .