Loading ...

SuperTrend

Author: 发明者量化, Date: 2022-04-27 18:21:50
Tags: supertrend

At the request of our platform users, FMZ is compatible with the Pine language function library of TradingView now, and has entered a stable version.

  • the grammer is fully compatible with v5 version
  • all indicators of ta library are fully implemented
  • full implementation of math library
  • full implementation of string library
  • full implementation of array library
  • input parameters are recognized in the interface automatically
  • request.security support for heikinashi
  • strategy library implementation (full support for stop loss/profit target/trailing stop/conditional orders, etc.)
  • compatible with plot/plotchar/plotshape/plotcandle/alert/alertcondition etc.

It is a continuous process that provide full support for language functions, and this public version is made available in advance for user testing.

Later, FMZ will continue to increase and improve the function library support for Pine language of TradingView, if necessary, please leave a comment on this strategy.

Remark: If you encounter undefined variables, it is proved that this attribute is not supported. You can delete the relevant call, or send a work order to contact the technician to solve the problem.

img


/*backtest
start: 2020-04-27 00:00:00
end: 2022-04-26 23:59:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Bitfinex","currency":"BTC_USD"}]
*/
strategy("supertrend", overlay=true)

[supertrend, direction] = ta.supertrend(input(5, "factor"), input.int(10, "atrPeriod"))

plot(direction < 0 ? supertrend : na, "Up direction", color = color.green, style=plot.style_linebr)
plot(direction > 0 ? supertrend : na, "Down direction", color = color.red, style=plot.style_linebr)

if direction < 0
    if supertrend > supertrend[2]
        strategy.entry("entry long", strategy.long)
    else if strategy.position_size < 0
        strategy.close_all()
else if direction > 0
    if supertrend < supertrend[3]
        strategy.entry("entry short", strategy.short)
    else if strategy.position_size > 0
        strategy.close_all()


Related

More

栩笨笨 pine脚本能实现微信通知功能吗

wang3602000 python 在发明者学的 PINE 暂时没太看懂 他们都说PINE比PYTHON简单 , 呜呜 多币种的超级趋势 好写吗 我想以多币种的超级趋势为基础 ,添加自己脑袋里的东西 不知道怎么做

wang3602000 请问 这个策略如何转换成多币种的

xaifer48 能出个Pine语言的教程么

Leafar 牛牛牛

夏天不打你 这个下单数量也是通过strategy.entry的qty参数调整吗?

Zer3192 发明者越来越强大了

xunfeng91 牛逼v5,这策略可以直接上实盘了

发明者量化 当然可以 runtime.log 后面加 @ 不过现在只能通知到app了, 微信通知已经下了

发明者量化 Pine不支持多币种,一个策略只支持一个币种

发明者量化 正在录制,目前可以先看文档 https://www.fmz.com/doc/9315

发明者量化 是的,默认不指定的话就是界面选项里的参数