답변완료
타지표수식을 예스수식으로 변환요청드립니다.
트레이딩뷰 지표수식 예스수식으로 가능하면 변환 요청드립니다.
감사합니다.
-----------------------------------------------------------------------
//@version=4
study("Williams Fractals", shorttitle="Fractals", format=format.price, precision=0, overlay=true)
// Define "n" as the number of periods and keep a minimum value of 2 for error handling.
n = input(title="Periods", defval=2, minval=2, type=input.integer)
// UpFractal
bool upflagDownFrontier = true
bool upflagUpFrontier0 = true
bool upflagUpFrontier1 = true
bool upflagUpFrontier2 = true
bool upflagUpFrontier3 = true
bool upflagUpFrontier4 = true
for i = 1 to n
upflagDownFrontier := upflagDownFrontier and (high[n-i] < high[n])
upflagUpFrontier0 := upflagUpFrontier0 and (high[n+i] < high[n])
upflagUpFrontier1 := upflagUpFrontier1 and (high[n+1] <= high[n] and high[n+i + 1] < high[n])
upflagUpFrontier2 := upflagUpFrontier2 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+i + 2] < high[n])
upflagUpFrontier3 := upflagUpFrontier3 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+3] <= high[n] and high[n+i + 3] < high[n])
upflagUpFrontier4 := upflagUpFrontier4 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+3] <= high[n] and high[n+4] <= high[n] and high[n+i + 4] < high[n])
flagUpFrontier = upflagUpFrontier0 or upflagUpFrontier1 or upflagUpFrontier2 or upflagUpFrontier3 or upflagUpFrontier4
upFractal = (upflagDownFrontier and flagUpFrontier)
// downFractal
bool downflagDownFrontier = true
bool downflagUpFrontier0 = true
bool downflagUpFrontier1 = true
bool downflagUpFrontier2 = true
bool downflagUpFrontier3 = true
bool downflagUpFrontier4 = true
for i = 1 to n
downflagDownFrontier := downflagDownFrontier and (low[n-i] > low[n])
downflagUpFrontier0 := downflagUpFrontier0 and (low[n+i] > low[n])
downflagUpFrontier1 := downflagUpFrontier1 and (low[n+1] >= low[n] and low[n+i + 1] > low[n])
downflagUpFrontier2 := downflagUpFrontier2 and (low[n+1] >= low[n] and low[n+2] >= low[n] and low[n+i + 2] > low[n])
downflagUpFrontier3 := downflagUpFrontier3 and (low[n+1] >= low[n] and low[n+2] >= low[n] and low[n+3] >= low[n] and low[n+i + 3] > low[n])
downflagUpFrontier4 := downflagUpFrontier4 and (low[n+1] >= low[n] and low[n+2] >= low[n] and low[n+3] >= low[n] and low[n+4] >= low[n] and low[n+i + 4] > low[n])
flagDownFrontier = downflagUpFrontier0 or downflagUpFrontier1 or downflagUpFrontier2 or downflagUpFrontier3 or downflagUpFrontier4
downFractal = (downflagDownFrontier and flagDownFrontier)
plotshape(downFractal, style=shape.triangledown, location=location.belowbar, offset=-n, color=color.maroon, transp=0, size = size.small)
plotshape(upFractal, style=shape.triangleup, location=location.abovebar, offset=-n, color=color.olive, transp=0, size = size.small)
2021-06-14
1510
글번호 149935
지표
답변완료
예스트레이더 시스템 주문 관련 질문
안녕하세요,
예스트레이더로 수식을 작성해서 자동으로 주문이 나가게 하려고 지금 백테스팅 중입니다. 이와 관련해서 아래와 같이 질문이 있어서요.
- 일봉 기준으로 매수, 매도, 매수청산, 매도청산 신호가 나오게끔 준비 중입니다.
- 다만 하나의 전략보다는 상관성이 낮은 전략 여러개를 한종목에 한꺼번에 돌리려고 합니다
- 이와 같은 경우, 한 종목을 여러개 뛰워 놓고 전략별로 돌리는게 좋을까요 아니면 한 종목을 하나만 뛰워 놓고 하나의 시스템에 여러가지 전략을 넣고 돌리는게 좋을까요?
다소 애매할꺼 같아서 아래와 같이 예를 준비하였습니다. (아래의 너무나도 심플한 전략과 똑같이 돌린다는거는 아니고 어떻게 효율적으로 돌려야 하는지 여쭤보고자 예를 작성하였습니다)
전략1: 일봉기준으로 오늘의 종가가 200이평선 위에 있으면 내일 시가로 매수, 내일 종가로 매수 청산
전략2: 일봉기준으로 오늘의 종가가 어제의 종가보다 위에 있으면 내일 시가로 매수, 내일 종가로 매수 청산
전략3: 일봉기준으로 오늘의 고가가 어제의 고가보다 위에 있으면 내일 종가로 매도, 모래 시가로 매도 청산
이 경우, 각 전략별로 하나씩 시스템을 돌리는게 맞는지 아니면 하나의 시스템으로 3개의 전략을 돌리는게 맞는지 궁금합니다. 너무 기초적인 질문이라 이거 관련해서 참고할만한 자료가 있을까요? 미리 감사 드립니다.
2021-06-14
1387
글번호 149933
시스템
답변완료
수식 재수정 요청 입니다
input : StartTime(080000),EndTime(55000),Xtime(55500);
var : Tcond(false),B1(0),B2(0),X1(0),X2(0),entry(0);
if sdate != sDate[1] Then
SetStopEndofday(Xtime);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
SetStopEndofday(0);
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
B1 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.618;
B2 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.580;
X1 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.950;
X2 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.900;
if Tcond == true Then
{
if (MarketPosition == 0 or (MarketPosition == 1 and MaxEntries == 1)) Then
{
if entry < 5 and L > B1 Then
Buy("b1",AtLimit,B1);
if entry < 5 and L > B2 Then
Buy("b2",AtLimit,B2);
}
if MarketPosition == 1 Then
{
ExitLong("bx1",AtLimit,X1,"B1");
ExitLong("bx2",AtLimit,X2,"B2");
}
}
SetStopProfittarget(PriceScale*300,PointStop);
SetStopLoss(PriceScale*20,PointStop);
-----------------------------------------------------------
전일 피보나치 수열을 하단 0 상단 100 의 기준으로 당일 진입 청산을 하는 위 수식어에서
"당일 시가(08:00)가 전일의 61.8 ~ 76.4 % 의 구간사이 일때" 의 수식어를 포함해서
진입과 청산은 임의의 b1 , b2 의 청산을 1회 , 2회의 2가지 수식어에 관한 내용인데요
"당일 시가(08:00)가 전일의 61.8 ~ 76.4 % 의 구간이라는 설정과 진입후 청산의 % 는
같지 않다는 내용입니다.
달리말하자면 "당일 시가 (08:00)" 가 전일의 61.8 ~ 76.4 % 의 구간이 되지않는다면
진입후 청산의 수열및 신호가 없다는 것입니다.
늘 감사합니다.
2021-06-14
1309
글번호 149929
시스템