커뮤니티
수식이 너무 길어요
2009-12-25 22:50:58
708
글번호 26966
수고하십니다.
아래와 같이 수식을 작성하니 너무 길어서 감당이 안되는군요.
비례하므로, 짧게 작성하는 방법이 있을 것 같은데...
미리 감사 드립니다. 수고하십시오.
If BarsSinceEntry > 1 then setstoploss ( 5.0 ) ;
If BarsSinceEntry > 2 then setstoploss ( 4.9 ) ;
If BarsSinceEntry > 3 then setstoploss ( 4.8 ) ;
If BarsSinceEntry > 4 then setstoploss ( 4.7 ) ;
If BarsSinceEntry > 5 then setstoploss ( 4.6 ) ;
If BarsSinceEntry > 6 then setstoploss ( 4.5 ) ;
If BarsSinceEntry > 7 then setstoploss ( 4.4 ) ;
If BarsSinceEntry > 8 then setstoploss ( 4.3 ) ;
If BarsSinceEntry > 9 then setstoploss ( 4.2 ) ;
If BarsSinceEntry > 10 then setstoploss ( 4.1 ) ;
If BarsSinceEntry > 11 then setstoploss ( 4.0 ) ;
If BarsSinceEntry > 12 then setstoploss ( 3.9 ) ;
If BarsSinceEntry > 13 then setstoploss ( 3.8 ) ;
If BarsSinceEntry > 14 then setstoploss ( 3.7 ) ;
If BarsSinceEntry > 15 then setstoploss ( 3.6 ) ;
If BarsSinceEntry > 16 then setstoploss ( 3.5 ) ;
If BarsSinceEntry > 17 then setstoploss ( 3.4 ) ;
If BarsSinceEntry > 18 then setstoploss ( 3.3 ) ;
If BarsSinceEntry > 19 then setstoploss ( 3.2 ) ;
If BarsSinceEntry > 20 then setstoploss ( 3.1 ) ;
If BarsSinceEntry > 21 then setstoploss ( 3.0 ) ;
If BarsSinceEntry > 22 then setstoploss ( 2.9 ) ;
If BarsSinceEntry > 23 then setstoploss ( 2.8 ) ;
If BarsSinceEntry > 24 then setstoploss ( 2.7 ) ;
If BarsSinceEntry > 25 then setstoploss ( 2.6 ) ;
If BarsSinceEntry > 26 then setstoploss ( 2.5 ) ;
If BarsSinceEntry > 27 then setstoploss ( 2.4 ) ;
If BarsSinceEntry > 28 then setstoploss ( 2.3 ) ;
If BarsSinceEntry > 29 then setstoploss ( 2.2 ) ;
If BarsSinceEntry > 30 then setstoploss ( 2.1 ) ;
If BarsSinceEntry > 31 then setstoploss ( 2.0 ) ;
If BarsSinceEntry > 32 then setstoploss ( 1.9 ) ;
If BarsSinceEntry > 33 then setstoploss ( 1.8 ) ;
If BarsSinceEntry > 34 then setstoploss ( 1.7 ) ;
If BarsSinceEntry > 35 then setstoploss ( 1.6 ) ;
If BarsSinceEntry > 36 then setstoploss ( 1.5 ) ;
If BarsSinceEntry > 37 then setstoploss ( 1.4 ) ;
If BarsSinceEntry > 38 then setstoploss ( 1.3 ) ;
If BarsSinceEntry > 39 then setstoploss ( 1.2 ) ;
If BarsSinceEntry > 40 then setstoploss ( 1.1 ) ;
If BarsSinceEntry > 41 then setstoploss ( 1.0 ) ;
답변 1
예스스탁 예스스탁 답변
2009-12-28 09:58:46
안녕하세요
예스스탁입니다.
if MarketPosition == 1 and BarsSinceEntry > 1 Then
exitlong("bx",AtStop,EntryPrice*(0.95+(0.001*(BarsSinceEntry-2))));
if MarketPosition == -1 and BarsSinceEntry > 1 Then
ExitShort("sx",AtStop,EntryPrice*(1.05-(0.001*(BarsSinceEntry-2))));
즐거운 하루되세요
> HI_yhooh 님이 쓴 글입니다.
> 제목 : 수식이 너무 길어요
> 수고하십니다.
아래와 같이 수식을 작성하니 너무 길어서 감당이 안되는군요.
비례하므로, 짧게 작성하는 방법이 있을 것 같은데...
미리 감사 드립니다. 수고하십시오.
If BarsSinceEntry > 1 then setstoploss ( 5.0 ) ;
If BarsSinceEntry > 2 then setstoploss ( 4.9 ) ;
If BarsSinceEntry > 3 then setstoploss ( 4.8 ) ;
If BarsSinceEntry > 4 then setstoploss ( 4.7 ) ;
If BarsSinceEntry > 5 then setstoploss ( 4.6 ) ;
If BarsSinceEntry > 6 then setstoploss ( 4.5 ) ;
If BarsSinceEntry > 7 then setstoploss ( 4.4 ) ;
If BarsSinceEntry > 8 then setstoploss ( 4.3 ) ;
If BarsSinceEntry > 9 then setstoploss ( 4.2 ) ;
If BarsSinceEntry > 10 then setstoploss ( 4.1 ) ;
If BarsSinceEntry > 11 then setstoploss ( 4.0 ) ;
If BarsSinceEntry > 12 then setstoploss ( 3.9 ) ;
If BarsSinceEntry > 13 then setstoploss ( 3.8 ) ;
If BarsSinceEntry > 14 then setstoploss ( 3.7 ) ;
If BarsSinceEntry > 15 then setstoploss ( 3.6 ) ;
If BarsSinceEntry > 16 then setstoploss ( 3.5 ) ;
If BarsSinceEntry > 17 then setstoploss ( 3.4 ) ;
If BarsSinceEntry > 18 then setstoploss ( 3.3 ) ;
If BarsSinceEntry > 19 then setstoploss ( 3.2 ) ;
If BarsSinceEntry > 20 then setstoploss ( 3.1 ) ;
If BarsSinceEntry > 21 then setstoploss ( 3.0 ) ;
If BarsSinceEntry > 22 then setstoploss ( 2.9 ) ;
If BarsSinceEntry > 23 then setstoploss ( 2.8 ) ;
If BarsSinceEntry > 24 then setstoploss ( 2.7 ) ;
If BarsSinceEntry > 25 then setstoploss ( 2.6 ) ;
If BarsSinceEntry > 26 then setstoploss ( 2.5 ) ;
If BarsSinceEntry > 27 then setstoploss ( 2.4 ) ;
If BarsSinceEntry > 28 then setstoploss ( 2.3 ) ;
If BarsSinceEntry > 29 then setstoploss ( 2.2 ) ;
If BarsSinceEntry > 30 then setstoploss ( 2.1 ) ;
If BarsSinceEntry > 31 then setstoploss ( 2.0 ) ;
If BarsSinceEntry > 32 then setstoploss ( 1.9 ) ;
If BarsSinceEntry > 33 then setstoploss ( 1.8 ) ;
If BarsSinceEntry > 34 then setstoploss ( 1.7 ) ;
If BarsSinceEntry > 35 then setstoploss ( 1.6 ) ;
If BarsSinceEntry > 36 then setstoploss ( 1.5 ) ;
If BarsSinceEntry > 37 then setstoploss ( 1.4 ) ;
If BarsSinceEntry > 38 then setstoploss ( 1.3 ) ;
If BarsSinceEntry > 39 then setstoploss ( 1.2 ) ;
If BarsSinceEntry > 40 then setstoploss ( 1.1 ) ;
If BarsSinceEntry > 41 then setstoploss ( 1.0 ) ;