Files
strategies/Accurate-Swing-Trading-System.md
T

75 lines
1.6 KiB
Markdown
Raw Normal View History

2023-01-11 17:10:25 +08:00
2023-07-14 18:39:48 +08:00
> Name
2023-01-11 17:10:25 +08:00
2023-04-18 23:12:35 +08:00
Accurate-Swing-Trading-System
2023-01-11 17:10:25 +08:00
2023-07-14 18:39:48 +08:00
> Author
2023-01-11 17:10:25 +08:00
Zer3192
2023-07-14 18:39:48 +08:00
> Strategy Arguments
2023-01-11 17:10:25 +08:00
2023-07-14 18:39:48 +08:00
|Argument|Default|Description|
2023-01-11 17:10:25 +08:00
|----|----|----|
|v_input_1|3|Swing|
|v_input_2|true|Barcolor|
|v_input_3|false|Bgcolor|
2023-07-14 18:39:48 +08:00
> Source (PineScript)
2023-01-11 17:10:25 +08:00
2024-03-03 22:27:55 +08:00
``` pinescript
2023-01-11 17:10:25 +08:00
/*backtest
start: 2021-05-08 00:00:00
end: 2022-05-07 23:59:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ceyhun
//@version=4
study("Accurate Swing Trading System",overlay=true)
no=input(3,title="Swing")
Barcolor=input(true,title="Barcolor")
Bgcolor=input(false,title="Bgcolor")
res=highest(high,no)
sup=lowest(low,no)
avd=iff(close>res[1],1,iff(close<sup[1],-1,0))
avn=valuewhen(avd!=0,avd,0)
tsl=iff(avn==1,sup,res)
Buy=crossover(close,tsl)
Sell=crossunder(close,tsl)
plotshape(Buy,"BUY", shape.labelup, location.belowbar, color.green, text="BUY",textcolor=color.black)
plotshape(Sell,"SELL", shape.labeldown, location.abovebar, color.red, text="SELL",textcolor=color.black)
colr = close>=tsl ? color.green : close<=tsl ? color.red : na
plot(tsl, color=colr, linewidth=3, title="TSL")
barcolor(Barcolor ? colr : na)
bgcolor(Bgcolor ? colr :na)
alertcondition(Buy, title="Buy Signal", message="Buy")
alertcondition(Sell, title="Sell Signal", message="Sell")
if Buy
strategy.entry("long", strategy.long)
else if Sell
strategy.entry("short", strategy.short)
```
2023-07-14 18:39:48 +08:00
> Detail
2023-01-11 17:10:25 +08:00
https://www.fmz.com/strategy/367565
2023-07-14 18:39:48 +08:00
> Last Modified
2023-01-11 17:10:25 +08:00
2022-06-04 07:05:48