커뮤니티
수식 수정좀 부탁드립니다.
2017-02-08 02:21:45
103
글번호 106606
매번 빠른 답변 주셔서 감사드립니다.
아래 수식에 아래와 같은 조건의 청산식을 추가하고 싶습니다.
청산 조건
Stochastics 변수값을 period (22), period1(5), period2(5) 로 지정하고,
Stochastics 하단 기준선을 30, 상단 기준선을 70 으로 지정하여 아래 조건을 만족할 때 청산하고 싶습니다.
매도청산 : Stochastics 하단 기준선 30 아래에서 Stochastics K 선이 Stochastics D 선을 상향 돌파하고 2틱이 더 진행된 때
(StochasticsK 선과 StochasticsD 선이 모두 스톡 하단 기준선 30 아래에서 돌파한 경우입니다
가령StochasticsK 선은 30 아래까지 내려왔다가 30선 위에서 StochasticsD선을 돌파하였을 경우는 청산하면 안됩니다.)
매수청산 : Stochastics 상단 기준선 70 위에서 Stochastics K 선이 Stochastics D 선을 하향 이탈하고 2틱이 더 진행된 때
-------------------------
input : P(120);
var : T(0), moveLine(0), OrderValue(0);
moveLine = ma(C,P);
if (T <= 0 and (moveLine > moveLine[1])) Then
{
OrderValue = Close;
T = 1;
}
if (T >= 0 and (moveLine < moveLine[1])) Then
{
OrderValue = Close;
T = -1;
}
if T == 1 then
if (Close >= (OrderValue + (PriceScale * 1))) then
//buy("매수",AtStop,value1+PriceScale*1);
Buy("매수", OnClose);
if T == -1 then
//sell("매도",AtStop,value1-PriceScale*1);
if (Close <= (OrderValue - (PriceScale *1))) then
Sell("매도", OnClose);
if MarketPosition == 1 Then{
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*3));
if var1 > var1[1] Then
Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱");
}
if MarketPosition == -1 Then{
var1 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*3));
if var1 > var1[1] Then
Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱");
}
답변 1
예스스탁 예스스탁 답변
2017-02-08 13:04:06
안녕하세요
예스스탁입니다.
input : P(120),period (22), period1(5),period2(5);
var : T(0), moveLine(0), OrderValue(0),stok(0),stod(0),B1(0),S1(0);
moveLine = ma(C,P);
stok = StochasticsK(period,period1);
stod = StochasticsD(period,period1,period2);
if (T <= 0 and (moveLine > moveLine[1])) Then
{
OrderValue = Close;
T = 1;
}
if (T >= 0 and (moveLine < moveLine[1])) Then
{
OrderValue = Close;
T = -1;
}
if T == 1 then
if (Close >= (OrderValue + (PriceScale * 1))) then
//buy("매수",AtStop,value1+PriceScale*1);
Buy("매수", OnClose);
if T == -1 then
//sell("매도",AtStop,value1-PriceScale*1);
if (Close <= (OrderValue - (PriceScale *1))) then
Sell("매도", OnClose);
if MarketPosition == 1 Then{
if crossup(stok,stod) and stok < 30 Then{
Condition1 = true;
B1 = C;
}
if Condition1 == true Then
ExitLong("bx",atlimit,B1+PriceScale*2);
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*3));
if var1 > var1[1] Then
Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱");
}
Else
Condition1 = false;
if MarketPosition == -1 Then{
if CrossDown(stok,stod) and stok > 70 Then{
Condition2 = true;
S1 = C;
}
if Condition2 == true Then
ExitShort("sx",atlimit,S1-PriceScale*2);
var1 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*3));
if var1 > var1[1] Then
Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱");
}
Else
Condition2 = false;
즐거운 하루되세요
> 천왕봉 님이 쓴 글입니다.
> 제목 : 수식 수정좀 부탁드립니다.
> 매번 빠른 답변 주셔서 감사드립니다.
아래 수식에 아래와 같은 조건의 청산식을 추가하고 싶습니다.
청산 조건
Stochastics 변수값을 period (22), period1(5), period2(5) 로 지정하고,
Stochastics 하단 기준선을 30, 상단 기준선을 70 으로 지정하여 아래 조건을 만족할 때 청산하고 싶습니다.
매도청산 : Stochastics 하단 기준선 30 아래에서 Stochastics K 선이 Stochastics D 선을 상향 돌파하고 2틱이 더 진행된 때
(StochasticsK 선과 StochasticsD 선이 모두 스톡 하단 기준선 30 아래에서 돌파한 경우입니다
가령StochasticsK 선은 30 아래까지 내려왔다가 30선 위에서 StochasticsD선을 돌파하였을 경우는 청산하면 안됩니다.)
매수청산 : Stochastics 상단 기준선 70 위에서 Stochastics K 선이 Stochastics D 선을 하향 이탈하고 2틱이 더 진행된 때
-------------------------
input : P(120);
var : T(0), moveLine(0), OrderValue(0);
moveLine = ma(C,P);
if (T <= 0 and (moveLine > moveLine[1])) Then
{
OrderValue = Close;
T = 1;
}
if (T >= 0 and (moveLine < moveLine[1])) Then
{
OrderValue = Close;
T = -1;
}
if T == 1 then
if (Close >= (OrderValue + (PriceScale * 1))) then
//buy("매수",AtStop,value1+PriceScale*1);
Buy("매수", OnClose);
if T == -1 then
//sell("매도",AtStop,value1-PriceScale*1);
if (Close <= (OrderValue - (PriceScale *1))) then
Sell("매도", OnClose);
if MarketPosition == 1 Then{
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*3));
if var1 > var1[1] Then
Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱");
}
if MarketPosition == -1 Then{
var1 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*3));
if var1 > var1[1] Then
Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱");
}
다음글
이전글