本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Senthaamizh
//Identifies whether the instrument is trending or mean reverting
//@version=4
strategy("Trend Following or Mean Reverting",shorttitle = "TF/MR",default_qty_type = strategy.percent_of_equity,default_qty_value = 100, overlay=true)
buy = close>high[1]
sell = close<low[1]
if (buy)
strategy.entry("Long", strategy.long,qty=1)
if (sell)
strategy.entry("Short", strategy.short,qty=1)