Navigation´╝ÜHome > Content >

astro_swiss_(2).mq4

Time: 2013-11-21 | Download file:astro_swiss_(2).mq4

#import "swedll32.dll"
  
  double _swe_julday@24(
	int year, int month, int day, double hour, 
	int gregflag);
  
  double _swe_deltat@8(
   double tjd);
  
  int _swe_calc@24(
   double tjd, //{Julian day number}
   int ipl, //{planet number}
   int iflag, //{flag bits}
   double& xx[], //{first of 6 doubles}
   string& sErr); //{Error-String}
   
   
   void _swe_set_topo@24(double geolon, double geolat, double altitude);
			/* eastern longitude is positive,  western longitude is negative,
			   northern latitude is positive,	  southern latitude is negative */
	
	
	
   int _swe_houses@36(
   double tjd_ut, 	/* Julian day number, UT */
   double geolat, 	/* geographic latitude, in degrees */
   double geolon, 	/* geographic longitude, in degrees
			 * eastern longitude is positive,
			 * western longitude is negative,
			 * northern latitude is positive,
			 * southern latitude is negative */
   int hsys, 		/* house method, ascii code of one of the letters PKORCAEVXHTBG */
   double& cusps[], 	/* array for 13 doubles: 1 empty + 12 houses * */
   double& ascmc[]);	/* array for 10 doubles */
   
	// note about hsys, int a = 'P'; etc, see MQL4 Reference - Basics - Data types - Literal constants
   
   
/*
cusps[0] = 0
cusps[1] = house 1
cusps[2] = house 2
...

In the array ascmc, the function returns the following values: 
ascmc[0] = 	Ascendant
ascmc[1] =	MC
ascmc[2] =	ARMC
ascmc[3] =	Vertex
ascmc[4] =	"equatorial ascendant"
ascmc[5] =	"co-ascendant" (Walter Koch)
ascmc[6] =	"co-ascendant" (Michael Munkasey)
ascmc[7] =	"polar ascendant" (M. Munkasey)
*/   
   
   
   
   int _swe_houses_ex@40(
	double tjd_ut, 	/* Julian day number, UT */
	int iflag,//int32 iflag, 		/* 0 or SEFLG_SIDEREAL or SEFLG_RADIANS */
	double geolat, 	/* geographic latitude, in degrees */
	double geolon, 	/* geographic longitude, in degrees
			 * eastern longitude is positive,
			 * western longitude is negative,
			 * northern latitude is positive,
			 * southern latitude is negative */
	int hsys, 		/* house method, ascii code of one of the letters PKORCAEVXHTBG */
	double& cusps[], 	/* array for 13 doubles */
   double& ascmc[]);	/* array for 10 doubles */ 
   
   
   
#import

#define SE_ASC		0
#define SE_MC		1
#define SE_ARMC		2
#define SE_VERTEX		3
#define SE_EQUASC  		4	/* "equatorial ascendant" */
#define SE_COASC1		5	/* "co-ascendant" (W. Koch) */
#define SE_COASC2		6	/* "co-ascendant" (M. Munkasey) */
#define SE_POLASC		7	/* "polar ascendant" (M. Munkasey) */
#define SE_NASCMC		8


// ---------------------------------------------------------
#define SE_ECL_NUT	     -1      
#define SE_SUN          	0       
#define SE_MOON         	1       
#define SE_MERCURY      	2       
#define SE_VENUS        	3       
#define SE_MARS         	4       
#define SE_JUPITER      	5       
#define SE_SATURN       	6       
#define SE_URANUS       	7       
#define SE_NEPTUNE      	8       
#define SE_PLUTO        	9       
#define SE_MEAN_NODE    	10      
#define SE_TRUE_NODE    	11
#define SE_MEAN_APOG    	12      
#define SE_OSCU_APOG    	13    
#define SE_EARTH        	14 
#define SE_CHIRON       	15 
#define SE_PHOLUS       	16 
#define SE_CERES        	17 
#define SE_PALLAS       	18 
#define SE_JUNO         	19
#define SE_VESTA        	20

#define SE_FICT_OFFSET  	40
#define SE_NFICT_ELEM           	15

/* Hamburger or Uranian "planets" */

#define SE_CUPIDO       	40
#define SE_HADES        	41
#define SE_ZEUS         	42
#define SE_KRONOS       	43
#define SE_APOLLON      	44
#define SE_ADMETOS      	45
#define SE_VULKANUS     	46
#define SE_POSEIDON     	47

/* other fictitious bodies */

#define SE_ISIS         	48
#define SE_NIBIRU       	49
#define SE_HARRINGTON           50
#define SE_NEPTUNE_LEVERRIER    51
#define SE_NEPTUNE_ADAMS        52
#define SE_PLUTO_LOWELL         53
#define SE_PLUTO_PICKERING      54
#define SE_VULCAN      		55
#define SE_WHITE_MOON  		56
#define SE_PROSERPINA  		57
#define SE_WALDEMATH  		58

#define SE_AST_OFFSET	10000

