SuperTrend

Author: Inventors quantified, 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

StalkerDoes it support the same currency, different exchanges than pair synchronization? for example exchange[0].Sell? exchaneg[1].Sell: na

Oh, my God.Is the pine script capable of WeChat notification?

wang3602000I'm trying to figure out how to do this, and I'm trying to figure out how to do this, and I'm trying to figure out how to do this, and I'm trying to figure out how to do this, and I'm trying to figure out how to do this.

wang3602000So how does this strategy translate into a multi-currency currency?

xaifer48Can you give me a tutorial on the Pine language?

lefarcenCow cow cow

Summer won't beat you. 这个下单数量也是通过strategy.entry的qty参数调整吗?

Zer3192Inventors are becoming more powerful

xunfeng91Super Mario 5 is a strategy that can be used directly on the desktop.

Inventors quantifiedhttps://www.fmz.com/doc/9315#request.security can be compared to the K line, the depth cannot be compared to the line

Inventors quantifiedOf course, you can add @ after runtime.log, but now you can only notify the app, the WeChat notification has gone down.

Inventors quantifiedPine doesn't support multi-currency, one strategy only supports one currency

Inventors quantifiedWe are recording and you can view the documentation at https://www.fmz.com/doc/9315

Inventors quantifiedYes, the default is not specified is a parameter in the interface options