Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © mikelily
- //@version=5
- strategy("FB")
- // A
- Condition1= ta.sma(close, 50) < ta.sma(close, 200)
- Condition2= ta.crossover(ta.sma(close, 1), ta.sma(close, 50))
- shortCondition1 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 50))
- if (Condition1) and (Condition2)
- strategy.entry("買進1", strategy.long)
- if (shortCondition1)
- strategy.close("買進1",qty_percent=100)
- // B
- Condition3= ta.sma(close, 50) > ta.sma(close, 200)
- Condition4= ta.crossover(ta.sma(close, 1), ta.sma(close, 50))
- shortCondition2 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 200))
- if (Condition3) and (Condition4)
- strategy.entry("買進2", strategy.long)
- if (shortCondition2)
- strategy.close("買進2",qty_percent=100)
- // C
- Condition5= ta.sma(close, 50) < ta.sma(close, 200)
- Condition6= ta.crossover(ta.sma(close, 1), ta.sma(close, 200))
- shortCondition3 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 50))
- if (Condition5) and (Condition6)
- strategy.entry("買進3", strategy.long)
- if (shortCondition3)
- strategy.close("買進3",qty_percent=100)
- // D
- Condition7= ta.sma(close, 50) > ta.sma(close, 200)
- Condition8= ta.crossover(ta.sma(close, 1), ta.sma(close, 200))
- shortCondition4 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 200))
- if (Condition5) and (Condition6)
- strategy.entry("買進4", strategy.long)
- if (shortCondition4)
- strategy.close("買進4",qty_percent=100)
Advertisement
Add Comment
Please, Sign In to add comment