두개의 중복진입식과, 두개의 손절식이 있을때 그중 한번의 손절이라도 실행되면 당일매매는
정지되는 함수입니다.
시스템 트레이딩 설정창에서 피라미딩 설정을 모든진입신호로 설정해야합니다.
[예제](피라미딩 중복진입)
매수조건= 5분 10분 골드크로스 (1차매수)
추가매수= 5분 60분 골드크로스 (2차매수)
손절식1 = 1차매수후 -1.0 포인트 손실시
손절식2 = 2차매수후 -0.5 포인트 손실시
즉, 진입횟수는 무제한 이지만, 두개의 손절식중 한개라도 실행되면 당일 자동 매매정지 하는 식입니다.
------------------------------------------------------------------------------------------------------------------
var : buypos1(0),buypos2(0),buyval1(0),buyval2(0),Noentry1(0),Noentry2(0);
if date != date[1] then{
Noentry1 = 0;
Noentry2 = 0;
}
if crossup(ma(c,5),ma(c,10)) and Noentry1 < 1 and Noentry2 < 1 then{
buy("매수1");
buypos1 = 1;
buypos2 = 0;
buyval1 = c;
}
if crossup(ma(c,5),ma(c,60)) and Noentry1 < 1 and Noentry2 < 1 then{
buy("매수2");
buypos2 = 1;
buypos1 = 0;
buyval2 = c;
}
if crossdown(ma(c,5),ma(c,10)) or crossdown(ma(c,5),ma(c,10)) then
exitlong("매수청산");
if buypos1 == 1 and crossdown(c, buyval1-1) then{
exitlong("손절1");
Noentry1 = 1;
}
if buypos2 == 1 and crossdown(c, buyval2-0.5) then{
exitlong("손절2");
Noentry2 = 1;
}
시스템 트레이딩 설정창에서 피라미딩 설정을 모든진입신호로 설정해야합니다.
[예제](피라미딩 중복진입)
매수조건= 5분 10분 골드크로스 (1차매수)
추가매수= 5분 60분 골드크로스 (2차매수)
손절식1 = 1차매수후 -1.0 포인트 손실시
손절식2 = 2차매수후 -0.5 포인트 손실시
즉, 진입횟수는 무제한 이지만, 두개의 손절식중 한개라도 실행되면 당일 자동 매매정지 하는 식입니다.
------------------------------------------------------------------------------------------------------------------
var : buypos1(0),buypos2(0),buyval1(0),buyval2(0),Noentry1(0),Noentry2(0);
if date != date[1] then{
Noentry1 = 0;
Noentry2 = 0;
}
if crossup(ma(c,5),ma(c,10)) and Noentry1 < 1 and Noentry2 < 1 then{
buy("매수1");
buypos1 = 1;
buypos2 = 0;
buyval1 = c;
}
if crossup(ma(c,5),ma(c,60)) and Noentry1 < 1 and Noentry2 < 1 then{
buy("매수2");
buypos2 = 1;
buypos1 = 0;
buyval2 = c;
}
if crossdown(ma(c,5),ma(c,10)) or crossdown(ma(c,5),ma(c,10)) then
exitlong("매수청산");
if buypos1 == 1 and crossdown(c, buyval1-1) then{
exitlong("손절1");
Noentry1 = 1;
}
if buypos2 == 1 and crossdown(c, buyval2-0.5) then{
exitlong("손절2");
Noentry2 = 1;
}
댓글 없음:
댓글 쓰기