通過微信通知自動監測比特幣強弱指標信號,在震盪市中多空雙吃

直接上代码吧,主要是要有通知机制。

1、通过js写的代码,在fmz.com注册,新建一个监测机器人


通过微信通知自动监测比特币强弱指标信号,在震荡市中多空双吃

fmz新建机器人


2、授权管理,在火币Api那边获取key;

3、写JS代码,按FMZ格式来写:

function onTick(exchange, lastPushTime) {

var records = exchange.GetRecords();

if (!records || records.length < (14 + 5)) {

return;

}

rsi = TA.RSI(records, 14);

var rsiValue0 = rsi[records.length - 1];

var rsiValue1 = rsi[records.length - 2];

var rsiValue2 = rsi[records.length - 3];

if (rsiValue0 > rsiHigh || rsiValue0 < rsiLow){

if (rsiValue0 > rsiHigh) {

// 卖出

//Log the price on the bot's page and sent the message. '@' in the end means push message

Log("开始微信推送提醒卖出")

Log("BTC提醒卖出,RSI当前值", rsiValue0, "最新价格",records[records.length-1].Close , "@");

// exchange.Sell( - 1, 0.1)

}

if (rsiValue0 < rsiLow) {

// 买入

Log("开始微信推送提醒买入")

Log("BTC提醒买入,RSI当前值", rsiValue0, "最新价格",records[records.length-1].Close , "@");

// exchange.Buy(- 1, 0.1)

}

}

Log("当前K线(最新)", records[records.length-1].Close ,"上一根K线", records[records.length-2].Close, "RSI当前值", rsiValue0);

}

function main() {

Log("Start running");

Log("比特币机器人启动啦!微信你好 !@");

var lastPushTime = 0 //the variable of last push timestamp.

while (true) {

onTick(exchange, lastPushTime);

Sleep(5000);

}

}

4、直接跑起来,设置微信push通知


通过微信通知自动监测比特币强弱指标信号,在震荡市中多空双吃

微信通知设置


5、这样在震荡市就可以多空双吃啦,这只是最简单的比特币跟踪策略,复杂的就私下里联系吧。



分享到:


相關文章: