OPEN-SOURCE SCRIPT
Heikin Ashi Color Flip Strategy

Manual HA calculation → no repainting
✔ Entry on first green after red
✔ Exit on first red after green
✔ process_orders_on_close = false → orders execute on next bar open
✔ Logic is clean and readable
How to make it your kind of strategy (next step)
Given your past preferences, the best upgrade is:
• Trade only when price > EMA 21
• Or only when SPY > EMA 50 & VIX < 20
• Exit on price close below EMA 21 (your preferred rule)
Consider the following to increase win rate and decrease drawdown:
• Add EMA-21 exit instead of HA red
• Add SPY/VIX regime filter
• Give you real QQQ daily backtest metrics
• Convert this into a scan/alert-only indicator
Disclaimer:
This indicator is provided for educational and informational purposes only and does not constitute financial, investment, or trading advice. The signals generated by this indicator are not guaranteed to be accurate or profitable. Past performance is not indicative of future results. Trading and investing involve substantial risk, and you should perform your own analysis and consult a qualified financial professional before making any trading decisions. The author is not responsible for any financial losses incurred from the use of this indicator.
✔ Entry on first green after red
✔ Exit on first red after green
✔ process_orders_on_close = false → orders execute on next bar open
✔ Logic is clean and readable
How to make it your kind of strategy (next step)
Given your past preferences, the best upgrade is:
• Trade only when price > EMA 21
• Or only when SPY > EMA 50 & VIX < 20
• Exit on price close below EMA 21 (your preferred rule)
Consider the following to increase win rate and decrease drawdown:
• Add EMA-21 exit instead of HA red
• Add SPY/VIX regime filter
• Give you real QQQ daily backtest metrics
• Convert this into a scan/alert-only indicator
Disclaimer:
This indicator is provided for educational and informational purposes only and does not constitute financial, investment, or trading advice. The signals generated by this indicator are not guaranteed to be accurate or profitable. Past performance is not indicative of future results. Trading and investing involve substantial risk, and you should perform your own analysis and consult a qualified financial professional before making any trading decisions. The author is not responsible for any financial losses incurred from the use of this indicator.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.