예스스탁
예스스탁 답변
2020-03-26 10:41:12
안녕하세요
예스스탁입니다.
반대조건 지정이 잘못된 부분이 있어 수정했습니다.
var : T(0),HH(0),HL(0),LH(0),LL(0),mav(0);
var : loss(0),PO1(0),PO2(0),PL1(0),PL2(0),NO1(0),NO2(0),NH1(0),NH2(0);
mav = ma(C,20);
Condition1 = countif(C>O,3) == 3;
Condition2 = countif(C<O,3) == 3;
if T <= 0 and Condition1 == true and Condition1[1] == false Then
{
T = 1;
HH = highest(H,3);
HL = L[2];
Condition3 = false;
}
if T >= 0 and Condition2== true and Condition2[1] == false Then
{
T = -1;
LH = H[2];
LL = lowest(L,3);
Condition4 = false;
}
if T == 1 Then
{
if H > HH Then
HH = H;
if L < (HH+HL)/2 Then
T = 0;
if T == 1 and Condition3 == false and crossup(c,mav) Then
Condition3 = true;
if Condition3 == true and Condition3[1] == true and min(c,O) < mav Then
T = 0;
if MarketPosition <= 0 and HH-HL >= PriceScale*20 and Condition3 == true and countif(C>O,2) == 2 and C[2]<O[2] Then
{
buy("b");
loss = lowest(O,2);
ExitLong("bx1",AtStop,loss);
}
}
if MarketPosition == 1 Then
{
ExitLong("bx11",AtStop,loss);
ExitLong("bx2",AtLimit,EntryPrice+(HH[BarsSinceEntry]-HL[BarsSinceEntry]));
if countif(C>O,BarsSinceEntry) >= 2 Then
ExitLong("bx3",AtStop,EntryPrice+PriceScale*1);
}
if T == -1 Then
{
if L < LL Then
LL = L;
if H > (LL+LH)/2 Then
T = 0;
if T == -1 and Condition4 == false and CrossDown(c,mav) Then
Condition4 = true;
if Condition4 == true and Condition4[1] == true and max(c,O) > mav Then
T = 0;
if MarketPosition >= 0 and LH-LL >= PriceScale*20 and Condition4 == true and countif(C<O,2) == 2 and C[2]>O[2] Then
{
sell("s");
loss = Highest(O,2);
ExitShort("sx1",AtStop,loss);
}
}
if MarketPosition == -1 Then
{
ExitShort("sx11",AtStop,loss);
ExitShort("sx2",AtLimit,EntryPrice-(LH[BarsSinceEntry]-LL[BarsSinceEntry]));
if countif(C<O,BarsSinceEntry) >= 2 Then
ExitShort("sx3",AtStop,EntryPrice-PriceScale*1);
}
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 수식수정을 부탁드립니다,.
> 작성해 주신 아래 수식에서
매도부분이 전혀 실행되지 않고 있으며
이익청산에서
3연속봉후에 상승폭의 최고가는 새로운 양봉이 진행
될 수록 새롭게 경신해 가며 생성되는 상승폭 수식이 빠져있고
매수진입이후 매수진입가 + 상승폭 에 도달하면 매수진입을 청산하는 부분도 빠져있습니다.
수정을 부탁드립니다.
안녕하세요
예스스탁입니다.
청산 모두 현재가로 처리해 드립니다.
var : T(0),HH(0),HL(0),LH(0),LL(0),mav(0);
var : loss(0),PO1(0),PO2(0),PL1(0),PL2(0),NO1(0),NO2(0),NH1(0),NH2(0);
mav = ma(C,20);
Condition1 = countif(C>O,3) == 3;
Condition2 = countif(C<O,3) == 3;
if T <= 0 and Condition1 == true and Condition1[1] == false Then
{
T = 1;
HH = highest(H,3);
HL = L[2];
Condition3 = false;
}
if T >= 0 and Condition2== true and Condition2[1] == false Then
{
T = -1;
LH = H[2];
LL = lowest(L,3);
Condition4 = false;
}
if T == 1 Then
{
if H > HH Then
HH = H;
if L < (HH+HL)/2 Then
T = 0;
if T == 1 and Condition3 == false and crossup(c,mav) Then
Condition3 = true;
if Condition3 == true and Condition3[1] == true and min(c,O) < mav Then
T = 0;
if MarketPosition <= 0 and HH-HL >= PriceScale*20 and Condition3 == true and countif(C>O,2) == 2 and C[2]<O[2] Then
{
buy("b");
loss = lowest(O,2);
ExitLong("bx1",AtStop,loss);
}
}
if MarketPosition == 1 Then
{
ExitLong("bx2",AtStop,loss);
if countif(C>O,BarsSinceEntry) >= 2 Then
ExitLong("bx",AtStop,EntryPrice+PriceScale*1);
}
if T == -1 Then
{
if L < LL Then
LL = L;
if H > (LL+LH)/2 Then
T = 0;
if T == -1 and Condition4 == false and crossup(c,mav) Then
Condition4 = true;
if Condition4 == true and Condition4[1] == true and max(c,O) > mav Then
T = 0;
if MarketPosition <= 0 and HL-LL >= PriceScale*20 and Condition4 == true and countif(C<O,2) == 2 and C[2]>O[2] Then
{
sell("s");
loss = Highest(O,2);
ExitShort("sx1",AtStop,loss);
}
}
if MarketPosition == -1 Then
{
ExitShort("sx2",AtStop,loss);
if countif(C<O,BarsSinceEntry) >= 2 Then
ExitShort("sx",AtStop,EntryPrice-PriceScale*1);
}
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> //매수준비 (매수스탠바이)
무포지션에서
최초 음봉 후에
연속되는 3연속봉이 모두 양봉이 발생하면
이 때부터 3개의 봉의 최고가 high 를 잡고 상승폭의 최고가는 새로운 양봉이 진행
될 수록
새롭게 경신해 가며 음봉이 발생하면 발생 음봉의 전봉의 양봉까지의 최고가를 잡습니다.
상승폭의 최저가는 위의 최초 음봉 바로 뒤의 연속봉중 첫 양봉의 저가를
상승폭의 최저가라고 정의합니다.
상승폭 최저가 대비 최고가의 간격이 상승폭 간격이 되고
최초의 최고가 형성이후 만들어지는 봉의 최저가가 상승폭의 절반을 하향으로
침범하지 않을 때 매수 준비 조건이며
또 이 상승폭 간격 안에 20 이동평균값이 있어야 하고
상승폭이 20틱 이상이어야 매수조건이며
이 상승폭 간격 안에서 종가가 20 이평값을 돌파한 한 후에는
이후 발생봉의 몸통 즉 시가이던 지 종가이던 지 그 어느것도 20 이평값을 하향돌파해서는 안됩니다.
위의 조건들을 만족하지 못하면 모든 매수 준비는
해제하고
모든 변수들도 무포지션시처럼 초기화하고 새로운 상승폭 조건들을 감시합니다.
//매수진입
위의 조건 매수 스탠바이 즉 매수준비상태에서
음봉을 관찰하고 음봉이후에 양봉이 2개 연속 발생하면 매수합니다.
이때의 매수할 때의 양봉 2개 즉 연속발생할 때 연속 2개 양봉중 시가가 낮은 값을
손절청산값 A1 정의합니다.
A1= 매수시의 연속 2개 양봉중 낮은 시가
손절청산
매수후 손졸청산값을 가능하면 현재가로 부탁합니다.A1을 종가가 아닌 현재가가 하향할 때 청산합니다.
현재가로 손절이나 본절 청산이 가능합니까?
반대방향 진입
매도조건도 위의 매수조건과 동일한 논리 즉 반대방향으로 작성 부탁드립니다.
감사합니다.