예스스탁
예스스탁 답변
2024-08-08 16:54:24
안녕하세요
예스스탁입니다.
피라미딩을 다른진입신호만 허용으로 설정하고 적요하시면 됩니다.
input : P1(20),P2(60);
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");
}
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");
}
Else
{
sx1 = False;
sx2 = False;
sx3 = False;
}
즐거운 하루되세요
> 카르마다 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 수고많습니다.
선물 2계약 시스템매매에서
진입은
20이평선과 60이평선 중에서 더 높은 가격보다 10틱이상 상승하면 바로 1계약 매수, 그 더 높은 가격보다 위에서 종가가 완성되면 1계약 추가 매수입니다. (추가매수는 더 높은 가격보다만 1틱이라도 더 크면 만족합니다)
청산은
1. 30틱 이상 상승한 후 20틱 밀리면 1계약 청산 또는 진입가에서 30틱 밀리면 1계약 청산
2. 나머지 1개는 20이평선과 60이평선중에 1개선이라도 10틱이상 하락하거나 두 이평선중에서 1틱이라도 이탈로 종가가 완성되면 청산. (이때 2계약이 다 남아 있다면 1계약 청산이 아니라 모두 청산입니다)
매도진입과 청산은 반대입니다.
※ 만일 10틱이상 상승, 하락시 바로 진입이 불가하다면 1계약은 1틱이라도 더 높으면 진입, 나머지 1계약은 10틱이상 더 높으면 진입으로 해주셔도 좋습니다. 즉 10틱이상 더 위에 있으면 2계약 모두 진입이고 5틱만 상승한 종가면 1계약만 진입했다가 이후 10틱이상 올라가는 봉에서 진입되면 됩니다.
두가지 방식 다 가능하다면 둘 다 만들어주셔도 감사하겠습니다.
주석도 조금 부탁드립니다.
미리 노고에 감사드립니다.