커뮤니티
재문의
2013-12-16 23:23:05
165
글번호 70540
안녕하세요 친절한답변에 감사드립니다 작성해주신 아래식을 10년시믈해보니 2003 . 2004 . 2005 년만 나오고 그후로는 신호가 없읍니다 왜그런지요
#전체 첫진입
if MarketPosition == 0 and stime == 151500 and TotalTrades == 0 Then
buy("b1",AtMarket,def,1);
#두번째 진입부터
if MarketPosition == 0 and stime == 151500 and TotalTrades > 0 Then{
if MarketPosition(1) == 1 Then{
if PositionProfit(1) > 0 Then
buy("bb",AtMarket,def,1);
Else
sell("BS",AtMarket,def,min(MaxContracts(1)*2,8));
}
if MarketPosition(1) == -1 Then{
if PositionProfit(1) > 0 Then
sell("sS",AtMarket,def,1);
Else
Buy("SB",AtMarket,def,min(MaxContracts(1)*2,8));
}
}
SetStopLoss(PriceScale*15,PointStop);
SetStopProfittarget(PriceScale*20,PointStop);
SetStopEndofday(150000);
답변 1
예스스탁 예스스탁 답변
2013-12-17 11:28:27
안녕하세요
예스스탁입니다.
수량을 산정에 문제가 있었습니다.
maxcontracts(1)함수를 이용해서 수량계산을 했는지
진입과 청산이 하나의 봉에서 발생하게 되는봉이 발생하면
다음거래에서 값이 0이 리턴되어 신호가 발생되지 않았습니다.
아래 다른 방법으로 식을 수정했습니다.
var : vol(0);
#전체 첫진입
if MarketPosition == 0 and stime == 151500 and TotalTrades == 0 Then{
Vol = 1;
buy("b1",AtMarket,def,Vol);
}
#두번째 진입부터
if MarketPosition == 0 and stime == 151500 and TotalTrades > 0 Then{
if MarketPosition(1) == 1 Then{
if PositionProfit(1) > 0 Then{
Vol = 1;
buy("bb",AtMarket,def,Vol);
}
Else{
Vol = min(Vol*2,8);
sell("BS",AtMarket,def,vol);
}
}
if MarketPosition(1) == -1 Then{
if PositionProfit(1) > 0 Then{
Vol = 1;
sell("sS",AtMarket,def,Vol);
}
Else{
Vol = min(Vol*2,8);
Buy("SB",AtMarket,def,vol);
}
}
}
SetStopLoss(PriceScale*15,PointStop);
SetStopProfittarget(PriceScale*20,PointStop);
SetStopEndofday(150000);
if sdate == 20010126 Then
MessageLog("%.2f %.2f %.2f %.2f %.2f",MarketPosition,MarketPosition(1),TotalTrades,PositionProfit(1),MaxContracts(1));
즐거운 하루되세요
> 민선생1 님이 쓴 글입니다.
> 제목 : 재문의
> 안녕하세요 친절한답변에 감사드립니다 작성해주신 아래식을 10년시믈해보니 2003 . 2004 . 2005 년만 나오고 그후로는 신호가 없읍니다 왜그런지요
#전체 첫진입
if MarketPosition == 0 and stime == 151500 and TotalTrades == 0 Then
buy("b1",AtMarket,def,1);
#두번째 진입부터
if MarketPosition == 0 and stime == 151500 and TotalTrades > 0 Then{
if MarketPosition(1) == 1 Then{
if PositionProfit(1) > 0 Then
buy("bb",AtMarket,def,1);
Else
sell("BS",AtMarket,def,min(MaxContracts(1)*2,8));
}
if MarketPosition(1) == -1 Then{
if PositionProfit(1) > 0 Then
sell("sS",AtMarket,def,1);
Else
Buy("SB",AtMarket,def,min(MaxContracts(1)*2,8));
}
}
SetStopLoss(PriceScale*15,PointStop);
SetStopProfittarget(PriceScale*20,PointStop);
SetStopEndofday(150000);
다음글
이전글