예스스탁
예스스탁 답변
2022-02-21 16:38:38
안녕하세요
예스스탁입니다.
if문은 봉완성시(다음봉시가수신)기준입니다.
atstop타입을 이용해 HH,LL,center값 터치로 변경해 드립니다.
input : Period(10);
Vars: HH(0), LL(0) ,center(0), LongCondition(False),ShortCondition(False),ExitLongConditon(False), ExitShortCondition(False);
HH = Highest(high, Period);
LL = Lowest(low, Period);
center= (HH+LL)/2 ;
If MarketPosition <= 0 and C < HH Then
Begin
Buy("매수",AtStop,HH);
End;
If MarketPosition == 1 and C > center Then
Begin
ExitLong("매수청산",AtStop,center);
End;
If MarketPosition >= 0 and C > LL Then
Begin
Sell("매도",AtStop,LL);
End;
If MarketPosition == -1 and C < center Then
Begin
ExitShort("매도청산",AtStop,center);
End;
즐거운 하루되세요
> 짜왕 님이 쓴 글입니다.
> 제목 : 수식부탁드리겠습니다
> input : Period(10);
Vars: HH(0), LL(0) ,center(0), LongCondition(False),ShortCondition(False),ExitLongConditon(False), ExitShortCondition(False);
HH = Highest(high, Period);
LL = Lowest(low, Period);
center= (HH+LL)/2 ;
LongCondition = CrossUp(C,HH[1]);
ShortCondition = CrossDown(C,LL[1]);
ExitLongConditon = CrossDown(C,center[1]);
ExitShortCondition = CrossUp(C,center[1]);
If LongCondition Then
Begin
Buy("매수");
End;
If ExitLongConditon Then
Begin
ExitLong("매수청산");
End;
If ShortCondition Then
Begin
Sell("매도");
End;
If ExitShortCondition Then
Begin
ExitShort("매도청산");
End;
이렇게 수식을 작성하였는데
진입이 고가를 돌파하는 순간 진입되어야 하는데 캔들의 종가에 진입이 됩니다
index함수를 사용해서 고가를 돌파하는 다음틱에 진입하는 방법으로 해야할것같은데
해당부분 작성이 잘 안되어 질문드립니다
HH[1]라인 LL[1]라인을 현재가가 돌파하는 즉시 그 가격에 진입하는 수식을 만들고싶습니다