커뮤니티
다시 좀 부탁 드립니다
2013-07-05 15:15:29
180
글번호 65038
아래 수식으로 해보니깐 생각과 좀 달라서요
#진입이후 최고가에서 0.5포인트 하락하면 청산
if MarketPosition == 1 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-x);
이 부부분을 추가한 건데요
진입이후 얼마이상 올라가면 그때부터 0.5포인트 하락하면 청산 이렇게
하고 싶습니다 이때 이 얼마 이상이 더 추가 되야 되지 싶습니다
예를들어 진입이후 2포인트 이상 올라갔다가 0.5포인트 내리면 강제청산 이런식이구요
2포인트 이 부분도 외부변수로 좀 부탁 드릴께요
input : LossPoint(0.65),진입양봉갯수(3),청산양봉갯수(3),청산음봉갯수(3),
재매수횟수(3),재매수청산횟수(3),ProfitPoint(3.7),X(0.5);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
#초기화
if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then{
Rebuy = 0;
ReEL = 0;
count = 0;
}
#진입횟수 카운트
if (stime >= 180000 or stime < 040000) and
MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if (stime >= 180000 or stime < 040000) and
MarketPosition == 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav4,BarsSinceExit(1)) >= 1))
&& MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& C > MAv4
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv4 Then
Exitlong("매수청산1");
if count >= 1 and (stime >= 180000 or stime < 040000) then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv1 and
countif(C < mav4,BarsSinceExit(1)) < 1 Then
buy("재매수");
}
if MarketPosition == 1 and BarsSinceEntry >= 3 and ReEL < 재매수청산횟수 then{
if Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수 or Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수 Then
ExitLong("매수청산4");
}
if stime == 040000 or (stime > 040000 and stime[1] < 040000) Then
Exitlong();
#진입이후 최고가에서 0.5포인트 하락하면 청산
if MarketPosition == 1 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-x);
답변 1
예스스탁 예스스탁 답변
2013-07-05 17:13:03
안녕하세요
예스스탁입니다.
Y이상 상승후에 최고가에서 x이하 하락하면 청산하게
작성했습니다.
input : LossPoint(0.65),진입양봉갯수(3),청산양봉갯수(3),청산음봉갯수(3),
재매수횟수(3),재매수청산횟수(3),ProfitPoint(3.7),Y(2.0),X(0.5);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
#초기화
if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then{
Rebuy = 0;
ReEL = 0;
count = 0;
}
#진입횟수 카운트
if (stime >= 180000 or stime < 040000) and
MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if (stime >= 180000 or stime < 040000) and
MarketPosition == 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav4,BarsSinceExit(1)) >= 1))
&& MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& C > MAv4
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv4 Then
Exitlong("매수청산1");
if count >= 1 and (stime >= 180000 or stime < 040000) then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv1 and
countif(C < mav4,BarsSinceExit(1)) < 1 Then
buy("재매수");
}
if MarketPosition == 1 and BarsSinceEntry >= 3 and ReEL < 재매수청산횟수 then{
if Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수 or Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수 Then
ExitLong("매수청산4");
}
if stime == 040000 or (stime > 040000 and stime[1] < 040000) Then
Exitlong();
#진입이후 최고가에서 0.5포인트 하락하면 청산
if MarketPosition == 1 Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-x);
}
즐거운 하루되세요
> 난정욱 님이 쓴 글입니다.
> 제목 : 다시 좀 부탁 드립니다
> 아래 수식으로 해보니깐 생각과 좀 달라서요
#진입이후 최고가에서 0.5포인트 하락하면 청산
if MarketPosition == 1 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-x);
이 부부분을 추가한 건데요
진입이후 얼마이상 올라가면 그때부터 0.5포인트 하락하면 청산 이렇게
하고 싶습니다 이때 이 얼마 이상이 더 추가 되야 되지 싶습니다
예를들어 진입이후 2포인트 이상 올라갔다가 0.5포인트 내리면 강제청산 이런식이구요
2포인트 이 부분도 외부변수로 좀 부탁 드릴께요
input : LossPoint(0.65),진입양봉갯수(3),청산양봉갯수(3),청산음봉갯수(3),
재매수횟수(3),재매수청산횟수(3),ProfitPoint(3.7),X(0.5);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
#초기화
if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then{
Rebuy = 0;
ReEL = 0;
count = 0;
}
#진입횟수 카운트
if (stime >= 180000 or stime < 040000) and
MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if (stime >= 180000 or stime < 040000) and
MarketPosition == 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav4,BarsSinceExit(1)) >= 1))
&& MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& C > MAv4
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv4 Then
Exitlong("매수청산1");
if count >= 1 and (stime >= 180000 or stime < 040000) then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv1 and
countif(C < mav4,BarsSinceExit(1)) < 1 Then
buy("재매수");
}
if MarketPosition == 1 and BarsSinceEntry >= 3 and ReEL < 재매수청산횟수 then{
if Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수 or Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수 Then
ExitLong("매수청산4");
}
if stime == 040000 or (stime > 040000 and stime[1] < 040000) Then
Exitlong();
#진입이후 최고가에서 0.5포인트 하락하면 청산
if MarketPosition == 1 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-x);
다음글
이전글