我正在尝试使用Poloniex API和PHP Trader EXtension来计算RSI。这是我到目前为止所拥有的。
date_default_timezone_set( 'UTC' );
$api = new poloniex( 'xxxxxxx', 'xxxxx' );
$data = $api->getChartValues( 'BTC_LTC', strtotime( "-21 hours" ), time(), 300 );
print_r( $data);
$rsi = array();
foreach ( $data as $a )
{
$rsi[] = $a['close'];
}
$rsi = trader_rsi( array_reverse($rsi) , 14 );getChartValues从Poloniex API调用returnChartData API函数。运行脚本后,输出的RSI与有效的RSI完全不同。
我哪里做错了?
发布于 2018-06-20 16:34:56
也许不需要反转,下面是我的代码,它运行良好
$rsi = array();
foreach ( $data as $a )
{
$rsi[] = $a['close'];
}
$rsi = trader_rsi( $rsi , 14 );
print_r( $rsi );发布于 2018-02-16 20:25:02
根据RSI definition的说法
使用以下公式计算相对强度指数: RSI = 100 - 100 / (1 + RS)其中RS =指定时间帧内上行周期的平均增益/指定时间帧内下行周期的平均损失/ ...
比较上升期和下跌期的默认时间框架是14,就像14个交易日一样。
您确定计算中的RS参数与“有效参数”中的RS参数完全相同吗?根据你的说法,什么是“有效的”来源?
https://stackoverflow.com/questions/44711596
复制相似问题