회전 순서 블록

저자:차오장, 날짜: 2022-05-11 23:32:43
태그:피브

어떻게 작동하는지 주전 역전 촛불을 기반으로 주문 블록 피보트 높은 또는 피보트 낮은 발견되고 확인되면, 그 피보트 촛불의 개방 및 폐쇄 값에 상자가 그려집니다

// 설정 설정에서 당신은 고 또는 낮은 회전 확인하는 데 필요한 거리를 변경할 수 있습니다 이 길이는 스크립트가 로컬의 높음이나 낮음인지 확인하는 길이가 됩니다.

당신은 또한 상자가 확장되는 촛불의 양을 변경할 수 있는 능력을 가지고 있으며, 또한 상승 및 하락 상자의 색상을

'사용 케이스' 피보트 포인트는 종종 자체적으로 지원 및 저항 포인트를 제공합니다. 오더 블록을 표시하는 한 가지 방법은 피보트 촛불을 가져다가 저항 영역으로 표시하는 것입니다.

제안은 이 시나리오를 개선할 수 있는 변경사항을 제안해 주시면 좋습니다.

' 조건 ' 스크립트를 자유롭게 사용할 수 있습니다. 스크립트를 사용할 경우 사람들이 어떻게 사용하는지 보고 싶어서 저를 태그해 주시겠습니까. 행운을 빌어요.

백테스트

img


// 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="Pivot High", 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="Pivot Low", 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="Box Size", tooltip="Amount of candles long", group=plotGroupTitle)
bullBoxColor        = input('#00E600', title="Bullish Box Color", group=plotGroupTitle, inline="1")
bearBoxColor        = input('#FF0000', title="Bearish Box Color", 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)

관련

더 많은