커뮤니티
수식추가해주세요===========
2011-03-13 10:20:19
649
글번호 36503
Input : Period(1),maP(30),N(0.05),Tr1(1.7),Tr2(0.5),진입(1000),ADXP(20),Per1(0.5),X1(10);
Var : value(0);
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 then
{
if value > value[1]+진입 and ma(C,map) >= ma(C,map)[1]+N and Condition1 Then
buy();
if value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and Condition1 Then
Sell();
SetStopLoss(PriceScale*15,PointStop);
#SetStopProfittarget(PriceScale*30,PointStop);
if MarketPosition == 1 Then{
if Highest(H,BarsSinceEntry) < EntryPrice+2 Then
ExitLong("bx1",AtStop,Highest(H,BarsSinceEntry)-tr1);
Else
ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-tr2);
}
if MarketPosition == -1 Then{
if Lowest(L,BarsSinceEntry) > EntryPrice-2 Then
ExitShort("sx1",AtStop,Lowest(L,BarsSinceEntry)+tr1);
Else
ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+tr2);
}
}
//시간청산
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포인트이상이면 청산및 진입금지 해주세요
답변 1
예스스탁 예스스탁 답변
2011-03-14 11:41:39
안녕하세요
예스스탁입니다.
Input : Period(1),maP(30),N(0.05),Tr1(1.7),Tr2(0.5),진입(1000),ADXP(20),Per1(0.5),X1(10),당일손익(2);
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 < 2 then
{
if value > value[1]+진입 and ma(C,map) >= ma(C,map)[1]+N and Condition1 Then
buy();
if value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and Condition1 Then
Sell();
SetStopLoss(PriceScale*15,PointStop);
#SetStopProfittarget(PriceScale*30,PointStop);
if MarketPosition == 1 Then{
if Highest(H,BarsSinceEntry) < EntryPrice+2 Then
ExitLong("bx1",AtStop,Highest(H,BarsSinceEntry)-tr1);
Else
ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-tr2);
}
if MarketPosition == -1 Then{
if Lowest(L,BarsSinceEntry) > EntryPrice-2 Then
ExitShort("sx1",AtStop,Lowest(L,BarsSinceEntry)+tr1);
Else
ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+tr2);
}
}
//시간청산
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 MarketPosition != 0 and crossup(dayPL,2) Then{
exitlong();
ExitShort();
}
즐거운 하루되세요
> leekss1 님이 쓴 글입니다.
> 제목 : 수식추가해주세요===========
> Input : Period(1),maP(30),N(0.05),Tr1(1.7),Tr2(0.5),진입(1000),ADXP(20),Per1(0.5),X1(10);
Var : value(0);
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 then
{
if value > value[1]+진입 and ma(C,map) >= ma(C,map)[1]+N and Condition1 Then
buy();
if value < value[1]-진입 and ma(C,map) <= ma(C,map)[1]-N and Condition1 Then
Sell();
SetStopLoss(PriceScale*15,PointStop);
#SetStopProfittarget(PriceScale*30,PointStop);
if MarketPosition == 1 Then{
if Highest(H,BarsSinceEntry) < EntryPrice+2 Then
ExitLong("bx1",AtStop,Highest(H,BarsSinceEntry)-tr1);
Else
ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-tr2);
}
if MarketPosition == -1 Then{
if Lowest(L,BarsSinceEntry) > EntryPrice-2 Then
ExitShort("sx1",AtStop,Lowest(L,BarsSinceEntry)+tr1);
Else
ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+tr2);
}
}
//시간청산
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포인트이상이면 청산및 진입금지 해주세요
다음글
이전글