=Paper= {{Paper |id=Vol-3762/538 |storemode=property |title=VolTS Augmented: An Improvement of a Volatility-based Trading System to Forecast Stock Markets Trends |pdfUrl=https://ceur-ws.org/Vol-3762/538.pdf |volume=Vol-3762 |authors=Ivan Letteri |dblpUrl=https://dblp.org/rec/conf/ital-ia/Letteri24 }} ==VolTS Augmented: An Improvement of a Volatility-based Trading System to Forecast Stock Markets Trends== https://ceur-ws.org/Vol-3762/538.pdf
                                VolTS Augmented: An Improvement of a Volatility-based
                                Trading System to Forecast Stock Markets Trends
                                Ivan Letteri1,*
                                1
                                    University of L’Aquila, Coppito (AQ), 67100, Italy


                                                                         Abstract
                                                                         In this study, we proposed an improvement to a previous strategy of the work called VolTS. It is a module
                                                                         of the AITA framework that integrates statistical analysis with machine learning techniques for forecasting
                                                                         stock market trends. The main goal is to verify the cointegration in volatility-based trading strategies within
                                                                         financial markets, and then to devise a methodology that leverages market dynamics to yield profits. This
                                                                         methodology improvement incorporates the Dynamic Time Warping to assess the similarity of trend sequences,
                                                                         even when they exhibit temporal misalignment coupling it. With the K-Nearest Neighbors algorithm, which
                                                                         identifies the most akin price patterns, we construct a sophisticated model spotlighting stocks among the nine
                                                                         largest ones listed on both the NYSE and Nasdaq exchanges that exhibit analogous price movements to our
                                                                         portfolio stocks. From volatility assets pointofview, it is applied the Granger Causality Test to the dataset
                                                                         containing the same mid-range volatility clusters of the chosen stocks, thus identifying them with robust
                                                                         predictive relationships. These “predictor” stocks were pivotal in shaping our trading strategy, serving as trend
                                                                         indicators to inform decisions on target stock trades. The empirical findings demonstrated the effectiveness of
                                                                         our method in identifying, small but not rare, profitable day-trading opportunities. This success was attributed
                                                                         to the predictive insights from volatility clusters, the Granger causality relationships, and Co-integration
                                                                         trends identified among the stocks. In conclusion, our research has significantly contributed to the realm
                                                                         of volatility-based trading strategies by introducing a methodology that mixes statistical techniques with
                                                                         machine learning.

                                                                         Keywords
                                                                         Dynamic Time Warping, K-Nearest Neighbour, Technical Analysis, Stock Market Prediction, Algorithmic
                                                                         Trading, Backtesting



                                1. Introduction                                                              enced stocks, can Dynamic Time Warping (DTW)
                                                                                                             [2] be paired with K-Nearest Neighbours (KNN) to
                                This article explores the emerging field of volatility- spotlight stocks that “fluctuate” to the same tune
                                based trading strategies, which is encountering exploiting the delay among them?
                                promising growth in the financial sector. Artificial                            This study aimed to formulate trading strategies
                                intelligence (AI) has emerged as a pivotal player, based on predictive connections affecting influen-
                                offering robust tools for analysing market volatil- tial stocks as trend indicators. The proposed time
                                ity and leveraging it for profitable outcomes. AI series study, related to the prices and volatility-
                                models, trained to estimate mean volatility, offer driven trading strategy was then rigorously evalu-
                                valuable insights into the inherent uncertainty and ated through backtesting and performance analysis
                                risk linked to individual securities or the overall to validate its reliability. Through empirical evi-
                                market [1].                                                                  dence, this research has given an improvement to
                                   Our research was primarily driven by the follow- the previous volatility-based trading strategies [3].
                                ing key questions: 𝑅𝑄1 : Can k-means clustering                                 The augmented AI trading strategy utilised k-
                                effectively determine the mean volatility of promi- means clustering of average volatility data [4]. This
                                nent stocks? 𝑅𝑄2 : defined the stocks with the same data encompassed nine major stock markets. Our
                                mid-term volatility, can the Granger Causality Test initial objective was to identify distinct volatility
                                be employed to identify predictive influences be- patterns within the market and subsequently group
                                tween stocks? 𝑅𝑄3 : Established the subset of influ- assets accordingly. Following this, the Granger
                                                                                                             Causality Test (GCT) [5] was leveraged to pinpoint
                                Ital-IA 2024: 4th National Conference on Artificial In-
                                telligence, organized by CINI, May 29–30, 2024, Naples, stocks that significantly predicted others within our
                                Italy                                                                        analysis. Then, we pairwise compare two time series
                                *
                                  Corresponding author.                                                      to find the closest match between them via DTW.
                                $ ivan.letteri@univaq.it (I. Letteri)                                        Then, the future trend is predicted as the average
                                 0000-0002-3843-386X (I. Letteri)
                                         © 2024 Copyright for this paper by its authors. Use permitted under of the trends of the 𝐾 neighbours. These predictive
                                         Creative Commons License Attribution 4.0 International (CC BY
                                         4.0).                                                               relationships were then utilised to establish buy, sell,
                                    CEUR
                                    Workshop
                                    Proceedings
                                                  http://ceur-ws.org
                                                  ISSN 1613-0073
                                                                       CEUR Workshop Proceedings (CEUR-WS.org)




CEUR
                  ceur-ws.org
Workshop      ISSN 1613-0073
Proceedings
or hold trading decisions.                                  The Parkinson (PK) estimator incorporates the
   Our previous research focused on technical trad-       stock’s daily high and low prices as follow:
ing strategies that emphasised technical indicators                       ⎯
[1],[6]. This current exploration delves, first into
                                                                          ⎸                                  𝑁    (︂      (ℎ)
                                                                                                                                   )︂2
                                                                          ⎸                1     ∑︁    𝑥
Historical Volatility estimators as a dataset for iden-              𝑃𝐾 = ⎷                          𝑙𝑛 𝑡(𝑙)                             .
                                                                                        4𝑁 𝑙𝑛(2)       𝑥𝑡
tifying medium volatility selecting stocks for the                                               𝑖=1
Granger Causality Test asset cointegration approach
                                                          It is derived from the assumption that the true
[7]. Second, within the context of investment timing,
                                                          volatility of the asset is proportional to the loga-
we predict it via DTW paired with KNN.                                                         (ℎ)         (𝑙)
   This paper is organised as follows: Section 2          rithm (𝑙𝑛) of the ratio of the high 𝑥𝑡 and low 𝑥𝑡
summarize fundamental concepts within our AITA            prices of 𝑁 observations.
framework [8], highlighting the Volatility Trading           The Garman-Klass (GK) estimator as-
System (VolTS) module [3]. Section 3 outlines             sumes      that    price    movements     are   log-
the improvement with the VolTS Augmented (in              normally
                                                          √︃           distributed calculated as follows:
                                                                𝑁
                                                                          (︂               )︂2        𝑁
                                                                                                                                   (︂               )︂2
short VolTS-Aug) module, which analyses securi-             1
                                                                ∑︀ 1             𝑥𝑡
                                                                                     (ℎ)              ∑︀                                      (𝑐)
                                                                                                                                             𝑥𝑡
ties’ volatility averages and price trends establishing     𝑁         2
                                                                               𝑙𝑛 (𝑙)            −         (2𝑙𝑛(2) − 1) 𝑙𝑛 (𝑜)
                                                                                 𝑥𝑡                                                          𝑥𝑡
                                                                𝑖=1                                   𝑖=1
predictive relationships. It then delves into the im-
                                                            The Rogers-Satchell (RS) estimator uses the
plementation of the trading strategy and includes
                                                          range of prices within a given time interval as a
a thorough empirical analysis of its performance
and robustness. Section 4 presents practical find-        √︃ for the volatility of the asset as follows: 𝑅𝑆 =
                                                          proxy
                                                                           (︂          )︂        (︂          )︂          (︂          )︂        (︂          )︂
                                                                𝑁                (ℎ)                   (ℎ)                     (𝑙)                   (𝑙)
ings achieved through backtesting followed by a             1
                                                                ∑︀
                                                                      𝑙𝑛
                                                                                𝑥𝑡
                                                                                            𝑙𝑛
                                                                                                      𝑥𝑡
                                                                                                                  + 𝑙𝑛
                                                                                                                              𝑥𝑡
                                                                                                                                          𝑙𝑛
                                                                                                                                                    𝑥𝑡
                                                            𝑁                    (𝑐)                   (𝑜)                     (𝑐)                   (𝑜)
discussion. Finally, Section 5 concludes the study              𝑡=1
                                                                                𝑥𝑡                    𝑥𝑡                      𝑥𝑡                    𝑥𝑡

by summarising the effectiveness and applicability      RS assumes that the range of prices within the
of the proposed method.                              interval is a good proxy for the volatility of the
                                                     asset, additionally, the estimator may be sensitive
                                                     to outliers and extreme price movements.
2. BACKGROUND                                           The Yang-Zhang (YZ) estimator [9] in-
                                                     corporates      OHLC prices as follows: 𝑌 𝑍 =
2.1. Price Action                                    √︀   2                    2                             2
                                                        𝜎𝑂𝑣𝑒𝑟𝑛𝑖𝑔ℎ𝑡𝑉    𝑜𝑙 + 𝑘𝜎𝑂𝑝𝑒𝑛𝑇 𝑜𝐶𝑙𝑜𝑠𝑒𝑉 𝑜𝑙 + (1 − 𝑘)𝜎𝑅𝑆 ,
                                                                                       𝑁 +1    2
The price action (PA) influences Historical Volatil- where 𝑘 = 0.34/1.34 + 𝑁 −1 , 𝜎𝑂𝑝𝑒𝑛𝑇 𝑜𝐶𝑙𝑜𝑠𝑒𝑉 𝑜𝑙 =
ity (HV), and in turn, HV can provide insights into          𝑁
                                                                (︂
                                                                      (𝑐)        (𝑐)
                                                                                     )︂2
                                                                     𝑥𝑡        𝑥𝑡                 2
future PA. When the PA exhibits strong price move- 𝑁 1−1
                                                            ∑︀
                                                                  𝑙𝑛 (𝑜)  − 𝑙𝑛 (𝑜)       , and 𝜎𝑂𝑣𝑒𝑟𝑛𝑖𝑔ℎ𝑡𝑉  𝑜𝑙 =
                                                                     𝑥𝑡        𝑥𝑡
ments, such as wide trading ranges, breakouts, or           𝑖=1
                                                                (︂                     )︂ 2
                                                             𝑁        (𝑜)          (𝑜)
rapid directional changes, it tends to increase.       1
                                                            ∑︀       𝑥𝑡          𝑥𝑡
                                                                  𝑙𝑛       − 𝑙𝑛             . YZ exhibits notable
   VolTS-Aug, as an improvement of the VolTS mod- 𝑁 −1 𝑖=1            (𝑐)
                                                                     𝑥𝑡−1
                                                                                  (𝑐)
                                                                                 𝑥𝑡−1
ule within the AITA framework, adheres to these performance across a broad spectrum of scenarios,
principles. Low HV signifies a period of consolida- including those characterised by jumps and non-
tion or low price volatility, indicating a potential normality in the data. However, this estimator has
upcoming spike in volatility or a shift in the PA. limitations, and its effectiveness may be constrained
On the other side, high HV suggests a higher proba- in certain contexts.
bility of sharp market movements or trend changes.      In this research, our attention is centred on mid-
Also into VolTS-Aug, the PA is encoded as OHLC, volatility. This focus allows us to either close open
i.e., the open, high, low, and close prices of the positions or refrain from entering a position when
assets.                                              the anticipated volatility coefficient is high, thereby
   For each timeframe 𝑡, the OHLC of an asset mitigating the risk of losses. On the other hand, if
is represented as a 4-dimensional vector 𝑋𝑡 = the expected volatility is too low, it does not offer
   (𝑜)  (ℎ)   (𝑙) (𝑐)           (𝑙)       (𝑙)    (ℎ)
(𝑥𝑡 , 𝑥𝑡 , 𝑥𝑡 , 𝑥𝑡 )𝑇 , where 𝑥𝑡 > 0, 𝑥𝑡 < 𝑥𝑡        any potential for gains.
       (𝑜)  (𝑐)     (𝑙) (ℎ)
and 𝑥𝑡 , 𝑥𝑡 ∈ [𝑥𝑡 , 𝑥𝑡 ].
                                                          2.3. Trading Strategy
2.2. Historical Volatility Time Series              In this experiment, we used the Trend Following
The construction of the dataset is composed by time (TF)  strategy. It is one way to engage in trend
series from the following HV estimators:            trading, where a trader initiates an order in the
                                                    direction of the breakout after the price surpasses
                                                    the resistance line as follows: let 𝑃𝑡 the price at
time 𝑡, and let 𝑀 𝐴 denote the Moving Average of          3. THE EXPERIMENT
the asset price over a certain period. If 𝑃𝑡 ≥ 𝑀 𝐴𝑡
indicates an upward trend to take a long position         3.1. Asset Collections
otherwise it is a downward trend to take a short
                                                          AITA automatically downloads the OHLC prices
position.
                                                          via an internal Python library connected to an API,
  Then, our strategy is compared only with the
                                                          using the MetaTrader5 (MT5)1 . The data collected
Buy and Hold (B&H) strategy considering it as a
                                                          for this study includes the OHLC prices of the stocks
benchmark.
                                                          listed in Table 1.

2.4. Backtesting Metrics                                  Table 1
AITA framework considers the following profit and         List of the main 9 stocks selected for the experimentation.
risk metrics to evaluate the potential profitability            Ticker             Company                Market
of investments and manage risk exposure.                       MSFT          Microsoft Corporation        Nasdaq
   Drawdown (DD). It is a measure of the peak-to-              GOOGL             Alphabet Inc.            Nasdaq
trough decline in the value of a trading account               MU           Micron Technology, Inc.       Nasdaq
before a new peak is attained. DD is defined as                NVDA           NVIDIA Corporation          NYSE
follows: 𝐷𝐷 = 𝑃 −𝑇   , where 𝑃 is the highest value            AMZN            Amazon.com, Inc.           NYSE
                  𝑇
or peak of the portfolio. 𝑇 is the lowest value                META           Meta Platforms, Inc.        NYSE
                                                               QCOM       QUALCOMM Incorporated           Nasdaq
or trough after the peak. Maximum Drawdown
                                                               IBM       Int. Business Machines Corp.     NYSE
(MDD) is the most significant loss from peak to
                                                               INTC            Intel Corporation          NYSE
trough during a(︁specific period calculated
                                    )︁      as follows:
                  𝑃𝑖 −𝑚𝑖𝑛𝑗:𝑖≤𝑗≤𝑁 𝑇𝑗
𝑀 𝐷𝐷 = 𝑚𝑎𝑥𝑖              𝑃𝑖
                                      , where 𝑃𝑖 is the
highest value or peak of the portfolio time 𝑖. 𝑇𝑗 is
the lowest value or trough after the peak up to time
                                                          3.2. Historical Volatility Time Series
𝑗. 𝑁 is the total number of data points.                  The History Volatility Clustering process of our
   Sortino ratio (SoR). It is a risk-adjusted profit      approach determines the stocks with intermediate
measure, which refers to the return per unit of           volatility. First calculate the average of historical
                                𝑅 −𝑅
deviation as follows: 𝑆𝑜𝑅 = 𝑝𝜎𝑑 𝑓 , where 𝑅𝑝 is           volatility time series among the aforementioned esti-
the expected portfolio return, 𝑅𝑓 the risk-free rate      mators (see sect. 2.2). Next, the resulting volatility
of return, and 𝜎𝑑 denotes the downside deviation of       series are clusterized using the KMeans++ algo-
the portfolio returns.                                    rithm. In particular, we split into three clusters
   Sharpe ratio (SR). It is a variant of the risk-        (𝐾 = 3) high, middle, and low volatility.
adjusted profit measure, which applies 𝜎𝑝 as a risk          Figure 1 shows the results displayed through a
                    𝑅 −𝑅
measure: 𝑆𝑅 = 𝑝𝜎𝑝 𝑓 where 𝜎𝑝 is the standard              plot of the time series belonging to the middle clus-
deviation of the portfolio return.                        ter where we are focused on our strategy. It is worth
   Calmar ratio (CR) is another variant of the risk-      noting that, the main region is in the time window
adjusted profit measure, which applies MDD as risk        from 1st January 2021 to 1st March 2024.
                    𝑅 −𝑅
measure: 𝐶𝑅 = 𝑀𝑝 𝐷𝐷𝑓 .                                       So, we use this interval as the dataset, and then
   To check the goodness of trades, we mainly fo-         from the intermediate cluster (confined between
cused on the Total Returns 𝑇 𝑅𝑘 (𝑡) for each stock        the two red dashed lines in fig 1). The candidate
(𝑘 = 1, ..., 𝑝) in the time interval (𝑡 = 1, ..., 𝑛)      assets selected are NVDA, META, AMZN, MU and
with the price 𝑃 , defined as follows: 𝑇 𝑅𝑘 (𝑡) =         QCOM.
 𝑃𝑘 (𝑡+Δ𝑡)−𝑃𝑘 (𝑡)
       𝑃𝑘 (𝑡)
                  .
   Furthermore, we analyzed the standardized re-          3.3. Causality Analysis
turns 𝑟𝑘 = (𝑇 𝑅𝑘 −𝜇𝑘 )/𝜎𝑘 , with (𝑘 = 1, ..., 𝑝), where   Co-integration refers to the long-term stable lin-
𝜎𝑘 is the standard deviation of 𝑇 𝑅𝑘 , e 𝜇𝑘 denote        ear combination between two or more time series,
the average overtime for the studied period.              although individual series may be non-stationary.
                                                             In the context of volatility-based trading, the
                                                          VolTS-Aug module performs the GCT to examine
                                                          this relationship between the lagged volatility of

                                                          1
                                                              https://www.metatrader5.com/
Figure 1: Stocks selected in the range, from 1st January 2021 to 1st March 2024, are MU, NVDA, AMZN, QCOM,
META from the Historical Volatility estimators dataset.



one asset and the future volatility of another asset        3.4. The Algorithm
by applying the following steps:
                                                            Three are the main steps followed by VolTS-Aug:
  Step 1. Significant Granger causality: Let 𝑋 and
                                                               Regression step: For each pair of time series
𝑌 be the pair stocks time series volatility to check,
                                                            (𝑋𝑖 , 𝑌𝑗 ), where 𝑖 ̸= 𝑗, we construct a linear regres-
where 𝑋 represents the potential causal variable
                                                            sion model: 𝑋𝑖 = 𝛽0,𝑖𝑗 + 𝛽1,𝑖𝑗 𝑌𝑗 + 𝜖𝑖𝑗 , where 𝛽0,𝑖𝑗 is
and 𝑌 represents the potential effect variable. The
                                                            the intercept, 𝛽1,𝑖𝑗 is the regression coefficient, and
null hypothesis (H0) states that 𝑋 does not Granger
                                                            𝜖𝑖𝑗 is the error term. We calculate the F-statistic
cause 𝑌 , while the alternative hypothesis (H1) states
                                                            to evaluate the overall adequacy of the model.
that 𝑋 does Granger cause 𝑌 . The F-test is defined
                                                               GCT step: For each pair of time series (𝑋𝑖 , 𝑌𝑗 ), we
as follows:
                                                            perform the Granger causality test. The model for
                   [(𝑅𝑆𝑆𝑌 (𝑡) − 𝑅𝑆𝑆𝑌 𝑋(𝑡) )/𝑝]              the
                                                            ∑︀𝑛 Granger test can be∑︀expressed      as 𝑋𝑖 (𝑡) = 𝛼𝑖𝑗 +
      𝐹 − 𝑡𝑒𝑠𝑡 =                                 ,                                       𝑛
                                                                    𝛽 𝑋 (𝑡 − 𝑘) + 𝑘=1 𝛾𝑘,𝑖𝑗 𝑌𝑗 (𝑡 − 𝑘) + 𝜖𝑖𝑗 (𝑡),
                    [(𝑅𝑆𝑆𝑌 𝑋(𝑡) )/(𝑛 − 𝑝 − 𝑘)]                 𝑘=1 𝑘,𝑖𝑗 𝑖
                                                            where 𝑋𝑖 (𝑡) is the current value of 𝑋𝑖 , 𝑋𝑖 (𝑡 − 𝑘)
where 𝑅𝑆𝑆 is the Residual Sum of Squares for the            and 𝑌𝑗 (𝑡 − 𝑘) are the lagged values of 𝑋𝑖 and 𝑌𝑗 ,
two AutoRegressive models: 𝑌 (𝑡) = 𝑐𝑌 +𝛽𝑌1 *𝑌 (𝑡−           respectively, and 𝜖𝑖𝑗 (𝑡) is the error term. If the
1) + 𝛽𝑌2 * 𝑌 (𝑡 − 2) + · · · + 𝛽𝑌𝑝 * 𝑌 (𝑡 − 𝑝) + 𝜖𝑌 (𝑡) ,   coefficients 𝛾𝑘,𝑖𝑗 are statistically different from zero,
and 𝑋 : 𝑌 (𝑡) = 𝑐𝑌 𝑋 + 𝛽𝑌 𝑋1 * 𝑋(𝑡 − 1) + 𝛽𝑌 𝑋2 *           we reject the null hypothesis and conclude that 𝑌𝑗
𝑋(𝑡 − 2) + · · · + 𝛽𝑌 𝑋𝑝 * 𝑋(𝑡 − 𝑝) + 𝜖𝑌 𝑋(𝑡) , with 𝑝      Granger causes 𝑋𝑖 .
the lag order, 𝑛 the number of observations, and               DTW-KNN step: (i) For each pair of time se-
𝑘 the number of parameters in the models. It in-            ries (𝑋𝑖 , 𝑌𝑗 ), where 𝑋𝑖 has length 𝑛 and 𝑌𝑗 has
dicates how much the regression coefficients of the         length 𝑚, the DTW distance   ∑︀𝑛 𝑑(𝑋∑︀𝑚𝑖 , 𝑌𝑖 ) is given by
lagged time series help to explain the variation in         𝑑(𝑋𝑖 , 𝑌𝑖 ) = 𝑚𝑖𝑛𝑎𝑙𝑖𝑔𝑛𝑚𝑒𝑛𝑡 𝑖=1 𝑗=1 𝑐(𝑖, 𝑗), where
the target time series.                                     𝑐(𝑖, 𝑗) is the distance between points 𝑋𝑖 [𝑖] and 𝑌𝑗 [𝑗],
Step 2. Causality Direction: If the volatility of           and the optimization is performed overall possible
Stock 𝑋 Granger causes the volatility of Stock 𝑌 ,          alignments. (ii) The process of finding the best
it suggests that changes in Stock 𝑋 volatility can          parameters delta time 𝛿𝑡 involves the KNN whit 𝑘
be used to predict changes in Stock 𝑌 volatility. A         optimization through grid search.
low p-value suggests the presence of a causal rela-
tionship between the time series.                           3.5. Metrics observed
Step 3. Delta Time Trends: VolTS-Aug performs
the DTW paired with KNN to examine the interval             Profit and risk metrics are pivotal considerations
time necessary for profitable trades: (i) The DTW           in trading AITA framework evaluates the following,
distance between two time series is the sum of differ-      for the potential profitability of the investments and
ences between their corresponding points, optimally         to manage the risk exposure.
aligned. (ii) The KNN classifier, aimed at finding             (i) The Maximum drawdown (MDD) measures the
the most similar neighbours for each observation            largest decline from the peak in the whole trading
based on DTW distance.                                      period, to show the worst case, as follows: 𝑀 𝐷𝐷 =
𝑚𝑎𝑥𝜏 ∈(0,𝑡) [𝑚𝑎𝑥𝑡∈(0,𝜏 ) 𝑛𝑡𝑛−𝑛𝑡
                                𝜏
                                  ].                                  Tab. 2 contains further details about the perfor-
   (ii) The Sharpe ratio (SR) is a risk-adjusted profit            mance metrics of the strategy and shows how the
measure, which refers to the return per unit of                    total amount in the portfolio is increased to 3241.57$
deviation as follows: 𝑆𝑅 = E[𝑟]    [𝑟]
                                       .                           (8.05%), which is a positive sign of profitable trad-
   (iii) The Sortino ratio (SoR) is a variant of the               ing, also considering the fixed commission of 9$ per
risk-adjusted profit measure, which applies DD as                  trade. Notice that, the managing of the budget
risk measure: 𝑆𝑜𝑅 = 𝐷𝐷   E[𝑟]
                              .                                    is set in compounded mode, so the full amount is
   (iv) The Calmar ratio (CR) is another variant                   reused for each trade.
of the risk-adjusted profit measure, which applies
MDD as risk measure: 𝐶𝑅 = 𝑀E[𝑟]          𝐷𝐷
                                              .                    4.2. Backtesting
   To check the goodness of trades, we mainly fo-
cused on the (v) Total Returns 𝑅𝑘 (𝑡) for each stock               The analysis of individual stocks’ performance is
(𝑘 = 1, ..., 𝑝) in the time interval (𝑡 = 1, ..., 𝑛),              presented in figure 3 about META co-integration.
                                                                   The trades of AMZN bought following the META
where 𝑇 𝑅 = 𝑅𝑘 (𝑡) = 𝑍𝑘 (𝑡+Δ𝑡)−𝑍       𝑍𝑘 (𝑡)
                                                𝑘 (𝑡)
                                                      , and fur-
                                                                   trend given a profit of 59.98$, with a winrate of
thermore analysing the standardized returns 𝑟𝑘 =
                                                                   75%, a MDD of 0.035%, and a return of 5.98%,
(𝑅𝑘 − 𝜇𝑘 )/𝜎𝑘 , with (𝑘 = 1, ..., 𝑝), where 𝜎𝑘 is the
                                                                   which outperforms the B&H strategy with return
standard deviation of 𝑅𝑘 , e 𝜇𝑘 denote the average
                                                                   of 0.998%. The trades of MU bought following
overtime for the studied period.
                                                                   the META trend given a profit of 146.68$, with a
                                                                   winrate of 100%, a MDD of 0%, and a return of
4. RESULTS AND DISCUSSIONS                                         34.91%, which outperforms the B&H strategy with
                                                                   return of 3%. The trades of NVDA bought following
4.1. The Experiment                                                the META trend given a profit of 39.11$, with a
                                                                   winrate of 75%, a MDD of 0.11%, and a return of
                                                                   3.98%, which is similar to the B&H strategy with
                                                                   return of 4.02%.




                                                                   Figure 3: Trades during the 21 testing days (1st March -
Figure 2: Best Granger Causality Test with 21 lags.
                                                                   5th April).

   The VolTS algorithm iterates the daily lags in
a range from 2 to 30 days to determine the best                      Figure 3 shows all the 7 positions applied at the
testing range time. The best result is achieved                    same time on NVDA, MU and AMZN with buy-
with lags=21, where ’best’ is considered when there                ing/selling trades following the co-integration with
is direction coherency among the stocks with the                   META trend determined with VolTS-Aug algorithm.
lowest p-value, with the maximum cardinality of                    The trades on MU stock outperforms all the oth-
the set of stocks previously filtered, and not create              ers stocks increasing notably the portfolio gain (see
cyclic graph in the connections. On other words,                   Table 2).
the GCT suggests buying AMZN, MU and NVDA
when META has a positive trend and vice versa                      5. Conclusions
(see fig. 2).
   The experiment results indicate that the strategy               In this paper, we propose VolTS-Aug an improve-
resulted in a total gain of 241.57$ in 21 days of                  ment of the AITA framework module calle VolTS.
market opening, starting with an initial budget of                 VolTS-Aug handle volatility in trading strategy com-
1000$ per stock.                                                   bining causality by the Historical Volatility Granger
                                                                   Causality Test and DTW & KNN to determine
Table 2
Results of the backtesting in the experiment.
             Stock                     #Trades    𝜇 WinRate (%)      𝜇 TR ($)    𝜇 SR    𝜇 SoR     CR
     META ->AMZN, NVDA, MU               7            83.33           241.57     3.03     8.75    15.941


a profitable stock pairings improving on previous              and error correction: Representation, estima-
work [10, 1].                                                  tion, and testing, Econometrica 55 (1987)
  The novelty of the approach implemented in                   251–276. URL: http://www.jstor.org/stable/
VolTS-Aug lies in a better trades timing. To vali-             1913236.
date this claim, we applied our methodology to nine        [8] I. Letteri, AITA: A new framework for trading
assets reduce to four after filtering by our methodol-         forward testing with an artificial intelligence
ogy. The results shows a promising potential of this           engine, in: F. Falchi, F. Giannotti, A. Mon-
approach with a gain of 241.57$ (8.05%) in 21 days.            reale, C. Boldrini, S. Rinzivillo, S. Colantonio
In future works, we will further test its reliability          (Eds.), Proceedings of the Italia Intelligenza
with more refined assets selection (e.g., [11, 12]) and        Artificiale - Thematic Workshops co-located
balancing (buy, sell and hold trades) strategies (e.g.,        with the 3rd CINI National Lab AIIS Confer-
[13, 14]).                                                     ence on Artificial Intelligence (Ital IA 2023),
                                                               Pisa, Italy, May 29-30, 2023, volume 3486 of
                                                               CEUR Workshop Proceedings, CEUR-WS.org,
References                                                     2023, pp. 506–511.
                                                           [9] D. Yang, Q. Zhang, Drift-independent volatil-
 [1] I. Letteri, G. D. Penna, G. D. Gasperis,
                                                               ity estimation based on high, low, open, and
     A. Dyoub, Dnn-forwardtesting: A new trad-
                                                               close prices, The Journal of Business 73 (2000)
     ing strategy validation using statistical time-
                                                               477–492. URL: http://www.jstor.org/stable/
     series analysis and deep neural networks, 2022.
                                                               10.1086/209650.
     arXiv:2210.11532.
                                                          [10] I. Letteri, G. D. Penna, G. D. Gasperis, A. Dy-
 [2] V. Niennattrakul, C. A. Ratanamahatana, On
                                                               oub, A stock trading system for a medium
     clustering multimedia time series data using
                                                               volatile asset using multi layer perceptron,
     k-means and dynamic time warping, in: 2007
                                                               2022. arXiv:2201.12286.
     International Conference on Multimedia and
                                                          [11] I. Letteri, G. D. Penna, L. D. Vita, M. T.
     Ubiquitous Engineering (MUE’07), 2007, pp.
                                                               Grifa, Mta-kdd’19: A dataset for malware
     733–738. doi:10.1109/MUE.2007.165.
                                                               traffic detection 2597 (2020) 153–165. URL:
 [3] I. Letteri, Volts: A volatility-based trad-
                                                               http://ceur-ws.org/Vol-2597/paper-14.pdf.
     ing system to forecast stock markets trend
                                                          [12] I. Letteri, G. D. Penna, P. Caianiello, Feature
     using statistics and machine learning, 2023.
                                                               selection strategies for HTTP botnet traffic de-
     arXiv:2307.13422.
                                                               tection (2019) 202–210. doi:10.1109/EuroSPW.
 [4] D. Arthur, S. Vassilvitskii, K-means++: The
                                                               2019.00029.
     advantages of careful seeding, volume 8,
                                                          [13] I. Letteri, A. D. Cecco, G. D. Penna, Dataset
     2007, pp. 1027–1035. doi:10.1145/1283383.
                                                               optimization strategies for malware traffic
     1283494.
                                                               detection,      CoRR abs/2009.11347 (2020).
 [5] G. Kirchgässner, J. Wolters, Granger Causal-
                                                               URL:         https://arxiv.org/abs/2009.11347.
     ity, Springer Berlin Heidelberg, Berlin, Hei-
                                                               arXiv:2009.11347.
     delberg, 2007, pp. 93–123. doi:10.1007/
                                                          [14] I. Letteri, A. D. Cecco, A. Dyoub, G. D. Penna,
     978-3-540-73291-4\_3.
                                                               Imbalanced dataset optimization with new re-
 [6] I. Letteri, G. D. Penna, G. D. Gasperis, A. Dy-
                                                               sampling techniques, in: K. Arai (Ed.), In-
     oub, Trading strategy validation using for-
                                                               telligent Systems and Applications - Proceed-
     wardtesting with deep neural networks, in:
                                                               ings of the 2021 Intelligent Systems Confer-
     M. Arami, P. Baudier, V. Chang (Eds.), Pro-
                                                               ence, IntelliSys 2021, Amsterdam, The Nether-
     ceedings of the 5th International Conference
                                                               lands, 2-3 September, 2021, Volume 2, vol-
     on Finance, Economics, Management and IT
                                                               ume 295 of Lecture Notes in Networks and
     Business, FEMIB 2023, Prague, Czech Repub-
                                                               Systems, Springer, 2021, pp. 199–215. doi:10.
     lic, April 23-24, 2023, SCITEPRESS, 2023, pp.
                                                               1007/978-3-030-82196-8\_15.
     15–25. doi:10.5220/0011715300003494.
 [7] R. F. Engle, C. W. J. Granger, Co-integration