커뮤니티
문의
2016-09-05 11:24:43
96
글번호 101675
안녕하세요
일전에 문의한 적이 있는데 구현이 어려워 간단하게 다시 정리해서 신호를 만들려고 합니다
아래 수식에서 진입 개수 추가하는 수식만 수정 부탁합니다
단기 장기 이평선 크로스 기본신호에따라 목표틱인 P1, P2의 익절이 도달되지 않으면 반대신호 나올때마다 N계약까지 한 계약씩 추가하면 됩니다
P1, P2틱 익절이 도달되면 다시 한 계약으로 시작합니다
물론 적은 익절이든 로스컷(L1, L2)이든 목표틱 P1, P2가 도달되지 않으면 무조건 한 계약씩 추가해서 최대 N계약까지 진입하고 N계약후엔 목표틱 도달전까지 계속 N계약을 유지합니다
감사합니다
---------------------------------------------------------------------------------------
nput : L1(10),P1(10),L2(15),P2(15);
var1 = ma(c,5);
var2 = ma(c,20);
if MarketPosition <= 0 and crossup(var1,var2) Then
buy("B");
if MarketPosition == 1 Then{
if stime >= 70000 and stime < 160000 Then{
exitlong("BL1",AtStop,EntryPrice-PriceScale*L1);
exitlong("BP1",AtLimit,EntryPrice+PriceScale*P1);
}
Else{
exitlong("BL2",AtStop,EntryPrice-PriceScale*L2);
exitlong("BP2",AtLimit,EntryPrice+PriceScale*P2);
}
}
if MarketPosition >= 0 and CrossDown(var1,var2) Then
sell("S");
if MarketPosition == -1 Then{
if stime >= 70000 and stime < 160000 Then{
ExitShort("SL1",AtStop,EntryPrice+PriceScale*L1);
ExitShort("SP1",AtLimit,EntryPrice-PriceScale*P1);
}
Else{
ExitShort("SL2",AtStop,EntryPrice+PriceScale*L2);
ExitShort("SP2",AtLimit,EntryPrice-PriceScale*P2);
}
}
답변 1
예스스탁 예스스탁 답변
2016-09-05 18:22:13
안녕하세요
예스스탁입니다.
input : 기본수량(1), 증가수량(1),최대수량(10);
input : L1(10),P1(10),L2(15),P2(15);
var1 = ma(c,5);
var2 = ma(c,20);
if MarketPosition <= 0 and crossup(var1,var2) Then{
if (MarketPosition == 0 and TotalTrades == 0) or
(MarketPosition == 0 and TotalTrades >= 1 and
(IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("sP1",1))) Then
buy("B1",onclose,def,기본수량);
Else{
if MarketPosition == -1 then
buy("B2",onclose,def,min(CurrentContracts+증가수량,최대수량));
else
buy("B3",onclose,def,min(MaxContracts(1)+증가수량,최대수량));
}
}
if MarketPosition == 1 Then{
if stime >= 70000 and stime < 160000 Then{
exitlong("BL1",AtStop,EntryPrice-PriceScale*L1);
exitlong("BP1",AtLimit,EntryPrice+PriceScale*P1);
}
Else{
exitlong("BL2",AtStop,EntryPrice-PriceScale*L2);
exitlong("BP2",AtLimit,EntryPrice+PriceScale*P2);
}
}
if MarketPosition >= 0 and CrossDown(var1,var2) Then{
if (MarketPosition == 0 and TotalTrades == 0) or
(MarketPosition == 0 and TotalTrades >= 1 and
(IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("sP1",1))) Then
Sell("S1",onclose,def,기본수량);
Else{
if MarketPosition == 1 then
Sell("S2",onclose,def,min(CurrentContracts+증가수량,최대수량));
else
sell("S3",onclose,def,min(MaxContracts(1)+증가수량,최대수량));
}
}
if MarketPosition == -1 Then{
if stime >= 70000 and stime < 160000 Then{
ExitShort("SL1",AtStop,EntryPrice+PriceScale*L1);
ExitShort("SP1",AtLimit,EntryPrice-PriceScale*P1);
}
Else{
ExitShort("SL2",AtStop,EntryPrice+PriceScale*L2);
ExitShort("SP2",AtLimit,EntryPrice-PriceScale*P2);
}
}
즐거운 하루되세요
> 쿠루드 님이 쓴 글입니다.
> 제목 : 문의
> 안녕하세요
일전에 문의한 적이 있는데 구현이 어려워 간단하게 다시 정리해서 신호를 만들려고 합니다
아래 수식에서 진입 개수 추가하는 수식만 수정 부탁합니다
단기 장기 이평선 크로스 기본신호에따라 목표틱인 P1, P2의 익절이 도달되지 않으면 반대신호 나올때마다 N계약까지 한 계약씩 추가하면 됩니다
P1, P2틱 익절이 도달되면 다시 한 계약으로 시작합니다
물론 적은 익절이든 로스컷(L1, L2)이든 목표틱 P1, P2가 도달되지 않으면 무조건 한 계약씩 추가해서 최대 N계약까지 진입하고 N계약후엔 목표틱 도달전까지 계속 N계약을 유지합니다
감사합니다
---------------------------------------------------------------------------------------
nput : L1(10),P1(10),L2(15),P2(15);
var1 = ma(c,5);
var2 = ma(c,20);
if MarketPosition <= 0 and crossup(var1,var2) Then
buy("B");
if MarketPosition == 1 Then{
if stime >= 70000 and stime < 160000 Then{
exitlong("BL1",AtStop,EntryPrice-PriceScale*L1);
exitlong("BP1",AtLimit,EntryPrice+PriceScale*P1);
}
Else{
exitlong("BL2",AtStop,EntryPrice-PriceScale*L2);
exitlong("BP2",AtLimit,EntryPrice+PriceScale*P2);
}
}
if MarketPosition >= 0 and CrossDown(var1,var2) Then
sell("S");
if MarketPosition == -1 Then{
if stime >= 70000 and stime < 160000 Then{
ExitShort("SL1",AtStop,EntryPrice+PriceScale*L1);
ExitShort("SP1",AtLimit,EntryPrice-PriceScale*P1);
}
Else{
ExitShort("SL2",AtStop,EntryPrice+PriceScale*L2);
ExitShort("SP2",AtLimit,EntryPrice-PriceScale*P2);
}
}