MA-EMA Crossover LT

Just a simple strategy based on dynamic zones by Allenster. Still a work in progress.
Release Notes: // This is a Trend Following strategy. Strategy Logic as follows -
// Very simple MA and EMA crossover for Entry (Short or Long)
// Re-entry is on EMA crossover
// Dynamic Zones are used for Stop Loss exit - Dynamic Zone is simply a % of "X" period price range. I use 128 periods for checking range.
// Dynamic Zones script is taken from @allanster
// I have found that it gives good results (at least on-paper results) on 3 hours timeframe or Daily timeframes.
// I have kept certain default parameters like quantity, trade type long/short, etc since they were convinient for the kind of stocks I was checking.
// One can change many of these parameters to optimise the results.
// There are still some changes to be done to script as follows - //12Apr20
// 1. If on Long Entry, the entry point is below the dynamic zone line, then the stop loss is calculated above the entry point. I will fix it one of these days.
// 2. Additional re-entry logic or take-profit logic in case the stock runs much ahead
// 3. I need to write a Alerts script that would have 10s of stocks built into one script.
// 4. Any other feedback
// Please note I am not a programmer by profession. I am just trying to code a few simple trading ideas for my personal use
// So, any suggestions / help in changing / optimizing code is most welcome.
Release Notes: Added the link to Dynamic Zones Script in comments. It's a beautiful, neat and clean script. I use it quite frequently during trading. I find it somewhat similar to %Williams, but visually much more intuitive. Please check it as
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?


This is one of the best scripts I've seen on TradingView. Excellent work. The only problem is it uses the security and syminfo.tickerid function witch is typically a red flag for scripts that repaint. has anyone picked up any repainting using this script?
Masa_1234 FabulousFinish
As far as I know, this script doesn't repaint. The trade happens on the next candle after the signal is generated. So the results that you see in the strategy are not repaints.
Which also means that, in real time you need to wait for the candle to close to confirm the trade. And take the trade on the next candle. Hope this clarifies.
And, you can do your own paper trades and let me know the observation.

Actually, it is a very simple concept. I am using moving average crossover on a higher timeframe and executing on a lower timeframe. I wanted to avoid whipsaw as far as possible and hence I thought of this idea of using higher timeframes.
Hi again... Thanx again :)
One questions: for some reason I don't get buy/sell signals on this script. Any settings that should be set perhaps?
Reading is the same with your last script MA-EMA XO Alerts. Same settings, right?
Masa_1234 cgminer997
Yes. Both scripts are same. If you share specific stock/s you observed this, I will check the issue.
cgminer997 Masa_1234
@Masa_1234, :) Thanx :)
Nice work. Do you have Alerts for this script?
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