커뮤니티
부탁드립니다---
2011-03-22 16:34:59
784
글번호 36796
Input : Period(0),maP(0),map6(0),N(0),Tr1(0),Tr2(0),진입(0),ADXP(0);
Input :Per1(0),X1(0),익절폭(0),절(0),손절0),시작시간(0);
Var : value(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;
}
#당일누적손익계산 끝
var2 = adx(adxP);
value = ma(bids,period)-ma(asks,period);
#최근 X봉 동안 최고값이 최저값대비 per%이상 큼
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
if stime >= 시작시간 and stime < 144500 and var2 >=10 and (dayPL < (c*익절폭) and dayPL > -(DayOpen*손절)) then
{
if value > value[1]+진입 and ma(C,map) >= ma(C,map)[1]+N and ma(C,9) >= ma(C,9)[1] and Condition1 Then
buy();
if value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and ma(C,9) <= ma(C,9)[1] and Condition1 Then
Sell();
}
SetStopLoss(PriceScale*절,PointStop);
#SetStopProfittarget(PriceScale*45,PointStop);
#당일 이익청산
if crossup(daypl,c*익절폭) then{
exitlong("익절1");
ExitShort("익절2");
}
#당일 손실청산
if CrossDown(daypl,-(dayopen*손절)) then{
exitlong("손절1");
ExitShort("손절2");
}
#단기이평청산----------------------
#if MarketPosition == 1 and ma(C,5) < ma(C,5)[1]-0.25 Then
# ExitLong();
#if MarketPosition == -1 and ma(C,5) > ma(C,5)[1]+0.25 Then
# ExitShort();
//시간청산--------------------
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); //평일
}
첨부에두가지부탁드립니다
- 1. 익절유지.xls (0.15 MB)
답변 1
예스스탁 예스스탁 답변
2011-03-23 10:25:30
안녕하세요
예스스탁입니다.
1.
관련 내용은 저희쪽에서 답변드릴 내용이 없습니다.
익절 발생시점에서 앞으로 추가로 이익이 발생할지를 판단해야 하므로
해당 조건식에 대해 고려해 보셔야 합니다.
추적스탑등도 하나의 대안이 될 수 있습니다.
2.
Input : Period(0),maP(0),map6(0),N(0),Tr1(0),Tr2(0),진입(0),ADXP(0);
Input :Per1(0),X1(0),절(0),손절(0),시작시간(0);
Var : 익절폭(0),value(0);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
익절폭 = (DayHigh-daylow)/dayopen;
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;
}
#당일누적손익계산 끝
var2 = adx(adxP);
value = ma(bids,period)-ma(asks,period);
#최근 X봉 동안 최고값이 최저값대비 per%이상 큼
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
if stime >= 시작시간 and stime < 144500 and var2 >=10 and (dayPL < (c*익절폭) and dayPL > -(DayOpen*손절)) then
{
if value > value[1]+진입 and ma(C,map) >= ma(C,map)[1]+N and ma(C,9) >= ma(C,9)[1] and Condition1 Then
buy();
if value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and ma(C,9) <= ma(C,9)[1] and Condition1 Then
Sell();
}
SetStopLoss(PriceScale*절,PointStop);
#SetStopProfittarget(PriceScale*45,PointStop);
#당일 이익청산
if crossup(daypl,c*익절폭[BarsSinceEntry]) then{
exitlong("익절1");
ExitShort("익절2");
}
#당일 손실청산
if CrossDown(daypl,-(dayopen*손절)) then{
exitlong("손절1");
ExitShort("손절2");
}
#단기이평청산----------------------
#if MarketPosition == 1 and ma(C,5) < ma(C,5)[1]-0.25 Then
# ExitLong();
#if MarketPosition == -1 and ma(C,5) > ma(C,5)[1]+0.25 Then
# ExitShort();
//시간청산--------------------
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); //평일
}
즐거운 하루되세요
> leekss1 님이 쓴 글입니다.
> 제목 : 부탁드립니다---
> Input : Period(0),maP(0),map6(0),N(0),Tr1(0),Tr2(0),진입(0),ADXP(0);
Input :Per1(0),X1(0),익절폭(0),절(0),손절0),시작시간(0);
Var : value(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;
}
#당일누적손익계산 끝
var2 = adx(adxP);
value = ma(bids,period)-ma(asks,period);
#최근 X봉 동안 최고값이 최저값대비 per%이상 큼
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
if stime >= 시작시간 and stime < 144500 and var2 >=10 and (dayPL < (c*익절폭) and dayPL > -(DayOpen*손절)) then
{
if value > value[1]+진입 and ma(C,map) >= ma(C,map)[1]+N and ma(C,9) >= ma(C,9)[1] and Condition1 Then
buy();
if value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and ma(C,9) <= ma(C,9)[1] and Condition1 Then
Sell();
}
SetStopLoss(PriceScale*절,PointStop);
#SetStopProfittarget(PriceScale*45,PointStop);
#당일 이익청산
if crossup(daypl,c*익절폭) then{
exitlong("익절1");
ExitShort("익절2");
}
#당일 손실청산
if CrossDown(daypl,-(dayopen*손절)) then{
exitlong("손절1");
ExitShort("손절2");
}
#단기이평청산----------------------
#if MarketPosition == 1 and ma(C,5) < ma(C,5)[1]-0.25 Then
# ExitLong();
#if MarketPosition == -1 and ma(C,5) > ma(C,5)[1]+0.25 Then
# ExitShort();
//시간청산--------------------
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); //평일
}
첨부에두가지부탁드립니다
이전글