Customize Moving Average Input Color - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources




Added new input parameter "Line Color".

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, the "Line Color" parameter has been added to the Strategy Tester. Now, the Expert Advisor needs access to iCustom instead of iMA (example in the code is a cross between two iMAs ):
//--- Create a handle to the iMA indicator Handle_iMA_First= Custom (m_symbol.Name(), Period (), "Customize moving average input color" , InpMAPeriodFirst, InpMAShiftFirst, InpMAMethodFirst, InpMAFirstColor, PRICE_CLOSE ); //handle_iMA_First=iMA(Symbol(),Period(),InpMAPeriodFirst,InpMAShiftFirst,InpMAMethodFirst,PRICE_CLOSE); //--- if 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 ); }
As in the cross EA of two iMAs , the moving averages are displayed in different colors in the visual strategy tester:

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