커뮤니티
스탑로스 재질문드립니다.
2018-10-17 01:29:43
141
글번호 122750
var : BLcnt(0),SLcnt(0);
Input : 당일손실틱수(100);
Var : N1(0),dayPl(0),당일누적손실(0),Xcond(false);
당일누적손실 = -PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then{
BLcnt = 0;
SLcnt = 0;
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
daypl <= 당일누적손실 then
Xcond = true;
if MarketPosition == 0 and
MarketPosition(1) == 1 and
TotalTrades > TotalTrades[1] and LatestExitName(1) == "StopLoss" Then
{
BLcnt = BLcnt+1;
}
if MarketPosition == 1 and CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "StopLoss" Then
{
BLcnt = BLcnt+1;
}
if MarketPosition == 0 and
MarketPosition(1) == -1 and
TotalTrades > TotalTrades[1] and LatestExitName(1) == "StopLoss" Then
SLcnt = SLcnt+1;
if MarketPosition == -1 and CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "StopLoss" Then
SLcnt = SLcnt+1;
If blcnt < 2 and Xcond == false and CrossUp(Close,Ma(c,5)) Then
{
Buy();
}
SetStopLoss(20*PriceScale,PointStop);
SetStopProfittarget(20*PriceScale,PointStop);
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
짜주신 로직입니다.
20틱 스탑. 100틱손실시 멈춤. dbl로 나와야하는 구간이 모조리 나와버립니다.
다우존스 2분봉 10000캔들입니다.
- 1. dbl도배.png (0.04 MB)
답변 1
예스스탁 예스스탁 답변
2018-10-18 11:06:42
안녕하세요
예스스탁입니다.
변수에 부호가 잘못되어 있었습니다.
수정한 식입니다.
var : BLcnt(0),SLcnt(0);
Input : 당일손실틱수(100);
Var : N1(0),dayPl(0),당일누적손실(0),Xcond(false);
당일누적손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then{
BLcnt = 0;
SLcnt = 0;
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
daypl <= -당일누적손실 then
Xcond = true;
if MarketPosition == 0 and
MarketPosition(1) == 1 and
TotalTrades > TotalTrades[1] and LatestExitName(1) == "StopLoss" Then
{
BLcnt = BLcnt+1;
}
if MarketPosition == 1 and CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "StopLoss" Then
{
BLcnt = BLcnt+1;
}
if MarketPosition == 0 and
MarketPosition(1) == -1 and
TotalTrades > TotalTrades[1] and LatestExitName(1) == "StopLoss" Then
SLcnt = SLcnt+1;
if MarketPosition == -1 and CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "StopLoss" Then
SLcnt = SLcnt+1;
If blcnt < 2 and Xcond == false and CrossUp(Close,Ma(c,5)) Then
{
Buy();
}
SetStopLoss(20*PriceScale,PointStop);
SetStopProfittarget(20*PriceScale,PointStop);
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
즐거운 하루되세요
> stockric 님이 쓴 글입니다.
> 제목 : 스탑로스 재질문드립니다.
> var : BLcnt(0),SLcnt(0);
Input : 당일손실틱수(100);
Var : N1(0),dayPl(0),당일누적손실(0),Xcond(false);
당일누적손실 = -PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then{
BLcnt = 0;
SLcnt = 0;
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
daypl <= 당일누적손실 then
Xcond = true;
if MarketPosition == 0 and
MarketPosition(1) == 1 and
TotalTrades > TotalTrades[1] and LatestExitName(1) == "StopLoss" Then
{
BLcnt = BLcnt+1;
}
if MarketPosition == 1 and CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "StopLoss" Then
{
BLcnt = BLcnt+1;
}
if MarketPosition == 0 and
MarketPosition(1) == -1 and
TotalTrades > TotalTrades[1] and LatestExitName(1) == "StopLoss" Then
SLcnt = SLcnt+1;
if MarketPosition == -1 and CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "StopLoss" Then
SLcnt = SLcnt+1;
If blcnt < 2 and Xcond == false and CrossUp(Close,Ma(c,5)) Then
{
Buy();
}
SetStopLoss(20*PriceScale,PointStop);
SetStopProfittarget(20*PriceScale,PointStop);
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
짜주신 로직입니다.
20틱 스탑. 100틱손실시 멈춤. dbl로 나와야하는 구간이 모조리 나와버립니다.
다우존스 2분봉 10000캔들입니다.
다음글
이전글