안녕하세요?
전에 만들어주신 지표식을 가지고 시스템에 적용중에
수식작성에 어려움이 있어 문의 드립니다.
파라미딩을 이용하니 스위칭 부분이 이뤄지지 않습니다.
1. 아래 수식에서 var10 이나 var20 : 이부분이 항상 첫진입니다.
(ⓐ 부분 1계약 매수 or 매도)
L 이 var10 이탈하면 매도 1계약 이거나
H 가 var20 돌파하면 매수 1계약
if a3 > 0 and u == 1 then
Var10 = a3;
if b3 > 0 and uu == 1 then
Var20 = b3;
결과값 var10,var20
2. 1번 진입이후
매도 진입일때 value5 돌파하면 추가 1계약 매도 이거나
매수 진입일때 value6 이탈하면 추가 1계약 매수 입니다.
총2계약만 진입입니다.
3. 2계약 진입이후
h > DayHigh(0)[1] 이면 2계약매도분 청산후 매수1계약으로 스위칭.
L < DayLow(0)[1] 이면 2계약매수분 청산후 매도1계약으로 스위칭.
4. 스위칭이후
var10 : 진입하지 않음 value5 : 1계약 추가진입.(매도)
var20 : 진입하지 않음 value6 : 1계약 추가진입.(매수)
감사합니다.
수식 앞부분은 생략하고 시스템부분만 적었습니다.
if a3 > 0 and u == 20000 then
Var10 = a3;
if b3 > 0 and uu == 20000 then
Var20 = b3;
ClearDebug();
input : starttime(100000),endtime(050000);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if Tcond == true then
{
If MarketPosition == 0 and L < Var10 Then // ⓐ
Sell("1차S",AtStop,var10);
If MarketPosition == -1 and MaxEntries == 1 and H > value5 Then
Sell("2차S",AtStop,value5);
If MarketPosition == -2 and MaxEntries == 2 and h > DayHigh(0)[1] Then
Buy("S-B",AtStop,DayHigh(0)[1]);
If MarketPosition == 0 and H > Var20 Then //ⓐ
Buy("1차B",AtStop,var20);
If MarketPosition == 1 and MaxEntries == 1 and L < value6 Then
Buy("2차B",AtStop,value6);
If MarketPosition == 2 and MaxEntries == 2 and L < DayLow(0)[1] Then
Sell("S-S",AtStop,DayLow(0)[1]);
}
답변 1
예스스탁
예스스탁 답변
2020-12-01 13:12:27
안녕하세요
예스스탁입니다.
MarketPosition은 포지션 방향을 알려주는 함수로 0,1,-1만 있습니다.
진입횟수는 MaxEntries로만 지정하셔야 합니다.
if a3 > 0 and u == 20000 then
Var10 = a3;
if b3 > 0 and uu == 20000 then
Var20 = b3;
input : starttime(100000),endtime(050000);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if Tcond == true then
{
If MarketPosition == 0 and L > Var10 Then
Sell("1차S",AtStop,var10);
If MarketPosition == -1 and MaxEntries == 1 and H > value5 Then
Sell("2차S",AtStop,value5);
If MarketPosition == -1 and MaxEntries == 2 and H < DayHigh(0) Then
Buy("S-B",AtStop,DayHigh(0));
If MarketPosition == 0 and H < Var20 Then //ⓐ
Buy("1차B",AtStop,var20);
If MarketPosition == 1 and MaxEntries == 1 and L < value6 Then
Buy("2차B",AtStop,value6);
If MarketPosition == 1 and MaxEntries == 2 and L > DayLow(0) Then
Sell("S-S",AtStop,DayLow(0));
}
즐거운 하루되세요
> 상중하 님이 쓴 글입니다.
> 제목 : 안녕하세요?
> 안녕하세요?
전에 만들어주신 지표식을 가지고 시스템에 적용중에
수식작성에 어려움이 있어 문의 드립니다.
파라미딩을 이용하니 스위칭 부분이 이뤄지지 않습니다.
1. 아래 수식에서 var10 이나 var20 : 이부분이 항상 첫진입니다.
(ⓐ 부분 1계약 매수 or 매도)
L 이 var10 이탈하면 매도 1계약 이거나
H 가 var20 돌파하면 매수 1계약
if a3 > 0 and u == 1 then
Var10 = a3;
if b3 > 0 and uu == 1 then
Var20 = b3;
결과값 var10,var20
2. 1번 진입이후
매도 진입일때 value5 돌파하면 추가 1계약 매도 이거나
매수 진입일때 value6 이탈하면 추가 1계약 매수 입니다.
총2계약만 진입입니다.
3. 2계약 진입이후
h > DayHigh(0)[1] 이면 2계약매도분 청산후 매수1계약으로 스위칭.
L < DayLow(0)[1] 이면 2계약매수분 청산후 매도1계약으로 스위칭.
4. 스위칭이후
var10 : 진입하지 않음 value5 : 1계약 추가진입.(매도)
var20 : 진입하지 않음 value6 : 1계약 추가진입.(매수)
감사합니다.
수식 앞부분은 생략하고 시스템부분만 적었습니다.
if a3 > 0 and u == 20000 then
Var10 = a3;
if b3 > 0 and uu == 20000 then
Var20 = b3;
ClearDebug();
input : starttime(100000),endtime(050000);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if Tcond == true then
{
If MarketPosition == 0 and L < Var10 Then // ⓐ
Sell("1차S",AtStop,var10);
If MarketPosition == -1 and MaxEntries == 1 and H > value5 Then
Sell("2차S",AtStop,value5);
If MarketPosition == -2 and MaxEntries == 2 and h > DayHigh(0)[1] Then
Buy("S-B",AtStop,DayHigh(0)[1]);
If MarketPosition == 0 and H > Var20 Then //ⓐ
Buy("1차B",AtStop,var20);
If MarketPosition == 1 and MaxEntries == 1 and L < value6 Then
Buy("2차B",AtStop,value6);
If MarketPosition == 2 and MaxEntries == 2 and L < DayLow(0)[1] Then
Sell("S-S",AtStop,DayLow(0)[1]);
}