커뮤니티
다시부탁드립니다--------------
2012-01-30 17:33:27
443
글번호 47085
Var:시작봉(2),허용치(10),당일손익(400000);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
if DayIndex+1== 시작봉+1 Then{
if C > dayopen Then
var65 = o-PriceScale*허용치;
if C < dayopen Then
var65 = o+PriceScale*허용치;
}
if dayindex+1 == 시작봉+1 Then
var66 = O;
value1 = max(var65,var66);
value2 = min(var65,var66);
value3 = ma(c,10);
value6 = (당일손익/BigPointValue);
if dayindex+1 >= 시작봉+1 and dayPL < value6 Then{
if C>=value1 and count<1 Then
buy("b",AtStop,Value1);
if C<=value2 and count<1 Then
sell("s",AtStop,Value2);
}
if dayindex+1 >= 시작봉+1 and dayPL < value6 and
count>0 Then{
if C>=value1 Then
buy("b1",AtStop,Value1);
if C<=value2 Then
sell("s1",AtStop,Value2);
}
SetStopLoss(PriceScale*5,PointStop);
/*
if MarketPosition == 1 Then{
value4 = highest(H,BarsSinceEntry);
if value4 >= EntryPrice+PriceScale*2 and value4 < EntryPrice+PriceScale*3 Then
exitlong("bx1",AtStop,EntryPrice);
if value4 >= EntryPrice+PriceScale*4 and value4 < EntryPrice+PriceScale*6 Then
exitlong("bx2",AtStop,value4-(value4-EntryPrice)*0.70);
if value4 >= EntryPrice+PriceScale*7 and value4 < EntryPrice+PriceScale*10 Then
exitlong("bx3",AtStop,value4-(value4-EntryPrice)*0.60);
if value4 >= EntryPrice+PriceScale*11 and value4 < EntryPrice+PriceScale*15 Then
exitlong("bx4",AtStop,value4-(value4-EntryPrice)*0.50);
if value4 >= EntryPrice+PriceScale*16 and value4 < EntryPrice+PriceScale*25 Then
exitlong("bx5",AtStop,value4-(value4-EntryPrice)*0.45);
if value4 >= EntryPrice+PriceScale*26 and value4 < EntryPrice+PriceScale*40 Then
exitlong("bx6",AtStop,value4-(value4-EntryPrice)*0.40);
if value4 >= EntryPrice+PriceScale*41 and value4 < EntryPrice+PriceScale*60 Then
exitlong("bx7",AtStop,value4-(value4-EntryPrice)*0.35);
if value4 >= EntryPrice+PriceScale*61 and value4 < EntryPrice+PriceScale*90 Then
exitlong("bx8",AtStop,value4-(value4-EntryPrice)*0.30);
if value4 >= EntryPrice+PriceScale*91 and value4 < EntryPrice+PriceScale*110 Then
exitlong("bx9",AtStop,value4-(value4-EntryPrice)*0.25);
if value4 >= EntryPrice+PriceScale*111 and value4 < EntryPrice+PriceScale*150 Then
exitlong("bx10",AtStop,value4-(value4-EntryPrice)*0.20);
if value4 >= EntryPrice+PriceScale*151 Then
exitlong("bx11",AtStop,value4-(value4-EntryPrice)*0.1);
}
if MarketPosition == -1 Then{
value5 = Lowest(L,BarsSinceEntry);
if value5 <= EntryPrice-PriceScale*2 and value5 > EntryPrice-PriceScale*3 Then
ExitShort("sx1",AtStop,EntryPrice);
if value5 <= EntryPrice-PriceScale*4 and value5 > EntryPrice-PriceScale*6 Then
ExitShort("sx2",AtStop,value5+(entryprice-value5)*0.70);
if value5 <= EntryPrice-PriceScale*7 and value5 > EntryPrice-PriceScale*10 Then
ExitShort("sx3",AtStop,value5+(entryprice-value5)*0.60);
if value5 <= EntryPrice-PriceScale*11 and value5 > EntryPrice-PriceScale*15 Then
ExitShort("sx4",AtStop,value5+(entryprice-value5)*0.50);
if value5 <= EntryPrice-PriceScale*16 and value5 > EntryPrice-PriceScale*25 Then
ExitShort("sx5",AtStop,value5+(entryprice-value5)*0.45);
if value5 <= EntryPrice-PriceScale*26 and value5 > EntryPrice-PriceScale*40 Then
ExitShort("sx6",AtStop,value5+(entryprice-value5)*0.40);
if value5 <= EntryPrice-PriceScale*41 and value5 > EntryPrice-PriceScale*60 Then
ExitShort("sx7",AtStop,value5+(entryprice-value5)*0.35);
if value5 <= EntryPrice-PriceScale*61 and value5 > EntryPrice-PriceScale*90 Then
ExitShort("sx8",AtStop,value5+(entryprice-value5)*0.30);
if value5 <= EntryPrice-PriceScale*91 and value5 > EntryPrice-PriceScale*110 Then
ExitShort("sx9",AtStop,value5+(entryprice-value5)*0.25);
if value5 <= EntryPrice-PriceScale*111 and value5 > EntryPrice-PriceScale*150 Then
ExitShort("sx10",AtStop,value5+(entryprice-value5)*0.20);
if value5 <= EntryPrice-PriceScale*151 Then
ExitShort("sx11",AtStop,value5+(entryprice-value5)*0.1);
}
*/
if MarketPosition == 1 Then{
ExitLong("bxx",AtStop,EntryPrice+(-(value6)-(PLR)));
}
if MarketPosition == -1 Then{
ExitShort("sxx",AtStop,EntryPrice+((value6)+(PLR)));
}
//시간청산------------------------------------------------------------
var91 = int(date/100)-int(date/10000)*100; //월
var92 = date - int(date/100)*100; //일
var93 = DayOfWeek(date); //요일
if var91%3 == 0 and var92 >= 8 and var92 <= 14 and var93 == 4 then {
SetStopEndofday(144800);
}
else {
SetStopEndofday(150100);
}
옵션프로그램도 선물과 동일한거 아닌가요?(호가단위제외)
일단추적은 막아놨슴니다 정확히 아랫라인에서 매도 윗라인에서 매수 하게해주세요
정확히 그지점에서 매매되게해주세요 첨부보면 몇틱씩 차이 나네요
그리고 첫봉에 진입한경우도 있네요 로직상 4째봉 시가에 진입인데요
항상수고하십니다============
- 1. 옵션02300.xls (0.14 MB)
답변 1
예스스탁 예스스탁 답변
2012-01-30 18:45:48
안녕하세요
예스스탁입니다.
Var:시작봉(2),허용치(10),당일손익(400000);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
if DayIndex+1== 시작봉+1 Then{
if C > dayopen Then
var65 = o-PriceScale*허용치;
if C < dayopen Then
var65 = o+PriceScale*허용치;
}
if dayindex+1 == 시작봉+1 Then
var66 = O;
value1 = max(var65,var66);
value2 = min(var65,var66);
value3 = ma(c,10);
value6 = (당일손익/BigPointValue);
if dayindex+1 >= 시작봉+1 and dayPL < value6 and stime < 150000 and count<1 Then{
if c <= value1 Then
buy("b",AtStop,Value1);
if c >= value2 Then
sell("s",AtStop,Value2);
}
if dayindex+1 >= 시작봉+1 and dayPL < value6 and count>0 and stime < 150000 Then{
if c <= value1 Then
buy("b1",AtStop,Value1);
if c >= value2 Then
sell("s1",AtStop,Value2);
}
SetStopLoss(PriceScale*5,PointStop);
/*
if MarketPosition == 1 Then{
value4 = highest(H,BarsSinceEntry);
if value4 >= EntryPrice+PriceScale*2 and value4 < EntryPrice+PriceScale*3 Then
exitlong("bx1",AtStop,EntryPrice);
if value4 >= EntryPrice+PriceScale*4 and value4 < EntryPrice+PriceScale*6 Then
exitlong("bx2",AtStop,value4-(value4-EntryPrice)*0.70);
if value4 >= EntryPrice+PriceScale*7 and value4 < EntryPrice+PriceScale*10 Then
exitlong("bx3",AtStop,value4-(value4-EntryPrice)*0.60);
if value4 >= EntryPrice+PriceScale*11 and value4 < EntryPrice+PriceScale*15 Then
exitlong("bx4",AtStop,value4-(value4-EntryPrice)*0.50);
if value4 >= EntryPrice+PriceScale*16 and value4 < EntryPrice+PriceScale*25 Then
exitlong("bx5",AtStop,value4-(value4-EntryPrice)*0.45);
if value4 >= EntryPrice+PriceScale*26 and value4 < EntryPrice+PriceScale*40 Then
exitlong("bx6",AtStop,value4-(value4-EntryPrice)*0.40);
if value4 >= EntryPrice+PriceScale*41 and value4 < EntryPrice+PriceScale*60 Then
exitlong("bx7",AtStop,value4-(value4-EntryPrice)*0.35);
if value4 >= EntryPrice+PriceScale*61 and value4 < EntryPrice+PriceScale*90 Then
exitlong("bx8",AtStop,value4-(value4-EntryPrice)*0.30);
if value4 >= EntryPrice+PriceScale*91 and value4 < EntryPrice+PriceScale*110 Then
exitlong("bx9",AtStop,value4-(value4-EntryPrice)*0.25);
if value4 >= EntryPrice+PriceScale*111 and value4 < EntryPrice+PriceScale*150 Then
exitlong("bx10",AtStop,value4-(value4-EntryPrice)*0.20);
if value4 >= EntryPrice+PriceScale*151 Then
exitlong("bx11",AtStop,value4-(value4-EntryPrice)*0.1);
}
if MarketPosition == -1 Then{
value5 = Lowest(L,BarsSinceEntry);
if value5 <= EntryPrice-PriceScale*2 and value5 > EntryPrice-PriceScale*3 Then
ExitShort("sx1",AtStop,EntryPrice);
if value5 <= EntryPrice-PriceScale*4 and value5 > EntryPrice-PriceScale*6 Then
ExitShort("sx2",AtStop,value5+(entryprice-value5)*0.70);
if value5 <= EntryPrice-PriceScale*7 and value5 > EntryPrice-PriceScale*10 Then
ExitShort("sx3",AtStop,value5+(entryprice-value5)*0.60);
if value5 <= EntryPrice-PriceScale*11 and value5 > EntryPrice-PriceScale*15 Then
ExitShort("sx4",AtStop,value5+(entryprice-value5)*0.50);
if value5 <= EntryPrice-PriceScale*16 and value5 > EntryPrice-PriceScale*25 Then
ExitShort("sx5",AtStop,value5+(entryprice-value5)*0.45);
if value5 <= EntryPrice-PriceScale*26 and value5 > EntryPrice-PriceScale*40 Then
ExitShort("sx6",AtStop,value5+(entryprice-value5)*0.40);
if value5 <= EntryPrice-PriceScale*41 and value5 > EntryPrice-PriceScale*60 Then
ExitShort("sx7",AtStop,value5+(entryprice-value5)*0.35);
if value5 <= EntryPrice-PriceScale*61 and value5 > EntryPrice-PriceScale*90 Then
ExitShort("sx8",AtStop,value5+(entryprice-value5)*0.30);
if value5 <= EntryPrice-PriceScale*91 and value5 > EntryPrice-PriceScale*110 Then
ExitShort("sx9",AtStop,value5+(entryprice-value5)*0.25);
if value5 <= EntryPrice-PriceScale*111 and value5 > EntryPrice-PriceScale*150 Then
ExitShort("sx10",AtStop,value5+(entryprice-value5)*0.20);
if value5 <= EntryPrice-PriceScale*151 Then
ExitShort("sx11",AtStop,value5+(entryprice-value5)*0.1);
}
*/
if MarketPosition == 1 Then{
ExitLong("bxx",AtStop,EntryPrice+(-(value6)-(PLR)));
}
if MarketPosition == -1 Then{
ExitShort("sxx",AtStop,EntryPrice+((value6)+(PLR)));
}
//시간청산------------------------------------------------------------
var91 = int(date/100)-int(date/10000)*100; //월
var92 = date - int(date/100)*100; //일
var93 = DayOfWeek(date); //요일
if var91%3 == 0 and var92 >= 8 and var92 <= 14 and var93 == 4 then {
SetStopEndofday(144800);
}
else {
SetStopEndofday(150100);
}
즐거운 하루되세요
> leekss1 님이 쓴 글입니다.
> 제목 : 다시부탁드립니다--------------
> Var:시작봉(2),허용치(10),당일손익(400000);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
if DayIndex+1== 시작봉+1 Then{
if C > dayopen Then
var65 = o-PriceScale*허용치;
if C < dayopen Then
var65 = o+PriceScale*허용치;
}
if dayindex+1 == 시작봉+1 Then
var66 = O;
value1 = max(var65,var66);
value2 = min(var65,var66);
value3 = ma(c,10);
value6 = (당일손익/BigPointValue);
if dayindex+1 >= 시작봉+1 and dayPL < value6 Then{
if C>=value1 and count<1 Then
buy("b",AtStop,Value1);
if C<=value2 and count<1 Then
sell("s",AtStop,Value2);
}
if dayindex+1 >= 시작봉+1 and dayPL < value6 and
count>0 Then{
if C>=value1 Then
buy("b1",AtStop,Value1);
if C<=value2 Then
sell("s1",AtStop,Value2);
}
SetStopLoss(PriceScale*5,PointStop);
/*
if MarketPosition == 1 Then{
value4 = highest(H,BarsSinceEntry);
if value4 >= EntryPrice+PriceScale*2 and value4 < EntryPrice+PriceScale*3 Then
exitlong("bx1",AtStop,EntryPrice);
if value4 >= EntryPrice+PriceScale*4 and value4 < EntryPrice+PriceScale*6 Then
exitlong("bx2",AtStop,value4-(value4-EntryPrice)*0.70);
if value4 >= EntryPrice+PriceScale*7 and value4 < EntryPrice+PriceScale*10 Then
exitlong("bx3",AtStop,value4-(value4-EntryPrice)*0.60);
if value4 >= EntryPrice+PriceScale*11 and value4 < EntryPrice+PriceScale*15 Then
exitlong("bx4",AtStop,value4-(value4-EntryPrice)*0.50);
if value4 >= EntryPrice+PriceScale*16 and value4 < EntryPrice+PriceScale*25 Then
exitlong("bx5",AtStop,value4-(value4-EntryPrice)*0.45);
if value4 >= EntryPrice+PriceScale*26 and value4 < EntryPrice+PriceScale*40 Then
exitlong("bx6",AtStop,value4-(value4-EntryPrice)*0.40);
if value4 >= EntryPrice+PriceScale*41 and value4 < EntryPrice+PriceScale*60 Then
exitlong("bx7",AtStop,value4-(value4-EntryPrice)*0.35);
if value4 >= EntryPrice+PriceScale*61 and value4 < EntryPrice+PriceScale*90 Then
exitlong("bx8",AtStop,value4-(value4-EntryPrice)*0.30);
if value4 >= EntryPrice+PriceScale*91 and value4 < EntryPrice+PriceScale*110 Then
exitlong("bx9",AtStop,value4-(value4-EntryPrice)*0.25);
if value4 >= EntryPrice+PriceScale*111 and value4 < EntryPrice+PriceScale*150 Then
exitlong("bx10",AtStop,value4-(value4-EntryPrice)*0.20);
if value4 >= EntryPrice+PriceScale*151 Then
exitlong("bx11",AtStop,value4-(value4-EntryPrice)*0.1);
}
if MarketPosition == -1 Then{
value5 = Lowest(L,BarsSinceEntry);
if value5 <= EntryPrice-PriceScale*2 and value5 > EntryPrice-PriceScale*3 Then
ExitShort("sx1",AtStop,EntryPrice);
if value5 <= EntryPrice-PriceScale*4 and value5 > EntryPrice-PriceScale*6 Then
ExitShort("sx2",AtStop,value5+(entryprice-value5)*0.70);
if value5 <= EntryPrice-PriceScale*7 and value5 > EntryPrice-PriceScale*10 Then
ExitShort("sx3",AtStop,value5+(entryprice-value5)*0.60);
if value5 <= EntryPrice-PriceScale*11 and value5 > EntryPrice-PriceScale*15 Then
ExitShort("sx4",AtStop,value5+(entryprice-value5)*0.50);
if value5 <= EntryPrice-PriceScale*16 and value5 > EntryPrice-PriceScale*25 Then
ExitShort("sx5",AtStop,value5+(entryprice-value5)*0.45);
if value5 <= EntryPrice-PriceScale*26 and value5 > EntryPrice-PriceScale*40 Then
ExitShort("sx6",AtStop,value5+(entryprice-value5)*0.40);
if value5 <= EntryPrice-PriceScale*41 and value5 > EntryPrice-PriceScale*60 Then
ExitShort("sx7",AtStop,value5+(entryprice-value5)*0.35);
if value5 <= EntryPrice-PriceScale*61 and value5 > EntryPrice-PriceScale*90 Then
ExitShort("sx8",AtStop,value5+(entryprice-value5)*0.30);
if value5 <= EntryPrice-PriceScale*91 and value5 > EntryPrice-PriceScale*110 Then
ExitShort("sx9",AtStop,value5+(entryprice-value5)*0.25);
if value5 <= EntryPrice-PriceScale*111 and value5 > EntryPrice-PriceScale*150 Then
ExitShort("sx10",AtStop,value5+(entryprice-value5)*0.20);
if value5 <= EntryPrice-PriceScale*151 Then
ExitShort("sx11",AtStop,value5+(entryprice-value5)*0.1);
}
*/
if MarketPosition == 1 Then{
ExitLong("bxx",AtStop,EntryPrice+(-(value6)-(PLR)));
}
if MarketPosition == -1 Then{
ExitShort("sxx",AtStop,EntryPrice+((value6)+(PLR)));
}
//시간청산------------------------------------------------------------
var91 = int(date/100)-int(date/10000)*100; //월
var92 = date - int(date/100)*100; //일
var93 = DayOfWeek(date); //요일
if var91%3 == 0 and var92 >= 8 and var92 <= 14 and var93 == 4 then {
SetStopEndofday(144800);
}
else {
SetStopEndofday(150100);
}
옵션프로그램도 선물과 동일한거 아닌가요?(호가단위제외)
일단추적은 막아놨슴니다 정확히 아랫라인에서 매도 윗라인에서 매수 하게해주세요
정확히 그지점에서 매매되게해주세요 첨부보면 몇틱씩 차이 나네요
그리고 첫봉에 진입한경우도 있네요 로직상 4째봉 시가에 진입인데요
항상수고하십니다============