Required Help for MQL4 Programing (Indicator)

 

Hi,


I am New to MQL4. I don't have much experience in MQL4 and also normal programing.

I required help from seniors.

1st I have done average of 14 days high by mentioning

double high1,high2,high3,...........high13,high14;

high1=high[1];

high2=high[2];

high3=high[3];

...........

............

..................

high14=high[14];


double totalhigh,highavg;

totalhigh=high1+high2+high3+..................high13+high14;

highavg=totalhigh/14;

==================================================

from here onwards, I want help from you to proceed further.

I want to draw line on Indicator filed " highavg " value. simply i want to create an indicator with 14 days average of HIGH. The 14 days average I have assigned to "highavg" variable. So plz help me to code to draw line on indicator filed with the value of " highavg "

 

this indicator is already ready & waiting for u in your "MT4" platform it's called Moving Average

iMA(Symbol(),0,14,0,MODE_SMA,PRICE_HIGH,0)

& plaese for the next time

 
If you are writting an indicator, put the ima() in to a buffer. If you are writting an EA, draw the line. If you just want the line on the chart, attach the moving average indicator.
static string objName="Ave(H,14)";
    /**/ if(ObjectMove(objName, 1, time[14]  highave))
            ObjectMove(objName, 0, time[1],  highave); // New or tmplt.
    else if (!ObjectCreate( objName, OBJ_TREND, WINDOW_MAIN
                          , time[14], highave, time[1],  highave)){   Alert(
        "ObjectCreate(", objName, "Trend) [1] failed: ",GetLastError());return;}
    else if (!ObjectSet( objName, OBJPROP_COLOR, clr ))                 Alert(
        "ObjectSet(", objName, "Color) [2] failed: ",   GetLastError());
    else if (!ObjectSet( objName, OBJPROP_RAY, false ))                 Alert(
        "ObjectSet(", objName, "Ray) [1] failed: ",     GetLastError());
 
qjol:

this indicator is already ready & waiting for u in your "MT4" platform it's called Moving Average

& plaese for the next time



It's just an example. The original need is different. If you don't mind, can mention the code " to draw line with the value of " highavg"?"
 
WHRoeder:
If you are writting an indicator, put the ima() in to a buffer. If you are writting an EA, draw the line. If you just want the line on the chart, attach the moving average indicator.



Sorry, I can't understand what you have replied. plz mention simply what you have said
 

1) u start with high[1] == 1 bar shift (i hope u know that)

2) no need to write high1 high2 .... use for loop

3) show some code & we will try to help u otherwise i have 2 suggestion for u 1) start here or 2) https://www.mql5.com/en/forum/128324