A Preliminary Analysis of EMA Period Lengths and Price Action in a Buy-Sell Model This blog introduced on March 26, 2026, an earlier version of the Buy on Proper Order and Sell on Dynamic Stop Loss Orders Buy-Sell model. Proper order was defined in that post by a relationship between a close price and two EMA values, such as close > ema_21 and ema_21 > ema_100. In this post, the model dynamically updates upper and lower boundary values based on price action to lock in a portion of accumulated gains or at least constrain the size of a loss associated with a trade. This post extends the March 26 post by updating the code for implementing the model, diving more deeply into how price action can change model performance, and testing the model over a broader range of tickers examined as well as over longer timeframes. The model examined in this post uses proper order relationships for close prices and exponential moving averages with different period lengths to discove...
Posts
About Security Trading Analytics Blog
- Get link
- X
- Other Apps
How to Populate a Trading Database with Refinitiv, Excel, and SQL Server—Update 1 The Excel STOCKHISTORY function downloads historical market data—such as stock prices and index values—directly into Excel worksheets from LSEG Data & Analytics (formerly Refinitiv). The “ How to Populate a Trading Database with Refinitiv, Excel, and SQL Server ” post summarizes and demonstrates a three-step process for building a data source inside SQL Server for historical stock prices and/or indexes. The three steps are as follows. Populate one worksheet tab per ticker with historical prices using Excel’s STOCKHISTORY function. Save each worksheet tab as a CSV file—one CSV per ticker. Bulk insert the CSV files into a tall SQL Server table indexed by ticker and date. While the three steps worked when properly executed, it was found that Excel formatting issues could lead to processing errors if not manually resolved. Additionally, the T-SQL code in the third step required ...
- Get link
- X
- Other Apps
A Blog for Traders Who Like to Analyze Their Trades and Data Analysts Who Like to Trade The Security Trading Analytics blog focuses on practical, data‑driven analysis for traders. You’ll find posts ranging from collecting historical stock prices to backtesting buy‑sell models across different strategies and asset classes. Current posts cover single‑stock ETFs, leveraged and unleveraged index ETFs, bitcoin‑related stocks, semiconductor stocks as well as a host of other assets. Most examples use spreadsheets and T‑SQL programming, but you’ll also see PowerShell scripts and metrics such as compound annual growth rate, overall percentage change, and cumulative growth rate across trades. The blog is authored by Rick Dobson, who operated his own national seminar practice, worked on finance and healthcare development projects, and contributed regularly to MSSQLTips.com. His work was recently recognized with the MSSQLTips.com Leadership Award . He is also the...