Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# 🚀 Unlock the Power of Trading!
|
||||
|
||||
Welcome to this open-source trading project. Here you will find powerful tools to enhance your trading journey. If you find this project useful, please consider starring ⭐, sharing, or donating to support further development!
|
||||
|
||||
---
|
||||
|
||||
**Support the project:**
|
||||
- Star this repository on GitHub
|
||||
- Share it with your trading friends
|
||||
- [Donate here](https://www.paypal.com/donate/?hosted_button_id=YOUR_BUTTON_ID) to help us grow!
|
||||
|
||||
---
|
||||

|
||||

|
||||
|
||||
## Source Files
|
||||
- `spheresample.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,105 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| SphereSample.mq5 |
|
||||
//| Copyright 2010, MetaQuotes Software Corp. |
|
||||
//| http://www.metaquotes.net/ |
|
||||
//| Revision 2010.02.08 |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "2010, MetaQuotes Software Corp."
|
||||
#property link "http://www.metaquotes.net"
|
||||
//---
|
||||
#include "Sphere.mqh"
|
||||
//---
|
||||
string ArrowChar="*";
|
||||
int SleepTime=50;
|
||||
//---
|
||||
#define NUM_SPHERES 5
|
||||
#define VISIBLE 0
|
||||
#define INVISIBLE 1
|
||||
//---
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script to demonstrate the use of arrays. |
|
||||
//+------------------------------------------------------------------+
|
||||
CSphere *Sphere[NUM_SPHERES];
|
||||
//--- arrays to initialize spheres
|
||||
int arrX[NUM_SPHERES]={100,100,300,500,500};
|
||||
int arrY[NUM_SPHERES]={100,500,300,500,350};
|
||||
int arrR[NUM_SPHERES]={30,40,100,60,20};
|
||||
int arrP[NUM_SPHERES]={10,13,30,20,7};
|
||||
int arrM[NUM_SPHERES]={10,13,30,20,7};
|
||||
color arrC[NUM_SPHERES]={Red,Blue,Yellow,Green,Gray};
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
int Init()
|
||||
{
|
||||
int i;
|
||||
//--- creating objects
|
||||
for(i=0;i<NUM_SPHERES;i++)
|
||||
{
|
||||
if((Sphere[i]=new CSphere)==NULL) break;
|
||||
if(!Sphere[i].Create(i,arrC[i],arrX[i],arrY[i],arrR[i],arrP[i],arrM[i],ArrowChar))
|
||||
break;
|
||||
}
|
||||
if(i!=NUM_SPHERES)
|
||||
{
|
||||
printf("Error creating sphere %d",i);
|
||||
return(-1);
|
||||
}
|
||||
//--- configuring orbits
|
||||
if(Sphere[0]!=NULL && Sphere[2]!=NULL)
|
||||
Sphere[0].SetOrbite(Sphere[2],M_PI/4,-M_PI/8,0,0.1);
|
||||
if(Sphere[1]!=NULL && Sphere[2]!=NULL)
|
||||
Sphere[1].SetOrbite(Sphere[2],-M_PI/8,-M_PI/16,M_PI/8,0.02);
|
||||
if(Sphere[3]!=NULL && Sphere[2]!=NULL)
|
||||
Sphere[3].SetOrbite(Sphere[2],M_PI/8,M_PI/4,M_PI/8,0.05);
|
||||
if(Sphere[4]!=NULL && Sphere[3]!=NULL)
|
||||
Sphere[4].SetOrbite(Sphere[3],M_PI/4,M_PI/8,M_PI/8,0.1);
|
||||
//---
|
||||
return(0);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void Deinit()
|
||||
{
|
||||
//--- deleting objects
|
||||
for(int i=0;i<NUM_SPHERES;i++)
|
||||
{
|
||||
if(Sphere[i]!=NULL)
|
||||
{
|
||||
delete Sphere[i];
|
||||
Sphere[i]=NULL;
|
||||
}
|
||||
}
|
||||
//---
|
||||
ChartRedraw();
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script program start function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnStart()
|
||||
{
|
||||
//--- call init function
|
||||
if(Init()==0)
|
||||
{
|
||||
//--- cycle until the script is not halted
|
||||
while(!IsStopped())
|
||||
{
|
||||
//--- öèêë ïî îáúåêòàì
|
||||
for(int i=0;i<NUM_SPHERES;i++)
|
||||
{
|
||||
if(Sphere[i]!=NULL)
|
||||
{
|
||||
Sphere[i].Recalculate();
|
||||
}
|
||||
}
|
||||
ChartRedraw();
|
||||
Sleep(SleepTime);
|
||||
}
|
||||
}
|
||||
//--- call deinit function
|
||||
Deinit();
|
||||
//---
|
||||
return(0);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Reference in New Issue
Block a user