커뮤니티

문의 드립니다.

프로필 이미지
양치기
2014-11-22 10:20:53
372
글번호 80636
답변완료
항상 도움 주셔서 감사합니다. 문1) 멀티챠트에는 변동성이라는 함수가 있던데 예스랭귀지에도 이에 대한 함수가 있는지요? 멀티차트에 보니 volatility(period) 이런 함수를 사용해서 일정기간의 변동성을 사용하더라구요 Inputs: VolLen(8), MultFact(2); Vars: TopBand(0), BotBand(0); #{ Define initial Top and Bottom Band } If BarNumber = 1 then Begin TopBand = Open + Volatility( VolLen ) * MultFact; BotBand = Open - Volatility( VolLen ) * Multfact; End; 예스랭귀지로 전환 부탁드립니다. 만약에 함수가 없다면 변동성을 구하는 식 부탁드립니다. 그리고 변동성 지표를 차트에 같이 표시하고 싶습니다. 도움 부탁드립니다. 문2) 아래식을 예스랭귀지로 변환 부탁드립니다. Input : fastma(9), slowma(26), macdma(9), ncos(4), nbars(50), trailbar(6); Var: mval(0), mavg(0), mdif(0), counter(0), totalbars(0), highesthi(0), lowestlo(0); Arrary: co[2,50](0); Mval = macd(close,fastma,slowma); Mvag=xaveage(macd(close,fastma,slowma),macdma); Mdif = mval &#8211; mavg; # store the macd cross information in the co arrary If mdif crosses over 0 or mdif crosses under 0 then begin For counter = 0 to 49 begin Co[ 0, 50 &#8211; counter ] = co[ 0, 49 &#8211; counter]; Co[ 1, 50 &#8211; counter ] = co[ 1, 49 &#8211; counter]; Co[ 2, 50 &#8211; counter ] = co[ 2, 49 &#8211; counter]; End; Co[ 0, 0 ] = barnumber ; Co[ 1, 0 ] = high ; Co[ 2, 0 ] = low ; End; # find the highest hing and the lowest low of the cross over and under bars Highesthi = -1 ; Lowestlo = 9999 ; For counter = 0 to ncos-1 begin If co[ 1, counter] > highesthi then Highesthi = co[ 1, counter]; If co[ 2, counter] < lowestlo then lowestlo = co[ 2, counter]; end; # if the last n crosses occured in the last 50 bars, then place the buy and sell orders Totalbars = barnumber &#8211; co[ 0, ncos &#8211; 1 ]; If totalbars < nbars then begin Buy at highesthi + average(truerange,4)*.5 stop; Sell at lowestlo &#8211; average(truerange,4)*.5 stop; End; # trailing stop orders Exitlong next bar at lowest(low, trailbar) stop; Exitlong next bar at hishest(high, trailbar) stop;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-11-24 17:47:31

