예스스탁
예스스탁 답변
2023-03-20 11:29:21
안녕하세요
예스스탁입니다.
진입과 청산이 동일봉종가에 동시 출력됩니다.
MarketPosition으로 진입과 청산시에 포지션확인하는 내용을 추가하시면 됩니다.
input:butd41(99999),butd42(99999),fly(0.95);
input : exst(103000),ex하락1(700),ex하락2(200);
input : ls(0.4),tr(0.8);
var : T1(0),Entry(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and
data2(c)>data3(c) and entry==0 and
!(data4(c<highd(0)-butd41)) then
Buy("b1");
if MarketPosition == 0 and
data2(c)>data3(c)+fly and entry==1 and
!(data4(c<highd(0)-butd42)) then
Buy("b2");
var : Tcond(false,Data2),h2(0,Data2),L2(0,Data2);
if Data2(Bdate != Bdate[1]) Then
Tcond = False;
if Data2((sdate != sdate[1] and stime >= exst) or
(sdate == sdate[1] and stime >= exst and stime[1] < exst)) Then
{
Tcond = true;
h2 = Data2(h);
l2 = Data2(l);
}
if Tcond == true Then
{
if Data2(H) > h2 Then
h2 = Data2(h);
if Data2(L) < l2 Then
l2 = Data2(l);
if MarketPosition == 1 and IsEntryName("b1") and data4(c<h2-ex하락1) then
exitlong("xb1");
if MarketPosition == 1 and IsEntryName("b2") and data4(c<h2-ex하락2) then
exitlong("xb2");
}
SetStopLoss(ls,PercentStop);
SetStopTrailing(tr,0,PercentStop,1);
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 2월7일
b1 진입 xb1로 청산 ok
b2 진입 xb2로 청산 ok
2월8일
b1 진입 xb1로 청산 ok
b2 진입 xb1로 청산 <---------- xb2로 청산되어야 함
b1 진입 xb1 청산은 답변하여 주신 수식이고
b2 진입 xb2는 제가 추가한 수식입니다.
추가한 수식의 오류를 수정하여 주시기 바랍니다.
********************************************************************************
input:butd41(99999),butd42(99999),fly(0.95);
input : exst(103000),ex하락1(700),ex하락2(200);
input : ls(0.4),tr(0.8);
var : T1(0),Entry(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if data2(c)>data3(c) and entry==0 and
!(data4(c<highd(0)-butd41)) then
Buy("b1");
if data2(c)>data3(c)+fly and entry==1 and
!(data4(c<highd(0)-butd42)) then
Buy("b2");
var : Tcond(false,Data2),h2(0,Data2),L2(0,Data2);
if Data2(Bdate != Bdate[1]) Then
Tcond = False;
if Data2((sdate != sdate[1] and stime >= exst) or
(sdate == sdate[1] and stime >= exst and stime[1] < exst)) Then
{
Tcond = true;
h2 = Data2(h);
l2 = Data2(l);
}
if Tcond == true Then
{
if Data2(H) > h2 Then
h2 = Data2(h);
if Data2(L) < l2 Then
l2 = Data2(l);
if IsEntryName("b1") and data4(c<h2-ex하락1) then
exitlong("xb1");
if IsEntryName("b2") and data4(c<h2-ex하락2) then
exitlong("xb2");
}
SetStopLoss(ls,PercentStop);
SetStopTrailing(tr,0,PercentStop,1);