What's new

50 days averaging method pinescript

2.00 star(s) 1 Vote

joelroyal

New Member
strategy(“50-day Moving Average Strategy”)



lookback = 50



ma = sma(close, lookback)



long_entry = crossover(close, ma)

short_entry = crossunder(close, ma)



long_exit = crossunder(close, ma)

short_exit = crossover(close, ma)



If long_entry

strategy.entry(“long”, strategy.long)



If long_exit

strategy.exit(“Long Exit”)



If short_entry

strategy.entry(“Short”, strategy.short)



If long_exit

strategy.exit(“Short Exit”)
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Members Online

No members online now.

Similar threads

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

Top