커뮤니티
마지막봉 신호 수정
2012-12-21 16:10:17
242
글번호 57499
항상 빠른 답변 감사드립니다.
기본시스템입니다.
__________________________________________________________________________________
Input: FastLen(10),SlowLen(500),ChLen(30),TrailBar(160),ReBars(30),stopPer(1.0);
Vars: FastMA(0),SlowMA(0),LEntryPrice(0),SEntryPrice(0),LCount(-999),SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
ExitLong("BLoss",AtStop,EntryPrice-1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
ExitShort("SLoss",AtStop,EntryPrice+1);
}
____________________________________________________________________________
진입과 청산에 마지막봉 신호를 제어할수 있도록 수정부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2012-12-21 17:29:32
안녕하세요
예스스탁입니다.
시스템은 정규장에서만 주문이 가능하므로 작성해 주셔야 합니다.
당일 정규장 마지막봉에 if조건이 만족하면
동시호가 데이터가 수신될때 주문이 집행이 됩니다.
동시호가 데이터는 동시호가거래가 모두 끝나고 데이터를
주기 때문에 이때 주문이 발생하면 장이 종료되어
거부됩니다.
아래와 같이 각 진입/청산식에 시간조건을
추가해 주시면 됩니다.
가령 10분봉 차트이고
시작시간을 기준으로 차트를 그리시면 당일 마지막봉이 15시 봉입니다.
if문을 15시봉 전까지 만족해야 15시 시가 수신될때 주문을 내실수 있습니다.
stime < 150000 조건을 추가해 주시면 됩니다.
Input: FastLen(10),SlowLen(500),ChLen(30),TrailBar(160),ReBars(30),stopPer(1.0);
Vars: FastMA(0),SlowMA(0),LEntryPrice(0),SEntryPrice(0),LCount(-999),SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen and stime < 150000 then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen and stime < 150000 then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True and stime < 150000 then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
ExitLong("BLoss",AtStop,EntryPrice-1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True and stime < 150000 then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
ExitShort("SLoss",AtStop,EntryPrice+1);
}
차트를 끝시간 기준으로 그리시면
정규장 마지막봉의 시간이 15시 10분이므로
stime < 151000 이라는 조건을 추가해 주시면 됩니다.
Input: FastLen(10),SlowLen(500),ChLen(30),TrailBar(160),ReBars(30),stopPer(1.0);
Vars: FastMA(0),SlowMA(0),LEntryPrice(0),SEntryPrice(0),LCount(-999),SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen and stime < 151000 then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen and stime < 151000 then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True and stime < 151000 then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
ExitLong("BLoss",AtStop,EntryPrice-1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True and stime < 151000 then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
ExitShort("SLoss",AtStop,EntryPrice+1);
}
즐거운 하루되세요
> 공감n감사 님이 쓴 글입니다.
> 제목 : 마지막봉 신호 수정
> 항상 빠른 답변 감사드립니다.
기본시스템입니다.
__________________________________________________________________________________
Input: FastLen(10),SlowLen(500),ChLen(30),TrailBar(160),ReBars(30),stopPer(1.0);
Vars: FastMA(0),SlowMA(0),LEntryPrice(0),SEntryPrice(0),LCount(-999),SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
ExitLong("BLoss",AtStop,EntryPrice-1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
ExitShort("SLoss",AtStop,EntryPrice+1);
}
____________________________________________________________________________
진입과 청산에 마지막봉 신호를 제어할수 있도록 수정부탁드립니다.
이전글