커뮤니티

수식 변환 요청드립니다

프로필 이미지
dqzero
2023-02-02 05:45:23
906
글번호 165930
답변완료
아래는 트레이딩 뷰에서 Mansfield Relative Strength지표입니다. 변환 부탁드립니다 //@version=3 // Use this indicator to compare how security is performing in compare with prefered index (SPX by default). // > 0 outperforming // < 0 underperforming // Works best for weekly, but can be applied to monthly and daily charts. It will be rather useless to use it in smaller timeframes // Apply it to SPX, industry index, sector index or other security in similar sector // UPDAT E 1: Added sector and industry as optional params. Leave them same as index if you don't want to use them study("Mansfield Relative Strength indicator") index = input(title="Index", type=symbol, defval="SP:SPX") sector = input(title="Sector (optional)", type=symbol, defval="SP:SPX") industry = input(title="Industry (optional)", type=symbol, defval="SP:SPX") ma_type = input(title="Which moving average to use?", defval="SMA", options=["SMA", "WMA", "EMA"]) len_daily = input(title="MA length for Daily", defval=200) len_weekly = input(title="MA length for Weekly", defval=52) len_monthly = input(title="MA length for Monthly", defval=10) len_other = input(title="MA length for all other periods", defval=52) val = close len = period == "W" ? len_weekly : (period == "D" ? len_daily : (period == "M" ? len_monthly : len_other)) ma_func(x, length) => ma_type == "WMA" ? wma(x, length) : (ma_type == "SMA" ? sma(x, length) : ema(x, length)) calc_mrs_func(x, ind, length) => ((x / security(ind, period, x)) / ma_func((x / security(ind, period, x)), length) - 1) * 10 mrs_index = calc_mrs_func(val, index, len) mrs_sector = calc_mrs_func(val, sector, len) mrs_industry = calc_mrs_func(val, industry, len) c = sign(mrs_index) + sign(mrs_sector) + sign(mrs_industry) bgcolor(c == 3 ? color(green, 80) : c == 2 ? color(green, 75) : c == 1 ? color(green, 70) : c == -1 ? color(red, 70) : c == -2 ? color(red, 75) : c == -3 ? color(red, 80) : gray) plot(mrs_index, linewidth=3, title="MRS index") plot(mrs_sector != mrs_index ? mrs_sector : na, linewidth=2, title="MRS sector") plot(mrs_industry != mrs_index ? mrs_industry : na, linewidth=1, title="MRS industry") hline(price=0, linestyle=dashed, title="Zero baseline")
지표
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2023-02-02 14:03:12

안녕하세요 예스스탁입니다. 올려주신 내용은 변환이 가능하지 않습니다. 올려주신 수식에는 수식안에서 데이타를 호출하는 내용이 있지만 예스랭귀지는 수식안에서 데이타호출이 가능하지 않습니다. 사용자분이 셋팅한 차트에 있는 데이터를 사용만 가능합니다. 즐거운 하루되세요 > dqzero 님이 쓴 글입니다. > 제목 : 수식 변환 요청드립니다 > 아래는 트레이딩 뷰에서 Mansfield Relative Strength지표입니다. 변환 부탁드립니다 //@version=3 // Use this indicator to compare how security is performing in compare with prefered index (SPX by default). // > 0 outperforming // < 0 underperforming // Works best for weekly, but can be applied to monthly and daily charts. It will be rather useless to use it in smaller timeframes // Apply it to SPX, industry index, sector index or other security in similar sector // UPDAT E 1: Added sector and industry as optional params. Leave them same as index if you don't want to use them study("Mansfield Relative Strength indicator") index = input(title="Index", type=symbol, defval="SP:SPX") sector = input(title="Sector (optional)", type=symbol, defval="SP:SPX") industry = input(title="Industry (optional)", type=symbol, defval="SP:SPX") ma_type = input(title="Which moving average to use?", defval="SMA", options=["SMA", "WMA", "EMA"]) len_daily = input(title="MA length for Daily", defval=200) len_weekly = input(title="MA length for Weekly", defval=52) len_monthly = input(title="MA length for Monthly", defval=10) len_other = input(title="MA length for all other periods", defval=52) val = close len = period == "W" ? len_weekly : (period == "D" ? len_daily : (period == "M" ? len_monthly : len_other)) ma_func(x, length) => ma_type == "WMA" ? wma(x, length) : (ma_type == "SMA" ? sma(x, length) : ema(x, length)) calc_mrs_func(x, ind, length) => ((x / security(ind, period, x)) / ma_func((x / security(ind, period, x)), length) - 1) * 10 mrs_index = calc_mrs_func(val, index, len) mrs_sector = calc_mrs_func(val, sector, len) mrs_industry = calc_mrs_func(val, industry, len) c = sign(mrs_index) + sign(mrs_sector) + sign(mrs_industry) bgcolor(c == 3 ? color(green, 80) : c == 2 ? color(green, 75) : c == 1 ? color(green, 70) : c == -1 ? color(red, 70) : c == -2 ? color(red, 75) : c == -3 ? color(red, 80) : gray) plot(mrs_index, linewidth=3, title="MRS index") plot(mrs_sector != mrs_index ? mrs_sector : na, linewidth=2, title="MRS sector") plot(mrs_industry != mrs_index ? mrs_industry : na, linewidth=1, title="MRS industry") hline(price=0, linestyle=dashed, title="Zero baseline")
프로필 이미지

