커뮤니티
문의드립니다.
2017-07-20 13:55:44
132
글번호 111469
안녕하세요
사진에 있는 시간 전에는 잘 되다가 이때부터 꼬였는지 3계약 진입하고 2계약 청산하여서 뒤에가 안들어 가는거 같습니다 어떻게 해야할까요 청산식 은 다음과 같습니다.
////청산
//매도
//1,2차
if MarketPosition==-1 and CurrentEntries < 3 Then{
ExitShort("매도익절1",AtLimit,EntryPrice-Benefit,"매도진입1");
ExitShort("매도익절2",AtLimit,EntryPrice-Benefit,"매도진입2");
}
if MarketPosition==-1 and CurrentEntries ==3 Then{
ExitShort("매도익절1.",AtLimit,EntryPrice,"매도진입1");
ExitShort("매도익절2.",AtLimit,EntryPrice,"매도진입2");
ExitShort("매도익절3",AtLimit,EntryPrice,"매도진입3");
}
if MarketPosition==-1 and CurrentEntries ==4 Then{
ExitShort("매도익절1..",AtLimit,EntryPrice+addPrice,"매도진입1");
ExitShort("매도익절2..",AtLimit,EntryPrice+addPrice,"매도진입2");
ExitShort("매도익절3.",AtLimit,EntryPrice+addPrice,"매도진입3");
ExitShort("매도익절4",AtLimit,EntryPrice+addPrice,"매도진입4");
}
if MarketPosition == -1 and CurrentEntries >= 5 then{
ExitShort("매도평균1",AtLimit,AvgEntryPrice,"매도진입1");
ExitShort("매도평균2",AtLimit,AvgEntryPrice,"매도진입2");
ExitShort("매도평균3",AtLimit,AvgEntryPrice,"매도진입3");
ExitShort("매도평균4",AtLimit,AvgEntryPrice,"매도진입4");
ExitShort("매도평균5",AtLimit,AvgEntryPrice,"매도진입5");
ExitShort("매도평균6",AtLimit,AvgEntryPrice,"매도진입6");
ExitShort("매도평균7",AtLimit,AvgEntryPrice,"매도진입7");
ExitShort("매도평균8",AtLimit,AvgEntryPrice,"매도진입8");
ExitShort("매도손절1",AtStop,EntryPrice+Loss,"매도진입1");
ExitShort("매도손절2",AtStop,EntryPrice+Loss,"매도진입2");
ExitShort("매도손절3",AtStop,EntryPrice+Loss,"매도진입3");
ExitShort("매도손절4",AtStop,EntryPrice+Loss,"매도진입4");
ExitShort("매도손절5",AtStop,EntryPrice+Loss,"매도진입5");
ExitShort("매도손절6",AtStop,EntryPrice+Loss,"매도진입6");
ExitShort("매도손절7",AtStop,EntryPrice+Loss,"매도진입7");
ExitShort("매도손절8",AtStop,EntryPrice+Loss,"매도진입8");
}
//매수
if MarketPosition==1 and CurrentEntries < 3 Then{
ExitLong("매수익절1",AtLimit,EntryPrice+Benefit,"매수진입1");
ExitLong("매수익절2",AtLimit,EntryPrice+Benefit,"매수진입2");
}
if MarketPosition== 1 and CurrentEntries==3 Then{
ExitLong("매수익절1.",AtLimit,EntryPrice,"매수진입1");
ExitLong("매수익절2.",AtLimit,EntryPrice,"매수진입2");
ExitLong("매수익절3",AtLimit,EntryPrice,"매수진입3");
}
if MarketPosition== 1 and CurrentEntries==4 Then{
ExitLong("매수익절1..",AtLimit,EntryPrice-addPrice,"매수진입1");
ExitLong("매수익절2..",AtLimit,EntryPrice-addPrice,"매수진입2");
ExitLong("매수익절3.",AtLimit,EntryPrice-addPrice,"매수진입3");
ExitLong("매수익절4",AtLimit,EntryPrice-addPrice,"매수진입4");
}
if MarketPosition == 1 and CurrentEntries >= 5 then{
ExitLong("매수평균1",AtLimit,AvgEntryPrice,"매수진입1");
ExitLong("매수평균2",AtLimit,AvgEntryPrice,"매수진입2");
ExitLong("매수평균3",AtLimit,AvgEntryPrice,"매수진입3");
ExitLong("매수평균4",AtLimit,AvgEntryPrice,"매수진입4");
ExitLong("매수평균5",AtLimit,AvgEntryPrice,"매수진입5");
ExitLong("매수평균6",AtLimit,AvgEntryPrice,"매수진입6");
ExitLong("매수평균7",AtLimit,AvgEntryPrice,"매수진입7");
ExitLong("매수평균8",AtLimit,AvgEntryPrice,"매수진입8");
ExitLong("매수손절1",AtStop,EntryPrice-Loss,"매수진입1");
ExitLong("매수손절2",AtStop,EntryPrice-Loss,"매수진입2");
ExitLong("매수손절3",AtStop,EntryPrice-Loss,"매수진입3");
ExitLong("매수손절4",AtStop,EntryPrice-Loss,"매수진입4");
ExitLong("매수손절5",AtStop,EntryPrice-Loss,"매수진입5");
ExitLong("매수손절6",AtStop,EntryPrice-Loss,"매수진입6");
ExitLong("매수손절7",AtStop,EntryPrice-Loss,"매수진입7");
ExitLong("매수손절8",AtStop,EntryPrice-Loss,"매수진입8");
}
- 1. saf.JPG (0.10 MB)
답변 1
예스스탁 예스스탁 답변
2017-07-21 11:15:13
안녕하세요
예스스탁입니다.
if MarketPosition== 1 and MaxEntries==3 Then{
ExitLong("매수익절1.",AtLimit,EntryPrice,"매수진입1");
ExitLong("매수익절2.",AtLimit,EntryPrice,"매수진입2");
ExitLong("매수익절3",AtLimit,EntryPrice,"매수진입3");
}
첨부하신 그림으로는
매수진입1 --> 매수진입2 --> 청산 --> 매수진입3과 같이 진행된 상태입니다.
위 수식 내용을 보시면 매수진입3이 청산이 되려면
현재 진입수가 3이어야 하는데 현재남은 진입수(CurrentEntries)는 1입니다.
하나의 봉에서 진입청산이 모두 발생가능하므로 CurrentEntries로는 체크가 불가할것 같습니다.
현재까지의 진입갯수로 체크하게 변경했습니다.
var : SEntry(0),BEntry(0);
if MarketPosition==-1 Then{
if CurrentContracts > CurrentContracts[1] Then
{
SEntry = Sentry +1;
}
if SEntry < 3 Then
{
ExitShort("매도익절1",AtLimit,EntryPrice-Benefit,"매도진입1");
ExitShort("매도익절2",AtLimit,EntryPrice-Benefit,"매도진입2");
}
if SEntry ==3 Then
{
ExitShort("매도익절1.",AtLimit,EntryPrice,"매도진입1");
ExitShort("매도익절2.",AtLimit,EntryPrice,"매도진입2");
ExitShort("매도익절3",AtLimit,EntryPrice,"매도진입3");
}
if SEntry ==4 Then
{
ExitShort("매도익절1..",AtLimit,EntryPrice+addPrice,"매도진입1");
ExitShort("매도익절2..",AtLimit,EntryPrice+addPrice,"매도진입2");
ExitShort("매도익절3.",AtLimit,EntryPrice+addPrice,"매도진입3");
ExitShort("매도익절4",AtLimit,EntryPrice+addPrice,"매도진입4");
}
if SEntry >= 5 then
{
ExitShort("매도평균1",AtLimit,AvgEntryPrice,"매도진입1");
ExitShort("매도평균2",AtLimit,AvgEntryPrice,"매도진입2");
ExitShort("매도평균3",AtLimit,AvgEntryPrice,"매도진입3");
ExitShort("매도평균4",AtLimit,AvgEntryPrice,"매도진입4");
ExitShort("매도평균5",AtLimit,AvgEntryPrice,"매도진입5");
ExitShort("매도평균6",AtLimit,AvgEntryPrice,"매도진입6");
ExitShort("매도평균7",AtLimit,AvgEntryPrice,"매도진입7");
ExitShort("매도평균8",AtLimit,AvgEntryPrice,"매도진입8");
ExitShort("매도손절1",AtStop,EntryPrice+Loss,"매도진입1");
ExitShort("매도손절2",AtStop,EntryPrice+Loss,"매도진입2");
ExitShort("매도손절3",AtStop,EntryPrice+Loss,"매도진입3");
ExitShort("매도손절4",AtStop,EntryPrice+Loss,"매도진입4");
ExitShort("매도손절5",AtStop,EntryPrice+Loss,"매도진입5");
ExitShort("매도손절6",AtStop,EntryPrice+Loss,"매도진입6");
ExitShort("매도손절7",AtStop,EntryPrice+Loss,"매도진입7");
ExitShort("매도손절8",AtStop,EntryPrice+Loss,"매도진입8");
}
}
Else
SEntry = 0;
//매수
if MarketPosition==1 Then{
if CurrentContracts > CurrentContracts[1] Then
{
BEntry = Bentry +1;
}
if BEntry < 3 Then
{
ExitLong("매수익절1",AtLimit,EntryPrice+Benefit,"매수진입1");
ExitLong("매수익절2",AtLimit,EntryPrice+Benefit,"매수진입2");
}
if BEntry == 3 Then
{
ExitLong("매수익절1.",AtLimit,EntryPrice,"매수진입1");
ExitLong("매수익절2.",AtLimit,EntryPrice,"매수진입2");
ExitLong("매수익절3",AtLimit,EntryPrice,"매수진입3");
}
if BEntry == 4 Then
{
ExitLong("매수익절1..",AtLimit,EntryPrice-addPrice,"매수진입1");
ExitLong("매수익절2..",AtLimit,EntryPrice-addPrice,"매수진입2");
ExitLong("매수익절3.",AtLimit,EntryPrice-addPrice,"매수진입3");
ExitLong("매수익절4",AtLimit,EntryPrice-addPrice,"매수진입4");
}
if BEntry >= 5 then
{
ExitLong("매수평균1",AtLimit,AvgEntryPrice,"매수진입1");
ExitLong("매수평균2",AtLimit,AvgEntryPrice,"매수진입2");
ExitLong("매수평균3",AtLimit,AvgEntryPrice,"매수진입3");
ExitLong("매수평균4",AtLimit,AvgEntryPrice,"매수진입4");
ExitLong("매수평균5",AtLimit,AvgEntryPrice,"매수진입5");
ExitLong("매수평균6",AtLimit,AvgEntryPrice,"매수진입6");
ExitLong("매수평균7",AtLimit,AvgEntryPrice,"매수진입7");
ExitLong("매수평균8",AtLimit,AvgEntryPrice,"매수진입8");
ExitLong("매수손절1",AtStop,EntryPrice-Loss,"매수진입1");
ExitLong("매수손절2",AtStop,EntryPrice-Loss,"매수진입2");
ExitLong("매수손절3",AtStop,EntryPrice-Loss,"매수진입3");
ExitLong("매수손절4",AtStop,EntryPrice-Loss,"매수진입4");
ExitLong("매수손절5",AtStop,EntryPrice-Loss,"매수진입5");
ExitLong("매수손절6",AtStop,EntryPrice-Loss,"매수진입6");
ExitLong("매수손절7",AtStop,EntryPrice-Loss,"매수진입7");
ExitLong("매수손절8",AtStop,EntryPrice-Loss,"매수진입8");
}
}
Else
BEntry = 0;
즐거운 하루되세요
> hanwoon 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 안녕하세요
사진에 있는 시간 전에는 잘 되다가 이때부터 꼬였는지 3계약 진입하고 2계약 청산하여서 뒤에가 안들어 가는거 같습니다 어떻게 해야할까요 청산식 은 다음과 같습니다.
////청산
//매도
//1,2차
if MarketPosition==-1 and CurrentEntries < 3 Then{
ExitShort("매도익절1",AtLimit,EntryPrice-Benefit,"매도진입1");
ExitShort("매도익절2",AtLimit,EntryPrice-Benefit,"매도진입2");
}
if MarketPosition==-1 and CurrentEntries ==3 Then{
ExitShort("매도익절1.",AtLimit,EntryPrice,"매도진입1");
ExitShort("매도익절2.",AtLimit,EntryPrice,"매도진입2");
ExitShort("매도익절3",AtLimit,EntryPrice,"매도진입3");
}
if MarketPosition==-1 and CurrentEntries ==4 Then{
ExitShort("매도익절1..",AtLimit,EntryPrice+addPrice,"매도진입1");
ExitShort("매도익절2..",AtLimit,EntryPrice+addPrice,"매도진입2");
ExitShort("매도익절3.",AtLimit,EntryPrice+addPrice,"매도진입3");
ExitShort("매도익절4",AtLimit,EntryPrice+addPrice,"매도진입4");
}
if MarketPosition == -1 and CurrentEntries >= 5 then{
ExitShort("매도평균1",AtLimit,AvgEntryPrice,"매도진입1");
ExitShort("매도평균2",AtLimit,AvgEntryPrice,"매도진입2");
ExitShort("매도평균3",AtLimit,AvgEntryPrice,"매도진입3");
ExitShort("매도평균4",AtLimit,AvgEntryPrice,"매도진입4");
ExitShort("매도평균5",AtLimit,AvgEntryPrice,"매도진입5");
ExitShort("매도평균6",AtLimit,AvgEntryPrice,"매도진입6");
ExitShort("매도평균7",AtLimit,AvgEntryPrice,"매도진입7");
ExitShort("매도평균8",AtLimit,AvgEntryPrice,"매도진입8");
ExitShort("매도손절1",AtStop,EntryPrice+Loss,"매도진입1");
ExitShort("매도손절2",AtStop,EntryPrice+Loss,"매도진입2");
ExitShort("매도손절3",AtStop,EntryPrice+Loss,"매도진입3");
ExitShort("매도손절4",AtStop,EntryPrice+Loss,"매도진입4");
ExitShort("매도손절5",AtStop,EntryPrice+Loss,"매도진입5");
ExitShort("매도손절6",AtStop,EntryPrice+Loss,"매도진입6");
ExitShort("매도손절7",AtStop,EntryPrice+Loss,"매도진입7");
ExitShort("매도손절8",AtStop,EntryPrice+Loss,"매도진입8");
}
//매수
if MarketPosition==1 and CurrentEntries < 3 Then{
ExitLong("매수익절1",AtLimit,EntryPrice+Benefit,"매수진입1");
ExitLong("매수익절2",AtLimit,EntryPrice+Benefit,"매수진입2");
}
if MarketPosition== 1 and CurrentEntries==3 Then{
ExitLong("매수익절1.",AtLimit,EntryPrice,"매수진입1");
ExitLong("매수익절2.",AtLimit,EntryPrice,"매수진입2");
ExitLong("매수익절3",AtLimit,EntryPrice,"매수진입3");
}
if MarketPosition== 1 and CurrentEntries==4 Then{
ExitLong("매수익절1..",AtLimit,EntryPrice-addPrice,"매수진입1");
ExitLong("매수익절2..",AtLimit,EntryPrice-addPrice,"매수진입2");
ExitLong("매수익절3.",AtLimit,EntryPrice-addPrice,"매수진입3");
ExitLong("매수익절4",AtLimit,EntryPrice-addPrice,"매수진입4");
}
if MarketPosition == 1 and CurrentEntries >= 5 then{
ExitLong("매수평균1",AtLimit,AvgEntryPrice,"매수진입1");
ExitLong("매수평균2",AtLimit,AvgEntryPrice,"매수진입2");
ExitLong("매수평균3",AtLimit,AvgEntryPrice,"매수진입3");
ExitLong("매수평균4",AtLimit,AvgEntryPrice,"매수진입4");
ExitLong("매수평균5",AtLimit,AvgEntryPrice,"매수진입5");
ExitLong("매수평균6",AtLimit,AvgEntryPrice,"매수진입6");
ExitLong("매수평균7",AtLimit,AvgEntryPrice,"매수진입7");
ExitLong("매수평균8",AtLimit,AvgEntryPrice,"매수진입8");
ExitLong("매수손절1",AtStop,EntryPrice-Loss,"매수진입1");
ExitLong("매수손절2",AtStop,EntryPrice-Loss,"매수진입2");
ExitLong("매수손절3",AtStop,EntryPrice-Loss,"매수진입3");
ExitLong("매수손절4",AtStop,EntryPrice-Loss,"매수진입4");
ExitLong("매수손절5",AtStop,EntryPrice-Loss,"매수진입5");
ExitLong("매수손절6",AtStop,EntryPrice-Loss,"매수진입6");
ExitLong("매수손절7",AtStop,EntryPrice-Loss,"매수진입7");
ExitLong("매수손절8",AtStop,EntryPrice-Loss,"매수진입8");
}
이전글