Man I love you guys.
I put in the original post that I didn't want to make MA changes for you, cause there's only like about a million different MA's combinations in MetaTrader (I'm sure I'm going to hear about that - I'm know someone on here has probably actually counted).
The post has been up less than a day and I have already had 3 requests for different MA's
Here's how you change the MA's - if you can type you can do this.
Open the mq4 file of the indicator in MetaEditor
Save the file under another name i.e. MA_Segments v2
Change the highlighted parts to match the MA you want to use. Replace the timeframe (PERIOD_D1) with one of these https://docs.mql4.com/constants/chartconstants/enum_timeframes Replace the period (200) with whatever number you want. Replace the MA Method (MODE_SMA) with the one you want https://docs.mql4.com/constants/indicatorconstants/enum_ma_method (Don't mess up the commas)
Change the red part of the variables to match your MA using this format MA_Timeframe_Period_MA Method
Change the green object names the same as you did the variables above. Note that the line and the label each have a name. (Don't mess up the double quotes)
Change the label text to match your MA.
Don't forget to change your comments also.
Click on Compile.
Thanks,
dave
PS: Now you're a programer too!!!
The variables are at the top... extern bool MA_D1_200_SMA = true; // set true to display These are further down... int deinit() { ObjectDelete("D1_200_SMA"); } // Daily 200 SMA line Change your comments too if (MA_D1_200_SMA) // draw if true { // if there is an old line delete it... if (ObjectFind("D1_200_SMA") != -1) ObjectDelete("D1_200_SMA"); // and draw a new one. ObjectCreate("D1_200_SMA", OBJ_TREND, 0, Time[0]+line_leader, iMA(NULL, PERIOD_D1,200,0,MODE_SMA,PRICE_CLOSE,0), (Time[0]+line_length+line_adjustment), iMA(NULL, PERIOD_D1,200,0,MODE_SMA,PRICE_CLOSE,0)); ObjectSet("D1_200_SMA", OBJPROP_RAY, false); ObjectSet("D1_200_SMA", OBJPROP_TIME1, Time[0]+line_leader); ObjectSet("D1_200_SMA", OBJPROP_TIME2, (Time[0]+line_length+line_adjustment)); ObjectSet("D1_200_SMA", OBJPROP_COLOR, Lime); } // Daily 200 SMA text label Change your comments too if (MA_D1_200_SMA) // draw if true { // if there is an old label delete it... if (ObjectFind("D1_200_SMA_label") != -1) ObjectDelete("D1_200_SMA_label"); // and draw new one. ObjectCreate("D1_200_SMA_label", OBJ_TEXT, 0, (Time[0]+text_shift+text_adjustment), iMA(NULL, PERIOD_D1,200,0,MODE_SMA,PRICE_CLOSE,0)); ObjectSet("D1_200_SMA_label", OBJPROP_TIME1, (Time[0]+text_shift+text_adjustment)); ObjectSet("D1_200_SMA_label", OBJPROP_COLOR, Lime); ObjectSetText("D1_200_SMA_label", "D1 200 SMA", font_size, "Arial", Lime); }
Will come back to look at this one as it is along the lines of something I want to do, ie; I want to be able to display MAV values no matter what time frame I'm in - like show the daily200MAV and the 1hr200mav even if I'm in say the 5 min chart
Will come back t it as I'm searching for something else atm........
Thank you so much,
great idea !! it 's very useful !!
:)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
MA's on the side:
Author: bdeyes