dqzero

2023-02-02 15:08:00

재 문의드립니다 기간을 주간으로 설정하고 SMA 52이평으로 한다면변환이 가능한지요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 변환 요청드립니다 > 안녕하세요 예스스탁입니다. 올려주신 내용은 변환이 가능하지 않습니다. 올려주신 수식에는 수식안에서 데이타를 호출하는 내용이 있지만 예스랭귀지는 수식안에서 데이타호출이 가능하지 않습니다. 사용자분이 셋팅한 차트에 있는 데이터를 사용만 가능합니다. 즐거운 하루되세요 > dqzero 님이 쓴 글입니다. > 제목 : 수식 변환 요청드립니다 > 아래는 트레이딩 뷰에서 Mansfield Relative Strength지표입니다. 변환 부탁드립니다 //@version=3 // Use this indicator to compare how security is performing in compare with prefered index (SPX by default). // > 0 outperforming // < 0 underperforming // Works best for weekly, but can be applied to monthly and daily charts. It will be rather useless to use it in smaller timeframes // Apply it to SPX, industry index, sector index or other security in similar sector // UPDAT E 1: Added sector and industry as optional params. Leave them same as index if you don't want to use them study("Mansfield Relative Strength indicator") index = input(title="Index", type=symbol, defval="SP:SPX") sector = input(title="Sector (optional)", type=symbol, defval="SP:SPX") industry = input(title="Industry (optional)", type=symbol, defval="SP:SPX") ma_type = input(title="Which moving average to use?", defval="SMA", options=["SMA", "WMA", "EMA"]) len_daily = input(title="MA length for Daily", defval=200) len_weekly = input(title="MA length for Weekly", defval=52) len_monthly = input(title="MA length for Monthly", defval=10) len_other = input(title="MA length for all other periods", defval=52) val = close len = period == "W" ? len_weekly : (period == "D" ? len_daily : (period == "M" ? len_monthly : len_other)) ma_func(x, length) => ma_type == "WMA" ? wma(x, length) : (ma_type == "SMA" ? sma(x, length) : ema(x, length)) calc_mrs_func(x, ind, length) => ((x / security(ind, period, x)) / ma_func((x / security(ind, period, x)), length) - 1) * 10 mrs_index = calc_mrs_func(val, index, len) mrs_sector = calc_mrs_func(val, sector, len) mrs_industry = calc_mrs_func(val, industry, len) c = sign(mrs_index) + sign(mrs_sector) + sign(mrs_industry) bgcolor(c == 3 ? color(green, 80) : c == 2 ? color(green, 75) : c == 1 ? color(green, 70) : c == -1 ? color(red, 70) : c == -2 ? color(red, 75) : c == -3 ? color(red, 80) : gray) plot(mrs_index, linewidth=3, title="MRS index") plot(mrs_sector != mrs_index ? mrs_sector : na, linewidth=2, title="MRS sector") plot(mrs_industry != mrs_index ? mrs_industry : na, linewidth=1, title="MRS industry") hline(price=0, linestyle=dashed, title="Zero baseline")
프로필 이미지

