커뮤니티
수식 변경 요청 드립니다.
2017-05-29 21:46:56
112
글번호 109933
안녕하세요.
다음 식의 변경을 요청드립니다.
추가해야 할 조건은 첫진입 계약은 1계약으로 시작하고 손절 시 그다음 진입시 계약수가 앞전 계약수의 2배가 되도록 하며 수익 시 다시 1계약으로 셋팅되도록 부탁드립니다.
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수 (20),손절틱수 (20);
input : Period(50);
Var: value(0), HH(0), LL(0);
value = CCI(Period);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
# 매수/매도청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and CrossUp(value,-100) Then
{
Buy();
}
# 매도/매수청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and CrossDown(value,100) 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-05-30 14:17:11
안녕하세요
예스스탁입니다.
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수 (20),손절틱수 (20);
input : Period(50);
Var: value(0), HH(0), LL(0),vol(0);
value = CCI(Period);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
# 매수/매도청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and CrossUp(value,-100) Then
{
if IsExitName("bx",1) or IsExitName("sx",1) Then
vol = MaxContracts(1)*2;
Else
vol = 1;
Buy("b",OnClose,def,vol);
}
# 매도/매수청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and CrossDown(value,100) Then
{
if IsExitName("bx",1) or IsExitName("sx",1) Then
vol = MaxContracts(1)*2;
Else
vol = 1;
Sell("s",OnClose,def,vol);
}
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();
}
즐거운 하루되세요
> 고박사122 님이 쓴 글입니다.
> 제목 : 수식 변경 요청 드립니다.
> 안녕하세요.
다음 식의 변경을 요청드립니다.
추가해야 할 조건은 첫진입 계약은 1계약으로 시작하고 손절 시 그다음 진입시 계약수가 앞전 계약수의 2배가 되도록 하며 수익 시 다시 1계약으로 셋팅되도록 부탁드립니다.
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수 (20),손절틱수 (20);
input : Period(50);
Var: value(0), HH(0), LL(0);
value = CCI(Period);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
# 매수/매도청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and CrossUp(value,-100) Then
{
Buy();
}
# 매도/매수청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and CrossDown(value,100) 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();
}