커뮤니티
문의 (TSConv)
2014-02-12 14:47:06
166
글번호 72468
TS 수식인데 변환 요청드립니다..
참고로 GradientColor()도 만들어주시면 감사하겠습니다..
inputs:
Price( Close ),
BaseLength( 10 ),
ArithOrGeom_1or2( 1 ),
IncrementOrMultiplier( 10 ),
FastColor( Yellow ),
SlowColor( Red ) ;
variables:
Counter( 0 ) ;
arrays:
Length[8]( 0 ),
SmoothingFactor[8]( 0 ),
XMA[8]( 0 ),
Color[8]( 0 ) ;
if CurrentBar = 1 then
begin
Length[1] = BaseLength ;
SmoothingFactor[1] = 2 / ( Length[1] + 1 ) ;
XMA[1] = Price ;
Color[1] = GradientColor( 1, 1, 8, FastColor, SlowColor ) ;
for Counter = 1 to 7
begin
if ArithOrGeom_1or2 = 1 then
Length[ Counter + 1 ] = Length[Counter] + IncrementOrMultiplier
else
Length[ Counter + 1 ] = Length[Counter] * IncrementOrMultiplier ;
SmoothingFactor[ Counter + 1 ] = 2 / ( Length[ Counter + 1 ] + 1 ) ;
XMA[ Counter + 1 ] = Price ;
Color[ Counter + 1 ] = GradientColor( Counter + 1, 1, 8, FastColor,
SlowColor ) ;
end ;
end
else
for Counter = 1 to 8
begin
XMA[Counter] = XMA[Counter][1] + SmoothingFactor[Counter] * ( Price -
XMA[Counter][1] ) ;
end ;
Plot1( XMA[1], "XMA1", Color[1] ) ;
Plot2( XMA[2], "XMA2", Color[2] ) ;
Plot3( XMA[3], "XMA3", Color[3] ) ;
Plot4( XMA[4], "XMA4", Color[4] ) ;
Plot5( XMA[5], "XMA5", Color[5] ) ;
Plot6( XMA[6], "XMA6", Color[6] ) ;
Plot7( XMA[7], "XMA7", Color[7] ) ;
Plot8( XMA[8], "XMA8", Color[8] ) ;
답변 1
예스스탁 예스스탁 답변
2014-02-12 16:06:49
안녕하세요
예스스탁입니다.
식은 예스랭귀지의 문법대로 변경했지만
GradientColor는 어떤 동작을 하는 함수인지 몰라
부터 빨간색까지 노란색으로 변하게 작성했습니다.
inputs:
Price( Close ),
BaseLength( 10 ),
ArithOrGeom_1or2( 1 ),
IncrementOrMultiplier( 10 ),
FastColor( Yellow ),
SlowColor( Red ) ;
variables:
Counter( 0 ) ;
arrays:
Length[8]( 0 ),
SmoothingFactor[8]( 0 ),
XMA[8]( 0 ),
Color[8]( 0 ) ;
if CurrentBar == 1 then
begin
Length[1] = BaseLength ;
SmoothingFactor[1] = 2 / ( Length[1] + 1 ) ;
XMA[1] = Price ;
Color[1] = RGB(255,0,0) ;
for Counter = 1 to 7
begin
if ArithOrGeom_1or2 == 1 then
Length[ Counter + 1 ] = Length[Counter] + IncrementOrMultiplier ;
else
Length[ Counter + 1 ] = Length[Counter] * IncrementOrMultiplier ;
SmoothingFactor[ Counter + 1 ] = 2 / ( Length[ Counter + 1 ] + 1 ) ;
XMA[ Counter + 1 ] = Price ;
Color[ Counter + 1 ] = RGB(255,int((255/8)*(Counter + 1)),0);
end ;
end
else
for Counter = 1 to 8
begin
XMA[Counter] = XMA[Counter][1] + SmoothingFactor[Counter] * ( Price - XMA[Counter][1] ) ;
end ;
Plot1( XMA[1], "XMA1", Color[1] ) ;
Plot2( XMA[2], "XMA2", Color[2] ) ;
Plot3( XMA[3], "XMA3", Color[3] ) ;
Plot4( XMA[4], "XMA4", Color[4] ) ;
Plot5( XMA[5], "XMA5", Color[5] ) ;
Plot6( XMA[6], "XMA6", Color[6] ) ;
Plot7( XMA[7], "XMA7", Color[7] ) ;
Plot8( XMA[8], "XMA8", Color[8] ) ;
즐거운 하루되세요
> TRF 님이 쓴 글입니다.
> 제목 : 문의 (TSConv)
> TS 수식인데 변환 요청드립니다..
참고로 GradientColor()도 만들어주시면 감사하겠습니다..
inputs:
Price( Close ),
BaseLength( 10 ),
ArithOrGeom_1or2( 1 ),
IncrementOrMultiplier( 10 ),
FastColor( Yellow ),
SlowColor( Red ) ;
variables:
Counter( 0 ) ;
arrays:
Length[8]( 0 ),
SmoothingFactor[8]( 0 ),
XMA[8]( 0 ),
Color[8]( 0 ) ;
if CurrentBar = 1 then
begin
Length[1] = BaseLength ;
SmoothingFactor[1] = 2 / ( Length[1] + 1 ) ;
XMA[1] = Price ;
Color[1] = GradientColor( 1, 1, 8, FastColor, SlowColor ) ;
for Counter = 1 to 7
begin
if ArithOrGeom_1or2 = 1 then
Length[ Counter + 1 ] = Length[Counter] + IncrementOrMultiplier
else
Length[ Counter + 1 ] = Length[Counter] * IncrementOrMultiplier ;
SmoothingFactor[ Counter + 1 ] = 2 / ( Length[ Counter + 1 ] + 1 ) ;
XMA[ Counter + 1 ] = Price ;
Color[ Counter + 1 ] = GradientColor( Counter + 1, 1, 8, FastColor,
SlowColor ) ;
end ;
end
else
for Counter = 1 to 8
begin
XMA[Counter] = XMA[Counter][1] + SmoothingFactor[Counter] * ( Price -
XMA[Counter][1] ) ;
end ;
Plot1( XMA[1], "XMA1", Color[1] ) ;
Plot2( XMA[2], "XMA2", Color[2] ) ;
Plot3( XMA[3], "XMA3", Color[3] ) ;
Plot4( XMA[4], "XMA4", Color[4] ) ;
Plot5( XMA[5], "XMA5", Color[5] ) ;
Plot6( XMA[6], "XMA6", Color[6] ) ;
Plot7( XMA[7], "XMA7", Color[7] ) ;
Plot8( XMA[8], "XMA8", Color[8] ) ;
다음글
이전글