답변완료
수식 문의 드립니다.
안녕하세요,
아래 지표를 플롯하면 차트내에 발생했던 좌우 5봉안의 고점,저점 추세선들이 모두 오른쪽 확장되어 그려지게 되는데요.
현재 가격이 차트에 그려진 모든 수평추세선 중 어느 하나라도 넘어서게되면 즉시 매수하고, 어느 하나라도 crossdown되면 즉시 매도하는 수식을 만들고 싶습니다.
항상 감사드립니다.
input : left(5), right(5);
var : swing_low(0),swing_high(0),Dir(0);
swing_low = SwingLow(1, L, left, right, left+right+1);
swing_high = SwingHigh(1, H, left, right,left+right+1);
if (swing_low != -1 ) Then
{
var11 = sdate[right];
var12 = STime[right];
var13 = Low[right];
var21 = var11[1];
var22 = var12[1];
var23 = var13[1];
var31 = var21[1];
var32 = var22[1];
var33 = var23[1];
if var23 > 0 Then
{
Value11 = TL_New(var11,var12,var13,sDate,sTime,var13);
TL_SetExtRight(value11,true);
TL_SetColor(value11,BLACk);
TL_SetSize(value11,2);
}
}
if ( swing_high != -1 ) Then{
var51 = sdate[right];
var52 = STime[right];
var53 = high[right];
var61 = var51[1];
var62 = var52[1];
var63 = var53[1];
var71 = var61[1];
var72 = var62[1];
var73 = var63[1];
if var63 > 0 Then
{
value31 = TL_New(var51,var52,var53,sDate,sTime,Var53);
TL_SetExtRight(value31,true);
TL_SetColor(value31,BLACk);
TL_SetSize(value31,2);
}
}
2022-01-07
990
글번호 155215
시스템
답변완료
변환부탁드립니다.
study("Breakout Finder", "BF", overlay = true, max_bars_back = 500, max_lines_count = 400)
prd = input(defval = 5, title="Period", minval = 2)
bo_len = input(defval = 200, title="Max Breakout Length", minval = 30, maxval = 300)
cwidthu = input(defval = 3., title = "Threshold Rate %", minval = 1., maxval = 10) / 100
mintest = input(defval = 2, title = "Minimum Number of Tests", minval = 1)
bocolorup = input(defval = color.blue, title = "Breakout Colors", inline = "bocol")
bocolordown = input(defval = color.red, title = "", inline = "bocol")
lstyle = input(defval = line.style_solid, title = "Line Style", options = [line.style_solid, line.style_dashed, line.style_dotted])
//width
lll = max(min(bar_index, 300), 1)
float h_ = highest(lll)
float l_ = lowest(lll)
float chwidth = (h_ - l_) * cwidthu
// check if PH/PL
ph = pivothigh(prd, prd)
pl = pivotlow(prd, prd)
//keep Pivot Points and their locations in the arrays
var phval = array.new_float(0)
var phloc = array.new_int(0)
var plval = array.new_float(0)
var plloc = array.new_int(0)
// keep PH/PL levels and locations
if ph
array.unshift(phval, ph)
array.unshift(phloc, bar_index - prd)
if array.size(phval) > 1 // cleanup old ones
for x = array.size(phloc) - 1 to 1
if bar_index - array.get(phloc, x) > bo_len
array.pop(phloc)
array.pop(phval)
if pl
array.unshift(plval, pl)
array.unshift(plloc, bar_index - prd)
if array.size(plval) > 1 // cleanup old ones
for x = array.size(plloc) - 1 to 1
if bar_index - array.get(plloc, x) > bo_len
array.pop(plloc)
array.pop(plval)
// check bullish cup
float bomax = na
int bostart = bar_index
num = 0
hgst = highest(prd)[1]
if array.size(phval) >= mintest and close > open and close > hgst
bomax := array.get(phval, 0)
xx = 0
for x = 0 to array.size(phval) - 1
if array.get(phval, x) >= close
break
xx := x
bomax := max(bomax, array.get(phval, x))
if xx >= mintest and open <= bomax
for x = 0 to xx
if array.get(phval, x) <= bomax and array.get(phval, x) >= bomax - chwidth
num += 1
bostart := array.get(phloc, x)
if num < mintest or hgst >= bomax
bomax := na
if not na(bomax) and num >= mintest
line.new(x1 = bar_index, y1 = bomax, x2 = bostart, y2 = bomax, color = bocolorup, style = lstyle)
line.new(x1 = bar_index, y1 = bomax - chwidth, x2 = bostart, y2 = bomax - chwidth, color = bocolorup, style = lstyle)
line.new(x1 = bostart, y1 = bomax - chwidth, x2 = bostart, y2 = bomax, color = bocolorup, style = lstyle)
line.new(x1 = bar_index, y1 = bomax - chwidth, x2 = bar_index, y2 = bomax, color = bocolorup, style = lstyle)
plotshape(not na(bomax) and num >= mintest, location = location.belowbar, style = shape.triangleup, color = bocolorup, size = size.small)
alertcondition(not na(bomax) and num >= mintest, title = "Breakout", message = "Breakout")
// check bearish cup
float bomin = na
bostart := bar_index
num1 = 0
lwst = lowest(prd)[1]
if array.size(plval) >= mintest and close < open and close < lwst
bomin := array.get(plval, 0)
xx = 0
for x = 0 to array.size(plval) - 1
if array.get(plval, x) <= close
break
xx := x
bomin := min(bomin, array.get(plval, x))
if xx >= mintest and open >= bomin
for x = 0 to xx
if array.get(plval, x) >= bomin and array.get(plval, x) <= bomin + chwidth
num1 += 1
bostart := array.get(plloc, x)
if num1 < mintest or lwst <= bomin
bomin := na
if not na(bomin) and num1 >= mintest
line.new(x1 = bar_index, y1 = bomin, x2 = bostart, y2 = bomin, color = bocolordown, style = lstyle)
line.new(x1 = bar_index, y1 = bomin + chwidth, x2 = bostart, y2 = bomin + chwidth, color = bocolordown, style = lstyle)
line.new(x1 = bostart, y1 = bomin + chwidth, x2 = bostart, y2 = bomin, color = bocolordown, style = lstyle)
line.new(x1 = bar_index, y1 = bomin + chwidth, x2 = bar_index, y2 = bomin, color = bocolordown, style = lstyle)
plotshape(not na(bomin) and num1 >= mintest, location = location.abovebar, style = shape.triangledown, color = bocolordown, size = size.small)
alertcondition(not na(bomin) and num1 >= mintest, title = "Breakdown", message = "Breakdown")
alertcondition((not na(bomax) and num >= mintest) or (not na(bomin) and num1 >= mintest), title = "Breakout or Breakdown", message = "Breakout or Breakdown")
2022-01-06
1196
글번호 155213
지표
답변완료
부탁드립니다
$,안녕하세요
아래식에서다음조건 추가 부탁드립니다
ㅡ,Red사각이 발생한 봉의 시가,고가,저가를 다음 Red사각이 나올때까지 우측
추세선 그리기합니다
ㅡ,Blue사각이 발생한 봉의 시가,고가,저가를 다음 Blue사각이 나올때까지 우측
추세선 그리기합니다
var : 봉수(0),최대봉(0),텍스트크기(12),UDV(0),tx(0);
if DayIndex+1 < 100 Then 봉수 = dayindex+1;
UDV = Upvol-DownVol;
if sTime >= 091000 and sTime <=150000 and Highest(v,봉수)[1] <= v Then
{
if UDV > 0 Then
{
tx = Text_New(sdate,sTime,H,"■");
Text_SetColor(tx,RED);
Text_SetSize(tx,텍스트크기);
Text_SetStyle(tx,2,1);
}
if UDV <= 0 Then
{
tx = Text_New(sdate,sTime,L,"■");
Text_SetColor(tx,BLUE);
Text_SetSize(tx,텍스트크기);
Text_SetStyle(tx,2,0);
}
PlaySound("C:예스트레이더dataSound1point.wav");
}
$, 관리자님의 도움주심에 늘 고맙습니다.
2022-01-06
1200
글번호 155199
지표