//+------------------------------------------------------------------+ //| astro1.mq4 | //| Copyright © 2006, Abhi | //| http://www.megadelfi.com/experts/ | //| E-mail: astro1expert{Q)megadelfi.com | //| fix my e-mail address before mailing me ;) | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #import "swedll32.dll" int _swe_day_of_week@8(double jd); double _swe_julday@24(int _Year, int _Month, int _Day, double hour, int gregflg); int _swe_date_conversion@28 ( int y , int m , int d , /* year, month, day */ double hour, /* hours (decimal, with fraction) */ string c, /* calendar ‘g’[regorian]|’j’[ulian] */ double& tjd[]); /* return value for Julian day */ void _swe_revjul@28(double tjd, int gregflag, int& _year[], int& _month[], int& _day[], double& _hour[]); int _swe_calc_ut@24 ( double tjd_ut, int ipl, int iflag, double& xx[], string& serr[]); int _swe_houses_ex@40 ( double tjd_ut, int iflag, double geolat, double geolon, int ihsy, double& hcusps[], double& ascmc[]); double HourMinToHour(int _Hour_, int _Min_) { double asi,asi2; asi = _Min_; asi = asi/60; //Print(" asi ", asi); asi2 = _Hour_+asi; //Print(" asi2 ", asi2); return(asi2); } string outdeg(double x) { int degree = MathFloor(MathAbs(x)); double fract = MathAbs(x) - degree; int Min = MathFloor(fract * 60); int Sec = fract * 3600 - Min * 60; return (degree + "°" + Min + "'" + Sec + "''"); } int init() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { // we input current date and time to get the current positions of planets double julday = _swe_julday@24(TimeYear(CurTime()),TimeMonth(CurTime()),TimeDay(CurTime()),HourMinToHour(TimeHour(CurTime())-3,TimeMinute(CurTime())),1); // but if you want to test the output with your own horoscope, input your own data //double julday = _swe_julday@24(1961,1,13,HourMinToHour(15,30),1); int result; double planetpos[6]; string errors[6]; if(IsDllsAllowed()==false) { Print("DLL call is not allowed. Expert cannot run."); return(0); } Print(DoubleToStr(julday,6)); // output for test if julday is correct Print(_swe_day_of_week@8(julday)); // this prints out the day of week (0 = Monday) // let's now calculate the Sun's position. Second parameter is 0 result = _swe_calc_ut@24(julday,0,0,planetpos,errors); Print("Sun: " + outdeg(planetpos[0])); // and output the formated result Comment("Sun: " + outdeg(planetpos[0])); // Output to graph's left upper corner too // let's now calculate the Moon's position. Second parameter is 1 result = _swe_calc_ut@24(julday,1,0,planetpos,errors); Print("Moon:" + outdeg(planetpos[0])); // and output the formated result return(0); } //+------------------------------------------------------------------+