예스스탁
예스스탁 답변
2023-06-05 09:41:57
안녕하세요
예스스탁입니다.
input : L1(10),L2(20),L3(60),L4(120);
input : 최소수익(200),수익감소(100),n(300);
var1 = ma(c,L1);
var2 = ma(c,L2);
Var3 = ma(c,L3);
Var4 = ma(c,L4);
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and C > ExitPrice(1)-n;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and C < ExitPrice(1)+n;
If var1 > Var2 and Var3 > Var4 Then
{
if Condition1 == False Then
Buy();
}
If Var1 < Var2 and Var3 < Var4 Then
{
if Condition2 == False Then
Sell();
}
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+최소수익 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-수익감소);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-최소수익 Then
ExitShort("sx",AtStop,lowest(L,BarsSinceEntry)+수익감소);
즐거운 하루되세요
> 너무조아 님이 쓴 글입니다.
> 제목 : 청산조건 과 재진입 조건
> 아래 수식에서와 같이
최소수익이 200Pt 이상이고
최대수익 대비 100Pt 이상 하락시 청산 되도록 하되,
청산 후에는 그와 다른 포지션 조건이 만족 할때까지
청산 된 포지션과 같은 동일포지션에 재진입 하지 아니 하도록 하나,
다만,
매수포지션 청산 후 청산 가격에서 300Pt 이상 하락 하거나
매도포지션 청산 후 청산 가격에서 300Pt 이상 상승 한 경우에는
청산 된 포지션과 동일한 포지션에 재 진입 할 수 있도록
아래 수식을 변경하여 주시면 감사 하겠습니다.
input : L1(10),L2(20),L3(60),L4(120);
input : 최소수익(200),수익감소(100);
var1 = ma(c,L1);
var2 = ma(c,L2);
Var3 = ma(c,L3);
Var4 = ma(c,L4);
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1;
If var1 > Var2 and Var3 > Var4 Then
{
if Condition1 == False Then
Buy();
}
If Var1 < Var2 and Var3 < Var4 Then
{
if Condition2 == False Then
Sell();
}
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+최소수익 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-수익감소);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-최소수익 Then
ExitShort("sx",AtStop,lowest(L,BarsSinceEntry)+수익감소);