Next Article in Journal
On Strong Approximation in Generalized Hölder and Zygmund Spaces
Previous Article in Journal
What Are Recurrent Expansion Algorithms? Exploring a Deeper Space than Deep Learning
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

A Permutation-Based Mathematical Heuristic for Buy-Low-Sell-High †

1
The Functor Lab, Department of Cognitive and Brain Science, Ben-Gurion University of the Negev, Beer-Sheva 8443944, Israel
2
Gilasio Coding, Tel-Aviv 6458701, Israel
*
Author to whom correspondence should be addressed.
Presented at the 1st International Online Conference on Mathematics and Applications, 1–15 May 2023; Available online: https://iocma2023.sciforum.net/.
Comput. Sci. Math. Forum 2023, 7(1), 8; https://doi.org/10.3390/IOCMA2023-14380
Published: 28 April 2023

Abstract

:
Buy-low-sell-high is one of the basic rules of thumb used by individuals for investment, although it is not considered to be a constructive strategy. In this paper, we show how the appropriate representation of a minute-by-minute trading time series through ordinal (i.e., permutation) patterns and the use of a simple decision heuristic may surprisingly result in significant benefits. We do not compare our proposed approach to sophisticated methods in trading but show how a mathematical model adhering to the idea of bounded rationality may result in significant benefits.

1. Introduction

The sophistication of current mathematical finance invites the question of whether complex models are necessary for reaching significant gains in financial markets. In this context, it may be interesting to study how simple models may support profitable decision-making even in situations, such as high-frequency trading, imbued with uncertainty. In this paper, we draw on the idea of bounded rationality (e.g., [1]) and the surprising performance of simple models over complex ones (e.g., [2]) to show that a permutation-based representation of financial time series and the use of a simple version of the buy-low-sell-high strategy surprisingly allow us to successfully perform high-frequency (HF) minute-by-minute trading.

2. Materials and Methods

We use the minute-by-minute prices of various stocks [3] and represent the stock’s prices as a time-series. Given a one-dimensional time series S(t) of length N, we partition the series into overlapping blocks of length D (the embedding dimension) using a time delay τ. The elements in each block or vector are then sorted in ascending order and the vector is mapped into one of D! permutations (i.e., πi), each representing the ordinal pattern of the elements. For D = 3 there are six possible permutations: π1 = {0,1,2}, π2 = {0,2,1}, π3 = {1,0,2}, π4 = {1,2,0}, π5 = {2,0,1}, and π6 = {2,1,0}. This results in a symbolic sequence of permutations: {πs} s = 1 … n. The idea of mapping (i.e., representing) a time series of values into a time series of permutations may be highly relevant to prediction in natural environments [4]. For D = 3 and τ = 1, which are the focus of our study, there are only three legitimate transitions for each permutation. What is important to realize is that the constraints imposed on the transition from one permutation to the next significantly reduce the uncertainty associated with the next permutation. Let us represent a time series of prices as a series of permutations length 3. Here, we may adopt a buy-low-sell-high (BLSH) strategy: Whenever we observe a decline in the price from tn to tn+1, we buy n ≥ 1 units of the stock and aim to sell it in the next step (i.e., tn+2) if an increase is observed. There are three permutations where a decline of a price is observed from tn to tn+1: π3 = {1,0,2}, π5 = {2,0,1}, and π6 = {2,1,0}. In two of these cases, we may have a profit from selling the stock at the third step. In one case (i.e., π6), a failure is experienced when selling the stock in the third step. In two of the cases, permutations 3 and 5, the BLSH is a successful strategy, whereas in the third case, the one of permutation 6, it is a failure. Therefore, the Minimal Entrance Point (MEP) to a rational BLSH strategy as described above is that:
100   n π 3 + π 5   n π 3 + π 5 + π 6   51  
meaning that the relative percent of permutations 3 and 5 in the time series of permutations is equal to or greater than 51. The MEP is a simple heuristic for selecting stocks for trading and applying the simple BLSH strategy as described above. For example, we have analyzed the time series of 500 stocks (11 September 2017 to 16 February 2018), represented the time series as a series of permutations, and for each stock computed its MEP and the 95% Confidence Interval (CI) for the MEP. The data cover a time range of six months. Sorting the stocks according to the lower bound of their MEP 95% CI, we have identified the top seven stocks and used them for the analysis. According to the idea presented above, selecting stocks according to their MEP should result in a beneficial BLSH strategy. However, the MEP is a necessary but insufficient condition for a successful BLSH strategy. The next phase is to gain a quick estimation of the expected value of applying the BLSH. To compute the expected value, we must somehow estimate the outcome of selling the stock at the third component of each permutation in two scenarios: gain and loss. For simplicity, we assume that in the context of HF minute-by-minute trading, the average delta in price from minute to minute—Δ—is relatively stable and small. Therefore, for permutation 5 (i.e., 2, 0, 1) where a decline of the price is observed and then an increase, we may heuristically assume that the price increase is half the delta in price. Given our ignorance of the size of the decline from rank 2 to rank 0, it is simple to assume under our ignorance that the increase in price from rank 0 to rank 1 is half the size of the delta. In this context, buying a stock at the price of ω and selling at ω + 0.5Δ would leave us with a gain of 0.5Δ. According to the same logic, for permutation 3, the average expected gain is 1.5Δ. In all of the cases where we buy a stock after observing a price decline, the loss expected after observing another decline (permutation 6) is Δ. Following a simple expected value analysis:
E V = P X i X i
we should expect that in adopting a BLSH strategy, where we gain whenever we encounter permutations 3 and 5 and lose whenever we encounter permutation 6, the expected value is positive, meaning that applying the BLSH strategy to the series of permutations under the constraint imposed by the MEP is a beneficial strategy. In other words, if the MEP is high enough and the difference in the stock price is small and consistent, then applying the BLSH strategy to the stocks selected using the MEP heuristics should be (probabilistically) beneficial. In HF trading based on the closing price of a minute-by-minute time series, there is a basic condition whereby we may calculate the optimal proportion of our total bankroll to bet. According to the Kelly criterion, the optimal proportion of our total bankroll to bet should be:
f * = bp q b
where p is the probability of success, q is the probability of failure, and b is the odds or the amount we stand to win to the amount we stand to lose. b can be estimated through simulating the time series, but we may also assume that in the short run of a one-minute difference, the benefits of winning are the same as those of losing. Given this assumption, we may set b to “1”. If the opening price of a stock is USD 11.23 and p = 63% (rounded), the Kelly score is 50%. However, as Kelly represents the limit of a rational bet, a more cautious strategy should be to use a fraction of Kelly such as 0.33 of the f*. The proportional Kelly (0.33) score is 17%. In this case, our optimal betting size would be up to 17% of our total bankroll. This limit is important to the rational agent as in the above context, it provides her with a simple heuristic for deciding whether it is beneficial to enter the BLSH procedure described above. For example, if the price of a single stock is USD 11.23 and Kelly advises you to risk up to 17% of your total bankroll (BR), then your total bankroll or your “pocket size” must be at least:
BR = 100 P r i c e   f * = 100 11.23 17 = 66   USD
for trading with a single stock at a time, which mean that unless you have a pocket size of USD 66, it is better not to enter the game given the above constraints. The overall heuristic presented so far may be generally described as follows: (1) Search for stocks satisfying the MEP criterion. (2) Rank the stocks according to their MEP score and select the top k. (3) For each stock, compute the proportional Kelly score. (4) Use the price of a single unit to determine the minimal “pocket size” (i.e., BR). (5) If the minimal pocket size is higher than your actual pocket size, then refrain from playing the game; otherwise, apply the BLSH strategy. (6) When applying the BLSH strategy, buy whenever you observe a decline in price and sell immediately afterward. To test the above heuristic, we have analyzed the minute-by-minute stock prices of the seven stocks previously selected. We have used a simple heuristic:
For a given selected stock:
Define a bankroll (BR) which is the sum that you begin with. We use BR = 100 ∗ the initial price of the stock.
Start with the first minute of your time series.
Your focal point, the minute you observe is always defined as n.
   If you observe a decrease in price from tn−1 to tn, use the relative Kelly of your BR to buy n stocks.
   If you observe an increase from tn to tn+1 THEN sell, update your BR, and restart the game from tn+2. At this point, tn+2 is your focal point.

