커뮤니티
안녕하세요?
2017-04-12 16:58:34
139
글번호 108726
안녕하세요
간단한수식 질문드립니다.
1. 기존수식에 양봉 두개째 매수(종가기준)
기존수식에 음봉 두개째 매도(종가기준)
중간에 도지 발생시 도지는 제외(양봉 도지 양봉 =>도지 다음양봉에서 종가진입)
2. 매매시간 오전9시부터 새벽 4시까지 (09:00~04:00)
3. 분할청산과 stoploss
청산: 3계약 진입후 10,20,30틱에 청산
stoploss(1) : 한계약 10틱 수익이후 한계약은 진입가,한계약은 -10틱
stoploss(2) : 한계약 10틱 수익,한계약 20틱수익이후 나머지 한계약은 진입가.
위두가지를 수식으로 작성 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2017-04-13 11:35:08
안녕하세요
예스스탁입니다.
아래 청산식이 올려주신 손절의 2가지 경우 모두 포함합니다.
var : T(0),Tcond(false);
if C > O Then
T = 1;
if C < O Then
T = -1;
if stime == 090000 or (stime > 090000 and stime[1] < 090000) Then
Tcond = true;
if stime == 040000 or (stime > 040000 and stime[1] < 040000) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if Tcond == true then{
if 기존진입식 and T == 1 and T[1] == 1 Then
buy("b",OnClose,def,3);
if 기존진입식 and T == -1 and T[1] == -1 Then
sell("s",OnClose,def,3);
}
if MarketPosition == 1 Then{
exitlong("bp1",Atlimit,EntryPrice+PriceScale*10,"",1,1);
exitlong("bp2",Atlimit,EntryPrice+PriceScale*20,"",1,1);
exitlong("bp3",Atlimit,EntryPrice+PriceScale*30,"",1,1);
if CurrentContracts < MaxContracts Then{
exitlong("bl1",Atlimit,EntryPrice,"",1,1);
exitlong("bl2",Atlimit,EntryPrice-PriceScale*10,"",1,1);
}
}
if MarketPosition == -1 Then{
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*10,"",1,1);
ExitShort("sp2",Atlimit,EntryPrice-PriceScale*20,"",1,1);
ExitShort("sp3",Atlimit,EntryPrice-PriceScale*30,"",1,1);
if CurrentContracts < MaxContracts Then{
ExitShort("sl1",Atlimit,EntryPrice,"",1,1);
ExitShort("sl2",Atlimit,EntryPrice+PriceScale*10,"",1,1);
}
}
즐거운 하루되세요
> 상중하 님이 쓴 글입니다.
> 제목 : 안녕하세요?
> 안녕하세요
간단한수식 질문드립니다.
1. 기존수식에 양봉 두개째 매수(종가기준)
기존수식에 음봉 두개째 매도(종가기준)
중간에 도지 발생시 도지는 제외(양봉 도지 양봉 =>도지 다음양봉에서 종가진입)
2. 매매시간 오전9시부터 새벽 4시까지 (09:00~04:00)
3. 분할청산과 stoploss
청산: 3계약 진입후 10,20,30틱에 청산
stoploss(1) : 한계약 10틱 수익이후 한계약은 진입가,한계약은 -10틱
stoploss(2) : 한계약 10틱 수익,한계약 20틱수익이후 나머지 한계약은 진입가.
위두가지를 수식으로 작성 부탁드립니다.
다음글
이전글