# Introduction he price of oil affects the global economy and geographical events, making oil price uncertain and unstable, because oil is a major source of energy [28]. In the application of computer science and time series mathematical theories to the oil and gas industries , the prediction of oil prices is still a challenge because oil falls under the categories of commodities which are easily affected by change in government policies and unpredictable natural or unnatural events. The oil market is complicated because, like the stock market, its features are neither linear nor stationary [3] [4]. Oil, an already volatile market, reached a flash point in 2020 accentuated by the coronavirus (COVID 19) pandemic which resulted in a sharp drop of price that affected the oil exporting countries. Fig. 1 is a pictorial view of an instance in the sharp drop in global oil prices as a result of the COVID 19 pandemic. Fig. 1 shows that oil collapsed to the lowest price in 18 years. Such a price drop negatively impacted on the economy of the nations that depend on oil as a major part of their gross domestic product (GDP) and nations that depend on oil for economy sustenance and survival. Such inadvertent and sharp drops in oil prices also have adverse effects on the performance of software systems designed for the forecasting of oil prices. Therefore, developing a proactive model capable of automation for the prediction of oil prices is of high significance and is worth the efforts. [12]. However, many of the available and popular technical indicators have proved unprofitable and disappointing to investors, often resulting not only in ordinary losses but in total loss of investment capital, in spite of the claims of their designers and developers. In this paper, a dynamic level technical indicator model for the forecasting of commodities' prices is proposed. The remaining part of this paper is organized as follows the next section is the background of study. This is, followed by the review of related works, the methodology and the implementation. Finally, the results and discussion are presented and followed by the conclusion and future works. # II. # Background of Study Technical Indicators are primarily intended for displaying some graphical signals on a security charts for the purpose of guiding traders and users on appropriate trading decisions. These graphical signals are displayed through some calculated dependencies achievable through programming codes in a programming language suitable for the terminal employed for the security or commodity. # Related Works Although many technical indicators exist, only few are documented publicly in the research community. Previous works relating to technical indicators are discussed in this section. Bartolucci et al [2] proposed a generalized version of moving average convergence and divergence by adopting the martingale and applied the indicator for the monitoring of crude oil prices. Nazário et al [3] gave the classification of technical analysis on stock market in a literature review. Using the combination of technical indicators and news articles as inputs, Vargas et al [5] applied deep learning for the prediction of daily directional stock price movement. They compared the performance of a hybrid model composed of a Convolutional Neural Network (CNN) for the financial news with Long Short-Term Memory (LSTM) for technical indicators. Chan and Teong [6] applied neural networks to enhance technical analysis positing that false breakout had been previously experienced with the use of technical analysis. Oriani and Coelho [7] evaluated the impact of a number of technical indicators on the stock market using multilayer perceptrons (MLP) but presented no model. Gholamiangonabadi et al [14] combined Principal Component Analysis, Stepwise Regression Analysis and Artificial Neural Networks for the performance evaluation of the technical indicators of an electrical industry stock exchange. Thawornwong et al [17] also focused on the application of neural networks for decision making in the stock market. Stankovi? [15] investigated the effectiveness of least square support vector machine and some traditional technical indicators such as MACD and Relative Strength Index (RSI) for financial series stock trend prediction and investment strategy optimization. Chong and Ng [18] simply tested and compared MACD with RSI using the Financial Times -Institute of Actuaries 30 (FT30) index of Mills. Rosillo [19] also simply tested the RSI, MACD, momentum and stochastic rules for technical analysis using the Spanish stock market. Almeida et al [16] analyzed some technical indicators using an algorithm based on differential evolution to generate Pareto fronts for each technical indicator to achieve multi-objective optimization. Chi and Peng [20] studied the relationship among various technical indicators and using self-organizing map and fuzzy neural network. On the prediction of oil prices, the diverse approaches proposed by other members of the research community include: the use of sentiment on news article [21], autoregressive integrated moving average (ARIMA) model [22], a hybrid of wavelet or Commodity Futures Prices and artificial neural networks [23] [25], deep learning based models [24], statistical learning method [26], time-varying approach [27], gray wave forecasting method and optimization via bagging ensemble models [29]. Most of the existing technical indicator models adopt the statistical approach while recent ones adopt deep learning methodology and they are limited in the diversity of application. Our proposed model creates programmable dynamic levels for price supports and resistances. The proposed model can be used both for trending and hedging markets. In addition, while most of the existing technical indicators were used for stock decision making, our proposed model focuses on the prediction of oil prices. These are some of the main contributions and novelty of this paper. IV. # Methodology The proposed model leverages on the overriding impact of support and resistance levels of the terminal charts and their effects on the system's profit. An algorithm was developed to capture, establish and indicate the support and resistance for different timeframes of the terminal charts and to dynamically move these levels as the price of the commodity changes. The relative movements of one minute (M1), five minutes (M5), fifteen minutes (M15), one hour (H1), four hour (H4) and daily (D1) timeframes during price trending, reversal and breakout were observed and studied over a period of time. The result of the research observation was then recommended for order placements and other trading decisions. # a) The Dynamic Level Technical Indicator Model The The graphical component displays the various indicators with different object properties. This component sets the line color, width and style. While the changing values of the dynamic levels can be captured with program codes for auto-trading, manual trading depending on the positioning of the indicator lines for trading decision. The algorithm of the graphical component is shown below. # i. Algorithm for the graphical component The algorithm of the graphical component of the dynamic level component given below for M15 resistance for(int b=0; b<2; b+=2) { ObjectDelete("LineNameLabel"+b); ObjectCreate("LineNameLabel"+b,OBJ_HLINE,0,0,MaxBuyPriceHigh15M); //MaxBuyPriceClose1H ObjectSet("LineNameLabel"+b,OBJPROP_COLOR,Aqua); ObjectSet("LineNameLabel"+b,OBJPROP_WIDTH,2); ObjectSet("LineNameLabel"+b,OBJPROP_RAY,False); } The algorithm of the graphical component of the traditional technical indicator is given below for M15 resistance. # //---plot MaxBuyPriceHigh15M indicator_label "MaxBuyPriceHigh15M" indicator_type DRAW_LINE indicator_color clrAqua indicator_style STYLE_SOLID indicator_width 2 e) Research Observations and Model applications It was observed in the course of this study that trending in the bullish direction occurs when the M5 line moves above the M15 line or the M15 line moves above the H1 line at the resistance level. Similarly, trending in the bearish direction occurs when the M5 line moves below the M15 line or the M15 line moves below the H1 line at the support level. Price breakout in the bullish direction occurs when the M15 line moves above the H4 line at the resistance level. In the same way, price breakout in the bearish direction occurs when the M15 line moves below the H4 line at the resistance level. These observations, which has not been stated in previous studies by the research community, produced positive results when implemented. They therefore, form part of the contribution to knowledge of this paper. # f) Materials The experiments carried out in this study were performed with Meta Quote programming language installed on Intel(R) Core(TM) i3-2330M CPU @ 2.20GHz, 4 GB RAM, 64-bit Windows 8 operating system. The program was run on MetaTrader 4 terminal installed on a US based virtual private server. V. # Implementation The proposed model was implemented for M5, M15, H1, H4 and D1 timeframes. The various properties of the indicator lines in the different timeframes implemented are shown in Table 1. The values of the dynamic level active array size, the line variable names at supports and resistances as well as the line color, line type and line width are shown in Table 1. Fig. 5 illustrates how the proposed model captured the exact support of the H4 with orange color, displayed using the H4 timeframe chart. The proposed technical indicator is implemented with the name "Dynamic Level 1" as shown in Fig. 5. The file name used for saving the indicator's program codes is displayed as "Dynamic Level 1.mq4" under indicators files' Listing in Fig. 3. The price of oil affects the global economy because oil is a major source of energy. However, the features of the oil market is neither linear nor stationary, making the prediction of oil price a challenge. In this paper, a dynamic level indicator model has been proposed for the forecasting of oil prices. The proposed model was deployed for the UK Oil on live trading for a period of three months and compared with MACD/ Stochastic Oscillator technical indicators which ran at the same period. The result showed that the proposed model is more profitable than MACD/Stochastic Oscillator indicators and therefore can be adopted for oil price prediction. In addition, the research observation of this paper introduces a novel method of price trend prediction based on the relative movements of the dynamic levels in the terminal charts. Future works shall focus on the investigation of further possible profit optimization of the dynamic level technical indicator model. 1![Fig. 1: Price developments of crude oil in US dollars, from 2000 until April 2020 Author ? ?: Department of Computer Science, Federal University of Petroleum Resources, Effurun. Delta State, Nigeria. e-mails: oyemade.david@fupre.edu.ng, enebeli.david@fupre.edu.ng Technical indicators, most of which adopt time series or deep learning solutions, are suitable for the prediction of oil prices [1] [5] [10] [11] [12]. However,](image-2.png "Fig. 1 :") ![Traditionally, buffers are required in the development of technical indicators because by design, values of indicator arrays must be passed via exchange buffers to a client terminal. Various types of lines and sometimes symbols are usually drawn by the technical indicators. One indicator array and one buffer array are associated with one indicator line, with each buffer having its own index which starts from zero. Fig. 2 demonstrates how values of indicator arrays are passed via a buffer to a client terminal.](image-3.png "") 2![Fig. 2: Technical Indicator Creation -Passing values of indicator arrays via a buffer to a client terminal [13] Technical analysis refers to the use of technical indicators and historical data for trading decisions in contrast to the use of economic, political or geographical events [3]. The use of events for trading decisions is referred to as fundamental analysis. Technical analysis is a set of rules or charting that anticipates future prices based on the study of the basic security information such as open price, selling price, volume traded, amongst other information. Contemporary technical indicators can be classified into: Trend, Oscillators, Volumes and Bill Williams. Various technical indicators which fall under each can be seen in Fig. 3 which shows the technical indicators tree. Examples of such technical indicators include: Average Directional Movement Index, Bollinger Bands, Average True Range, Bears Power, Accumulative/ Distribution, Money Flow Index, Accelerator oscillator and Alligator.](image-4.png "Fig. 2 :") 3![Fig. 3: A Technical Indicators Tree (Showing their Classification) and Indicators' Files Listing III.](image-5.png "Fig. 3 :") ![Dynamic Level Technical Indicator Model for Oil Price Forecasting Global Journal of Computer Science and Technology Volume XXI Issue I Version I](image-6.png "A") ![proposed dynamic level technical indicator model consists of three components: the dynamic level component, the graphical component and the traditional technical indicator component. These three components are synchronized and they complement each other in functionality. The composition and operations of the components are explained in this section. The conceptual diagram of the dynamic level technical indicator model is shown in Fig. 4.](image-7.png "") 4![Fig. 4: The Conceptual Diagram of Dynamic Level Technical Indicator Model b) The Dynamic Level ComponentThe Dynamic Level Component uses the array data structure to store the prices of the upper and lower shadow of price candles for various timeframes. Different array sizes were applied to different timeframes. Different colors were also assigned to the indicator lines as appropriate. Support and resistance levels are determined by the index of the array with highest upper shadow for bullish (or buy) candles and lowest lower shadow for bearish (or sell) candle. The continually changing values of the indexes of upper and lower candle shadows ensure the dynamism of the established support and resistance levels. The algorithm for the dynamic level component is given below. The algorithm defines the procedure TradeLevel_BuyHigh and the procedure TradeLevel_SellLow with some parameters. This procedures can be reused for different time frames.](image-8.png "Fig. 4 :") ![c) Traditional Technical Indicator ComponentThe traditional technical indicator component uses buffers as explained in section 2. For every line displayed in a traditional technical indicator, a buffer is needed. The algorithm for the traditional technical indicator component at M15 resistance is given below.i. Algorithm for Traditional Technical Indicator Component Declare the array MaxBuyPriceHigh15MBuffer[] for the indicator buffer array Declare the array MaxBuyPriceHigh15MBuffer[] for the price at resistance SetIndexBuffer(6,MaxBuyPriceHigh15MBuffer) //initialize the buffer array Counted_bars IndicatorCounted(); // Number of counted bars i Bars-Counted_bars-1; // Index of the first uncounted while(i>=0) // Loop for uncounted bars { MaxBuyPriceHigh15MBuffer[i] ?MaxBuyPriceHigh15M; i--; // Calculating index of the next bar } d) The Graphical Component](image-9.png "") 5![Fig. 5: Dynamic Level Technical Indicator on UK Oil H4 Chart and the Indicators File Listing](image-10.png "Fig. 5 :") 6![Fig. 6: Three Months Performance Chart of Dynamic Level Technical Indicator 1 and MACD/Stochastic Indicator An instance of the operation and result of dynamic level technical indicator 2 is shown in Fig. 8 which accentuates the profitability of the proposed model.](image-11.png "Fig. 6 :") 78![Fig. 7: Three Months Performance Chart of Dynamic Level Technical Indicator 1 and 2 versus MACD/ Stochastic Indicators](image-12.png "Fig. 7 :Fig. 8 :") 1TimeframeDynamic Level Active Array SizeObject Property ColorObject TypeObject WidthLine Variable Name at SupportLine Variable Name at ResistanceM14OBJ_HLINE2M55LawnGreenOBJ_HLINE2MinSellPriceLow5MMaxBuyPriceHigh5MM1560AquaOBJ_HLINE2MinSellPriceLow15MMaxBuyPriceHigh15MH172YellowOBJ_HLINE2MinSellPriceLow1HMaxBuyPriceHigh1HH4126OrangeOBJ_HLINE2MinSellPriceLow4HMaxBuyPriceHigh4HD1300VioletOBJ_HLINE2MinSellPriceLowD1MaxBuyPriceHighD1 © 2021 Global Journals * Time series analysis: Forecasting and control GEBox GMJenkins 1994 598 * A Generalized Moving Average Convergence/ Divergence for Testing Semi-strong Market Efficiency FBartolucci ACardinali FulviaPennoni 2018 Springer International Publishing AG part of Springer Nature * A literature review of technical analysis on stock markets RT FNazário JLSilva VASobreiro HKimura The Quaterly Review of Economics and Finance 66 2017. 2017 Elsevier * A hybrid evolutionary dynamic neural network for stock market trend analysis and prediction using unscented Kalman filter RBisoi PDash Applied Computing 19 June(1. 2014 * Deep Learning for Stock Market Prediction Using Technical Indicators and Financial News MRVargas CE MAnjo GL GBichara AGEvsukoff 2018 8 Loughborough University, IEEE Xplore * Enhancing Technical Analysis in the Forex Market Using Neural Networks KC CChan FKTeon Proceedings of ICNN'95 -International Conference on Neural Networks , IEEE Xplore ICNN'95 -International Conference on Neural Networks , IEEE Xplore 2002 * Evaluating the Impact of Technical Indicators on Stock Forecasting FBOriani_ GPCoelho ;Ieee Xplore 2016 * Individualized Indicator for All: Stock-wise Technical Indicator Optimization with Stock Embedding ZLi LYang JZhao TBian TQin Liu August 4-8, 2019. 2019 19 Anchorage, AK, USA, ACM * the-impact-of-coronavirus-covid-19-and-the-globaloil-price-shock-on-the-fiscal-position-of-oil-exporting -developing-countries-8bafbd95/. Accessed: 18 th April 2021 * Evaluating machine learning classification for financial trading: An empirical approach EAGerlein MartinMcginnity 10.1016/j.eswa.2016.01.018 Expert Systems with Applications 54 2016 Elsevier * Financial time series forecasting with deep learning: A systematic literature review OBSezer MUGudelek 10.1016/j.asoc.2020.106181 Applied Soft Computing Journal 90 2005-2019. 2020. 2020 Elsevier * PJBrockwell RADavis Time Series: Theory and Methods New York Springer-Verlag 1991 2 Springer Series in Statistics * Investigating the Performance of Technical Indicators in Electrical Industry in Tehran's Stock Exchange Using Hybrid Methods of SRA, PCA and Neural Networks DGholamiangonabadi SD MTaheri AMohammadi MBMenhaj The 5th Conference on Thermal Power Plants (lPGC2014) Tehran, Iran, IEEE June 10-11,2014. 2014 Shahid Beheshti University * Investment Strategy Optimization Using Technical Analysis and Predictive Modeling in Emerging Markets JStankovi ? IMarkovi ? MStojanovi Procedia Economics and Finance edia Economics and Finance 2015 19 * Multi-objective Optimization Approach to Stock Market Technical Indicators RAlmeida GReynoso-Meza MT ASteiner IEEE Congress on Evolutionary Computation (CEC) 2016. 2016 IEEE Xplore * 17] also focused on the application of neural networks for decision making in the stock market Thawornwong * Technical analysis and the London stock exchange: testing the MACD and RSI rules using the FT30 TTChong WNg 10.1080/13504850600993598 Applied Economics Letters 15 14 2008 * Technical Analysis and the Spanish Stock Exchange: Testing the RSI, MACD, Momentum and Stochastic Rules Using Spanish Market Companies RRosillo DDe La Fuente JA LBrugos 10.1080/00036846.2011.631894 Applied Economics 45 2013 * The Study on the Relationship among Technical Indicators and the Development of Stock Index Prediction System SChi WPeng ; Ieee Xplore 2003 * Forecasting Oil Price Trends with Sentiment of Online News Articles JLi ZXu LYu LTang Procedia Computer Science edia Computer Science 2016 91 * Crude Oil Price Forecasting using ARIMA model PA SJessin Kiruthiga International Research Journal of Engineering and Technology 2020 * Daily Crude Oil Price Forecasting Using Hybridizing Wavelet and Artificial Neural Network Model AShabri RSamsudin 201402. 2014 2014 10 Mathematical Problems in Engineering * Forecasting Oil Prices: a Deep Learning Based Model YChen KHe KF TGeoffrey Science Direct 2017. 2017 122 * Forecasting Model for Crude Oil Price Using Artificial Neural Networks and Commodity Futures Prices SKulkarni IHaidar International Journal of Computer Science and Information Security 2 1 2009 * Improved Crude Oil Price Forecasting With Statistical Learning Methods CSlim Journal of Modern Accounting and Auditing 11 1 2015 * Oil Price Forecasting Using a Time-Varying Approach LZhao SWang ZZhang Energies 2020, 13, 1403, pp. 8, 2020 * Forecasting the Price of Crude Oil: The Predictive Power of Futures Prices and Realized Volatility MHoff1 Olsvik 2015 Trondheim Norwegian University of Science and Technology, Department of Industrial Economics and Technology Management * Prediction of Oil Prices Using Bagging and Random Subspace LAGabralla1 AAbraham Advances in Intelligent Systems and Computing 303 Springer International Publishing Switzerland 2014. 2014 Proceedings of the Fifth Intern. Conf. on Innov