Wellx Optimized Variant of Kaufman Adaptive Moving Average - MetaTrader 4 Script - MT4/MT5 Resource

Optimized variant of Wellx's AMA indicator . The original version was optimized for use in Expert Advisor in December 2006. The unoptimized version consumes resources and allows execution/optimization of EAs containing calls to AMA in a reasonable time.
Its appearance is the same as the original.

Optimized variant of Kaufman adaptive moving average
Use Simple Expert to "feel the difference" in test speed.
//+------------------------------------------------------------------+ //| TestAMA.mq4 | //| Roche| //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "rosh" #Property associated with "http://www.metaquotes.net" External integer AMA type = 1 ; //+---------------------------------------------------------------------------------+ //|Expert initialization function | //+------------------------------------------------------------------+ integer_initialize () { //---- if (AMA type! = 0 ) print ( "Use optimization indicators" ); elseprint ( "Use original version of indicator" ) ; print ( "start" ); //---- return ( 0 ); } //+------------------------------------------------------------------+ //|Expert to initialize function | //+------------------------------------------------------------------+ integer deinitialization() { //---- Print ( "End" ); //---- Return ( 0 ); } //+------------------------------------------------------------------+ //|Expert start function | //+------------------------------------------------------------------+ integer start() { //---- Double value; if (AMA type != 0 ) value = custom ( symbol (), 0 , "AMA by Expert 2" , 0 , 1 ); Other values = custom ( symbol (), 0 , "Ama" , 0 , 1 ); //---- Return ( 0 ); } //+------------------------------------------------------------------+
If the external variable AMAtype=0, the original one is used, if it is not zero, the indicator is used.
Attachment download
📎AMA_for_Expert2.mq4 (5.31 KB)
Source: MQL5 #7379
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •