예스스탁
예스스탁 답변
2024-08-09 16:39:33
안녕하세요
예스스탁입니다.
input : P1(20),P2(60),N1(5),N2(20);
var : mav1(0),mav2(0);
var : bx1(False),bx2(False),bx3(False);
var : sx1(False),sx2(False),sx3(False);
mav1 = ma(c,P1);
mav2 = ma(c,P2);
if (MarketPosition <= 0 or ( MarketPosition == 1 and MaxEntries == 1)) and
H < max(mav1,mav2)+PriceScale*10 Then
Buy("b1",AtStop,max(mav1,mav2)+PriceScale*10,1);
if (MarketPosition <= 0 or ( MarketPosition == 1 and MaxEntries == 1)) and
C > max(mav1,mav2) Then
Buy("b2",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts < CurrentContracts[1] Then
{
if LatestExitName(0) == "bx1" Then
bx1 = true;
if LatestExitName(0) == "bx2" Then
bx2 = true;
if LatestExitName(0) == "bx3" Then
bx3 = true;
}
if bx1 == False and highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then
ExitLong("bx1",AtStop,highest(H,BarsSinceEntry)-PriceScale*20,"",1,1);
if bx2 == False Then
ExitLong("bx2",AtStop,EntryPrice-PriceScale*20,"",1,1);
if bx3 == False and
(mav1 <= mav1[BarsSinceEntry]-PriceScale*10 or
mav2 <= mav2[BarsSinceEntry]-PriceScale*10 or
c < mav1 or
C < mav2) Then
ExitLong("bx3");
#n1봉 이내 진입후 최고가에서 15틱 하락하면 즉시 청산
if BarsSinceEntry < n1 Then
ExitLong("bx4",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
#n2봉 이내 진입후 최고가에서 30틱 하락하면 즉시 청산
if BarsSinceEntry < n2 Then
ExitLong("bx5",AtStop,highest(H,BarsSinceEntry)-PriceScale*30);
}
Else
{
bx1 = False;
bx2 = False;
bx3 = False;
}
if (MarketPosition >= 0 or ( MarketPosition == -1 and MaxEntries == 1)) and
L > min(mav1,mav2)-PriceScale*10 Then
Sell("s1",AtStop,min(mav1,mav2)-PriceScale*10,1);
if (MarketPosition >= 0 or ( MarketPosition == -1 and MaxEntries == 1)) and
C < min(mav1,mav2) Then
Sell("s2",OnClose,Def,1);
if MarketPosition == -1 Then
{
if CurrentContracts < CurrentContracts[1] Then
{
if LatestExitName(0) == "sx1" Then
sx1 = true;
if LatestExitName(0) == "sx2" Then
sx2 = true;
if LatestExitName(0) == "sx3" Then
sx3 = true;
}
if sx1 == False and lowest(l,BarsSinceEntry) <= EntryPrice-PriceScale*30 Then
ExitShort("sx1",AtStop,lowest(L,BarsSinceEntry)+PriceScale*20,"",1,1);
if sx2 == False Then
ExitShort("sx2",AtStop,EntryPrice+PriceScale*20,"",1,1);
if sx3 == False and
(mav1 >= mav1[BarsSinceEntry]+PriceScale*10 or
mav2 >= mav2[BarsSinceEntry]+PriceScale*10 or
c > mav1 or
C > mav2) Then
ExitShort("sx3");
#n1봉 이내 진입후 최저가에서 15틱 상승하면 즉시 청산
if BarsSinceEntry < n1 Then
ExitShort("sx4",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*15);
#n2봉 이내 진입후 최저가에서 30틱 상승하면 즉시 청산
if BarsSinceEntry < n2 Then
ExitShort("sx5",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*30);
}
Else
{
sx1 = False;
sx2 = False;
sx3 = False;
}
즐거운 하루되세요
> 카르마다 님이 쓴 글입니다.
> 제목 : 88553 추가 문의드립니다!
> 노고에 늘 감사드립니다.
88553번에서 문의 드렸던 내용에 추가 요청드립니다.
매수의 경우
1. 조건에 맞아 매수 진입 되었는데 진입가를 기준으로 N1봉 이내에서 15틱이상 또는 N2봉 이내에서 30틱이상 되돌림이 나오면 즉시 청산합니다.
2. 청산된 후 원래 진입가를 기준으로 진입조건에 부합하고 진입가보다 10틱이상 내려갈 때만 바로 재매수하고 싶습니다.
매도는 그 반대입니다.
※ 약간의 주석도 부탁드립니다.
감사합니다. 즐거운 주말되세요~