커뮤니티
수식부탁드립니다-----------
2011-09-19 18:49:58
502
글번호 42800
input: 테마기간(66),채널기간(212),수평2(7),이익(92),손절(5),전봉차(0.008),진입가(-12),Per1(0.012),X1(100);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
if stime >= 090100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 then {
if var77 >= var77[1]+전봉차 and CountIF(Tchan==Tchan[1],수평) == 수평 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
----------------------------------------------
위식에 하루손실 20틱이면 매매종료 해주세요
답변 1
예스스탁 예스스탁 답변
2011-09-20 11:30:56
안녕하세요
예스스탁입니다.
input: 테마기간(66),채널기간(212),수평(7),이익(92),손절(5),전봉차(0.008),진입가(-12),Per1(0.012),X1(100);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
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;
}
#당일누적손익계산 끝
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
if stime >= 090100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*20) then {
if var77 >= var77[1]+전봉차 and CountIF(Tchan==Tchan[1],수평) == 수평 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*20) then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
if dayPL <= - PriceScale*20 Then{
exitlong();
ExitShort();
}
즐거운 하루되세요
> leekss1 님이 쓴 글입니다.
> 제목 : 수식부탁드립니다-----------
> input: 테마기간(66),채널기간(212),수평2(7),이익(92),손절(5),전봉차(0.008),진입가(-12),Per1(0.012),X1(100);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
if stime >= 090100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 then {
if var77 >= var77[1]+전봉차 and CountIF(Tchan==Tchan[1],수평) == 수평 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
----------------------------------------------
위식에 하루손실 20틱이면 매매종료 해주세요
이전글