커뮤니티
16267 재문의드립니다.
2010-11-24 12:21:18
840
글번호 33854
안녕하세요.
설명이 부족하여 원하던식이 아니여서 다시 부탁드립니다.
input에 선언된 변수값이 순차적으로 진입/청산이 이루어지는 피라미딩형식의
식을 부탁드립니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2010-11-24 13:56:31
안녕하세요
예스스탁입니다.
input : Len(0.1),len1(2.7),n(20);
input : LEN2(0.2),LEN3(3),N1(20);
input : LEN4(0.3),LEN5(4),N2(30);
input : LEN6(0.5),LEN7(6),N3(50);
input : LEN8(0.6),LEN9(2),N4(70);
input : tcount(2);
var: CurrentEntryNum(0);
var1 = dayHigh(1)-dayLow(1);
if date<>date[1] Then {
var10 = TotalTrades;
}
CurrentEntryNum = TotalTrades;
Condition1 = date==exitdate(1) And MarketPosition(1) == 1;
Condition2 = date==exitdate(1) And MarketPosition(1) == -1;
if stime < 150000 then {
if CurrentEntryNum < var10 + tcount and Condition1 == false and MarketPosition != 1 Then
buy("매수1", atstop, dayOpen(0)+var1*len);
if CurrentEntryNum < var10 + tcount and Condition2 == false and MarketPosition != -1 Then
sell("매도1", atstop, dayOpen(0)-var1*len);
}
if stime < 150000 and CountIF(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 then {
if MarketPosition == 1 and CurrentEntries == 1 Then
buy("매수2", atstop, dayOpen(0)+var1*len2);
if MarketPosition == 1 and CurrentEntries == 2 Then
buy("매수3", atstop, dayOpen(0)+var1*len4);
if MarketPosition == 1 and CurrentEntries == 3 Then
buy("매수4", atstop, dayOpen(0)+var1*len6);
if MarketPosition == 1 and CurrentEntries == 4 Then
buy("매수5", atstop, dayOpen(0)+var1*len8);
}
if stime < 150000 then {
if MarketPosition ==-1 and CurrentEntries == 1 Then
sell("매도2", atstop, dayOpen(0)-var1*len2);
if MarketPosition ==-1 and CurrentEntries == 2 Then
sell("매도3", atstop, dayOpen(0)-var1*len4);
if MarketPosition ==-1 and CurrentEntries == 3 Then
sell("매도4", atstop, dayOpen(0)-var1*len6);
if MarketPosition ==-1 and CurrentEntries == 4 Then
sell("매도5", atstop, dayOpen(0)-var1*len8);
}
If marketposition == 1 Then {
ExitLong("매수청산1",Atstop,highest(high,barssinceentry+1)-atr(n)*len1,"매수1");
ExitLong("매수청산2",Atstop,highest(high,barssinceentry+1)-atr(n)*len3,"매수2");
ExitLong("매수청산3",Atstop,highest(high,barssinceentry+1)-atr(n)*len5,"매수3");
ExitLong("매수청산4",Atstop,highest(high,barssinceentry+1)-atr(n)*len7,"매수4");
ExitLong("매수청산5",Atstop,highest(high,barssinceentry+1)-atr(n)*len9,"매수5");
}
if MarketPosition == -1 then{
ExitShort("매도청산1",Atstop,lowest(low,barssinceentry+1)+atr(n)*len1,"매도1");
ExitShort("매도청산2",Atstop,lowest(low,barssinceentry+1)+atr(n)*len3,"매도2");
ExitShort("매도청산3",Atstop,lowest(low,barssinceentry+1)+atr(n)*len5,"매도3");
ExitShort("매도청산4",Atstop,lowest(low,barssinceentry+1)+atr(n)*len7,"매도4");
ExitShort("매도청산5",Atstop,lowest(low,barssinceentry+1)+atr(n)*len9,"매도5");
}
len과 len2의 값이 0.1로 같아 len2를 0.2로 설정했습니다.
즐거운 하루되세요
> 베드로 님이 쓴 글입니다.
> 제목 : 16267 재문의드립니다.
> 안녕하세요.
설명이 부족하여 원하던식이 아니여서 다시 부탁드립니다.
input에 선언된 변수값이 순차적으로 진입/청산이 이루어지는 피라미딩형식의
식을 부탁드립니다.
감사합니다.