How do you define ascending? That's how you code it.
that's my problem.
I don't know how to define.can someone help me and give me an idea to define it?
masoud0455_a: that's my problem.I don't know how to define.
| Perhaps:
Ascending | Define Ascending at Dictionary.com |
:-)))
I got it and I coded it.
Just get 2 price of first and 15 candle back and subtract them and compare the result with my define distance.
#property copyright "Masoud" #property link "https://www.mql5.com" #property version "1.00" #property strict #property show_inputs extern int CandlesBack=15; //How many candles look back: extern int pipsdefine=5;//How many pips define at M5 //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { double pips =Point; if(Digits==3||Digits==5) pips*=10; //------ int timef; double distance=pipsdefine*pips; switch(Period()) { case 15: timef=15; distance*=2; break; //10 pips M15 case 30: timef=30; distance*=4; break; //20 pips M30 case 60: timef=60; distance*=4; break; case 240: timef=240; distance*=5; break; case 1440:timef=1440; distance*=12; break; default:timef=5; break; } double startSMA20 =iMA(Symbol(),timef,20,0,MODE_SMA,PRICE_CLOSE,1); double endSMA20 =iMA(Symbol(),timef,20,0,MODE_SMA,PRICE_CLOSE,CandlesBack); if(startSMA20-endSMA20 > distance) MessageBox("Ascending","Trend Info"); else if(startSMA20-endSMA20 < -distance) MessageBox("Descending","Trend Info"); else MessageBox("Sideway","Trend Info"); }
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
I want to know Ascending/Descending moving average in mql4.
give me an idea to code this. How can I do it?