커뮤니티
수식문의 드립니다.
2011-09-16 07:13:58
425
글번호 42708
아래 선물 시스템식을 옵션 시스템매매에 적용하려합니다.
선물을 참조데이타로 하여 아래수식으로 나오는 신호를 가지고 옵션 매매할 수 있도록 변환해 주시면 감사하겠습니다.
Inputs: Len(4), P(60), DiV(25), mult(5);
vars: MP(0), stopprice(0), Move(0);
If High - Low <> 0 then
Move = ema( (C - O) / (H - L) * V, len);
If Low < lowest( low, P )[1] and Move > highest( Move, P)[1] then
Buy("B2",onclose, def,1);
If High > Highest( High, P )[1] and Move < Lowest( Move, P)[1] then
Sell("S2",onclose, def,1);
If Low < Lowest( Low , P )[1] and MRO(Move < lowest( Move , P )[1],20,1) == -1 then {
var1= h;
var2 = index;
}
If High > Highest( High, P )[1] AND MRO(Move > Highest( Move, P)[1],20,1) == -1 then {
var3 = L;
var2 = index;
}
if index - var2 < 2 then {
if CrossUp(C, var1) and C > dayOpen then buy();
if CrossDown(C, var3) and C < dayOpen then sell();
}
mp = marketposition;
if MP == 1 and MP[1] <> 1 then Begin
StopPrice = low - ma(range,4)*mult;
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = High + ma(range,4)*mult;
end;
If MP == 1 then begin
exitlong ("ExitLong", atstop,stopprice );
stopprice = stopprice +( low-stopprice )/Div;
end;
If MP == -1 then begin
exitshort ("Exitshort", atstop,stopprice);
stopprice = stopprice - (stopprice-high)/Div;
end;
SetStopLoss(3,pointstop);
if stime == 144000 then {
exitlong();
exitshort();
}
답변 1
예스스탁 예스스탁 답변
2011-09-16 17:29:59
안녕하세요
예스스탁입니다.
참조종목을 이용으로 변경한 식입니다.
Inputs: Len(4), P(60), DiV(25), mult(5);
vars: MP(0,data1), stopprice(0,data2), Move(0,data2);
var : va1(0,data2),va2(0,data2),va3(0,data2),D2C(0,data1);
If data2(High - Low <> 0) then
Move = data2(ema( (C - O) / (H - L) * V, len));
If data2(Low < lowest( low, P )[1] and Move > highest( Move, P)[1]) then
Buy("B2",onclose, def,1);
If data2(High > Highest( High, P )[1] and Move < Lowest( Move, P)[1]) then
Sell("S2",onclose, def,1);
If data2(Low < Lowest( Low , P )[1] and MRO(Move < lowest( Move , P )[1],20,1) == -1) then {
va1= data2(h);
va2 = data2(index);
}
If data2(High > Highest( High, P )[1] AND MRO(Move > Highest( Move, P)[1],20,1) == -1) then {
va3 = data2(L);
va2 = data2(index);
}
if data2(index - va2 < 2) then {
if data2(CrossUp(C, va1) and C > OpenD(0)) then buy();
if data2(CrossDown(C, va3) and C < OpenD(0)) then sell();
}
mp = marketposition;
if MP == 1 and MP[1] <> 1 then Begin
StopPrice = data2(low - ma(range,4)*mult);
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = data2(High + ma(range,4)*mult);
end;
If MP == 1 then{
if BarsSinceEntry > 1 and data2(L) <= stopprice then
exitlong ("ExitLong");
stopprice = stopprice +data2((low-stopprice )/Div);
}
If MP == -1 then {
if BarsSinceEntry > 1 and data2(H) >= stopprice Then
exitshort ("Exitshort");
stopprice = stopprice - data2((stopprice-high)/Div);
}
D2C = data2(C);
if BarsSinceEntry > 1 and MarketPosition == 1 and data2(L) <= D2c[BarsSinceEntry-1]-3 then
ExitLong();
if BarsSinceEntry > 1 and MarketPosition == -1 and data2(H) >= D2c[BarsSinceEntry-1]-3 then
ExitShort();
if stime == 144000 then {
exitlong();
exitshort();
}
즐거운 하루되세요
> lyhc 님이 쓴 글입니다.
> 제목 : 수식문의 드립니다.
> 아래 선물 시스템식을 옵션 시스템매매에 적용하려합니다.
선물을 참조데이타로 하여 아래수식으로 나오는 신호를 가지고 옵션 매매할 수 있도록 변환해 주시면 감사하겠습니다.
Inputs: Len(4), P(60), DiV(25), mult(5);
vars: MP(0), stopprice(0), Move(0);
If High - Low <> 0 then
Move = ema( (C - O) / (H - L) * V, len);
If Low < lowest( low, P )[1] and Move > highest( Move, P)[1] then
Buy("B2",onclose, def,1);
If High > Highest( High, P )[1] and Move < Lowest( Move, P)[1] then
Sell("S2",onclose, def,1);
If Low < Lowest( Low , P )[1] and MRO(Move < lowest( Move , P )[1],20,1) == -1 then {
var1= h;
var2 = index;
}
If High > Highest( High, P )[1] AND MRO(Move > Highest( Move, P)[1],20,1) == -1 then {
var3 = L;
var2 = index;
}
if index - var2 < 2 then {
if CrossUp(C, var1) and C > dayOpen then buy();
if CrossDown(C, var3) and C < dayOpen then sell();
}
mp = marketposition;
if MP == 1 and MP[1] <> 1 then Begin
StopPrice = low - ma(range,4)*mult;
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = High + ma(range,4)*mult;
end;
If MP == 1 then begin
exitlong ("ExitLong", atstop,stopprice );
stopprice = stopprice +( low-stopprice )/Div;
end;
If MP == -1 then begin
exitshort ("Exitshort", atstop,stopprice);
stopprice = stopprice - (stopprice-high)/Div;
end;
SetStopLoss(3,pointstop);
if stime == 144000 then {
exitlong();
exitshort();
}
다음글