资源加载中... loading...

有偿

Author: 梦想身价八位数, Created: 2023-09-22 01:58:16, Updated:

求一个 pine 语言的马丁策略,能在 Trading 上运行的


More

发明者量化-小小梦 ```pine //@version=5 indicator("Martingale Strategy", overlay=true) // 初始仓位大小 initialPositionSize = input(1, title="初始仓位大小") // 加倍倍数 martingaleMultiplier = input(2, title="加倍倍数") // 止损百分比 stopLossDiff = input(2000, title="止损价差") // 盈利百分比 takeProfitDiff = input(2000, title="止盈价差") currentPositionSize = strategy.position_size buySignal = false // 盈利止盈 if (close - strategy.position_avg_price >= takeProfitDiff) strategy.close_all() // 止损加倍 if (close - strategy.position_avg_price <= -stopLossDiff) currentPositionSize := currentPositionSize * martingaleMultiplier buySignal := true if currentPositionSize == 0 buySignal := true currentPositionSize := initialPositionSize // 买入逻辑 strategy.order("Buy", strategy.long, currentPositionSize, when=buySignal) ``` 仅供参考,马丁策略有风险。

发明者量化-小小梦 不客气。

梦想身价八位数 感谢梦总