mql5/Scripts/Examples/ObjectSphere/SphereSample.mq5

82 lines
5.9 KiB
MQL5

2025-08-05 01:57:33 -04:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| SphereSample.mq5 |
//| Copyright 2000-2025, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2000-2025, MetaQuotes Ltd."
#property link "https://www.mql5.com"
//---
#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]={clrRed,clrBlue,clrYellow,clrGreen,clrGray};
//+------------------------------------------------------------------+
//| Script initialization function |
//+------------------------------------------------------------------+
int Init(void)
{
int i;
//--- creating objects
for(i=0;i<NUM_SPHERES;i++)
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);