Download MetaTrader 5

Indicators: MA's on the side

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
186000
MetaQuotes Software Corp.  

MA's on the side:

Often times I find my chart is too cluttered with indicators to see the price action, however I still need those reference points. My solution was to create an indicator which displays the current level of some of the MA's of the current candle.

Author: bdeyes

bdeyes
74
bdeyes  

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); 
    }
Johannes Jilles van Duijn
797
Johannes Jilles van Duijn  
good idee bad indicator
Seth
19
Seth  

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........

MQL4 Comments
16319
MQL4 Comments  

Thank you so much,

great idea !! it 's very useful !!

:)

To add comments, please log in or register