Just starting out in developing a trading bot in NodeJS using Alpaca API. This is an algo I came up with. Critique would be much appreciated.
X stock loses 10%+ within 2 days while owning asset, triggers sale of stock.
X stock loses 15%+ within 2 days following sale of stock, triggers purchase of stock
Y stock loses 15%+ within 2 days without owning asset, triggers purchase of stock
X or Y stock gains 10%+ while owning asset, nothing happens.
X or Y stock gains 15%+ while not owning asset, nothing happens.
The main principle here is there is no limit on gains, no buy/sell will happen
based on gains. Rather, it focuses on losses to achieve the following:
1. It locks in gains after seeing a limited amount of loss
2. It minimizes losses if too much loss.
3. It grabs stocks when they devalue, getting them for a cheaper price
Example TSLA scenario:
1. We start it by buying 10 shares for $100. Bot action: begins monitoring stock.
2. Gains to $150 on day 1. Total value: $1500, profit: $500, Bot action: none.
3. Loses value from $150 to $140 on day 2. $10 is below 10%. Bot action: none.
4. Loses value from $140 to $130 on day 3. $20 loss in 2 days. Bot action: sell stock.
— NOTE: Thanks to #4, $300 profit is locked in. Account balance is now $1300
5. Loses value from $130 to $110 on day 4. 15% loss. Bot action: buy stock
— NOTE: Thanks to $300 profit, we are able to buy 11 shares instead of 10.
6. Loses value from $110 to $100 on day 5. Less than 10% loss. Bot action: none
7. Gains to $130 on day 6. Bot action: none
8. Gains to $150 on day 7. Bot action: none
9. Gains to $300 on day 8. Bot action: none
10: Loses from $300 to $270. Bot action: sell stock.
— NOTE: Thanks to #10, original total at #5 was $1210, so selling it at total of
— $2970 results in a yield of $1760 profit.
Original investment: $1000
Final total: $2970
CON: If something is wrong with company and there's a bloodbath, the algorithm
would keep buying at 15% loss, then holding until there's another 10% loss,
then selling, then waiting until there's another 15% loss, then buying. This
could potentially eat into profits if there's a constant drop in the stock.
Maybe put in a cap so it if sells twice, it does not buy again and requires
us to manually buy the stock again to have the bot resume using algo?
Submitted November 10, 2020 at 04:09PM by LockesRabb