커뮤니티
문의드립니다.
2012-09-09 22:36:37
276
글번호 54515
이전답변에 대해 감사드립니다.
수식에 몇가지 추가할 사항이 있어 문의드립니다.
input : 금액1(1000000),금액2(1000000),금액3(2000000);
if CodeCategory == 1 Then
{
if BasePrice < 50000 Then
{
Var1 = int(int(금액1/C)/10)*10;
Var2 = int(int(금액1/C)/10)*10;
Var3 = int(int(금액1/C)/10)*10;
}
Else{
Var1 = int(금액1/C);
Var2 = int(금액2/C);
Var3 = int(금액3/C);
}
}
if CodeCategory == 2 Then
{
Var1 = int(금액1/C);
Var2 = int(금액2/C);
Var3 = int(금액3/C);
}
if CodeCategory == 6 Then
{
Var1 = int(금액1/(C*BigPointValue));
Var2 = int(금액2/(C*BigPointValue));
Var3 = int(금액3/(C*BigPointValue));
}
Condition1 = ExitDate(1) == sdate and IsExitName("bxx",1);
value1 = BollBandDown(20,2);
value2 = ma(c,20);
value3 = BollBandUp(20,2);
if MarketPosition == 0 and Condition1 == false Then
buy("b",Atlimit,value1*0.97,var1);
if MarketPosition == 1 and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then{
buy("b2",atlimit,EntryPrice*0.98,var2);
buy("b3",atlimit,EntryPrice*0.96,var3);
}
if MarketPosition == 1 Then{
if CrossDown(c,ma(c,20)) Then
exitlong();
if CurrentEntries == 3 Then
ExitLong("bxx",AtStop,EntryPrice*0.94);
if CurrentContracts == MaxContracts and CurrentEntries > CurrentEntries[1] Then{
if CodeCategory == 1 and BasePrice < 50000 Then{
Var11 = int(int(CurrentContracts*(1/3))/10)*10;
Var12 = int(int(CurrentContracts*(1/2))/10)*10;
}
Else{
Var11 = int(CurrentContracts*(1/3));
Var12 = int(CurrentContracts*(1/2));
}
}
if CurrentEntries == 1 Then
{
if CurrentContracts == MaxContracts Then
ExitLong("bx11",atlimit,EntryPrice*1.005,"",var11,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx12",atlimit,EntryPrice*1.011,"",var11,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx13",atlimit,EntryPrice*1.020);
}
if CurrentEntries == 2 Then
{
if CurrentContracts == MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then
ExitLong("bx21",atlimit,EntryPrice,"",var11,1);
if CurrentContracts < MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) == 1 Then
ExitLong("bx22",atlimit,EntryPrice*1.005,"",var11,1);
if CurrentContracts < MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) == 2 Then
ExitLong("bx23",atlimit,EntryPrice*1.011);
}
if CurrentEntries == 3 Then
{
if CurrentContracts == MaxContracts Then
ExitLong("bx31",atlimit,EntryPrice,"",var12,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx32",atlimit,EntryPrice*0.005);
}
}
위의 수식에 1,2,3차 매수가 각각 실행 되었을 경우 매수 평균가 기준- 최대수익대비 하락- 20% ,1%수익이후 전량매도를 할 수있는 수식을 추가 하고자 합니다.
그리고 오후 2시 40분이 되면 매수된 물량을 모두 청산하는 식을 추가해주시면 감사하겠습니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2012-09-10 10:25:48
안녕하세요
예스스탁입니다.
input : 금액1(1000000),금액2(1000000),금액3(2000000);
if CodeCategory == 1 Then
{
if BasePrice < 50000 Then
{
Var1 = int(int(금액1/C)/10)*10;
Var2 = int(int(금액1/C)/10)*10;
Var3 = int(int(금액1/C)/10)*10;
}
Else{
Var1 = int(금액1/C);
Var2 = int(금액2/C);
Var3 = int(금액3/C);
}
}
if CodeCategory == 2 Then
{
Var1 = int(금액1/C);
Var2 = int(금액2/C);
Var3 = int(금액3/C);
}
if CodeCategory == 6 Then
{
Var1 = int(금액1/(C*BigPointValue));
Var2 = int(금액2/(C*BigPointValue));
Var3 = int(금액3/(C*BigPointValue));
}
Condition1 = ExitDate(1) == sdate and IsExitName("bxx",1);
value1 = BollBandDown(20,2);
value2 = ma(c,20);
value3 = BollBandUp(20,2);
if MarketPosition == 0 and Condition1 == false Then
buy("b",Atlimit,value1*0.97,var1);
if MarketPosition == 1 and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then{
buy("b2",atlimit,EntryPrice*0.98,var2);
buy("b3",atlimit,EntryPrice*0.96,var3);
}
if MarketPosition == 1 Then{
if CrossDown(c,ma(c,20)) Then
exitlong();
if CurrentEntries == 3 Then
ExitLong("bxx",AtStop,EntryPrice*0.94);
if CurrentContracts == MaxContracts and CurrentEntries > CurrentEntries[1] Then{
value99 = H;
if CodeCategory == 1 and BasePrice < 50000 Then{
Var11 = int(int(CurrentContracts*(1/3))/10)*10;
Var12 = int(int(CurrentContracts*(1/2))/10)*10;
}
Else{
Var11 = int(CurrentContracts*(1/3));
Var12 = int(CurrentContracts*(1/2));
}
}
if CurrentEntries == 1 Then
{
if CurrentContracts == MaxContracts Then
ExitLong("bx11",atlimit,EntryPrice*1.005,"",var11,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx12",atlimit,EntryPrice*1.011,"",var11,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx13",atlimit,EntryPrice*1.020);
}
if CurrentEntries == 2 Then
{
if CurrentContracts == MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then
ExitLong("bx21",atlimit,EntryPrice,"",var11,1);
if CurrentContracts < MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) == 1 Then
ExitLong("bx22",atlimit,EntryPrice*1.005,"",var11,1);
if CurrentContracts < MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) == 2 Then
ExitLong("bx23",atlimit,EntryPrice*1.011);
}
if CurrentEntries == 3 Then
{
if CurrentContracts == MaxContracts Then
ExitLong("bx31",atlimit,EntryPrice,"",var12,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx32",atlimit,EntryPrice*0.005);
}
if H > value99 Then
value99 = H;
if value99 >= AvgEntryPrice*1.01 Then
exitlong("bx4",AtStop,value99-(value99-AvgEntryPrice)*0.20);
}
SetStopEndofday(144000);
즐거운 하루되세요
> 사과쥬스 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 이전답변에 대해 감사드립니다.
수식에 몇가지 추가할 사항이 있어 문의드립니다.
input : 금액1(1000000),금액2(1000000),금액3(2000000);
if CodeCategory == 1 Then
{
if BasePrice < 50000 Then
{
Var1 = int(int(금액1/C)/10)*10;
Var2 = int(int(금액1/C)/10)*10;
Var3 = int(int(금액1/C)/10)*10;
}
Else{
Var1 = int(금액1/C);
Var2 = int(금액2/C);
Var3 = int(금액3/C);
}
}
if CodeCategory == 2 Then
{
Var1 = int(금액1/C);
Var2 = int(금액2/C);
Var3 = int(금액3/C);
}
if CodeCategory == 6 Then
{
Var1 = int(금액1/(C*BigPointValue));
Var2 = int(금액2/(C*BigPointValue));
Var3 = int(금액3/(C*BigPointValue));
}
Condition1 = ExitDate(1) == sdate and IsExitName("bxx",1);
value1 = BollBandDown(20,2);
value2 = ma(c,20);
value3 = BollBandUp(20,2);
if MarketPosition == 0 and Condition1 == false Then
buy("b",Atlimit,value1*0.97,var1);
if MarketPosition == 1 and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then{
buy("b2",atlimit,EntryPrice*0.98,var2);
buy("b3",atlimit,EntryPrice*0.96,var3);
}
if MarketPosition == 1 Then{
if CrossDown(c,ma(c,20)) Then
exitlong();
if CurrentEntries == 3 Then
ExitLong("bxx",AtStop,EntryPrice*0.94);
if CurrentContracts == MaxContracts and CurrentEntries > CurrentEntries[1] Then{
if CodeCategory == 1 and BasePrice < 50000 Then{
Var11 = int(int(CurrentContracts*(1/3))/10)*10;
Var12 = int(int(CurrentContracts*(1/2))/10)*10;
}
Else{
Var11 = int(CurrentContracts*(1/3));
Var12 = int(CurrentContracts*(1/2));
}
}
if CurrentEntries == 1 Then
{
if CurrentContracts == MaxContracts Then
ExitLong("bx11",atlimit,EntryPrice*1.005,"",var11,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx12",atlimit,EntryPrice*1.011,"",var11,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx13",atlimit,EntryPrice*1.020);
}
if CurrentEntries == 2 Then
{
if CurrentContracts == MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then
ExitLong("bx21",atlimit,EntryPrice,"",var11,1);
if CurrentContracts < MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) == 1 Then
ExitLong("bx22",atlimit,EntryPrice*1.005,"",var11,1);
if CurrentContracts < MaxContracts and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) == 2 Then
ExitLong("bx23",atlimit,EntryPrice*1.011);
}
if CurrentEntries == 3 Then
{
if CurrentContracts == MaxContracts Then
ExitLong("bx31",atlimit,EntryPrice,"",var12,1);
if CurrentContracts < MaxContracts Then
ExitLong("bx32",atlimit,EntryPrice*0.005);
}
}
위의 수식에 1,2,3차 매수가 각각 실행 되었을 경우 매수 평균가 기준- 최대수익대비 하락- 20% ,1%수익이후 전량매도를 할 수있는 수식을 추가 하고자 합니다.
그리고 오후 2시 40분이 되면 매수된 물량을 모두 청산하는 식을 추가해주시면 감사하겠습니다.
감사합니다.