{"id":113,"date":"2025-06-17T02:54:41","date_gmt":"2025-06-17T02:54:41","guid":{"rendered":"https:\/\/blog.alltick.co\/ja-jp\/?p=113"},"modified":"2025-06-17T02:54:43","modified_gmt":"2025-06-17T02:54:43","slug":"bollinger-bands-strategy","status":"publish","type":"post","link":"https:\/\/blog.alltick.co\/ja-jp\/bollinger-bands-strategy\/","title":{"rendered":"\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u6226\u7565"},"content":{"rendered":"\n<p>\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u6226\u7565\u306f\u30011980\u5e74\u4ee3\u521d\u982d\u306b\u30b8\u30e7\u30f3\u30fb\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u3001\u8cc7\u7523\u306e\u4fa1\u683c\u30ec\u30d9\u30eb\u3068\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u3092\u8a55\u4fa1\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b\u975e\u5e38\u306b\u4eba\u6c17\u306e\u3042\u308b\u30c6\u30af\u30cb\u30ab\u30eb\u5206\u6790\u30c4\u30fc\u30eb\u3067\u3059\u3002\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u306f\u30013\u672c\u306e\u7dda\u3067\u69cb\u6210\u3055\u308c\u3066\u304a\u308a\u3001\u4e2d\u592e\u306e\u7dda\u306fn\u671f\u9593\u306e\u79fb\u52d5\u5e73\u5747\uff08\u901a\u5e38\u306f20\u65e5\u9593\u306e\u5358\u7d14\u79fb\u52d5\u5e73\u5747\uff09\u3067\u3001\u4e0a\u90e8\u30d0\u30f3\u30c9\u3068\u4e0b\u90e8\u30d0\u30f3\u30c9\u306f\u901a\u5e38\u3001\u4e2d\u592e\u306e\u7dda\u306e\u4e0a\u3068\u4e0b\u30672\u3064\u306e\u6a19\u6e96\u504f\u5dee\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u6226\u7565\u306e\u8aac\u660e<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4e2d\u592e\u30d0\u30f3\u30c9<\/strong>: \u8cc7\u7523\u306en\u671f\u9593\u306e\u79fb\u52d5\u5e73\u5747\u3067\u3001\u4e2d\u592e\u5024\u306e\u5e02\u5834\u30c8\u30ec\u30f3\u30c9\u3092\u8868\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4e0a\u90e8\u30d0\u30f3\u30c9<\/strong>: \u4e2d\u592e\u30d0\u30f3\u30c9\u306e2\u6a19\u6e96\u504f\u5dee\u4e0a\u306b\u3042\u308a\u3001\u9ad8\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u306e\u4fa1\u683c\u30be\u30fc\u30f3\u3092\u793a\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4e0b\u90e8\u30d0\u30f3\u30c9<\/strong>: \u4e2d\u592e\u30d0\u30f3\u30c9\u306e2\u6a19\u6e96\u504f\u5dee\u4e0b\u306b\u3042\u308a\u3001\u4f4e\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u306e\u4fa1\u683c\u30be\u30fc\u30f3\u3092\u793a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u53d6\u5f15\u30b7\u30b0\u30ca\u30eb<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u8cb7\u3044\u30b7\u30b0\u30ca\u30eb<\/strong>: \u4fa1\u683c\u304c\u4e0b\u90e8\u30d0\u30f3\u30c9\u306b\u89e6\u308c\u308b\u304b\u3001\u305d\u308c\u3092\u4e0b\u56de\u308b\u5834\u5408\u3001\u8cc7\u7523\u304c\u904e\u5c0f\u8a55\u4fa1\u3055\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u3001\u8cb7\u3044\u306e\u30c1\u30e3\u30f3\u30b9\u3092\u793a\u5506\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3057\u3070\u3057\u3070\u5e02\u5834\u306e\u58f2\u308a\u904e\u304e\u306e\u30b7\u30b0\u30ca\u30eb\u3068\u898b\u306a\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u58f2\u308a\u30b7\u30b0\u30ca\u30eb<\/strong>: \u4fa1\u683c\u304c\u4e0a\u90e8\u30d0\u30f3\u30c9\u306b\u89e6\u308c\u308b\u304b\u3001\u305d\u308c\u3092\u4e0a\u56de\u308b\u5834\u5408\u3001\u8cc7\u7523\u304c\u904e\u5927\u8a55\u4fa1\u3055\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u3001\u58f2\u308a\u306e\u30c1\u30e3\u30f3\u30b9\u3092\u793a\u5506\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3057\u3070\u3057\u3070\u5e02\u5834\u306e\u8cb7\u3044\u904e\u304e\u306e\u30b7\u30b0\u30ca\u30eb\u3068\u898b\u306a\u3055\u308c\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u306e\u5909\u5316<\/strong><br>\u30d0\u30f3\u30c9\u306e\u5e45\u306e\u5909\u5316\u306f\u3001\u5e02\u5834\u306e\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u306e\u5909\u5316\u3092\u53cd\u6620\u3057\u3066\u3044\u307e\u3059\u3002\u30d0\u30f3\u30c9\u304c\u5e83\u304c\u308b\u3068\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u304c\u5897\u52a0\u3057\u3001\u30d0\u30f3\u30c9\u304c\u72ed\u307e\u308b\u3068\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u304c\u6e1b\u5c11\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u6226\u7565\u306e\u5229\u70b9<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5e83\u3044\u9069\u7528\u7bc4\u56f2<\/strong>: \u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u6226\u7565\u306f\u3001\u682a\u5f0f\u3001\u5916\u56fd\u70ba\u66ff\u3001\u5546\u54c1\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306a\u5e02\u5834\u3068\u6642\u9593\u67a0\u306b\u9069\u7528\u3067\u304d\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u8996\u899a\u7684\u306a\u660e\u77ad\u3055<\/strong>: \u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u306e\u8996\u899a\u7684\u306a\u6027\u8cea\u306b\u3088\u308a\u3001\u5e02\u5834\u3067\u306e\u8cb7\u308f\u308c\u904e\u304e\u3084\u58f2\u3089\u308c\u904e\u304e\u306e\u72b6\u614b\u3092\u7c21\u5358\u306b\u8b58\u5225\u3067\u304d\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u67d4\u8edf\u6027<\/strong>: \u30c8\u30ec\u30fc\u30c0\u30fc\u306f\u3001\u79fb\u52d5\u5e73\u5747\u671f\u9593\u3084\u6a19\u6e96\u504f\u5dee\u306e\u4e57\u6570\u3092\u8abf\u6574\u3057\u3066\u3001\u7570\u306a\u308b\u5e02\u5834\u306e\u72b6\u6cc1\u3084\u53d6\u5f15\u30b9\u30bf\u30a4\u30eb\u306b\u9069\u5fdc\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u6226\u7565\u306e\u6b20\u70b9<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9045\u884c\u6027<\/strong>: \u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u306f\u904e\u53bb\u306e\u30c7\u30fc\u30bf\u306b\u57fa\u3065\u304f\u30c4\u30fc\u30eb\u3067\u3042\u308b\u305f\u3081\u3001\u5e02\u5834\u306e\u52d5\u304d\u306b\u9045\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u3001\u30b7\u30b0\u30ca\u30eb\u304c\u9045\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u8aa4\u3063\u305f\u30b7\u30b0\u30ca\u30eb<\/strong>: \u7bc4\u56f2\u53d6\u5f15\u3084\u30c8\u30ec\u30f3\u30c9\u306e\u306a\u3044\u5e02\u5834\u3067\u306f\u3001\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u306f\u8aa4\u89e3\u3092\u62db\u304f\u30b7\u30b0\u30ca\u30eb\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u3001\u983b\u7e41\u306b\u8aa4\u3063\u305f\u53d6\u5f15\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u78ba\u8a8d\u304c\u5fc5\u8981<\/strong>: \u53d6\u5f15\u306e\u7cbe\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306b\u306f\u3001\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u3092\u76f8\u5bfe\u529b\u6307\u6570\uff08RSI\uff09\u3084MACD\u306a\u3069\u306e\u4ed6\u306e\u6307\u6a19\u3084\u5206\u6790\u30c4\u30fc\u30eb\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u30b7\u30b0\u30ca\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5b9f\u65bd\u306e\u63d0\u6848<\/strong><\/h2>\n\n\n\n<p>\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u6226\u7565\u3092\u4f7f\u7528\u3059\u308b\u969b\u3001\u6295\u8cc7\u5bb6\u306f\u30d0\u30c3\u30af\u30c6\u30b9\u30c8\u3092\u884c\u3044\u3001\u81ea\u5206\u306e\u53d6\u5f15\u30b9\u30bf\u30a4\u30eb\u306b\u6700\u9069\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u8a2d\u5b9a\u3092\u6c7a\u5b9a\u3059\u308b\u3079\u304d\u3067\u3059\u3002\u307e\u305f\u3001\u5e83\u7bc4\u306a\u5e02\u5834\u74b0\u5883\u3092\u89b3\u5bdf\u3057\u3001\u4ed6\u306e\u30c6\u30af\u30cb\u30ab\u30eb\u6307\u6a19\u304b\u3089\u306e\u30b7\u30b0\u30ca\u30eb\u3092\u8003\u616e\u3057\u3066\u3001\u8aa4\u3063\u305f\u30b7\u30b0\u30ca\u30eb\u3092\u907f\u3051\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u3068\u30a8\u30b0\u30b8\u30c3\u30c8\u30dd\u30a4\u30f3\u30c8\u3092\u6700\u9069\u5316\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Java\u30b3\u30fc\u30c9\u4f8b<\/strong><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import java.util.List;\n\npublic class BollingerBandsStrategy {\n    public static void main(String[] args) {\n        List&lt;Double> prices = \n        int windowSize = 20; \n        double numStdDeviations = 2.0; \n        double upperBand;\n        double lowerBand;\n\n        for (int i = windowSize; i &lt; prices.size(); i++) {\n            List&lt;Double> window = prices.subList(i - windowSize, i);\n            double mean = calculateMean(window);\n            double stdDev = calculateStandardDeviation(window, mean);\n\n            upperBand = mean + numStdDeviations * stdDev;\n            lowerBand = mean - numStdDeviations * stdDev;\n\n            double currentPrice = prices.get(i);\n            if (currentPrice > upperBand) {\n\n            } else if (currentPrice &lt; lowerBand) {\n\n            }\n        }\n    }\n\n    private static double calculateMean(List&lt;Double> values) {\n        double sum = 0.0;\n        for (double value : values) {\n            sum += value;\n        }\n        return sum \/ values.size();\n    }\n\n    private static double calculateStandardDeviation(List&lt;Double> values, double mean) {\n        double sumSquaredDiff = 0.0;\n        for (double value : values) {\n            double diff = value - mean;\n            sumSquaredDiff += diff * diff;\n        }\n        double variance = sumSquaredDiff \/ values.size();\n        return Math.sqrt(variance);\n    }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Python\u30b3\u30fc\u30c9\u4f8b<\/strong><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nimport pandas as pd\n\ndef bollinger_bands_strategy(prices, window_size=20, num_std_deviations=2):\n    df = pd.DataFrame(prices, columns=['Close'])\n    df['Mean'] = df['Close'].rolling(window=window_size).mean()\n    df['Std'] = df['Close'].rolling(window=window_size).std()\n    df['UpperBand'] = df['Mean'] + num_std_deviations * df['Std']\n    df['LowerBand'] = df['Mean'] - num_std_deviations * df['Std']\n\n    df['Signal'] = 0\n    df.loc[df['Close'] > df['UpperBand'], 'Signal'] = -1  \n    df.loc[df['Close'] &lt; df['LowerBand'], 'Signal'] = 1  \n\n    df['Position'] = df['Signal'].diff()\n\n    return df\n\nprices = [10.2, 11.4, 10.8, 12.1, 11.7, 10.9, 12.5, 11.8, 12.6, 13.2]\nresult = bollinger_bands_strategy(prices)\n\nprint(result)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u6226\u7565\u306f\u30011980\u5e74\u4ee3\u521d\u982d\u306b\u30b8\u30e7\u30f3\u30fb\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u3001\u8cc7\u7523\u306e\u4fa1\u683c\u30ec\u30d9\u30eb\u3068\u30dc\u30e9\u30c6\u30a3\u30ea\u30c6\u30a3\u3092\u8a55\u4fa1\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b\u975e\u5e38\u306b\u4eba\u6c17\u306e\u3042\u308b\u30c6\u30af\u30cb\u30ab\u30eb\u5206\u6790\u30c4\u30fc\u30eb\u3067\u3059\u3002\u30dc\u30ea\u30f3\u30b8\u30e3\u30fc\u30d0\u30f3\u30c9\u306f\u30013 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":114,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guide"],"featured_image_src":"https:\/\/i0.wp.com\/blog.alltick.co\/ja-jp\/wp-content\/uploads\/sites\/2\/2025\/06\/fig-8-2.jpg?fit=1272%2C791&ssl=1","author_info":{"display_name":"admin","author_link":"https:\/\/blog.alltick.co\/ja-jp\/author\/admin\/"},"_links":{"self":[{"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":1,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/posts\/113\/revisions\/115"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/media\/114"}],"wp:attachment":[{"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alltick.co\/ja-jp\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}