我试图在烛台中按其收盘价绘制7种证券的平均价格。我知道我们有一些内置函数(例如plotcandle),但是我没有太多概念,因此仅出于测试目的尝试了第一个图(即使它会返回折线图)。我在指标标题中看到“示例:解决错误” FXCM ...
该想法的最佳解决方案是什么?我只想使用7个证券收盘价的平均价格绘制折线图或蜡烛图。我们最终应该有3种主要证券,它们应该以烛台图形式或折线图形式打印在主图表中。
study("Example", overlay=true) usdcad = security("FXCM:USDCAD", "240", close) usdjpy = security("FXCM:USDJPY", "240", close) usdaud = security("FXCM:USDAUD", "240", close) usdgbp = security("FXCM:USDGBP", "240", close) usdchf = security("FXCM:USDCHF", "240", close) usdeur = security("FXCM:USDEUR", "240", close) usdnzd = security("FXCM:USDNZD", "240", close) usdAverage = (usdcad + usdjpy + usdaud + usdgbp + usdchf + usdeur + usdnzd) / 7 plot(usdAverage) audusd = security("FXCM:AUDUSD", "240", close) audjpy = security("FXCM:AUDJPY", "240", close) audcad = security("FXCM:AUDCAD", "240", close) audgbp = security("FXCM:AUDGB", "240", close) audchf = security("FXCM:AUDCHF", "240", close) audeur = security("FXCM:AUDEUR", "240", close) audnzd = security("FXCM:AUDNZD", "240", close) audAverage = (audcad + audjpy + audusd + audgbp + audchf + audeur + audnzd) / 7 plot(audAverage) nzdusd = security("FXCM:NZDUSD", "240", close) nzdjpy = security("FXCM:NZDJPY", "240", close) nzdcad = security("FXCM:NZDCAD", "240", close) nzdgbp = security("FXCM:NZDGBP", "240", close) nzdchf = security("FXCM:NZDCHF", "240", close) nzdeur = security("FXCM:NZDEUR", "240", close) nzdaud = security("FXCM:NZDAUD", "240", close) nzdAverage = (nzdcad + nzdjpy + nzdusd + nzdgbp + nzdchf + nzdeur + nzdaud) / 7 plot(audAverage) cadusd = security("FXCM:CADUSD", "240", close) cadjpy = security("FXCM:CADJPY", "240", close) cadaud = security("FXCM:CADAUD", "240", close) cadgbp = security("FXCM:CADGBP", "240", close) cadchf = security("FXCM:CADCHF", "240", close) cadeur = security("FXCM:CADEUR", "240", close) cadnzd = security("FXCM:CADNZD", "240", close) cadAverage = (cadnzd + cadjpy + cadusd + cadgbp + cadchf + cadeur + cadaud) / 7 plot(cadAverage)```