// ---------------------------------------- iflag

#define SEFLG_JPLEPH    	1	// use JPL ephemeris 
#define SEFLG_SWIEPH    	2	// use SWISSEPH ephemeris, default
#define SEFLG_MOSEPH    	4	// use Moshier ephemeris 

#define SEFLG_HELCTR         	8	// return heliocentric position 
#define SEFLG_TRUEPOS 	16	// return true positions, not apparent 
#define SEFLG_J2000          	32	// no precession, i.e. give J2000 equinox 
#define SEFLG_NONUT          	64	// no nutation, i.e. mean equinox of date 
#define SEFLG_SPEED3         	128	// speed from 3 positions (do not use it, SEFLG_SPEED is
				// faster and preciser.) 
#define SEFLG_SPEED          	256	// high precision speed (analyt. comp.)
#define SEFLG_NOGDEFL 	512	// turn off gravitational deflection 
#define SEFLG_NOABERR 	1024	// turn off 'annual' aberration of light 
#define SEFLG_EQUATORIAL	2048	// equatorial positions are wanted 
#define SEFLG_XYZ            	4096	// cartesian, not polar, coordinates 
#define SEFLG_RADIANS       	8192	// coordinates in radians, not degrees 
#define SEFLG_BARYCTR       	16384	// barycentric positions 
//#define SEFLG_TOPOCTR 	(32*1024)	// topocentric positions 
//#define SEFLG_SIDEREAL	(64*1024)	// sidereal positions 


// ---------------------------------------------------------

string serr = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";

double astro_swe_calc(datetime d, int body, int iflag, double& longtitude, double& latitude, double& distance, double& speed_longtitude)
{
   //datetime d = Time[shift];
   double tjd = _swe_julday@24(TimeYear(d), TimeMonth(d), TimeDay(d), TimeHour(d)+TimeMinute(d)/60, 1); //dhour := ihour + imin / 60.0 + isec / 3600.0;
   //ExtMapBuffer1[shift] = tjd;
   double deltat = _swe_deltat@8(tjd);
   //ExtMapBuffer2[shift] = deltat;
   double tjdet = tjd + deltat;
   //
   //int iflag = 0;//SEFLG_HELCTR;
   double xx[6];
   //string serr1 = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
   //string serr2 = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
   //string serr3 = "12345678901234567890123456789012345678901234567890";
   //string serr = serr1 + serr2 + serr3;
   int rflag = _swe_calc@24(tjdet, body, iflag, xx, serr); //[0]
   longtitude = xx[0];
   latitude = xx[1];
   distance = xx[2];
   speed_longtitude = xx[3]; // not work?
   //Print(serr);
/*
0 Longitude	Rectascension
1 Latitude	Declination
2 Distance in AU	distance in AU
3 Speed in longitude (deg/day)	Speed in rectascension (deg/day)
4 Speed in latitude (deg/day)	Speed in declination (deg/day)
5 Speed in distance (AU/day)	Speed in distance (AU/day)
*/
}

double astro_swe_ascendant(datetime d)
{
   //
   //
   //
}



string astro_bodyname(int body)
{
   string name;
   switch(body)
   {
     case -1: name = "all planets"; break;
     case 0: name = "SE_SUN"; break;
     case 1: name = "SE_MOON"; break;
     case 2: name = "SE_MERCURY"; break;
     case 3: name = "SE_VENUS"; break;
     case 4: name = "SE_MARS"; break;
     case 5: name = "SE_JUPITER"; break;
     case 6: name = "SE_SATURN"; break;
     case 7: name = "SE_URANUS"; break;
     case 8: name = "SE_NEPTUNE"; break;
     case 9: name = "SE_PLUTO"; break;
     
     case 14: name = "SE_EARTH"; break;
     case 15: name = "SE_CHIRON"; break;
     default: name = "()";break;
  }
  return(name);
}



string astro_iflag(int iflag)
{
   string name;
   switch(iflag)
   {
     case 0: name = "geo"; break;
     case 8: name = "helio"; break;
     default: name = "()"; break;
   }
   return(name);
}



void astro_swe_set_topo(double geolon, double geolat, double altitude)
{
   _swe_set_topo@24(geolon, geolat, altitude);
}


double astro_swe_houses(datetime d)
{
   double tjd = _swe_julday@24(TimeYear(d), TimeMonth(d), TimeDay(d), TimeHour(d)+TimeMinute(d)/60, 1); //dhour := ihour + imin / 60.0 + isec / 3600.0;
   //double deltat = _swe_deltat@8(tjd);
   //double tjdet = tjd + deltat;
   
   //tjd_et = tjd_ut + delta_t(tjd_ut). 
   //double tjd_ut = tjd_et - delta_t(tdj_ut)
   
   //
   double long = -50;
   double lat = -50;
   //
   int ii = 'P';
   //
   double cusps[13];
   double ascmc[10];
   
   _swe_houses@36(tjd, long,lat, ii, cusps, ascmc);
   //
   return(ascmc[SE_ASC]);
}




Recommend