예스스탁 예스스탁 답변

2023-02-02 15:50:35

안녕하세요 예스스탁입니다. 이평 방법이나 기간은 문제되는 부분이 아닙니다. 수식안에서 security(ind, period, x)와 같은 함수로 데이타들을 호출하는데 저희 랭귀지와 체계가 달라 변환해 드릴 수 없습니다. 도움을 드리지 못해 죄송합니다. 즐거운 하루되세요 > dqzero 님이 쓴 글입니다. > 제목 : Re : Re : 수식 변환 요청드립니다 > 재 문의드립니다 기간을 주간으로 설정하고 SMA 52이평으로 한다면변환이 가능한지요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 변환 요청드립니다 > 안녕하세요 예스스탁입니다. 올려주신 내용은 변환이 가능하지 않습니다. 올려주신 수식에는 수식안에서 데이타를 호출하는 내용이 있지만 예스랭귀지는 수식안에서 데이타호출이 가능하지 않습니다. 사용자분이 셋팅한 차트에 있는 데이터를 사용만 가능합니다. 즐거운 하루되세요 > dqzero 님이 쓴 글입니다. > 제목 : 수식 변환 요청드립니다 > 아래는 트레이딩 뷰에서 Mansfield Relative Strength지표입니다. 변환 부탁드립니다 //@version=3 // Use this indicator to compare how security is performing in compare with prefered index (SPX by default). // > 0 outperforming // < 0 underperforming // Works best for weekly, but can be applied to monthly and daily charts. It will be rather useless to use it in smaller timeframes // Apply it to SPX, industry index, sector index or other security in similar sector // UPDAT E 1: Added sector and industry as optional params. Leave them same as index if you don't want to use them study("Mansfield Relative Strength indicator") index = input(title="Index", type=symbol, defval="SP:SPX") sector = input(title="Sector (optional)", type=symbol, defval="SP:SPX") industry = input(title="Industry (optional)", type=symbol, defval="SP:SPX") ma_type = input(title="Which moving average to use?", defval="SMA", options=["SMA", "WMA", "EMA"]) len_daily = input(title="MA length for Daily", defval=200) len_weekly = input(title="MA length for Weekly", defval=52) len_monthly = input(title="MA length for Monthly", defval=10) len_other = input(title="MA length for all other periods", defval=52) val = close len = period == "W" ? len_weekly : (period == "D" ? len_daily : (period == "M" ? len_monthly : len_other)) ma_func(x, length) => ma_type == "WMA" ? wma(x, length) : (ma_type == "SMA" ? sma(x, length) : ema(x, length)) calc_mrs_func(x, ind, length) => ((x / security(ind, period, x)) / ma_func((x / security(ind, period, x)), length) - 1) * 10 mrs_index = calc_mrs_func(val, index, len) mrs_sector = calc_mrs_func(val, sector, len) mrs_industry = calc_mrs_func(val, industry, len) c = sign(mrs_index) + sign(mrs_sector) + sign(mrs_industry) bgcolor(c == 3 ? color(green, 80) : c == 2 ? color(green, 75) : c == 1 ? color(green, 70) : c == -1 ? color(red, 70) : c == -2 ? color(red, 75) : c == -3 ? color(red, 80) : gray) plot(mrs_index, linewidth=3, title="MRS index") plot(mrs_sector != mrs_index ? mrs_sector : na, linewidth=2, title="MRS sector") plot(mrs_industry != mrs_index ? mrs_industry : na, linewidth=1, title="MRS industry") hline(price=0, linestyle=dashed, title="Zero baseline")