커뮤니티
타주기 참조
2011-04-15 05:14:17
627
글번호 37635
안녕하세요 질문입니다
아래식을 타주기 참조 로 변환 부탁드립니다
타주기 참조==> data2 종합지수(60분) 와 data3 다우산업(일간) 추가 해주세요
감사합니다 ^^
input : shortP(5),longP(20),Profit1(2),Loss1(1),Profit2(5),Loss2(2.5);
var : MAV1(0),MAV2(0),buyVal(0),Sellval(0);
MAV1 = ma(C, shortP);
MAV2 = ma(C, longP);
### 매수식
if crossup(MAV1,MAV2) then {
buy();
var1 = 0;
}
if marketposition() == 1 and h > entryprice() * (1 + Profit1/100) then {
var1 = 1;
buyVal = h;
}
if marketposition() == 1 and h > entryprice() * (1 + Profit2/100) then {
var1 = 2;
buyVal = h;
}
if var1 == 1 and C < buyVal * (1 - Loss1/100) then{
exitlong("TrailingStop1(매수)");
var1 = 0;
}
if var1 == 2 and C < buyVal * (1 - Loss2/100) then{
exitlong("TrailingStop2(매수)");
var1 = 0;
}
### 매도식
if crossdown(MAV1, MAV2) then {
sell();
var2 = 0;
}
if marketposition() == -1 and l < entryprice() * (1 - Profit1/100) then {
var2 = -1;
sellVal = l;
}
if marketposition() == -1 and l < entryprice() * (1 - Profit2/100) then {
var2 = -2;
sellVal = l;
}
if var2 == -1 and C > sellVal * (1 + Loss1/100) then{
exitshort("TrailingStop1(매도)");
var2 = 0;
}
if var2 == -2 and C> sellVal * (1 + Loss2/100) then{
exitshort("TrailingStop2(매도)");
var2 = 0;
}
답변 1
예스스탁 예스스탁 답변
2011-04-15 10:22:35
안녕하세요
예스스탁입니다.
1, data2
input : shortP(5),longP(20),Profit1(2),Loss1(1),Profit2(5),Loss2(2.5);
var : MAV1(0,data2),MAV2(0,data2),buyVal(0),Sellval(0),va1(0,data2),va2(0,data2),d2c(0,data1);
MAV1 = data2(ma(C, shortP));
MAV2 = data2(ma(C, longP));
### 매수식
if crossup(MAV1,MAV2) then {
buy();
va1 = 0;
}
d2c = data2(c);
if marketposition() == 1 and data2(h) > d2c[BarsSinceEntry] * (1 + Profit1/100) then {
va1 = 1;
buyVal = data2(h);
}
if marketposition() == 1 and data2(h) > d2c[BarsSinceEntry] * (1 + Profit2/100) then {
va1 = 2;
buyVal = data2(h);
}
if va1 == 1 and data2(C) < buyVal * (1 - Loss1/100) then{
exitlong("TrailingStop1(매수)");
va1 = 0;
}
if va1 == 2 and data2(C) < buyVal * (1 - Loss2/100) then{
exitlong("TrailingStop2(매수)");
va1 = 0;
}
### 매도식
if crossdown(MAV1, MAV2) then {
sell();
va2 = 0;
}
if marketposition() == -1 and data2(l) < d2c[BarsSinceEntry] * (1 - Profit1/100) then {
va2 = -1;
sellVal = data2(l);
}
if marketposition() == -1 and data2(l) < d2c[BarsSinceEntry] * (1 - Profit2/100) then {
va2 = -2;
sellVal = data2(l);
}
if va2 == -1 and data2(C) > sellVal * (1 + Loss1/100) then{
exitshort("TrailingStop1(매도)");
va2 = 0;
}
if va2 == -2 and data2(C)> sellVal * (1 + Loss2/100) then{
exitshort("TrailingStop2(매도)");
va2 = 0;
}
2. data3
input : shortP(5),longP(20),Profit1(2),Loss1(1),Profit2(5),Loss2(2.5);
var : MAV1(0,data3),MAV2(0,data3),buyVal(0),Sellval(0),va1(0,data3),va2(0,data3),d2c(0,data1);
MAV1 = data3(ma(C, shortP));
MAV2 = data3(ma(C, longP));
### 매수식
if crossup(MAV1,MAV2) then {
buy();
va1 = 0;
}
d2c = data3(c);
if marketposition() == 1 and data3(h) > d2c[BarsSinceEntry] * (1 + Profit1/100) then {
va1 = 1;
buyVal = data3(h);
}
if marketposition() == 1 and data3(h) > d2c[BarsSinceEntry] * (1 + Profit2/100) then {
va1 = 2;
buyVal = data3(h);
}
if va1 == 1 and data3(C) < buyVal * (1 - Loss1/100) then{
exitlong("TrailingStop1(매수)");
va1 = 0;
}
if va1 == 2 and data3(C) < buyVal * (1 - Loss2/100) then{
exitlong("TrailingStop2(매수)");
va1 = 0;
}
### 매도식
if crossdown(MAV1, MAV2) then {
sell();
va2 = 0;
}
if marketposition() == -1 and data3(l) < d2c[BarsSinceEntry] * (1 - Profit1/100) then {
va2 = -1;
sellVal = data3(l);
}
if marketposition() == -1 and data3(l) < d2c[BarsSinceEntry] * (1 - Profit2/100) then {
va2 = -2;
sellVal = data3(l);
}
if va2 == -1 and data3(C) > sellVal * (1 + Loss1/100) then{
exitshort("TrailingStop1(매도)");
va2 = 0;
}
if va2 == -2 and data3(C)> sellVal * (1 + Loss2/100) then{
exitshort("TrailingStop2(매도)");
va2 = 0;
}
즐거운 하루되세요
> yang오뚜기 님이 쓴 글입니다.
> 제목 : 타주기 참조
> 안녕하세요 질문입니다
아래식을 타주기 참조 로 변환 부탁드립니다
타주기 참조==> data2 종합지수(60분) 와 data3 다우산업(일간) 추가 해주세요
감사합니다 ^^
input : shortP(5),longP(20),Profit1(2),Loss1(1),Profit2(5),Loss2(2.5);
var : MAV1(0),MAV2(0),buyVal(0),Sellval(0);
MAV1 = ma(C, shortP);
MAV2 = ma(C, longP);
### 매수식
if crossup(MAV1,MAV2) then {
buy();
var1 = 0;
}
if marketposition() == 1 and h > entryprice() * (1 + Profit1/100) then {
var1 = 1;
buyVal = h;
}
if marketposition() == 1 and h > entryprice() * (1 + Profit2/100) then {
var1 = 2;
buyVal = h;
}
if var1 == 1 and C < buyVal * (1 - Loss1/100) then{
exitlong("TrailingStop1(매수)");
var1 = 0;
}
if var1 == 2 and C < buyVal * (1 - Loss2/100) then{
exitlong("TrailingStop2(매수)");
var1 = 0;
}
### 매도식
if crossdown(MAV1, MAV2) then {
sell();
var2 = 0;
}
if marketposition() == -1 and l < entryprice() * (1 - Profit1/100) then {
var2 = -1;
sellVal = l;
}
if marketposition() == -1 and l < entryprice() * (1 - Profit2/100) then {
var2 = -2;
sellVal = l;
}
if var2 == -1 and C > sellVal * (1 + Loss1/100) then{
exitshort("TrailingStop1(매도)");
var2 = 0;
}
if var2 == -2 and C> sellVal * (1 + Loss2/100) then{
exitshort("TrailingStop2(매도)");
var2 = 0;
}
다음글
이전글