커뮤니티
GAP구간 청산이용
2020-01-20 11:17:13
228
글번호 130939
아래 수식은 옵션거래에서 진입가격 구간을 사용하여 청산하는 수식입니다.
선물거래에서 갭발생시 역진입하는 수식이 있을 때
청산에 응용하고 싶습니다.
진입가격과 연관된 gap을 이용하는 청산구간을 만들 수 있는지요?
예를 들어
전일 close 260.00
금일 open 258.50
gap 1.50 발생
buy 진입
input : gap1(1.00),gap2(1.95);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == 1 then
if AAA >= gap1 and AAA <= gap2 then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1);
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*익절1);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1);
}
예를 들어
전일 close 260.00
금일 open 261.50
gap 1.50 발생
sell 진입
input : gap1(1.00),gap2(1.95);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == -1 then
if AAA >= gap1 and AAA <= gap2 then
{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1);
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*익절1);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1);
}
**********************************************************************************
1)buy 진입
input : 청산가격1(260.00),청산가격2(262.00);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == 1 then
if EntryPrice >= 청산가격1 and EntryPrice <= 청산가격2 then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1);
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*익절1);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1);
}
2)sell 진입
input : 청산가격1(260.00),청산가격2(262.00);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == -1 then
if EntryPrice >= 청산가격1 and EntryPrice <= 청산가격2 then
{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1);
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*익절1);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1);
}
답변 1
예스스탁 예스스탁 답변
2019-08-06 15:56:25
안녕하세요
예스스탁입니다.
청산은 진입신호가 발생하면 동작하므로
갭조건이 진입에 있으면 청산에는 특별히 필요가 없습니다.
별도로 청산식에 갭의 범위를 지정하고자 하시면
매수청산과 매도청산을 아래와 같이 설정하시면 됩니다.
input : gap1(1.00),gap2(1.95);
input : 손절1(60),익절1(300),TR1(150);
var : gap(0);
gap = dayopen(0)-DayClose(1);
if MarketPosition == 1 then
{
if gap <= -gap1 and gap >= -gap2 then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1);
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*익절1);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1);
}
}
if MarketPosition == -1 then
{
if gap >= gap1 and gap <= gap2 then
{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1);
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*익절1);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1);
}
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 아래 수식은 옵션거래에서 진입가격 구간을 사용하여 청산하는 수식입니다.
선물거래에서 갭발생시 역진입하는 수식이 있을 때
청산에 응용하고 싶습니다.
진입가격과 연관된 gap을 이용하는 청산구간을 만들 수 있는지요?
예를 들어
전일 close 260.00
금일 open 258.50
gap 1.50 발생
buy 진입
input : gap1(1.00),gap2(1.95);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == 1 then
if AAA >= gap1 and AAA <= gap2 then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1);
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*익절1);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1);
}
예를 들어
전일 close 260.00
금일 open 261.50
gap 1.50 발생
sell 진입
input : gap1(1.00),gap2(1.95);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == -1 then
if AAA >= gap1 and AAA <= gap2 then
{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1);
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*익절1);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1);
}
**********************************************************************************
1)buy 진입
input : 청산가격1(260.00),청산가격2(262.00);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == 1 then
if EntryPrice >= 청산가격1 and EntryPrice <= 청산가격2 then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1);
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*익절1);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1);
}
2)sell 진입
input : 청산가격1(260.00),청산가격2(262.00);
input : 손절1(60),익절1(300),TR1(150);
if MarketPosition == -1 then
if EntryPrice >= 청산가격1 and EntryPrice <= 청산가격2 then
{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1);
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*익절1);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1);
}