extern int PeriodoMediaVeloce=50;
extern int PeriodoMediaMedium=100;
extern int PeriodoMediaLenta=200;
input ENUM_TIMEFRAMES PeriodoMediaVeloce = PERIOD_CURRENT, PeriodoMediaMedium = PERIOD_CURRENT, PeriodoMediaLenta = PERIOD_CURRENT;
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ double FastMovingAverage, LastFastMovingAverage, MediumMovingAverage, LastMediumMovingAverage, SlowMovingAverage, LastSlowMovingAverage; void OnTick() { FastMovingAverage = iMA(Symbol(),0,PeriodoMediaVeloce,0,MODE_EMA,PRICE_CLOSE,0); LastFastMovingAverage = iMA(Symbol(),0,PeriodoMediaVeloce,0,MODE_EMA,PRICE_CLOSE,1); MediumMovingAverage = iMA(Symbol(),0,PeriodoMediaMedium,0,MODE_EMA,PRICE_CLOSE,0); LastMediumMovingAverage = iMA(Symbol(),0,PeriodoMediaMedium,0,MODE_EMA,PRICE_CLOSE,1); SlowMovingAverage = iMA(Symbol(),0,PeriodoMediaLenta,0,MODE_EMA,PRICE_CLOSE,0); LastSlowMovingAverage = iMA(Symbol(),0,PeriodoMediaLenta,0,MODE_EMA,PRICE_CLOSE,1); if(NewBar()){ calcolasize(Rischio); if(condizionelong()) EseguiOrdineLong(); if(condizioneshort())EseguiOrdineShort(); } }
Mladen Rakic :
Why are you using time frames for average period parameter instead of average period?
Why are you using time frames for average period parameter instead of average period?
I dont have anything. Simply corrected the code. And that's all.
iMA
[in] Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.
Konstantin Nikitin:
I dont have anything. Simply corrected the code. And that's all.
iMA
[in] Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.
This is a correction?
input ENUM_TIMEFRAMES PeriodoMediaVeloce = PERIOD_CURRENT, PeriodoMediaMedium = PERIOD_CURRENT, PeriodoMediaLenta = PERIOD_CURRENT;
Mladen Rakic :
This is a correction?
And this ...
You can specify only minutes. But it's easier to use the finished enumeration.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone and sorry for my English, I'm starting to program in mql4 and to do a simple and on the crossover moving averages. The problem is that the ea does not open positions, opens them only if I delete Lastfastmovingaverages, lastmediummoving etc. .. and I leave only those on the current candle.