And now in version 1.7, at what level is the stop loss?я добавлю глобальные TP и SL на основе прибыли / убытка в валюте счета.
And now in version 1.7, at what level is the stop loss?я добавлю глобальные TP и SL на основе прибыли / убытка в валюте счета.
Omg... that awsome... how u can able get to gpu instruction (except u are using native language dll)? I think in mql5 programming library cant do it...
//+------------------------------------------------------------------+
//| FFT_GPU |
//+------------------------------------------------------------------+
bool FFT_GPU(int direction,int power,float &data_real[],float &data_imag[],ulong &time_gpu)
{
//--- calculate the number of points
int num_points=1;
for(int i=0;i<power;i++)
num_points*=2;
//--- prepare data array for GPU calculation
float data[];
ArrayResize(data,2*num_points);
for(int i=0; i<num_points; i++)
{
data[2*i]=data_real[i];
data[2*i+1]=data_imag[i];
}
COpenCL OpenCL;
if(!OpenCL.Initialize(cl_program,true))
{
PrintFormat("Error in OpenCL initialization. Error code=%d",GetLastError());
return(false);
}
//--- create kernels
OpenCL.SetKernelsCount(3);
OpenCL.KernelCreate(0,kernel_init);
OpenCL.KernelCreate(1,kernel_stage);
OpenCL.KernelCreate(2,kernel_scale);
//--- create buffers
OpenCL.SetBuffersCount(2);
if(!OpenCL.BufferFromArray(0,data,0,2*num_points,CL_MEM_READ_ONLY))
{
PrintFormat("Error in BufferFromArray for input buffer. Error code=%d",GetLastError());
return(false);
}
if(!OpenCL.BufferCreate(1,2*num_points*sizeof(float),CL_MEM_READ_WRITE))
{
PrintFormat("Error in BufferCreate for data buffer. Error code=%d",GetLastError());
return(false);
}
//--- determine maximum work-group size
int local_size=(int)CLGetInfoInteger(OpenCL.GetKernel(0),CL_KERNEL_WORK_GROUP_SIZE);
//--- determine local memory size
uint local_mem_size=(uint)CLGetInfoInteger(OpenCL.GetContext(),CL_DEVICE_LOCAL_MEM_SIZE);
int points_per_group=(int)local_mem_size/(2*sizeof(float));
if(points_per_group>num_points)
points_per_group=num_points;
//--- set kernel arguments
OpenCL.SetArgumentBuffer(0,0,0);
OpenCL.SetArgumentBuffer(0,1,1);
OpenCL.SetArgumentLocalMemory(0,2,local_mem_size);
OpenCL.SetArgument(0,3,points_per_group);
OpenCL.SetArgument(0,4,num_points);
OpenCL.SetArgument(0,5,direction);
//--- OpenCL execute settings
int task_dimension=1;
uint global_size=(uint)((num_points/points_per_group)*local_size);
uint global_work_offset[1]={0};
uint global_work_size[1];
global_work_size[0]=global_size;
uint local_work_size[1];
local_work_size[0]=local_size;
//--- GPU calculation start
time_gpu=GetMicrosecondCount();
//-- execute kernel fft_init
if(!OpenCL.Execute(0,task_dimension,global_work_offset,global_work_size,local_work_size))
{
PrintFormat("fft_init: Error in CLExecute. Error code=%d",GetLastError());
return(false);
}
//-- further stages of the FFT
if(num_points>points_per_group)
{
//--- set arguments for kernel 1
OpenCL.SetArgumentBuffer(1,0,1);
OpenCL.SetArgument(1,2,points_per_group);
OpenCL.SetArgument(1,3,direction);
for(int stage=2; stage<=num_points/points_per_group; stage<<=1)
{
OpenCL.SetArgument(1,1,stage);
//-- execute kernel fft_stage
if(!OpenCL.Execute(1,task_dimension,global_work_offset,global_work_size,local_work_size))
{
PrintFormat("fft_stage: Error in CLExecute. Error code=%d",GetLastError());
return(false);
}
}
}
//--- scale values if performing the inverse FFT
if(direction<0)
{
OpenCL.SetArgumentBuffer(2,0,1);
OpenCL.SetArgument(2,1,points_per_group);
OpenCL.SetArgument(2,2,num_points);
//-- execute kernel fft_scale
if(!OpenCL.Execute(2,task_dimension,global_work_offset,global_work_size,local_work_size))
{
PrintFormat("fft_scale: Error in CLExecute. Error code=%d",GetLastError());
return(false);
}
}
//--- read the results from GPU memory
if(!OpenCL.BufferRead(1,data,0,0,2*num_points))
{
PrintFormat("Error in BufferRead for data_buffer2. Error code=%d",GetLastError());
return(false);
}
//--- GPU calculation finished
time_gpu=ulong((GetMicrosecondCount()-time_gpu));
//--- copy calculated data and release OpenCL handles
for(int i=0; i<num_points; i++)
{
data_real[i]=data[2*i];
data_imag[i]=data[2*i+1];
}
OpenCL.Shutdown();
//---
return(true);
}
ça va être incroyable ! sais tu quand sera disponible cette version ?myg3nx
You can easily find tutos on this matter...
Code://+------------------------------------------------------------------+ //| FFT_GPU | //+------------------------------------------------------------------+ bool FFT_GPU(int direction,int power,float &data_real[],float &data_imag[],ulong &time_gpu) { //--- calculate the number of points int num_points=1; for(int i=0;i<power;i++) num_points*=2; //--- prepare data array for GPU calculation float data[]; ArrayResize(data,2*num_points); for(int i=0; i<num_points; i++) { data[2*i]=data_real[i]; data[2*i+1]=data_imag[i]; } COpenCL OpenCL; if(!OpenCL.Initialize(cl_program,true)) { PrintFormat("Error in OpenCL initialization. Error code=%d",GetLastError()); return(false); } //--- create kernels OpenCL.SetKernelsCount(3); OpenCL.KernelCreate(0,kernel_init); OpenCL.KernelCreate(1,kernel_stage); OpenCL.KernelCreate(2,kernel_scale); //--- create buffers OpenCL.SetBuffersCount(2); if(!OpenCL.BufferFromArray(0,data,0,2*num_points,CL_MEM_READ_ONLY)) { PrintFormat("Error in BufferFromArray for input buffer. Error code=%d",GetLastError()); return(false); } if(!OpenCL.BufferCreate(1,2*num_points*sizeof(float),CL_MEM_READ_WRITE)) { PrintFormat("Error in BufferCreate for data buffer. Error code=%d",GetLastError()); return(false); } //--- determine maximum work-group size int local_size=(int)CLGetInfoInteger(OpenCL.GetKernel(0),CL_KERNEL_WORK_GROUP_SIZE); //--- determine local memory size uint local_mem_size=(uint)CLGetInfoInteger(OpenCL.GetContext(),CL_DEVICE_LOCAL_MEM_SIZE); int points_per_group=(int)local_mem_size/(2*sizeof(float)); if(points_per_group>num_points) points_per_group=num_points; //--- set kernel arguments OpenCL.SetArgumentBuffer(0,0,0); OpenCL.SetArgumentBuffer(0,1,1); OpenCL.SetArgumentLocalMemory(0,2,local_mem_size); OpenCL.SetArgument(0,3,points_per_group); OpenCL.SetArgument(0,4,num_points); OpenCL.SetArgument(0,5,direction); //--- OpenCL execute settings int task_dimension=1; uint global_size=(uint)((num_points/points_per_group)*local_size); uint global_work_offset[1]={0}; uint global_work_size[1]; global_work_size[0]=global_size; uint local_work_size[1]; local_work_size[0]=local_size; //--- GPU calculation start time_gpu=GetMicrosecondCount(); //-- execute kernel fft_init if(!OpenCL.Execute(0,task_dimension,global_work_offset,global_work_size,local_work_size)) { PrintFormat("fft_init: Error in CLExecute. Error code=%d",GetLastError()); return(false); } //-- further stages of the FFT if(num_points>points_per_group) { //--- set arguments for kernel 1 OpenCL.SetArgumentBuffer(1,0,1); OpenCL.SetArgument(1,2,points_per_group); OpenCL.SetArgument(1,3,direction); for(int stage=2; stage<=num_points/points_per_group; stage<<=1) { OpenCL.SetArgument(1,1,stage); //-- execute kernel fft_stage if(!OpenCL.Execute(1,task_dimension,global_work_offset,global_work_size,local_work_size)) { PrintFormat("fft_stage: Error in CLExecute. Error code=%d",GetLastError()); return(false); } } } //--- scale values if performing the inverse FFT if(direction<0) { OpenCL.SetArgumentBuffer(2,0,1); OpenCL.SetArgument(2,1,points_per_group); OpenCL.SetArgument(2,2,num_points); //-- execute kernel fft_scale if(!OpenCL.Execute(2,task_dimension,global_work_offset,global_work_size,local_work_size)) { PrintFormat("fft_scale: Error in CLExecute. Error code=%d",GetLastError()); return(false); } } //--- read the results from GPU memory if(!OpenCL.BufferRead(1,data,0,0,2*num_points)) { PrintFormat("Error in BufferRead for data_buffer2. Error code=%d",GetLastError()); return(false); } //--- GPU calculation finished time_gpu=ulong((GetMicrosecondCount()-time_gpu)); //--- copy calculated data and release OpenCL handles for(int i=0; i<num_points; i++) { data_real[i]=data[2*i]; data_imag[i]=data[2*i+1]; } OpenCL.Shutdown(); //--- return(true); }
APEX scanner is just some code to detect extremes to the upside or the downside...
Why do u use gpu instead using cpu core to make it work? And im sure 98% vps in this world doesnt have cuda driver installed... and if exist, for renting is soooo expensive like hell...myg3nx
You can easily find tutos on this matter...
Code://+------------------------------------------------------------------+ //| FFT_GPU | //+------------------------------------------------------------------+ bool FFT_GPU(int direction,int power,float &data_real[],float &data_imag[],ulong &time_gpu) { //--- calculate the number of points int num_points=1; for(int i=0;i<power;i++) num_points*=2; //--- prepare data array for GPU calculation float data[]; ArrayResize(data,2*num_points); for(int i=0; i<num_points; i++) { data[2*i]=data_real[i]; data[2*i+1]=data_imag[i]; } COpenCL OpenCL; if(!OpenCL.Initialize(cl_program,true)) { PrintFormat("Error in OpenCL initialization. Error code=%d",GetLastError()); return(false); } //--- create kernels OpenCL.SetKernelsCount(3); OpenCL.KernelCreate(0,kernel_init); OpenCL.KernelCreate(1,kernel_stage); OpenCL.KernelCreate(2,kernel_scale); //--- create buffers OpenCL.SetBuffersCount(2); if(!OpenCL.BufferFromArray(0,data,0,2*num_points,CL_MEM_READ_ONLY)) { PrintFormat("Error in BufferFromArray for input buffer. Error code=%d",GetLastError()); return(false); } if(!OpenCL.BufferCreate(1,2*num_points*sizeof(float),CL_MEM_READ_WRITE)) { PrintFormat("Error in BufferCreate for data buffer. Error code=%d",GetLastError()); return(false); } //--- determine maximum work-group size int local_size=(int)CLGetInfoInteger(OpenCL.GetKernel(0),CL_KERNEL_WORK_GROUP_SIZE); //--- determine local memory size uint local_mem_size=(uint)CLGetInfoInteger(OpenCL.GetContext(),CL_DEVICE_LOCAL_MEM_SIZE); int points_per_group=(int)local_mem_size/(2*sizeof(float)); if(points_per_group>num_points) points_per_group=num_points; //--- set kernel arguments OpenCL.SetArgumentBuffer(0,0,0); OpenCL.SetArgumentBuffer(0,1,1); OpenCL.SetArgumentLocalMemory(0,2,local_mem_size); OpenCL.SetArgument(0,3,points_per_group); OpenCL.SetArgument(0,4,num_points); OpenCL.SetArgument(0,5,direction); //--- OpenCL execute settings int task_dimension=1; uint global_size=(uint)((num_points/points_per_group)*local_size); uint global_work_offset[1]={0}; uint global_work_size[1]; global_work_size[0]=global_size; uint local_work_size[1]; local_work_size[0]=local_size; //--- GPU calculation start time_gpu=GetMicrosecondCount(); //-- execute kernel fft_init if(!OpenCL.Execute(0,task_dimension,global_work_offset,global_work_size,local_work_size)) { PrintFormat("fft_init: Error in CLExecute. Error code=%d",GetLastError()); return(false); } //-- further stages of the FFT if(num_points>points_per_group) { //--- set arguments for kernel 1 OpenCL.SetArgumentBuffer(1,0,1); OpenCL.SetArgument(1,2,points_per_group); OpenCL.SetArgument(1,3,direction); for(int stage=2; stage<=num_points/points_per_group; stage<<=1) { OpenCL.SetArgument(1,1,stage); //-- execute kernel fft_stage if(!OpenCL.Execute(1,task_dimension,global_work_offset,global_work_size,local_work_size)) { PrintFormat("fft_stage: Error in CLExecute. Error code=%d",GetLastError()); return(false); } } } //--- scale values if performing the inverse FFT if(direction<0) { OpenCL.SetArgumentBuffer(2,0,1); OpenCL.SetArgument(2,1,points_per_group); OpenCL.SetArgument(2,2,num_points); //-- execute kernel fft_scale if(!OpenCL.Execute(2,task_dimension,global_work_offset,global_work_size,local_work_size)) { PrintFormat("fft_scale: Error in CLExecute. Error code=%d",GetLastError()); return(false); } } //--- read the results from GPU memory if(!OpenCL.BufferRead(1,data,0,0,2*num_points)) { PrintFormat("Error in BufferRead for data_buffer2. Error code=%d",GetLastError()); return(false); } //--- GPU calculation finished time_gpu=ulong((GetMicrosecondCount()-time_gpu)); //--- copy calculated data and release OpenCL handles for(int i=0; i<num_points; i++) { data_real[i]=data[2*i]; data_imag[i]=data[2*i+1]; } OpenCL.Shutdown(); //--- return(true); }
APEX scanner is just some code to detect extremes to the upside or the downside...
As long as we keep learning life stays interesting . You are doing an amazing job and love the idea of using more CPU/GPU for improved pattern detection.That's why I've made this option switchable
I'm learning while giving to this community, nothing wrong with that...
Hello, the expert is free? Is there limitation? thank you.
Hi there !
Here's a little experiment I've been working on lately.
It's a MT5 EA and it trades the 28 pairs simultaneously.
You just need to load it on one M1 chart ONLY !
The default presets are the right ones...
This EA analyzes 100 moving averages per pair and tries to spots bear/bull momentum.
No expiry.
Lot size limited to 0.01 lot.
It's an experimental robot at this stage so don't use it LIVE yet as it has no SL strategy...
Cheers![]()
Symphoenix, can not a little more about the stop loss? And in absolute numbers?
Thanks Symphoenix, can I do backtesting?ho_analista
Hello !
The only limitation of the version posted on this thread is the lots size...
Best regards
Afar255
There is a stealth stop loss that is created when the drawdown exceeds Emergency_Limit (in points) value. When this happens, the EA tracks price action in order to close a batch of orders to compensate.
ho_analista
No backtesting possible, it crashes MT5.
Tavamanya
Are you talking about the differences of results between a standard account and an ECN one ?