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.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
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)

Comments

How to add alert ? Thanks
+3 Reply
Fantastic way to get nowhere fast and or blow your account
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
+1 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
+1 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 About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out