This is the indicator that I would like to convert to metatrder4:
i wish i would understand prorealtime's language to help you with the corresponding commands in MQL,
you might try to explain what you are trying to do and what the code does.
in the meantime... Alphabetic Index of MQL4 Functions (600+)
oscargomezf:
And I've got another quiestion. How can I visualize a period of time of 2 hours. I only can M1, M5, M15, M30, H1, H4, D1, W1 and MN?
use offline charts
Hi gjol,
I am trying to programm this code:
totalprice= (high[0]+low[0]+open[0]+close[0]) /4
a=20
tw= 20
maximo1= highest[a](totalprice) // I calculate the maxmum value of 20 candels of the totalprice
minimo1=lowest[a](totalprice) // I calculate the minimum value of 20 candels of the totalprice
osc= (totalprice-minimo1)/(maximo1-minimo1)*100 //With this I create a new oscillator called osc
TMM = TriangularAverage[tw](osc) //Here I am calculating the triangular average with a period of tw=20 of the oscillator osc
WMM = WeightedAverage[tw](osc) //Here I am calculating the weithted average with a period of tw=20 of the oscillator osc
¿How can I make a triangular average of a series of number ? I can't find out any function of TriangularAverage or WeightedAverage.
I have only found out a function to calculate de moving average iMA, but I can only introduce: PRICE_CLOSE, PRICE_OPEN, PRICE_HIGH, , PRICE_LOW, PRICE_MEDIAN, PRICE_TYPICAL or PRICE_WEIGHTED. But a I need to introduce a series of numbers not a type of price (my oscillator osc).
Thank you so much.
Best regards.
oscargomezf: I have only found out a function to calculate de moving average iMA, but I can only introduce: PRICE_CLOSE, PRICE_OPEN, PRICE_HIGH, , PRICE_LOW, PRICE_MEDIAN, PRICE_TYPICAL or PRICE_WEIGHTED. But
| But nothing. If you want something else, you have to code it. You state you know how to calculate a SMA(n), the TMA= (SMA1 + SMA2 + SMA3 + SMA4 + ... SMAn) / n so code it. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem. |
calculation of TMA by the formula: TMA = (SMA1 + SMA2 + SMA3 + SMA4 + ... SMAn) / n.
where SMA is simple moving average
//+------------------------------------------------------------------+ //| TMA.mq4 | //| Copyright 2005-2014, MetaQuotes Software Corp. | //| https://www.mql4.com | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 DarkGray extern int n=4; extern int period=14; // period for SMA. TMA = (SMA1 + SMA2 + SMA3 + SMA4 + ... SMAn) / n. double Buffer0[]; datetime time; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //--- indicator buffers mapping IndicatorBuffers(1); IndicatorDigits(Digits); //--- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Buffer0); //--- name for DataWindow and indicator subwindow label string short_name="period= "+IntegerToString(period)+", n="+IntegerToString(n)+""; IndicatorShortName(short_name); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int bars=Bars; int counted_bars=IndicatorCounted(); int z=bars-counted_bars; int e,f,k; double s,y,x[]; int limit=period+n; if(z>2)limit=bars; ArrayResize(x,limit,limit); for(int i=0; i<limit; i++) { if(i>=period) { e=i-period; x[e]=s/period; s+=Close[i]-Close[e]; //--- TMA if(f>=n) { k=f-n; Buffer0[k]=y/n; y+=x[f]-x[k]; } else { if(f<n) { y+=x[f]; } } f++; //---- } else { if(i<period) { s+=Close[i]; } } } return(0); } //+------------------------------------------------------------------+
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I am new in metatrader 4, I come from prorealtime, but I think that metatrader 4 is better than prorealtime and I would like to learn to program in Metatrader4.
The problem is there are a lot of funcitons of prorealtme that don't exist in metatrader and I think that I have to program them.
This is the indicator that I would like to convert to metatrder4:
And I've got another quiestion. How can I visualize a period of time of 2 hours. I only can M1, M5, M15, M30, H1, H4, D1, W1 and MN?
Thank you very much.