커뮤니티
수식 변경 요청드립니다.
2017-04-03 09:21:08
181
글번호 108407
안녕하세요.운영자님
다음 수식의 변경을 요청드립니다.
변경하고 싶은 사항은 아래 수식은 처음 손절선을 매수가의 -15틱으로 설정되어 있고 +15틱 이익이 나면 자동적으로 손절선이 +15틱 상향되게 되어 있는데요.
이것을 계속 +15틱 수익이 더 날때마다 계속하여 손절가를 +15틱 상향시킬 수 있도록 부탁드립니다.
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수 (30),손절틱수 (15);
input : P(20), Period4(14);
Var: mav(0),T(0), ADXv(0), HH(0), LL(0);
mav = ma(C,P);
ADXv = ADX(Period4);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
if mav > mav[1] Then
T = 1;
if mav < mav[1] Then
T = -1;
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and ADXv > 25 and T == 1 and T[1] != 1 Then
Buy();
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and ADXv > 25 and T == -1 and T[1] != -1 Then
Sell();
if MarketPosition == 1 Then{
LL = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수 ));
ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수 ))+(PriceScale*손절틱수 )*LL);
}
if MarketPosition == -1 Then{
HH = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*손절틱수 ));
ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수 )*HH);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
답변 1
예스스탁 예스스탁 답변
2017-04-04 11:17:37
안녕하세요
예스스탁입니다.
해당식 이미 문의하신 내용으로 작성되어 있습니다.
15틱 간격으로 손절손이 계속 올라가게 되어 있습니다.
즐거운 하루되세요
> 고박사122 님이 쓴 글입니다.
> 제목 : 수식 변경 요청드립니다.
> 안녕하세요.운영자님
다음 수식의 변경을 요청드립니다.
변경하고 싶은 사항은 아래 수식은 처음 손절선을 매수가의 -15틱으로 설정되어 있고 +15틱 이익이 나면 자동적으로 손절선이 +15틱 상향되게 되어 있는데요.
이것을 계속 +15틱 수익이 더 날때마다 계속하여 손절가를 +15틱 상향시킬 수 있도록 부탁드립니다.
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수 (30),손절틱수 (15);
input : P(20), Period4(14);
Var: mav(0),T(0), ADXv(0), HH(0), LL(0);
mav = ma(C,P);
ADXv = ADX(Period4);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
if mav > mav[1] Then
T = 1;
if mav < mav[1] Then
T = -1;
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and ADXv > 25 and T == 1 and T[1] != 1 Then
Buy();
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and ADXv > 25 and T == -1 and T[1] != -1 Then
Sell();
if MarketPosition == 1 Then{
LL = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수 ));
ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수 ))+(PriceScale*손절틱수 )*LL);
}
if MarketPosition == -1 Then{
HH = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*손절틱수 ));
ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수 )*HH);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
다음글