3. Results

See Table 1, where one can see that applying our procedure for minute-by-minute trading results in significant gains.

Author Contributions

Conceptualization, Y.N.; methodology, Y.N. and Y.C.; software, Y.C.; writing—original draft preparation, Y.N. and Y.C.; writing—review and editing, Y.N. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The time series of permutations for the tested stocks are available here: doi:10.5061/dryad.vq83bk3r9.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Simon, H.A. Models of Man; Wiley: New York, NY, USA, 1957. [Google Scholar]
  2. Neuman, Y.; Cohen, Y. Predicting Change in emotion through ordinal patterns and simple symbolic expressions. Mathematics 2022, 10, 2253. [Google Scholar] [CrossRef]
  3. Available online: https://www.kaggle.com/nickdl/snp-500-intraday-data (accessed on 1 January 2021).
  4. Neuman, Y.; Tamir, B.; Cohen, Y. Short-term prediction through ordinal patterns. R. Soc. Open Sci. 2021, 8, 201011. [Google Scholar] [CrossRef]
Table 1. The procedure’s gains for the five selected stocks.
Table 1. The procedure’s gains for the five selected stocks.
StockThe Initial BRGain (USD)%Gain
NWS1345+4478355
AES1124+61655
NWSA1323+39130
CHK336+628172
F1140+46841
HPE1325+38629
WU1879+36027
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Neuman, Y.; Cohen, Y. A Permutation-Based Mathematical Heuristic for Buy-Low-Sell-High. Comput. Sci. Math. Forum 2023, 7, 8. https://doi.org/10.3390/IOCMA2023-14380

AMA Style

Neuman Y, Cohen Y. A Permutation-Based Mathematical Heuristic for Buy-Low-Sell-High. Computer Sciences & Mathematics Forum. 2023; 7(1):8. https://doi.org/10.3390/IOCMA2023-14380

Chicago/Turabian Style

Neuman, Yair, and Yochai Cohen. 2023. "A Permutation-Based Mathematical Heuristic for Buy-Low-Sell-High" Computer Sciences & Mathematics Forum 7, no. 1: 8. https://doi.org/10.3390/IOCMA2023-14380

Article Metrics

Back to TopTop