답변완료
쿠루드오일 매매 수식 부탁드리겠습니다.
항상 도움을 주셔서 감사합니다. 자동매매로 잘 활용중에 있습니다.
다음 수식 부탁드릴께요~~
종목: 크루드 오일
차트 60분봉
적용플렛폼 유진선물 예스트레이드
최초 매수
RSI (20) < 30 일때 1계약 계약
추가매수
1.최초진입값에서 5포인트 하락시마다 1계약식 추가매수 (5%하락이 아님 )
2.추가매수는 max 20계약까지만 계약
청산
1. 각각 진입가격에서 6포인트 상승시 매수청산
예를 들어 최초매수가격이 70포인트
추가매수 65포인트 1개 추가 매수 60포인트 1추가매수 55포인트 1개 추가 매수
총 4계약 매수 처리된 상태에서 올라서 61포인트에서 55포인트에서 매수한 계약분은 청산
66포인트에서는 60포인트에서 매수한 계약분 청산
(첨부화일 차트 참조)
이런 형태로 매수-청산될수있도록 되는 수식 시스템 부탁드림니다.
첨부화일은 초기 진입을 임의로 90포인트에서 진입하는것으로 설정했습니다.
# SP 60분봉 202
# 2023년 11월 18일 매도 버전 일부 변경 익절1 1.5 --> 1.6 MFI값(18)--> 40
input : 시작일(10230524);
input : MFI기간(30),MFI값(40);
input : X(250),Y(100);
input : 매매기준선(4);
input : 분할매수포인트(0.1);
input : 익절포인트(0.1);
var : MoneyFlow(0),MoneyFlow1(0);
MoneyFlow = MFI(MFI기간);
if Data1(sDate) >= 시작일 Then
{
if MarketPosition == 0 and MoneyFlow <= MFI값 and C <= Highest(H,X)-PriceScale*Y and C < 매매기준선 Then
{
Buy("b1",OnClose,Def,1);
ExitLong("bx1",AtLimit,c+익절포인트,"b1");
}
}
if MarketPosition == 1 Then
{
if L > EntryPrice - 분할매수포인트 Then
{
Buy("b2",AtLimit,EntryPrice- 분할매수포인트,1);
ExitLong("bx2",AtLimit,min(NextBarOpen,EntryPrice)*10,"b2");
}
if L > EntryPrice-분할매수포인트*2 Then
{
Buy("b3",AtLimit,EntryPrice- 분할매수포인트*2,1);
ExitLong("bx3",AtLimit,min(NextBarOpen,EntryPrice)*10,"b3");
}
if L > EntryPrice-분할매수포인트*3 Then
{
Buy("b4",AtLimit,EntryPrice- 분할매수포인트*3,1);
ExitLong("bx4",AtLimit,min(NextBarOpen,EntryPrice)*10,"b4");
}
if L > EntryPrice-분할매수포인트*4 Then
{
Buy("b5",AtLimit,EntryPrice- 분할매수포인트*4,1);
ExitLong("bx5",AtLimit,min(NextBarOpen,EntryPrice)*10,"b5");
}
if L > EntryPrice-분할매수포인트*5 Then
{
Buy("b6",AtLimit,EntryPrice- 분할매수포인트*5,1);
ExitLong("bx6",AtLimit,min(NextBarOpen,EntryPrice)*10,"b6");
}
if L > EntryPrice-분할매수포인트*6 Then
{
Buy("b7",AtLimit,EntryPrice- 분할매수포인트*6,1);
ExitLong("bx7",AtLimit,min(NextBarOpen,EntryPrice)*10,"b7");
}
if L > EntryPrice-분할매수포인트*7 Then
{
Buy("b8",AtLimit,EntryPrice- 분할매수포인트*7,1);
ExitLong("bx8",AtLimit,min(NextBarOpen,EntryPrice)*10,"b8");
}
if L > EntryPrice-분할매수포인트*8 Then
{
Buy("b9",AtLimit,EntryPrice- 분할매수포인트*8,1);
ExitLong("bx9",AtLimit,min(NextBarOpen,EntryPrice)*10,"b9");
}
if L > EntryPrice-분할매수포인트*9 Then
{
Buy("b10",AtLimit,EntryPrice- 분할매수포인트*9,1);
ExitLong("bx10",AtLimit,min(NextBarOpen,EntryPrice)*10,"b10");
}
if L > EntryPrice-분할매수포인트*10 Then
{
Buy("b11",AtLimit,EntryPrice- 분할매수포인트*10,1);
ExitLong("bx11",AtLimit,min(NextBarOpen,EntryPrice)*10,"b11");
}
if L > EntryPrice-분할매수포인트*11 Then
{
Buy("b12",AtLimit,EntryPrice- 분할매수포인트*11,1);
ExitLong("bx12",AtLimit,min(NextBarOpen,EntryPrice)*10,"b12");
}
if L > EntryPrice-분할매수포인트*12 Then
{
Buy("b13",AtLimit,EntryPrice- 분할매수포인트*12,1);
ExitLong("bx13",AtLimit,min(NextBarOpen,EntryPrice)*10,"b13");
}
if L > EntryPrice-분할매수포인트*13 Then
{
Buy("b14",AtLimit,EntryPrice- 분할매수포인트*13,1);
ExitLong("bx14",AtLimit,min(NextBarOpen,EntryPrice)*10,"b14");
}
if L > EntryPrice-분할매수포인트*14 Then
{
Buy("b15",AtLimit,EntryPrice- 분할매수포인트*14,1);
ExitLong("bx15",AtLimit,min(NextBarOpen,EntryPrice)*10,"b15");
}
if L > EntryPrice-분할매수포인트*15 Then
{
Buy("b16",AtLimit,EntryPrice- 분할매수포인트*15,1);
ExitLong("bx16",AtLimit,min(NextBarOpen,EntryPrice)*10,"b16");
}
if L > EntryPrice-분할매수포인트*16 Then
{
Buy("b17",AtLimit,EntryPrice- 분할매수포인트*16,1);
ExitLong("bx17",AtLimit,min(NextBarOpen,EntryPrice)*10,"b17");
}
if L > EntryPrice-분할매수포인트*17 Then
{
Buy("b18",AtLimit,EntryPrice- 분할매수포인트*17,1);
ExitLong("bx18",AtLimit,min(NextBarOpen,EntryPrice)*10,"b18");
}
if L > EntryPrice-분할매수포인트*18 Then
{
Buy("b19",AtLimit,EntryPrice- 분할매수포인트*18,1);
ExitLong("bx19",AtLimit,min(NextBarOpen,EntryPrice)*10,"b19");
}
if L > EntryPrice-분할매수포인트*19 Then
{
Buy("b20",AtLimit,EntryPrice- 분할매수포인트*19,1);
ExitLong("bx20",AtLimit,min(NextBarOpen,EntryPrice)*10,"b20");
}
# SetStopProfittarget(청산퍼센트,PercentStop);
if CurrentContracts > CurrentContracts[1] Then
{
if LatestEntryName(0) == "b1" Then
value1 = LatestEntryPrice(0);
if LatestEntryName(0) == "b2" Then
value2 = LatestEntryPrice(0);
if LatestEntryName(0) == "b3" Then
value3 = LatestEntryPrice(0);
if LatestEntryName(0) == "b4" Then
value4 = LatestEntryPrice(0);
if LatestEntryName(0) == "b5" Then
value5 = LatestEntryPrice(0);
if LatestEntryName(0) == "b6" Then
value6 = LatestEntryPrice(0);
if LatestEntryName(0) == "b7" Then
value7 = LatestEntryPrice(0);
if LatestEntryName(0) == "b8" Then
value8 = LatestEntryPrice(0);
if LatestEntryName(0) == "b9" Then
value9 = LatestEntryPrice(0);
if LatestEntryName(0) == "b10" Then
value10 = LatestEntryPrice(0);
if LatestEntryName(0) == "b11" Then
value11 = LatestEntryPrice(0);
if LatestEntryName(0) == "b12" Then
value12 = LatestEntryPrice(0);
if LatestEntryName(0) == "b13" Then
value13 = LatestEntryPrice(0);
if LatestEntryName(0) == "b14" Then
value14 = LatestEntryPrice(0);
if LatestEntryName(0) == "b15" Then
value15 = LatestEntryPrice(0);
if LatestEntryName(0) == "b16" Then
value16 = LatestEntryPrice(0);
if LatestEntryName(0) == "b17" Then
value17 = LatestEntryPrice(0);
if LatestEntryName(0) == "b18" Then
value18 = LatestEntryPrice(0);
if LatestEntryName(0) == "b19" Then
value19 = LatestEntryPrice(0);
if LatestEntryName(0) == "b20" Then
value20 = LatestEntryPrice(0);
}
if value1 > 0 Then
ExitLong("bx1.",AtLimit,value1+ 익절포인트,"b1");
if value2 > 0 Then
ExitLong("bx2.",AtLimit,value2+ 익절포인트,"b2");
if value3 > 0 Then
ExitLong("bx3.",AtLimit,value3+ 익절포인트,"b3");
if value4 > 0 Then
ExitLong("bx4.",AtLimit,value4+ 익절포인트,"b4");
if value5 > 0 Then
ExitLong("bx5.",AtLimit,value5+ 익절포인트,"b5");
if value6 > 0 Then
ExitLong("bx6.",AtLimit,value6+ 익절포인트,"b6");
if value7 > 0 Then
ExitLong("bx7.",AtLimit,value7+ 익절포인트,"b7");
if value8 > 0 Then
ExitLong("bx8.",AtLimit,value8+ 익절포인트,"b8");
if value9 > 0 Then
ExitLong("bx9.",AtLimit,value9+ 익절포인트,"b9");
if value10 > 0 Then
ExitLong("bx10.",AtLimit,value10+ 익절포인트,"b10");
if value11 > 0 Then
ExitLong("bx11.",AtLimit,value11+ 익절포인트,"b11");
if value12 > 0 Then
ExitLong("bx12.",AtLimit,value12+ 익절포인트,"b12");
if value13 > 0 Then
ExitLong("bx13.",AtLimit,value13+ 익절포인트,"b13");
if value14 > 0 Then
ExitLong("bx14.",AtLimit,value14+ 익절포인트,"b14");
if value15 > 0 Then
ExitLong("bx15.",AtLimit,value15+ 익절포인트,"b15");
if value16 > 0 Then
ExitLong("bx16.",AtLimit,value16+ 익절포인트,"b16");
if value17 > 0 Then
ExitLong("bx17.",AtLimit,value17+ 익절포인트,"b17");
if value18 > 0 Then
ExitLong("bx18.",AtLimit,value18+ 익절포인트,"b18");
if value19 > 0 Then
ExitLong("bx19.",AtLimit,value19+ 익절포인트,"b19");
if value20 > 0 Then
ExitLong("bx20.",AtLimit,value20+ 익절포인트,"b20");
}
Else
{
value1 = 0;
value2 = 0;
value3 = 0;
value4 = 0;
value5 = 0;
value6 = 0;
value7 = 0;
value8 = 0;
value9 = 0;
value10 = 0;
value11 = 0;
value12 = 0;
value13 = 0;
value14 = 0;
value15 = 0;
value16 = 0;
value17 = 0;
value18 = 0;
value19 = 0;
value20 = 0;
}
2023-12-24
1217
글번호 174928
시스템
답변완료
수정 부탁드립니다.
일전에 만들어 주신 시스템식을 아래와 같이 3가지로 만들고 싶은데 가능할까요?
1. 매수신호에 매수'진입'하고, 매도신호에는 매수'청산' 만 되도록 (청산과 동시 매도진입X),
2. 매도신호에 매도'진입'하고, 매수신호에 매도'청산' 만 되도록 (청산과 동시 매수진입X).
3. ema 100 위 매수신호에 매수'진입'하고, 매도신호에는 매수'청산' 만 되도록 (청산과 동시 매도진입X),
ema 100 아래 매도신호에 매도'진입'하고, 매수신호에 매도'청산' 만 되도록 (청산과 동시 매수진입X).
항상 감사드립니다~!!
input : keyvalue(5);
input : atrperiod(10);
var : src(0),xatr(0),nloss(0),xATRTrailingStop(0),pos(0),xcolor(0);
src = close;
xATR = atr(atrperiod);
nLoss = keyvalue * xATR;
xATRTrailingStop = 0.0;
xATRTrailingStop = iff(src > iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]) and src[1] > iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), max(iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), src - nLoss),
iff(src < iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]) and src[1] < iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), min(iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), src + nLoss),
iff(src > iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), src - nLoss, src + nLoss)));
pos = 0;
pos = iff(src[1] < iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]) and src > iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), 1,
iff(src[1] > iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]) and src < iff(IsNan(xATRTrailingStop[1]) == true, 0,xATRTrailingStop[1]), -1, iff(IsNan(pos[1])==true, 0,pos[1])));
xcolor = iff(pos == -1 , red , iff(pos == 1 , green ,blue));
Condition1 = CrossUp(src,xATRTrailingStop);
Condition2 = CrossDown(src,xATRTrailingStop);
if Condition1 == true Then
Buy("Buy");
if Condition2 == true Then
Sell("Sell");
2023-12-18
1078
글번호 174922
시스템