Custom Moving Average Input - MetaTrader 5 Script | Forex Indicator Download - MT4/MT5 Resources



Two settings have been added to the input parameters: line color ( color ) and line width ( width ).

You may notice that if the Expert Advisor uses Moving Average indicator data, this indicator only appears in red color in the visual tester mode. If such an EA uses data from three moving averages, all three indicators will appear in red.

So distinguishing them is very difficult.
To solve the problem of visual display of moving averages, two parameters have been added to the strategy tester: line color and line width . Now, Expert Advisors require access to iCustom instead of iMA:
//--- Create a handle to the iMA indicator Handle_iMA_First= Custom (m_symbol.Name(), Period (), "Customized moving average input" , InpMAPeriodFirst, InpMAShiftFirst, InpMAMethodFirst, InpMAFirstColor , InpMAFirstWith , PRICE_CLOSE ); //--- If the handle is not created if (handle_iMA_First== INVALID_HANDLE ) { //--- Inform of failure and output error code print format ( "Unable to create iMA indicator handle for symbol %s/%s, error code %d" , symbol (), Enumeration to string ( period ()), getLastError ()); //--- The indicator stops returning early ( initialization failed ); }
Indicator color and width can now be managed directly from Expert Advisor:

Attachment download
📎 custom_moving_average_inputs.mq5 (14.88 KB)
Source: MQL5 #21779
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •