Infinity Algo Backtest

Stop-loss is now working in backtest
Alert function message
Fixed reverse trading
Changed Colors
New ribbon and channel bands
This update brings the backtesting strategy script in line with the main Infinity Algo V3.0 indicator, incorporating the AI optimization engine and refining the strategy logic and settings.
๐ Major Updates & New Features:
Pine Script V6 Update: The strategy script has been migrated to Pine Script version 6, enabling the use of newer Pine features and aligning it with the indicator script.
๐ง AI Optimization Engine Integration:
Adaptive Signals: Introduced the "AI" option in the ๐ Show Signals Type input. When selected and ๐ง Enable AI Optimization is checked, the strategy uses signals generated by the AI engine, which dynamically adapts its parameters based on simulated performance and market volatility.
AI Engine Core: Includes the same core AI logic as the indicator: simulation of configurations, performance evaluation based on selectable metrics (๐ AI Performance Metric), K-Means clustering based on volatility, and dynamic selection of the best configuration for the current market regime.
AI Inputs: Added the ๐ง AI Clustering settings group, allowing configuration of the AI engine (Enable, Update Frequency, Range, Simulation TP/SL%, Performance Metric). Note: The AI Dashboard visualization is not included in the strategy script.
"Opposite Signal" Exit Type: Added a new option to the ๐ Exit Type input (Opposite Signal) which closes the current position when a signal in the opposite direction occurs.
๐งน Removed Features:
Visualizations Removed:
Keltner Channel Bands
EMA Ribbon
Peak Profit Line. These were primarily visual aids not essential for backtesting logic.
โจ Refinements & Improvements:
Signal Type Input: Added the ๐ Show Signals Type dropdown (Normal + Smart, Normal Only, etc., including AI), providing explicit control over which signal logic drives the strategy entries, similar to the indicator.
Signal Toggle Logic: Integrated ๐ Toggle Same Signal Consecutively and ๐ Next Signal Must Be Opposite Signal inputs to control signal generation behavior consistently with the indicator.
Exit Logic Overhaul:
Refactored the strategy.exit and strategy.close logic to handle the different ๐ Exit Type options ('Percentage', 'Signals', 'Opposite Signal') more clearly.
Improved handling of partial exits for 'Signals'and 'Percentage' modes.
Ensured Stop Loss is applied correctly across different exit types.
State Management: Improved internal tracking of position state to work reliably with strategy.* functions and the different exit modes.
Settings Organization: Grouped related inputs more logically (e.g., ๐ Strategy Settings, โ๏ธ Signal Settings, ๐ง AI Clustering, ๐ฐ Take Profit Settings, ๐ช Exit Settings, ๐ Precision Settings, Alerts), mirroring the indicator's structure.
Alerts:
Code Structure: General refactoring for better readability, consistency with the V3 indicator, and integration of the AI components. Removed redundant code related to visual elements.
Note: As with the indicator, bugs may appear due to the significant changes. Thorough testing across different settings and market conditions is recommended.
Skrip jemputan sahaja
Hanya pengguna yang diberikan kebenaran oleh penulis mempunyai akses kepada skrip ini dan ini selalunya memerlukan pembayaran. Anda boleh menambahkan skrip kepada kegemaran anda tetapi anda hanya boleh menggunakannya selepas meminta kebenaran dan mendapatkannya daripada penulis โ ketarhui lebih lanjut di sini. Untuk lebih butiran, ikuti arahan penulis di bawah atau hubungi InfinityAlgo secara terus.
Ambil maklum bahawa skrip peribadi dan jemputan sahaja ini tidak disemak oleh moderator skrip dan kepatuhannya dengan Peraturan Dalaman adalah tidak dapat ditentukan. TradingView tidak menyarankan pembayaran untuk atau menggunakan skrip kecuali anda benar-benar mempercayai penulisnya dan memahami bagaimana ia berfungsi. Anda juga boleh mendapatkan alternatif sumber terbuka lain yang percuma dalam skrip komuniti kami.
Arahan penulis
Amaran: sila baca panduan kami untuk skrip jemputan sahaja sebelum memohon akses.
Penafian
Skrip jemputan sahaja
Hanya pengguna yang diberikan kebenaran oleh penulis mempunyai akses kepada skrip ini dan ini selalunya memerlukan pembayaran. Anda boleh menambahkan skrip kepada kegemaran anda tetapi anda hanya boleh menggunakannya selepas meminta kebenaran dan mendapatkannya daripada penulis โ ketarhui lebih lanjut di sini. Untuk lebih butiran, ikuti arahan penulis di bawah atau hubungi InfinityAlgo secara terus.
Ambil maklum bahawa skrip peribadi dan jemputan sahaja ini tidak disemak oleh moderator skrip dan kepatuhannya dengan Peraturan Dalaman adalah tidak dapat ditentukan. TradingView tidak menyarankan pembayaran untuk atau menggunakan skrip kecuali anda benar-benar mempercayai penulisnya dan memahami bagaimana ia berfungsi. Anda juga boleh mendapatkan alternatif sumber terbuka lain yang percuma dalam skrip komuniti kami.
Arahan penulis
Amaran: sila baca panduan kami untuk skrip jemputan sahaja sebelum memohon akses.