基于枢轴反转K线的订单块。 当发现并确认轴高或轴低时,将在该轴K线BAR的开盘和收盘上绘制一个框。
在设置中,您可以更改确认枢轴高或低所需的距离 这些是脚本检查的长度,以查看它是否处于其局部高点或低点。
你还可以改变盒子上K线柱的数量以及看涨和看跌盒子的颜色
支点通常自行提供支撑点和阻力点, 标记订单块的一种方法是,将枢轴K线BAR标记为阻力区域,在那里你可以寻找价格反转。
很高兴任何人都能就可以改进脚本的更改提出任何建议, 请随意使用该脚本,如果您确实使用该脚本,请您标记我,因为我有兴趣了解人们如何使用它。祝你好运。
回测测试
/*backtest start: 2021-11-01 00:00:00 end: 2022-05-26 00:00:00 period: 15m basePeriod: 5m exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}] args: [["ContractType","rb2210",360008]] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © MensaTrader //@version=5 indicator("Pivot Order Blocks", shorttitle="Pivot - OB", overlay=true, max_bars_back=500, max_boxes_count=250) //Titles inputGroupTitle = "=== Pivots ===" plotGroupTitle = "=== Plots ===" //Inputs leftLenH = input.int(title="枢轴高点左长度", defval=10, minval=1, inline="Pivot High", group=inputGroupTitle) rightLenH = input.int(title="枢轴高点右长度", defval=10, minval=1, inline="Pivot High", group=inputGroupTitle) leftLenL = input.int(title="枢轴低点左长度", defval=10, minval=1, inline="Pivot Low", group=inputGroupTitle) rightLenL = input.int(title="枢轴低点右长度", defval=10, minval=1, inline="Pivot Low", group=inputGroupTitle) boxLength = input.int(30, title="盒子大小", tooltip="Amount of candles long", group=plotGroupTitle) bullBoxColor = input('#00E600', title="牛市 盒子 颜色", group=plotGroupTitle, inline="1") bearBoxColor = input('#FF0000', title="熊市 盒子 颜色", group=plotGroupTitle, inline="1") ph = ta.pivothigh(leftLenH, rightLenH) pl = ta.pivotlow(leftLenL, rightLenL) //Variables var leftBull = bar_index var rightBull = bar_index var topBull = close var bottomBull = close var leftBear = bar_index var rightBear = bar_index var topBear = close var bottomBear = close //Bear Box Calc if ph leftBear := bar_index-leftLenH rightBear := bar_index-(leftLenH-boxLength) topBear := close>open ? close[leftLenH] : open[leftLenH] bottomBear := close>open ? open[leftLenH] : close[leftLenH] //Bull Box Calc if pl leftBull := bar_index-leftLenL rightBull := bar_index-(leftLenL-boxLength) topBull := close>open ? close[leftLenL] : open[leftLenL] bottomBull := close>open ? open[leftLenL] : close[leftLenL] //if pl // bull = box.new(left=leftBull, right=rightBull, top=topBull, bottom=bottomBull, bgcolor=color.new(bullBoxColor,80), border_color=bullBoxColor) //if ph // bear = box.new(left=leftBear, right=rightBear, top=topBear, bottom=bottomBear, bgcolor=color.new(bearBoxColor,80), border_color=bearBoxColor) if pl strategy.entry("Enter Long", strategy.long) else if ph strategy.entry("Enter Short", strategy.short)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6