When I add in any of the pre-defined indicators (custom or otherwise) that come with MT4 I have no issue.
When I use some of the indicators I�ve downloaded in MQ4 format and then compiled I can use MT4 with no issue.
When I code my own very basic indicator & compile without error, as soon as I load the indicator onto any chart my system virtually locks out and the Terminal process goes 100% busy and I have to stop the process in order to continue.
So the error surely lies with what I�m doing.
Any thoughts / ideas.
The indicator I was going to start and work on was a Stop Loss line linked to price, but before I tried to get clever I only wanted to record a new indicator 50 points below every close price, as my 1st stepping stone, and the code is very simple yet it locks out.
See below for sample code.
Any thoughts, help, comments welcome.
Paul.
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern double SLVar=50.0;
//---- buffers
double SLBuffer[];
//±-----------------------------------------------------------------+
//| Custom indicator initialization function |
//±-----------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,SLBuffer);
//----
return(0);
}
//±-----------------------------------------------------------------+
//| Custom indicator deinitialization function |
//±-----------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//±-----------------------------------------------------------------+
//| Custom indicator iteration function |
//±-----------------------------------------------------------------+
int start()
{
double sl,SLBuffer;
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=5) return(0);
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars–;
i=Bars-counted_bars;
//----
while(i>0)
{
sl = Close[i] - SLVar * Point;
SLBuffer = sl;
}
//----
return(0);
}
//±-----------------------------------------------------------------+