커뮤니티
수식부탁드림니다--------
2011-03-20 10:48:54
773
글번호 36708
Input : Period(0),maP(0),map6(0),N(00),Tr1(0),Tr2(0),진입(0),ADXP(0);
Input :Per1(0),X1(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 >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) and count < 1 then
{
if MarketPosition == 0 and 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 stime >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) and count < 1 then
{
if MarketPosition == 0 and 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 MarketPosition == 1 Then{
ExitLong("15b절",AtStop,EntryPrice-PriceScale*절);
ExitLong("bx5",AtLimit,EntryPrice+PriceScale*25);
}
if MarketPosition == -1 Then{
ExitShort("15s절",AtStop,EntryPrice+PriceScale*절);
ExitShort("sx5",AtLimit,EntryPrice-PriceScale*25);
}
#단기이평청산----------------------
#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틱에 청산 해주세요
---매도포지션시 목표이익이 되었는데 계속음봉이거나 이평이 하락중에있으면 이평 이상승전환 할때 청산하게 해주세요,단 추가로 이익이 더 올랐다가 다시목표이익 까지 밀리면 목표이익+1틱에 청산 해주세요
두번째부탁 드립니다)위식은 하루목표량 달성하면 재진입 안하게되있는데 이를 재진입할수 있게해주시는데 재진입조건은, 목표달성 으로 청산했을때 바로 진입 하지말고 청산후 이평의 방향이바뀌어 추세전환이 일어 나고 진입조건에 해당하면 진입하게해 주세요
- 1. 부탁1.xls (0.09 MB)
답변 1
예스스탁 예스스탁 답변
2011-03-21 13:45:34
안녕하세요
예스스탁입니다.
1.
Input : Period(0),maP(0),map6(0),N(00),Tr1(0),Tr2(0),진입(0),ADXP(0);
Input :Per1(0),X1(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 >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) and count < 1 then
{
if MarketPosition == 0 and 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 stime >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) and count < 1 then
{
if MarketPosition == 0 and 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 MarketPosition == 1 Then{
ExitLong("15b절",AtStop,EntryPrice-PriceScale*절);
if C < O or ma(C,map) < ma(C,map)[1] Then
ExitLong("bx5",AtLimit,EntryPrice+PriceScale*25);
if Highest(H,BarsSinceEntry) > EntryPrice+PriceScale*25 Then
ExitLong("bx5.",AtLimit,EntryPrice+PriceScale*25);
}
if MarketPosition == -1 Then{
ExitShort("15s절",AtStop,EntryPrice+PriceScale*절);
if C > O or ma(C,map) > ma(C,map)[1] Then
ExitShort("sx5",AtLimit,EntryPrice-PriceScale*(25+1));
if Lowest(L,BarsSinceEntry) < EntryPrice-PriceScale*25 Then
ExitShort("sx5.",AtLimit,EntryPrice-PriceScale*(25+1));
}
#단기이평청산----------------------
#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); //평일
}
2.
Input : Period(0),maP(0),map6(0),N(00),Tr1(0),Tr2(0),진입(0),ADXP(0),PP(0);
Input :Per1(0),X1(0),익절폭(0),절(0);
Var : value(0);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
value1 = ma(C,PP);
#당일누적손익계산 시작
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 >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) then
{
if MarketPosition == 0 and 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 stime >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) then
{
if MarketPosition == 0 and value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and ma(C,9) <= ma(C,9)[1] and Condition1 Then
Sell();
}
if stime >= 093000 and stime < 144500 and var2 >=10 and dayPL >= (c*익절폭) then
{
if MarketPosition(1) == -1 and IsExitName("익절2",1) and value1 > value1[1] and
MarketPosition == 0 and 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 stime >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) then
{
if MarketPosition(1) == 1 and IsExitName("익절1",1) And value1 < value1[1] and
MarketPosition == 0 and 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 MarketPosition == 1 Then{
ExitLong("15b절",AtStop,EntryPrice-PriceScale*절);
if C < O or ma(C,map) < ma(C,map)[1] Then
ExitLong("bx5",AtLimit,EntryPrice+PriceScale*25);
if Highest(H,BarsSinceEntry) > EntryPrice+PriceScale*25 Then
ExitLong("bx5.",AtLimit,EntryPrice+PriceScale*25);
}
if MarketPosition == -1 Then{
ExitShort("15s절",AtStop,EntryPrice+PriceScale*절);
if C > O or ma(C,map) > ma(C,map)[1] Then
ExitShort("sx5",AtLimit,EntryPrice-PriceScale*(25+1));
if Lowest(L,BarsSinceEntry) < EntryPrice-PriceScale*25 Then
ExitShort("sx5.",AtLimit,EntryPrice-PriceScale*(25+1));
}
#단기이평청산----------------------
#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(00),Tr1(0),Tr2(0),진입(0),ADXP(0);
Input :Per1(0),X1(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 >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) and count < 1 then
{
if MarketPosition == 0 and 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 stime >= 093000 and stime < 144500 and var2 >=10 and dayPL < (c*익절폭) and count < 1 then
{
if MarketPosition == 0 and 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 MarketPosition == 1 Then{
ExitLong("15b절",AtStop,EntryPrice-PriceScale*절);
ExitLong("bx5",AtLimit,EntryPrice+PriceScale*25);
}
if MarketPosition == -1 Then{
ExitShort("15s절",AtStop,EntryPrice+PriceScale*절);
ExitShort("sx5",AtLimit,EntryPrice-PriceScale*25);
}
#단기이평청산----------------------
#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틱에 청산 해주세요
---매도포지션시 목표이익이 되었는데 계속음봉이거나 이평이 하락중에있으면 이평 이상승전환 할때 청산하게 해주세요,단 추가로 이익이 더 올랐다가 다시목표이익 까지 밀리면 목표이익+1틱에 청산 해주세요
두번째부탁 드립니다)위식은 하루목표량 달성하면 재진입 안하게되있는데 이를 재진입할수 있게해주시는데 재진입조건은, 목표달성 으로 청산했을때 바로 진입 하지말고 청산후 이평의 방향이바뀌어 추세전환이 일어 나고 진입조건에 해당하면 진입하게해 주세요
다음글
이전글