커뮤니티
수식 문의 드립니다.
2017-02-17 14:38:25
101
글번호 106956
안녕하세요.
아래수식에서 목표청산 1일 3회 적용시, 목표청산 1회이상 발생 후 당일손실제한 손절시에는
당일손실제한 1.5PT 에서 목표정산 1회 수익분 1.1PT 제외한 당일손실제한 0.4PT로 연동적용
되도록 수정, 차트적용 목표청산 1일 3회 수식 점검 요청 드립니다.
(당일손실제한 1.5PT - 목표청산 1회 1.1PT 만 적용(2회 3회 제외) = 당일손실제한 0.4PT)
감사합니다.
input : N(1),PN(2),PPN(3),당일손실(1.5),i증감(0.2),진입수량(1),누적진입횟수(3);
var : cnt(0),BCount(0),SCount(0);
var : NP(0),PreNP(0),DayPL(0),loss(0),v1(0);
var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0),mav6(0);
var : Bxcond(false),SxCond(false);
var : Xcond(false);
var : TT(0),KK(0),DD(0);
var : Pcnt(0);
NP = NetProfit;
if date != date[1] Then{
preNP = NP[1];
Condition1 = false;
v1 = 0;
Xcond = false;
}
dayPL = NP-PreNP;
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
if Condition1 == false and TotalTrades > TotalTrades[1] Then{
Condition1 = true;
if PositionProfit(1) > 0 Then
v1 = PositionProfit(1);
}
//------------------------------------------------------------------------------------------------------
#당일손실제한
if MarketPosition == 1 Then{
ExitLong("당일손실제한bx3",AtStop,avgEntryPrice-(당일손실+(dayPL-v1))/CurrentContracts);
}
if MarketPosition == -1 Then{
ExitShort("당일손실제한sx3",AtStop,avgEntryPrice+(당일손실+(dayPL-v1))/CurrentContracts);
}
//------------------------------------------------------------------------------------------------------
#피라미딩진입
if MarketPosition == 1 and MaxEntries < 누적진입횟수 and Bxcond == false and Xcond == false Then
Buy("PBB",atlimit,LatestEntryPrice(0)+i증감,진입수량);
if MarketPosition == -1 and MaxEntries < 누적진입횟수 and Sxcond == false and XCond == false Then
sell("PSS",atlimit,LatestEntryPrice(0)-i증감,진입수량);
//-----------------------------------------------------------------------------------------------------
#목표수익청산
Input : SSPT1(1.1);
SetStopPosition;
SetStopProfittarget(SSPT1,PointStop);
//======================================================================================================
#진입수식(예제)
Input : Period(20);
if Bdate != Bdate[1] Then
Pcnt = 0;
if CurrentContracts < CurrentContracts[1] and
((MarketPosition != 0 and LatestExitName(0) == "StopProfitTarget") or
(MarketPosition != MarketPosition[1] and LatestExitName(1) == "StopProfitTarget")) Then
Pcnt = Pcnt+1;
value1 = TRIX(Period);
If CrossUP(value1, 0) and BCount+SCount < PPN and dayPL > -당일손실 and Pcnt < 3 Then{
Buy("TRIXB");
}
If CrossDown(value1, 0) and BCount+SCount < PPN and dayPL > -당일손실 and Pcnt < 3 Then{
Sell("TRIXS");
}
//------------------------------------------------------------------------------------------------------
SetStopEndofday(153000);
//------------------------------------------------------------------------------------------------------
답변 1
예스스탁 예스스탁 답변
2017-02-17 17:49:17
안녕하세요
예스스탁입니다.
input : N(1),PN(2),PPN(3),당일손실(1.5),i증감(0.2),진입수량(1),누적진입횟수(3);
Input : SSPT1(1.1);
var : cnt(0),BCount(0),SCount(0);
var : NP(0),PreNP(0),DayPL(0),loss(0),v1(0);
var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0),mav6(0);
var : Bxcond(false),SxCond(false);
var : Xcond(false);
var : TT(0),KK(0),DD(0);
var : Pcnt(0),Dloss(0);
NP = NetProfit;
if date != date[1] Then{
preNP = NP[1];
Condition1 = false;
v1 = 0;
Xcond = false;
}
dayPL = NP-PreNP;
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
if Condition1 == false and TotalTrades > TotalTrades[1] Then{
Condition1 = true;
if PositionProfit(1) > 0 Then
v1 = PositionProfit(1);
}
//------------------------------------------------------------------------------------------------------
#당일손실제한
if MarketPosition == 1 Then{
if Pcnt == 0 Then
Dloss = 당일손실;
Else
Dloss = 당일손실-SSPT1;
ExitLong("당일손실제한bx3",AtStop,avgEntryPrice-(당일손실+(dayPL-v1))/CurrentContracts);
}
if MarketPosition == -1 Then{
if Pcnt == 0 Then
Dloss = 당일손실;
Else
Dloss = 당일손실-SSPT1;
ExitShort("당일손실제한sx3",AtStop,avgEntryPrice+(당일손실+(dayPL-v1))/CurrentContracts);
}
//------------------------------------------------------------------------------------------------------
#피라미딩진입
if MarketPosition == 1 and MaxEntries < 누적진입횟수 and Bxcond == false and Xcond == false Then
Buy("PBB",atlimit,LatestEntryPrice(0)+i증감,진입수량);
if MarketPosition == -1 and MaxEntries < 누적진입횟수 and Sxcond == false and XCond == false Then
sell("PSS",atlimit,LatestEntryPrice(0)-i증감,진입수량);
//-----------------------------------------------------------------------------------------------------
#목표수익청산
SetStopPosition;
SetStopProfittarget(SSPT1,PointStop);
//======================================================================================================
#진입수식(예제)
Input : Period(20);
if Bdate != Bdate[1] Then
Pcnt = 0;
if CurrentContracts < CurrentContracts[1] and
((MarketPosition != 0 and LatestExitName(0) == "StopProfitTarget") or
(MarketPosition != MarketPosition[1] and LatestExitName(1) == "StopProfitTarget")) Then
Pcnt = Pcnt+1;
value1 = TRIX(Period);
If CrossUP(value1, 0) and BCount+SCount < PPN and dayPL > -당일손실 and Pcnt < 3 Then{
Buy("TRIXB");
}
If CrossDown(value1, 0) and BCount+SCount < PPN and dayPL > -당일손실 and Pcnt < 3 Then{
Sell("TRIXS");
}
//------------------------------------------------------------------------------------------------------
SetStopEndofday(153000);
//------------------------------------------------------------------------------------------------------
즐거운 하루되세요
> dandy 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 안녕하세요.
아래수식에서 목표청산 1일 3회 적용시, 목표청산 1회이상 발생 후 당일손실제한 손절시에는
당일손실제한 1.5PT 에서 목표정산 1회 수익분 1.1PT 제외한 당일손실제한 0.4PT로 연동적용
되도록 수정, 차트적용 목표청산 1일 3회 수식 점검 요청 드립니다.
(당일손실제한 1.5PT - 목표청산 1회 1.1PT 만 적용(2회 3회 제외) = 당일손실제한 0.4PT)
감사합니다.
input : N(1),PN(2),PPN(3),당일손실(1.5),i증감(0.2),진입수량(1),누적진입횟수(3);
var : cnt(0),BCount(0),SCount(0);
var : NP(0),PreNP(0),DayPL(0),loss(0),v1(0);
var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0),mav6(0);
var : Bxcond(false),SxCond(false);
var : Xcond(false);
var : TT(0),KK(0),DD(0);
var : Pcnt(0);
NP = NetProfit;
if date != date[1] Then{
preNP = NP[1];
Condition1 = false;
v1 = 0;
Xcond = false;
}
dayPL = NP-PreNP;
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
if Condition1 == false and TotalTrades > TotalTrades[1] Then{
Condition1 = true;
if PositionProfit(1) > 0 Then
v1 = PositionProfit(1);
}
//------------------------------------------------------------------------------------------------------
#당일손실제한
if MarketPosition == 1 Then{
ExitLong("당일손실제한bx3",AtStop,avgEntryPrice-(당일손실+(dayPL-v1))/CurrentContracts);
}
if MarketPosition == -1 Then{
ExitShort("당일손실제한sx3",AtStop,avgEntryPrice+(당일손실+(dayPL-v1))/CurrentContracts);
}
//------------------------------------------------------------------------------------------------------
#피라미딩진입
if MarketPosition == 1 and MaxEntries < 누적진입횟수 and Bxcond == false and Xcond == false Then
Buy("PBB",atlimit,LatestEntryPrice(0)+i증감,진입수량);
if MarketPosition == -1 and MaxEntries < 누적진입횟수 and Sxcond == false and XCond == false Then
sell("PSS",atlimit,LatestEntryPrice(0)-i증감,진입수량);
//-----------------------------------------------------------------------------------------------------
#목표수익청산
Input : SSPT1(1.1);
SetStopPosition;
SetStopProfittarget(SSPT1,PointStop);
//======================================================================================================
#진입수식(예제)
Input : Period(20);
if Bdate != Bdate[1] Then
Pcnt = 0;
if CurrentContracts < CurrentContracts[1] and
((MarketPosition != 0 and LatestExitName(0) == "StopProfitTarget") or
(MarketPosition != MarketPosition[1] and LatestExitName(1) == "StopProfitTarget")) Then
Pcnt = Pcnt+1;
value1 = TRIX(Period);
If CrossUP(value1, 0) and BCount+SCount < PPN and dayPL > -당일손실 and Pcnt < 3 Then{
Buy("TRIXB");
}
If CrossDown(value1, 0) and BCount+SCount < PPN and dayPL > -당일손실 and Pcnt < 3 Then{
Sell("TRIXS");
}
//------------------------------------------------------------------------------------------------------
SetStopEndofday(153000);
//------------------------------------------------------------------------------------------------------