예스스탁
예스스탁 답변
2023-05-08 10:26:06
안녕하세요
예스스탁입니다.
현재 수식의 본절청산하는 신호의 청산명은 bx,sx입니다.
if T == -1 Then
Sell("S",AtStop,S-PriceScale*조정틱);
첨부하신 그림의 exitlong_#1은 위 매도진입함수로
스위칭이 되서 발생한 청산입니다.
스위칭하는 것을 막고자 하시면 각 진입식에 MarketPosition == 0 조건을 아래와 같이 추가하시면 됩니다.
input : P1(20),P2(60),조정틱(5),감시틱수(22);
var : mav1(0),mav2(0),T(0),B(0),S(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
if CrossUp(mav1,mav2) Then
{
T = 1;
B = C;
}
if CrossDown(mav1,mav2) Then
{
T = -1;
S = C;
}
if MarketPosition == 0 and T == 1 and S > 0 Then
Buy("b",AtStop,S+PriceScale*조정틱);
if MarketPosition == 0 and T == -1 Then
Sell("S",AtStop,S-PriceScale*조정틱);
if MarketPosition == 1 Then
{
B = 0;
if highest(H,BarsSinceEntry) >= EntryPrice+감시틱수 Then
ExitLong("bx",AtStop,EntryPrice);
}
if MarketPosition == -1 Then
{
S = 0;
if Lowest(L,BarsSinceEntry) <= EntryPrice-감시틱수 Then
ExitShort("sx",AtStop,EntryPrice);
}
즐거운 하루되세요
> 왈라스 님이 쓴 글입니다.
> 제목 : 청산수식수정 부탁드립니다.
> 골든크로스 발생하면 해당봉 종가+조정틱이상 시세가 발생하면 매수하고
매수이후에 진입가 대비 감시틱수 이상 상승후 하락해서 진입가에 도달하면 청산됩니다.
반대로 골든크로스 발생하면 해당봉 종가-조정틱 이하 시세가 발생하면 매도하고
매도이후에 진입가 대비 감시틱수 이상 하락후 상승해서 진입가에 도달하면 청산됩니다.
input : P1(20),P2(60),조정틱(5),감시틱수(22);
var : mav1(0),mav2(0),T(0),B(0),S(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
if CrossUp(mav1,mav2) Then
{
T = 1;
B = C;
}
if CrossDown(mav1,mav2) Then
{
T = -1;
S = C;
}
if T == 1 and S > 0 Then
Buy("b",AtStop,S+PriceScale*조정틱);
if T == -1 Then
Sell("S",AtStop,S-PriceScale*조정틱);
if MarketPosition == 1 Then
{
B = 0;
if highest(H,BarsSinceEntry) >= EntryPrice+감시틱수 Then
ExitLong("bx",AtStop,EntryPrice);
}
if MarketPosition == -1 Then
{
S = 0;
if Lowest(L,BarsSinceEntry) <= EntryPrice-감시틱수 Then
ExitShort("sx",AtStop,EntryPrice);
}
//------------------------------------------------------
진입가 청산을 하고 싶읍니다.
22틱이상 가격에서 하락 한다면 본절청산하라는 수식입니다 만..
정상 작동 되지 않는 것 같아요...
수정 부탁드립니다.
이미지 첨부