커뮤니티
문의드립니다.
2013-06-27 16:16:46
143
글번호 64782
이평선 과다이격 생기면 진입하는 식입니다.
일단 식이 유효한건지 확인 부탁드리고....
매수진입후 생긴 고가대비 1%하락하면 추가매수 해서 본절할 수 있는식 부탁합니다.
추가매수 최대횟수는 n으로 정해주세요.
매도도 마찬가지입니다.
감사합니다.
input : y(2);
var : Ycond(0);
var1 = highest(h,BarsSinceExit(1)+1);
var2 = Lowest(L,BarsSinceExit(1)+1);
var11 = ma(c,60);
Ycond = 0;
if MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BLoss",1) or IsExitName("SLoss",1)) Then{
if Y == 0 Then
Ycond = 99;
if Y == 1 Then{
if Y != 0 and MarketPosition(1) == 1 Then
Ycond = 1;
if Y != 0 and MarketPosition(1) == -1 Then
Ycond = -1;
}
if Y == 2 Then{
if MarketPosition(1) == 1 and C < Var1*(0.997) Then
Ycond = 2;
if MarketPosition(1) == -1 and C > Var2*(1.003) Then
Ycond = 2;
Else
Ycond = 99;
}
}
if (Ycond == 0 or Ycond == 2) and C < var11*(0.995) Then
buy();
if (Ycond == 0 or Ycond == 2) and C > var11*(1.005) Then
sell();
if MarketPosition == 1 Then
ExitLong("BLoss",AtStop,highest(H,BarsSinceEntry)-2);
if MarketPosition == -1 Then
ExitShort("SLoss",AtStop,lowest(L,BarsSinceEntry)+2);
SetStopProfittarget(1.2,PointStop);
SetStopEndofday(144900);
답변 1
예스스탁 예스스탁 답변
2013-06-27 18:57:16
안녕하세요
예스스탁입니다.
input : y(2),N(5);
var : Ycond(0);
if date != date[1] Then
var99 = 0;
if MarketPosition != 0 and CurrentEntries > CurrentEntries[1] and CurrentEntries == 2 Then
var99 = var99+1;
var1 = highest(h,BarsSinceExit(1)+1);
var2 = Lowest(L,BarsSinceExit(1)+1);
var11 = ma(c,60);
Ycond = 0;
if MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BLoss",1) or IsExitName("SLoss",1)) Then{
if Y == 0 Then
Ycond = 99;
if Y == 1 Then{
if Y != 0 and MarketPosition(1) == 1 Then
Ycond = 1;
if Y != 0 and MarketPosition(1) == -1 Then
Ycond = -1;
}
if Y == 2 Then{
if MarketPosition(1) == 1 and C < Var1*(0.997) Then
Ycond = 2;
if MarketPosition(1) == -1 and C > Var2*(1.003) Then
Ycond = 2;
Else
Ycond = 99;
}
}
if MarketPosition <= 0 and (Ycond == 0 or Ycond == 2) and C < var11*(0.995) Then
buy();
if MarketPosition >= 0 and (Ycond == 0 or Ycond == 2) and C > var11*(1.005) Then
sell();
if MarketPosition == 1 Then
ExitLong("BLoss",AtStop,highest(H,BarsSinceEntry)-2);
if MarketPosition == -1 Then
ExitShort("SLoss",AtStop,lowest(L,BarsSinceEntry)+2);
#진입이후 최고가대비 1% 하락하면 추가매수
if MarketPosition == 1 and CurrentEntries == 1 and var99 < N Then
buy("bb",AtStop,highest(H,BarsSinceEntry)*0.99);
#진입이후 최저가대비 1% 상승하면 추가매도
if MarketPosition == -1 and CurrentEntries == 1 and var99 < N Then
sell("ss",AtStop,Lowest(L,BarsSinceEntry)*1.01);
#추가매수후 진입가로 하향하면 청산
if MarketPosition == 1 and CurrentEntries == 2 Then
ExitLong("bx1",AtStop,EntryPrice);
#추가매수후 진입가로 상향하면 청산
if MarketPosition == -1 and CurrentEntries == 2 Then
ExitShort("sx1",AtStop,EntryPrice);
SetStopProfittarget(1.2,PointStop);
SetStopEndofday(144900);
즐거운 하루되세요
> 쿠루드 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 이평선 과다이격 생기면 진입하는 식입니다.
일단 식이 유효한건지 확인 부탁드리고....
매수진입후 생긴 고가대비 1%하락하면 추가매수 해서 본절할 수 있는식 부탁합니다.
추가매수 최대횟수는 n으로 정해주세요.
매도도 마찬가지입니다.
감사합니다.
input : y(2);
var : Ycond(0);
var1 = highest(h,BarsSinceExit(1)+1);
var2 = Lowest(L,BarsSinceExit(1)+1);
var11 = ma(c,60);
Ycond = 0;
if MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BLoss",1) or IsExitName("SLoss",1)) Then{
if Y == 0 Then
Ycond = 99;
if Y == 1 Then{
if Y != 0 and MarketPosition(1) == 1 Then
Ycond = 1;
if Y != 0 and MarketPosition(1) == -1 Then
Ycond = -1;
}
if Y == 2 Then{
if MarketPosition(1) == 1 and C < Var1*(0.997) Then
Ycond = 2;
if MarketPosition(1) == -1 and C > Var2*(1.003) Then
Ycond = 2;
Else
Ycond = 99;
}
}
if (Ycond == 0 or Ycond == 2) and C < var11*(0.995) Then
buy();
if (Ycond == 0 or Ycond == 2) and C > var11*(1.005) Then
sell();
if MarketPosition == 1 Then
ExitLong("BLoss",AtStop,highest(H,BarsSinceEntry)-2);
if MarketPosition == -1 Then
ExitShort("SLoss",AtStop,lowest(L,BarsSinceEntry)+2);
SetStopProfittarget(1.2,PointStop);
SetStopEndofday(144900);