커뮤니티
수식 부탁드립니다
2017-02-21 17:11:29
112
글번호 107094
1. entryprice 는 최초 진입가이고
latestentryprice 는 최종 진입가인데
최초 진입후 최초 진입가가 수익 목표가에서 청산된 경우 피라미딩 후 청산되지 않고 계
속보유중인 가격 중 최저가를 나타내는 명령어가 있나요? 라는 질문에
If MarketPosition != 0 Then
{
if MaxEntries == 1 Then
LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) > LL Then
LL = latestEntryPrice(0);
}
이렇게 답변해 주셨는데
피라미딩 후 1개가 추가로 매수되었고 최초 진입가가 청산되지 않았을 경우,
최초 진입가가 최저가이지만 이식을 적용하면 추가로 진입한 가격이 최저가로 인식되어 추가로 진입한 2번째 진입가가 최저가로 인식되는거 같은데...
제가 질문을 정확히 못드린 것 같아 다시 질문을 드립니다
1. 최초 진입과 피라미딩으로 보유수량이 5개( 피라미딩후 최대 보유한도) 있었고 그중 몇개가
목표이익 달성으로 청산되었고 몇개가 추가진입하여 현재의 최저진입가는 최초 진입가에서
단가가 많이 높아진 상태에서 1개가 청산이 되어 나머지 잔량이 4개가 되었을 경우, 2개가
청산되어 잔량이 3개가 되었을 경우, 3개가 청산되어 잔량이 2개가 되었을 경우, 4개가 청산
되어 잔량이 1개가 되었을 모든 경우에 최저가를 나타내는 수식을 알고 싶습니다.
(청산은 손절매로 인하여 진입 순서대로 청산되지는 않습니다)
2. 3번 질문을 매도 피라미딩시 적용하면 NthMinList을 NthMAXList로 변경하면
되는 것이지요?
부탁드립니다
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 부탁드립니다
> 안녕하세요
예스스탁입니다.
1.
LatestEntryPrice(0)가 LL보다 작다라고 하셔야 합니다.
If MarketPosition != 0 Then
{
if MaxEntries == 1 Then
LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) < LL Then
LL = LatestEntryPrice(0);
}
2
없습니다.
3
아래 내용 참고하시기 바랍니다.
var : E1(0),E2(0),E3(0),E4(0),avg2(0),avg3(0);
If MarketPosition != 0 Then
{
if CurrentContracts > CurrentContracts[1] Then{
if MaxEntries == 1 Then
E1 = LatestEntryPrice(0);
if MaxEntries == 2 Then
E2 = LatestEntryPrice(0);
if MaxEntries == 3 Then
E3 = LatestEntryPrice(0);
if MaxEntries == 4 Then
E4 = LatestEntryPrice(0);
}
if MaxEntries == 1 Then{
avg2 = E1;
avg3 = E1;
}
if MaxEntries == 2 Then{
avg2 = (E1+E2)/2;
avg3 = (E1+E2)/2;
}
if MaxEntries == 3 Then{
avg2 = (NthMinList(1,E1,E2,E3)+NthMinList(2,E1,E2,E3))/2;
avg3 = (E1+E2+E3)/3;
}
if MaxEntries == 4 Then{
avg2 = (NthMinList(1,E1,E2,E3,E4)+NthMinList(2,E1,E2,E3,E4))/2;
avg3 = (NthMinList(1,E1,E2,E3,E4)+NthMinList(2,E1,E2,E3,E4)+NthMinList(3,E1,E2,E3,E4))/3;
}
}
즐거운 하루되세요
> 미송 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> 1. entryprice 는 최초 진입가이고
latestentryprice 는 최종 진입가인데
최초 진입후 최초 진입가가 수익 목표가에서 청산된 경우 피라미딩 후 청산되지 않고 계
속보유중인 가격 중 최저가를 나타내는 명령어가 있나요?
이 질문에 답변을 해주셔서 당초 시스템식
if MarketPosition == 1 Then
{
if MaxContracts < 4 Then
buy("bb",atstop,LatestEntryPrice(0)+1.5,1);
}
if MarketPosition == -1 Then
{
if MaxContracts < 4 Then
sell("ss",atstop,LatestEntryPrice(0)-1.5,1);
}
#진입별 5포인트 수익시 청산
SetStopProfittarget(5.0,PointStop);
#진입별 1.5포인트 손실시 청산
SetStoploss(1.5,PointStop);
if MarketPosition == 1 Then
ExitLong("bp",atlimit,EntryPrice+20.0);
if MarketPosition == -1 Then
ExitShort("sp",atlimit,EntryPrice-20.0);
if MarketPosition == 1 and c > entryprice + 15.0 and Relative1 >= 65 Then
exitlong("bx1",AtStop,c);
if MarketPosition == -1 and c < entryprice - 15.0 and Relative1 <= 35 Then
exitShort("sx1",AtStop,c);
if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice + 0.6 Then
Exitlong("bx2",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)-EntryPrice)*1.0);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice - 0.6 Then
Exitshort("Sx2",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)-EntryPrice)*1.0);
if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice + 1.0 Then
Exitlong("bx3",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)-EntryPrice)*0.9);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice - 1.0 Then
Exitshort("Sx3",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.9);
을 다음과 같이 바꾸었습니다
if MarketPosition == 1 Then
{
if MaxContracts < 4 Then
buy("bb",atstop,LatestEntryPrice(0)+1.5,1);
}
if MarketPosition == -1 Then
{
if MaxContracts < 4 Then
sell("ss",atstop,LatestEntryPrice(0)-1.5,1);
}
If MarketPosition == -1 Then
{
if MaxEntries == 1 Then LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) > LL Then
LL = LatestEntryPrice(0);
}
#진입별 5포인트 수익시 청산
SetStopProfittarget(5.0,PointStop);
#진입별 1.5포인트 손실시 청산
SetStoploss(1.5,PointStop);
if MarketPosition == 1 Then
ExitLong("bp",atlimit,EntryPrice+20);
if MarketPosition == -1 Then
ExitShort("sp",atlimit,EntryPrice-20);
if MarketPosition == 1 and c > entryprice + 15.0 and Relative1 >= 65 Then
exitlong("bx1",AtStop,c);
if MarketPosition == -1 and c < EntryPrice - 15.0 and Relative1 <= 35 Then
exitShort("sx1",AtStop,c);
if MarketPosition == 1 and CurrentContracts == 1 and highest(h,BarsSinceEntry) >= LL + 0.6 Then
Exitlong("bx2",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)- LL)*1.0);
if MarketPosition == -1 and CurrentContracts == 1 and lowest(L,BarsSinceEntry) <= LL - 0.6 Then
Exitshort("Sx2",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)- LL)*1.0);
if MarketPosition == 1 and CurrentContracts <= 2 and highest(h,BarsSinceEntry) >= LL-1.0 Then
Exitlong("bx3",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)- LL)*0.9);
if MarketPosition == -1 and CurrentContracts <= 2 and lowest(L,BarsSinceEntry) <= LL- 1.0 Then
Exitshort("Sx3",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)- LL)*0.9);
바꾼 결과는 당초와 다른것이 하나도 없었습니다.
더 바꿔야 하는 수식이 있는지 검토 부탁드립니다
2. entryprice 는 최초 진입가이고
latestentryprice 는 최종 진입가인데
피라미딩 후 청산되지 않고 보유중인 계약이 다수 있을경우 각 가격을 나타내는 명령어가 있
나요?
3. 또 위의 피라미딩 시스템은 4개의 잔량까지 보유 할 수 있는데 보유중인 가격중 하위 2개, 또는 3개 가격의 평균가(avgentryprice)을 나타내는 명령어를 만들고 싶습니다
감사합니다
답변 1
예스스탁 예스스탁 답변
2017-02-21 17:19:24
안녕하세요
예스스탁입니다.
1
이전에 답변드린 식과 질문에 올리신식 비교해 보시기 바랍니다.
진입이후 진입가 중 최저진입가 계산할때
답변에는 LatestEntryPrice(0) < LL 로 되어 있는데
올리신 식에는 계속 부등호가 반대로 되어 있습니다.
또한 해당 식은 청산과 관계없습니다.
진입이 발생할때마다 LL에 저장된 값과 비교해 저장하는 구조이기 때문에
진입의 청산여부와는 관계가 없습니다
즉 아래 식은 진입별로 청산은 관계가 없이
진입이후 최저가 계산하는 식입니다.
If MarketPosition != 0 Then
{
if MaxEntries == 1 Then
LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) < LL Then
LL = latestEntryPrice(0);
}
2
매도일경우 최고가를 기준으로 하면
NthMinList를 NthmaxList로 변경하면 됩니다.
즐거운 하루되세요
> 미송 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> 1. entryprice 는 최초 진입가이고
latestentryprice 는 최종 진입가인데
최초 진입후 최초 진입가가 수익 목표가에서 청산된 경우 피라미딩 후 청산되지 않고 계
속보유중인 가격 중 최저가를 나타내는 명령어가 있나요? 라는 질문에
If MarketPosition != 0 Then
{
if MaxEntries == 1 Then
LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) > LL Then
LL = latestEntryPrice(0);
}
이렇게 답변해 주셨는데
피라미딩 후 1개가 추가로 매수되었고 최초 진입가가 청산되지 않았을 경우,
최초 진입가가 최저가이지만 이식을 적용하면 추가로 진입한 가격이 최저가로 인식되어 추가로 진입한 2번째 진입가가 최저가로 인식되는거 같은데...
제가 질문을 정확히 못드린 것 같아 다시 질문을 드립니다
1. 최초 진입과 피라미딩으로 보유수량이 5개( 피라미딩후 최대 보유한도) 있었고 그중 몇개가
목표이익 달성으로 청산되었고 몇개가 추가진입하여 현재의 최저진입가는 최초 진입가에서
단가가 많이 높아진 상태에서 1개가 청산이 되어 나머지 잔량이 4개가 되었을 경우, 2개가
청산되어 잔량이 3개가 되었을 경우, 3개가 청산되어 잔량이 2개가 되었을 경우, 4개가 청산
되어 잔량이 1개가 되었을 모든 경우에 최저가를 나타내는 수식을 알고 싶습니다.
(청산은 손절매로 인하여 진입 순서대로 청산되지는 않습니다)
2. 3번 질문을 매도 피라미딩시 적용하면 NthMinList을 NthMAXList로 변경하면
되는 것이지요?
부탁드립니다
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 부탁드립니다
> 안녕하세요
예스스탁입니다.
1.
LatestEntryPrice(0)가 LL보다 작다라고 하셔야 합니다.
If MarketPosition != 0 Then
{
if MaxEntries == 1 Then
LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) < LL Then
LL = LatestEntryPrice(0);
}
2
없습니다.
3
아래 내용 참고하시기 바랍니다.
var : E1(0),E2(0),E3(0),E4(0),avg2(0),avg3(0);
If MarketPosition != 0 Then
{
if CurrentContracts > CurrentContracts[1] Then{
if MaxEntries == 1 Then
E1 = LatestEntryPrice(0);
if MaxEntries == 2 Then
E2 = LatestEntryPrice(0);
if MaxEntries == 3 Then
E3 = LatestEntryPrice(0);
if MaxEntries == 4 Then
E4 = LatestEntryPrice(0);
}
if MaxEntries == 1 Then{
avg2 = E1;
avg3 = E1;
}
if MaxEntries == 2 Then{
avg2 = (E1+E2)/2;
avg3 = (E1+E2)/2;
}
if MaxEntries == 3 Then{
avg2 = (NthMinList(1,E1,E2,E3)+NthMinList(2,E1,E2,E3))/2;
avg3 = (E1+E2+E3)/3;
}
if MaxEntries == 4 Then{
avg2 = (NthMinList(1,E1,E2,E3,E4)+NthMinList(2,E1,E2,E3,E4))/2;
avg3 = (NthMinList(1,E1,E2,E3,E4)+NthMinList(2,E1,E2,E3,E4)+NthMinList(3,E1,E2,E3,E4))/3;
}
}
즐거운 하루되세요
> 미송 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> 1. entryprice 는 최초 진입가이고
latestentryprice 는 최종 진입가인데
최초 진입후 최초 진입가가 수익 목표가에서 청산된 경우 피라미딩 후 청산되지 않고 계
속보유중인 가격 중 최저가를 나타내는 명령어가 있나요?
이 질문에 답변을 해주셔서 당초 시스템식
if MarketPosition == 1 Then
{
if MaxContracts < 4 Then
buy("bb",atstop,LatestEntryPrice(0)+1.5,1);
}
if MarketPosition == -1 Then
{
if MaxContracts < 4 Then
sell("ss",atstop,LatestEntryPrice(0)-1.5,1);
}
#진입별 5포인트 수익시 청산
SetStopProfittarget(5.0,PointStop);
#진입별 1.5포인트 손실시 청산
SetStoploss(1.5,PointStop);
if MarketPosition == 1 Then
ExitLong("bp",atlimit,EntryPrice+20.0);
if MarketPosition == -1 Then
ExitShort("sp",atlimit,EntryPrice-20.0);
if MarketPosition == 1 and c > entryprice + 15.0 and Relative1 >= 65 Then
exitlong("bx1",AtStop,c);
if MarketPosition == -1 and c < entryprice - 15.0 and Relative1 <= 35 Then
exitShort("sx1",AtStop,c);
if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice + 0.6 Then
Exitlong("bx2",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)-EntryPrice)*1.0);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice - 0.6 Then
Exitshort("Sx2",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)-EntryPrice)*1.0);
if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice + 1.0 Then
Exitlong("bx3",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)-EntryPrice)*0.9);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice - 1.0 Then
Exitshort("Sx3",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.9);
을 다음과 같이 바꾸었습니다
if MarketPosition == 1 Then
{
if MaxContracts < 4 Then
buy("bb",atstop,LatestEntryPrice(0)+1.5,1);
}
if MarketPosition == -1 Then
{
if MaxContracts < 4 Then
sell("ss",atstop,LatestEntryPrice(0)-1.5,1);
}
If MarketPosition == -1 Then
{
if MaxEntries == 1 Then LL = EntryPrice;
if CurrentContracts > CurrentContracts[1] and LatestEntryPrice(0) > LL Then
LL = LatestEntryPrice(0);
}
#진입별 5포인트 수익시 청산
SetStopProfittarget(5.0,PointStop);
#진입별 1.5포인트 손실시 청산
SetStoploss(1.5,PointStop);
if MarketPosition == 1 Then
ExitLong("bp",atlimit,EntryPrice+20);
if MarketPosition == -1 Then
ExitShort("sp",atlimit,EntryPrice-20);
if MarketPosition == 1 and c > entryprice + 15.0 and Relative1 >= 65 Then
exitlong("bx1",AtStop,c);
if MarketPosition == -1 and c < EntryPrice - 15.0 and Relative1 <= 35 Then
exitShort("sx1",AtStop,c);
if MarketPosition == 1 and CurrentContracts == 1 and highest(h,BarsSinceEntry) >= LL + 0.6 Then
Exitlong("bx2",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)- LL)*1.0);
if MarketPosition == -1 and CurrentContracts == 1 and lowest(L,BarsSinceEntry) <= LL - 0.6 Then
Exitshort("Sx2",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)- LL)*1.0);
if MarketPosition == 1 and CurrentContracts <= 2 and highest(h,BarsSinceEntry) >= LL-1.0 Then
Exitlong("bx3",AtStop,highest(H,BarsSinceEntry) - abs(highest(H,BarsSinceEntry)- LL)*0.9);
if MarketPosition == -1 and CurrentContracts <= 2 and lowest(L,BarsSinceEntry) <= LL- 1.0 Then
Exitshort("Sx3",AtStop,lowest(L,BarsSinceEntry) + abs(lowest(L,BarsSinceEntry)- LL)*0.9);
바꾼 결과는 당초와 다른것이 하나도 없었습니다.
더 바꿔야 하는 수식이 있는지 검토 부탁드립니다
2. entryprice 는 최초 진입가이고
latestentryprice 는 최종 진입가인데
피라미딩 후 청산되지 않고 보유중인 계약이 다수 있을경우 각 가격을 나타내는 명령어가 있
나요?
3. 또 위의 피라미딩 시스템은 4개의 잔량까지 보유 할 수 있는데 보유중인 가격중 하위 2개, 또는 3개 가격의 평균가(avgentryprice)을 나타내는 명령어를 만들고 싶습니다
감사합니다