Dr.Pip

Simple Moving Average Strategy

This is a modification of MOVINGAVG CROSS with different inputs of bar lengths that work with a great average percentage with not much drawdown. I ran the strategy tester with GBPUSD on 1 hour time frame.
Remove from Favorite Scripts Add to Favorite Scripts
strategy(title="Mbit Moving Average",overlay=true)

length = input(520)
confirmBars = input(27)
price = close
ma = sma(price, length)

bcond = price > ma

bcount = bcond ? nz(bcount[1]) + 1 : 0

scond = price < ma

scount = scond ? nz(scount[1]) + 1 : 0

long =  scount == confirmBars

short = bcount == confirmBars


//Strategy

strategy.entry("long", strategy.long, when=long)

strategy.entry("short",strategy.short, when=short)
How to add alert ? Thanks
Reply
Can I ask, what does repain mean??
Reply
does it repaints?
Reply
I think it doesn't repaint because it doesn't use future data for calculation.
Reply
Sorry... It repaints... any strategy that uses renko in a backtest isn't tradable because it uses future data
Reply
mykb Speed123
Thank you for the reply.
Reply
Dr.Pip Speed123
No renko is used for this strategy, you can absolutely change it if you want. This strategy only uses a simple moving average to take trades and it does not repaint, it just sometimes has really long trades and can sometimes lead to large drawdown just look at the list of trades on the strategy tester. The last trade placed as of today was on 6/27/16
Reply
Speed123 Dr.Pip
Thanks for the clarification. Good to know that it doesn't repaint.
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Help Center Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing TradingView Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out