커뮤니티
TS수식 변환좀 부탁드립니다.
2009-06-04 13:53:26
671
글번호 22570
--------------------------------
{
length 0.6~1, 0.05, 9
incre 1~10, 0.5, 19
}
input : length(0.8), incre(1) ;
{if date >= 1020701 and date <= 1030630 then begin}
if date >=1030701 and date <= 1040630 then begin
if date <> date[1] then begin
value98 = currentbar-1;
end ;
value99 = currentbar-value98;
if month(date)=1 and dayofmonth(date)=2 and value99=24 then value98 = value98-12 ;
value11 =highd(1) - lowd(1) ;
if value99 < 72 then begin
buy opend(0)+value11*length stop ;
sell opend(0)-value11*length stop ;
end ;
if marketPosition = 1 then begin
if highest(high, barsSinceEntry + 1) > entryPrice + avgTrueRange(20) of data2 *incre then
exitLong entryPrice + avgTrueRange(20) of data2 stop;
end ;
if marketPosition = -1 then begin
if lowest(low, barsSinceEntry + 1) < entryPrice - avgTrueRange(20) of data2 *incre then
exitShort entryPrice - avgTrueRange(20) of data2 stop;
end ;
setExitOnClose ;
end ;
답변 1
예스스탁 예스스탁 답변
2009-06-04 15:41:00
안녕하세요
예스스탁입니다.
input : length(0.8), incre(1) ;
var : month(0),dayofmonth(0);
month = int((sdate/10000)*100);
dayofmonth = FracPortion(sdate/100)*100;
//{if date >= 1020701 and date <= 1030630 then begin}
if date >=1030701 and date <= 1040630 then begin
if date <> date[1] then begin
value98 = currentbar-1;
end ;
value99 = currentbar-value98;
if month==1 and dayofmonth == 2 and value99==24 then value98 = value98-12 ;
value11 =highd(1) - lowd(1) ;
if value99 < 72 then begin
buy("b",AtStop,dayopen+value11*length);
sell("s",AtStop,dayopen-value11*length);
end ;
if marketPosition == 1 then begin
if highest(high, barsSinceEntry + 1) > entryPrice + data2(atr(20))*incre then
exitLong("bx",AtStop,entryPrice + data2(atr(20))) ;
end ;
if marketPosition == -1 then begin
if Lowest(L,BarsSinceEntry+1) < EntryPrice- data2(atr(20))*incre then
exitShort("sx",AtStop,entryPrice - data2(atr(20)));
end ;
end ;
SetStopEndofday(150000);
즐거운 하루되세요
> kmp 님이 쓴 글입니다.
> 제목 : TS수식 변환좀 부탁드립니다.
> --------------------------------
{
length 0.6~1, 0.05, 9
incre 1~10, 0.5, 19
}
input : length(0.8), incre(1) ;
{if date >= 1020701 and date <= 1030630 then begin}
if date >=1030701 and date <= 1040630 then begin
if date <> date[1] then begin
value98 = currentbar-1;
end ;
value99 = currentbar-value98;
if month(date)=1 and dayofmonth(date)=2 and value99=24 then value98 = value98-12 ;
value11 =highd(1) - lowd(1) ;
if value99 < 72 then begin
buy opend(0)+value11*length stop ;
sell opend(0)-value11*length stop ;
end ;
if marketPosition = 1 then begin
if highest(high, barsSinceEntry + 1) > entryPrice + avgTrueRange(20) of data2 *incre then
exitLong entryPrice + avgTrueRange(20) of data2 stop;
end ;
if marketPosition = -1 then begin
if lowest(low, barsSinceEntry + 1) < entryPrice - avgTrueRange(20) of data2 *incre then
exitShort entryPrice - avgTrueRange(20) of data2 stop;
end ;
setExitOnClose ;
end ;