pine-script - 仅当 Strategy.Openprofit > 0 时 Strategy.Exit
问题描述
您好,松树编码专家,
只有当 Open PL 大于 0 时,我才尝试退出订单。
如果有人可以帮助我编辑下面的示例代码,我将不胜感激。
//@version=4
strategy("Strategy", overlay=true, max_lines_count=500, max_bars_back=5000, pyramiding=100)
bars_back = input(defval=50, title="Custom Bars back")
f_resInMiliseconds() =>
_resInMiliseconds = 60000 * timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
bar_diff = int((timenow-time) / f_resInMiliseconds())
bar_in_window = bar_diff < bars_back
if bar_in_window
strategy.entry("long", true, 1, when = close<open, alert_message='Long')
strategy.entry("short", false, 1, when = close>open, alert_message='Short')
谢谢你,贾克斯。
解决方案
推荐阅读
- python - 如何用 pandas 计算百分比和累积百分比
- azure-devops - Azure DevOps Server 2019 Build 已排队但未启动
- ios - SwiftUI - 单击 NavigationLink 时触发其他操作
- java - 是否有可能将多个设备 LatLng 与 1 个设备 LatLng 进行比较?
- flutter - 如何从列表中获取特定的 DocumentSnapshot
- github - GitHub 删除的文件正在抛弃语言统计信息
- c# - 从 JSON 中删除附加文本
- react-native - 在 createStackNavigator() 之前执行代码
- java - 检查 Firebase 实时数据库中是否存在字段
- amazon-web-services - 调用 UpdateService 操作时的 AWS ECS InvalidParameterExcpetion