안녕하세요 예스스탁입니다. 1. 멀티차트가 설치되어 있지 않아 해당 함수의 내용을 모르겠습니다. 일반적으로 변동성관련해서 많이 사용하는 함수가 ATR입니다. Inputs: VolLen(8), MultFact(2); Vars: TopBand(0), BotBand(0); If index == 1 then Begin TopBand = Open + ATR( VolLen ) * MultFact; BotBand = Open - ATR( VolLen ) * Multfact; End; 2. Input : fastma(9), slowma(26), macdma(9), ncos(4), nbars(50), trailbar(6); Var: mval(0), mavg(0), mdif(0), counter(0), totalbars(0), highesthi(0), lowestlo(0); Array : co[2,50](0); Mval = macd(fastma,slowma); mavg = ema(Mval,macdma); Mdif = mval - mavg; # store the macd cross information in the co arrary If crossup(mdif,0) or CrossDown(mdif,0) then begin For counter = 0 to 49 begin Co[ 0, 50 - counter ] = co[ 0, 49 - counter]; Co[ 1, 50 - counter ] = co[ 1, 49 - counter]; Co[ 2, 50 - counter ] = co[ 2, 49 - counter]; End; Co[ 0, 0 ] = index ; Co[ 1, 0 ] = high ; Co[ 2, 0 ] = low ; End; # find the highest hing and the lowest low of the cross over and under bars Highesthi = -1 ; Lowestlo = 9999 ; For counter = 0 to ncos-1 begin If co[ 1, counter] > highesthi then Highesthi = co[ 1, counter]; If co[ 2, counter] < lowestlo then lowestlo = co[ 2, counter]; end; # if the last n crosses occured in the last 50 bars, then place the buy and sell orders Totalbars = index - co[ 0, ncos - 1 ]; If totalbars < nbars then begin Buy("b", AtStop, highesthi + ma(truerange,4)*.5); Sell("s", AtStop,lowestlo- ma(truerange,4)*.5); End; # trailing stop orders Exitlong("bx",AtStop,lowest(low, trailbar)); ExitShort("sx",AtStop,highest(high, trailbar)); 즐거운 하루되세요 > 양치기 님이 쓴 글입니다. > 제목 : 문의 드립니다. > 항상 도움 주셔서 감사합니다. 문1) 멀티챠트에는 변동성이라는 함수가 있던데 예스랭귀지에도 이에 대한 함수가 있는지요? 멀티차트에 보니 volatility(period) 이런 함수를 사용해서 일정기간의 변동성을 사용하더라구요 Inputs: VolLen(8), MultFact(2); Vars: TopBand(0), BotBand(0); #{ Define initial Top and Bottom Band } If BarNumber = 1 then Begin TopBand = Open + Volatility( VolLen ) * MultFact; BotBand = Open - Volatility( VolLen ) * Multfact; End; 예스랭귀지로 전환 부탁드립니다. 만약에 함수가 없다면 변동성을 구하는 식 부탁드립니다. 그리고 변동성 지표를 차트에 같이 표시하고 싶습니다. 도움 부탁드립니다. 문2) 아래식을 예스랭귀지로 변환 부탁드립니다. Input : fastma(9), slowma(26), macdma(9), ncos(4), nbars(50), trailbar(6); Var: mval(0), mavg(0), mdif(0), counter(0), totalbars(0), highesthi(0), lowestlo(0); Arrary: co[2,50](0); Mval = macd(close,fastma,slowma); Mvag=xaveage(macd(close,fastma,slowma),macdma); Mdif = mval &#8211; mavg; # store the macd cross information in the co arrary If mdif crosses over 0 or mdif crosses under 0 then begin For counter = 0 to 49 begin Co[ 0, 50 &#8211; counter ] = co[ 0, 49 &#8211; counter]; Co[ 1, 50 &#8211; counter ] = co[ 1, 49 &#8211; counter]; Co[ 2, 50 &#8211; counter ] = co[ 2, 49 &#8211; counter]; End; Co[ 0, 0 ] = barnumber ; Co[ 1, 0 ] = high ; Co[ 2, 0 ] = low ; End; # find the highest hing and the lowest low of the cross over and under bars Highesthi = -1 ; Lowestlo = 9999 ; For counter = 0 to ncos-1 begin If co[ 1, counter] > highesthi then Highesthi = co[ 1, counter]; If co[ 2, counter] < lowestlo then lowestlo = co[ 2, counter]; end; # if the last n crosses occured in the last 50 bars, then place the buy and sell orders Totalbars = barnumber &#8211; co[ 0, ncos &#8211; 1 ]; If totalbars < nbars then begin Buy at highesthi + average(truerange,4)*.5 stop; Sell at lowestlo &#8211; average(truerange,4)*.5 stop; End; # trailing stop orders Exitlong next bar at lowest(low, trailbar) stop; Exitlong next bar at hishest(high, trailbar) stop;