답변완료
차트신호시 콜옵션 외가1 풋옵션 외가1 동시매수
차트에서 매수신호가 발생하면
외가격 옵션을 양매수 하는 수식을 만들고자 합니다.
아래 수식에 반영하여 주시기 바라며 주석도 부탁드립니다.
*** 콜옵션 외가격+1 을 찾는다
*** 풋옵션 외가격-1 을 찾는다
항상 고맙습니다.
********************************************************************************
var UNum; var LNum;
var CallCode; var CallPrice;
var PutCode; var PutPrice;
var CC; var PP;
var CallOrderCode; var PutOrderCode;
var CallExit,PutExit;
function Main_OnStart()
{
CallExit = false;
PutExit = false;
Main.SetTimer(1, 5000);
}
//차트에서 신호가 발생하면
function Chart1_OnRiseSignal(Signal)
{
//해당 신호가 매수신호이면
if (Signal.signalKind == 1)
{
*** 콜옵션 외가격+1 을 찾는다
*** 풋옵션 외가격-1 을 찾는다
//콜옵션종목 매수
if (CallExit == false)
{
//지정가
Account1.OrderBuy(CallOrderCode, 1, Option1.GetAskByCode(CallOrderCode, 2), 0);
//시장가
//Account1.OrderBuy(CallOrderCode, 1, 0, 1);
}
//풋옵션종목 매수
if (PutExit == false)
{
//지정가
Account1.OrderBuy(PutOrderCode, 1, Option1.GetAskByCode(PutOrderCode, 2), 0);
//시장가
//Account1.OrderBuy(PutOrderCode, 1, 0, 1);
}
}
}
답변완료
시스템식 부탁드립니다.
항상 도움 주셔서 감사합니다.
아래 시스템식에서 하루 손실제한을 100 POINT로 제한하는 시스템식 부탁드립다.
#===============================================
Inputs : SL(51);
Inputs : TS(10),TP(50);
Inputs : T1(100),T2(15);
Inputs : shortPeriod(5), longPeriod(20), SPeriod(9);
Var : MACDV(0), MACDsig(0) ;
### 해외선물 새벽시간 당일청산 ###
if sDate != sDate[1] Then
SetStopEndofday(060000);
if Bdate != Bdate[1] Then
SetStopEndofday(0);
### 일매매손익에 따른 손절 ###
##### 변수셋팅 #####
MACDV = MACD(shortPeriod, longPeriod);
MACDsig = ema(MACDV,SPeriod);
#--------------------------------------------------------------------------------------
##### 매매로직 #####
#--------------------------------------------------------------------------------------
if sTime >= 140000 and sTime <=2400000 or stime >= 000000 and sTime <= 070000 Then {
#--------------------------------------------------------------------------------------
#----------------------
# Long Entry 매수
#----------------------
If marketposition <= 0 and macdv > macdsig and macdv > 0 Then Begin
Buy("B1",OnClose,DEf,amt);
End;
# Long Exit 익절 및 본청
if MarketPosition == 1 Then
{
if MaxEntries == 1 and C > dayopen() Then
{
ExitLong("BP1",AtLimit,AvgEntryPrice+T1);
}
if MaxEntries == 2 and C > dayopen() Then
ExitLong("BP2",AtLimit,AvgEntryPrice+T2);
if MaxEntries == 3 and C > dayopen() Then
ExitLong("BP3",AtLimit,AvgEntryPrice+T2);
if MaxEntries == 3 and C > dayopen() Then
ExitLong("BL",AtStop,AvgEntryPrice-T2*6);
if MaxEntries == 1 and C > dayopen() Then
Buy("B2",AtLimit,LatestEntryPrice(0)-T2,1);
if MaxEntries == 2 and C > dayopen() Then
Buy("B3",AtLimit,LatestEntryPrice(0)-T2,1);
}
#----------------------
# Short Entry 매도
#----------------------
If marketposition >= 0 and macdv < macdsig and macdv < 0 Then Begin
Sell("S1",OnClose,DEf,amt);
End;
# Short Exit 익절 및 본청
if MarketPosition == -1 Then
{
if MaxEntries == 1 and C < dayopen() Then
{
ExitShort("SP1",AtLimit,AvgEntryPrice-T1);
}
if MaxEntries == 2 and C < dayopen() Then
ExitShort("SP2",AtLimit,AvgEntryPrice-T2);
if MaxEntries == 3 and C < dayopen() Then
ExitShort("SP3",AtLimit,AvgEntryPrice-T2);
if MaxEntries == 3 and C < dayopen() Then
ExitShort("SL",AtStop,AvgEntryPrice+T2*6);
if MaxEntries == 1 and C < dayopen() Then
Sell("S2",AtLimit,LatestEntryPrice(0)+T2,1);
if MaxEntries == 2 and C < dayopen() Then
Sell("S3",AtLimit,LatestEntryPrice(0)+T2,1);
}
#--------------------------------------------------------------------------------------
} //매매시간 종료
#--------------------------------------------------------------------------------------
##### 포지션 익절, 손절 #####
#--------------------------------------------------------------------------------------
##### 스탑로스 #####
SetStopLoss(SL,PointStop);
SetStopTrailing(TS,TP,PointStop);
감사합니다.