커뮤니티
61668번 재질문좀 봐 주십시요
2019-03-11 21:12:30
268
글번호 126948
수고 많으십니다.
61668번 답변내용대로 수식만들어 적용해보니 청산신호가 이상합니다.
바쁘시더라도 다시한번 수식 확인 부탁드립니다. 수고하십시요
답변 1
예스스탁 예스스탁 답변
2019-03-12 13:55:31
안녕하세요
예스스탁입니다.
매도청산에 포지션이 잘못지정되어 수정했습니다.(1번수식)
목표수익과 손절이 30포인트, 20포인트입니다.
올려주신 그림의 종목에서는 나올수 없는 값입니다.
30틱 20틱이면 2번식 사용하시기 바랍니다.
1
input : starttime(100000),endtime(163000);
var : Tcond(false),entry(0),pl(0),Xcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
entry = 0;
Xcond = false;
pl = 0;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if TotalTrades > TotalTrades[1] Then
{
pl = pl + PositionProfit(1);
if Pl > 0 Then
Xcond = true;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
var1 = ma(C,5);
if Tcond == true and Xcond == false then
{
if MarketPosition == 0 and crossup(C,var1) and entry < 3 Then
{
buy("b",AtMarket);
value1 = C;
}
if MarketPosition == 0 and CrossDown(c,var1) and entry < 3 Then
{
sell("s",AtMarket);
value1 = C;
}
if MarketPosition == 1 Then
{
exitlong("bp",AtLimit,value1+30);
exitlong("bl",AtStop,value1-20);
}
if MarketPosition == -1 Then
{
ExitShort("sp",AtLimit,value1-30);
ExitShort("sl",AtStop,value1+20);
}
}
2
input : starttime(100000),endtime(163000);
var : Tcond(false),entry(0),pl(0),Xcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
entry = 0;
Xcond = false;
pl = 0;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if TotalTrades > TotalTrades[1] Then
{
pl = pl + PositionProfit(1);
if Pl > 0 Then
Xcond = true;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
var1 = ma(C,5);
if Tcond == true and Xcond == false then
{
if MarketPosition == 0 and crossup(C,var1) and entry < 3 Then
{
buy("b",AtMarket);
value1 = C;
}
if MarketPosition == 0 and CrossDown(c,var1) and entry < 3 Then
{
sell("s",AtMarket);
value1 = C;
}
if MarketPosition == 1 Then
{
exitlong("bp",AtLimit,value1+30*PriceScale);
exitlong("bl",AtStop,value1-20*PriceScale);
}
if MarketPosition == -1 Then
{
ExitShort("sp",AtLimit,value1-30*PriceScale);
ExitShort("sl",AtStop,value1+20*PriceScale);
}
}
즐거운 하루되세요
> bigdeal 님이 쓴 글입니다.
> 제목 : 61668번 재질문좀 봐 주십시요
> 수고 많으십니다.
61668번 답변내용대로 수식만들어 적용해보니 청산신호가 이상합니다.
바쁘시더라도 다시한번 수식 확인 부탁드립니다. 수고하십시요