답변완료
질문이요~
기초적인 문법질문입니다^^;; 아래 코드에서 value1 이라는 변수는 처음에 변수선언에서 따로 선언하지 않아도 괜찮은 건가요? 처음이라 모르는게 많습니다. 감사합니다~~
====================================================================================
input : buyN(1),SellN(1);
var : cnt(0),BCount(0),SCount(0);
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
value1 = ma(c,20);
if crossup(c,value1) and BCount < BuyN Then
Buy("매수진입");
if CrossDown(c,value1) and SCount < SellN Then
Sell("매도진입");
if MarketPosition == 1 and CrossDown(c,value1) Then
ExitLong("매수청산");
if MarketPosition == -1 and CrossUp(c,value1) Then
ExitShort("매도청산");
#손절 1포인트
SetStoploss(1,PointStop);
#목표수익 1포인트
SetStopProfittarget(1,PointStop);
#당일15시 청산
SetStopEndofday(150000);
2021-09-17
1414
글번호 152344
시스템
답변완료
문의드려요~ 감사합니다.
아래 수식을 잘 사용중입니다.
★아래 수식에 추가 사항요청이 있습니다. ^^
- 추가요청사항 (강제청산)
(1분봉기준)
이미 진입한 포지션에 따라 오전 10시부터 11시50분까지 최대 or 최저 분봉 기준 50포인트 이상시 강제청산 하는 내용입니다. ^^
예) 10시에 1개 11시에 1개 총 2개 매수진입... 10~11:50 분까지 지켜본 12시부터 그 사이 가장 저점인 봉 기준 50포인트 아래는 전체 포지션 강제청산
예) 10시에 1개 11시에 1개 총 2개 매도진입... 10~11:50 분까지 지켜본 12시부터 그 사이 가장 고점인 봉 기준 50포인트 위는 전체 포지션 강제청산
최대한 변수지정으로 해주시면 감사하겠습니다. ^^
명절 행복하게 보내세요~
감사합니다~
기존 쓰고있는 수식
-------------------------------------------------------------------------------------
input : position1(1),ntime1(100000),vol1(1);
input : position2(1),ntime2(110000),vol2(1);
input : xtime(55800);
input : 최소수익틱수(100),수익감소틱수(20);
var : ST(0);
if Bdate != Bdate[1] Then
{
ST = sTime;
}
if ST > 0 then
{
if (sdate != sdate[1] and stime >= ntime1) or
(sdate == sdate[1] and stime >= ntime1 and stime[1] < ntime1) Then
{
if position1 == 1 Then
Buy("매수-1",OnClose,DEf,vol1);
if position1 == -1 Then
Sell("매도-1",OnClose,DEf,vol1);
}
if (sdate != sdate[1] and stime >= ntime2) or
(sdate == sdate[1] and stime >= ntime2 and stime[1] < ntime2) Then
{
if position2 == 1 Then
Buy("매수-2",OnClose,DEf,vol2);
if position2 == -1 Then
Sell("매도-2",OnClose,DEf,vol2);
}
if MarketPosition == 1 and Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소수익틱수 Then
ExitLong("매수스탑x",AtStop,Highest(H,BarsSinceEntry)-PriceScale*수익감소틱수);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소수익틱수 Then
ExitShort("매도스탑x",AtStop,lowest(L,BarsSinceEntry)+PriceScale*수익감소틱수);
}
IF Xtime > ST Then
SetStopEndofday(Xtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Xtime);
}
if (sdate != sdate[1] and stime >= ST) or
(sdate == sdate[1] and stime >= ST and stime[1] < ST) Then
{
IF Xtime <= ST Then
{
SetStopEndofday(0);
}
}
2021-09-17
1237
글번호 152331
시스템