mikelily

fb q1

Sep 8th, 2022
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © mikelily
  3.  
  4. //@version=5
  5. strategy("FB")
  6.  
  7. // A
  8. Condition1= ta.sma(close, 50) < ta.sma(close, 200)
  9. Condition2= ta.crossover(ta.sma(close, 1), ta.sma(close, 50))
  10.  
  11. shortCondition1 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 50))
  12.  
  13. if (Condition1) and (Condition2)
  14. strategy.entry("買進1", strategy.long)
  15. if (shortCondition1)
  16. strategy.close("買進1",qty_percent=100)
  17.  
  18. // B
  19. Condition3= ta.sma(close, 50) > ta.sma(close, 200)
  20. Condition4= ta.crossover(ta.sma(close, 1), ta.sma(close, 50))
  21.  
  22. shortCondition2 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 200))
  23.  
  24. if (Condition3) and (Condition4)
  25. strategy.entry("買進2", strategy.long)
  26. if (shortCondition2)
  27. strategy.close("買進2",qty_percent=100)
  28.  
  29. // C
  30. Condition5= ta.sma(close, 50) < ta.sma(close, 200)
  31. Condition6= ta.crossover(ta.sma(close, 1), ta.sma(close, 200))
  32.  
  33. shortCondition3 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 50))
  34.  
  35. if (Condition5) and (Condition6)
  36. strategy.entry("買進3", strategy.long)
  37. if (shortCondition3)
  38. strategy.close("買進3",qty_percent=100)
  39.  
  40. // D
  41. Condition7= ta.sma(close, 50) > ta.sma(close, 200)
  42. Condition8= ta.crossover(ta.sma(close, 1), ta.sma(close, 200))
  43.  
  44. shortCondition4 = ta.crossunder(ta.sma(close, 1), ta.sma(close, 200))
  45.  
  46. if (Condition5) and (Condition6)
  47. strategy.entry("買進4", strategy.long)
  48. if (shortCondition4)
  49. strategy.close("買進4",qty_percent=100)
Advertisement
Add Comment
Please, Sign In to add comment