커뮤니티
손실발생시 매매중지 또는 타수식 적용
2015-06-04 01:36:43
106
글번호 86771
손실 발생시 연속적으로 3회정도 발생됨에 따라
이후 2회는 매매 중지 또는 타식으로 진입하고 싶읍니다.
input:period(30);
var:wr(0);
wr=willr(period);
if crossup(wr,-20) then buy();
if crossdown(wr,-80) then sell();
손실발생시 매매 중지 또는
스토캐스틱 교차매매로 2회 진입하고 싶음니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2015-06-04 14:11:48
안녕하세요
예스스탁입니다.
1, 두번쉼
input : period(30);
var : wr(0),cnt(0), loss(0),Cond(false),T(0);
wr=willr(period);
loss = 0;
for cnt = 0 to 2{
if MarketPosition != 0 And
PositionProfit(cnt) < 0 and (IsEntryName("b1",cnt) == true or IsEntryName("s1",cnt) == true) Then
Loss = loss+1;
if MarketPosition == 0 And
PositionProfit(cnt+1) < 0 and (IsEntryName("b1",cnt+1) == true or IsEntryName("s1",cnt+1) == true) Then
Loss = loss+1;
}
Cond = IsExitName("bx",1) or IsExitName("sx",1);
if crossup(wr,-20) then {
T = 1;
if loss < 3 Then
buy("b1");
Else
ExitShort("sx");
}
if crossdown(wr,-80) then {
T = -1;
if loss < 3 Then
sell("s1");
Else
ExitLong("bx");
}
if MarketPosition == 0 and cond == true Then{
If CrossUP(wr,-20) and countif(T != T[1], BarsSinceExit(1)) == 3 Then
{
Buy("b2");
}
If CrossDown(wr,-80) and countif(T != T[1], BarsSinceExit(1)) == 3 Then
{
Sell("s2");
}
}
2. 3번연속 손실 후 스토 2회 진입
input : period(30);
Input : sto1(10), sto2(5),sto3(5);
var : Stok(0),StoD(0);
var : wr(0),cnt(0), loss(0),Cond(false);
wr=willr(period);
StoK = StochasticsK(sto1,sto2);
StoD = StochasticsD(sto1,sto2,sto3);
loss = 0;
for cnt = 0 to 2{
if MarketPosition != 0 And
PositionProfit(cnt) < 0 and (IsEntryName("b1",cnt) == true or IsEntryName("s1",cnt) == true) Then
Loss = loss+1;
if MarketPosition == 0 And
PositionProfit(cnt+1) < 0 and (IsEntryName("b1",cnt+1) == true or IsEntryName("s1",cnt+1) == true) Then
Loss = loss+1;
}
Cond = IsExitName("bx",1) or IsExitName("sx",1) or IsExitName("bx",2) or IsExitName("sx",2);
if crossup(wr,-20) and cond == false then {
if loss < 3 Then
buy("b1");
Else
ExitShort("sx");
}
if crossdown(wr,-80) and cond == false then {
if loss < 3 Then
sell("s1");
Else
ExitLong("bx");
}
if Cond == true Then{
If CrossUP(StoK, StoD) Then
{
Buy("매수");
}
If CrossDown(StoK, StoD) Then
{
Sell("매도");
}
}
즐거운 하루되세요
> HI_sk***** 님이 쓴 글입니다.
> 제목 : 손실발생시 매매중지 또는 타수식 적용
> 손실 발생시 연속적으로 3회정도 발생됨에 따라
이후 2회는 매매 중지 또는 타식으로 진입하고 싶읍니다.
input:period(30);
var:wr(0);
wr=willr(period);
if crossup(wr,-20) then buy();
if crossdown(wr,-80) then sell();
손실발생시 매매 중지 또는
스토캐스틱 교차매매로 2회 진입하고 싶음니다.
감사합니다.
다음글
이전글