[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 230

 
doon:

What could be causing the error (wrong price)?


Somewhere in the code, the variable is not initialized correctly. Or option 2 - you forgot to normalize the price(NormalizeDouble())
 
drknn:

Somewhere in the code, the variable is initialized incorrectly. Or option 2 - you forgot to normalize the price (NormalizeDouble())

I doubt this is the case as it does not always happen, rarely and not systematically. It is due to some price factor, but which one?

 
doon:

I doubt this is the case as it does not always happen, rarely and not systematically. It happens because of some price factor, but which one?


So what's the problem? As soon as error number such-and-such occurs, print(" MyValue = ",MyValue);) and it will immediately become clear what it equals.
 

What is the value of MyValue?

 
doon:

What is the value of MyValue?


How do I know what your variable equals? :) Let the printer show you what it equals.
 
doon:

What is the value of MyValue?


Can anyone help. ZeroLag MACD indicator. I need to make the background above the 0.00 line one colour and below it another. Here is the code

//+------------------------------------------------------------------+
//| ZeroLag MACD.mq4 |
//| RD |
//| marynarz15@wp.pl |
//+------------------------------------------------------------------+
#property copyright "RD"
#property link "marynarz15@wp.pl"
//----

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 blue
#property indicator_color2 Red
//---- input parameters
extern int FastEMA = 12;
extern int SlowEMA = 24;
extern int SignalEMA = 9;
//---- buffers
double MACDBuffer[];
double SignalBuffer[];
double FastEMABuffer[];
double SlowEMABuffer[];
double SignalEMABuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int init()
{

//---- indicators
IndicatorBuffers(5);
SetIndexBuffer(0, MACDBuffer);
SetIndexBuffer(1, SignalBuffer);
SetIndexBuffer(2, FastEMABuffer);
SetIndexBuffer(3, SlowEMABuffer);
SetIndexBuffer(4, SignalEMABuffer);
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexStyle(1, DRAW_LINE,EMPTY);
SetIndexDrawBegin(0, SlowEMA);
SetIndexDrawBegin(1, SlowEMA);
IndicatorShortName("ZeroLag MACD(" + FastEMA + "," + SlowEMA + "," + SignalEMA + ")");
SetIndexLabel(0, "MACD");
SetIndexLabel(1, "Signal");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
double EMA, ZeroLagEMAp, ZeroLagEMAq;
for(int i = 0; i < limit; i++)
{
FastEMABuffer[i] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i);
SlowEMABuffer[i] = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, i);
}
for(i = 0; i < limit; i++)
{
EMA = iMAOnArray(FastEMABuffer, Bars, FastEMA, 0, MODE_EMA, i);
ZeroLagEMAp = FastEMABuffer[i] + FastEMABuffer[i] - EMA;
EMA = iMAOnArray(SlowEMABuffer, Bars, SlowEMA, 0, MODE_EMA, i);
ZeroLagEMAq = SlowEMABuffer[i] + SlowEMABuffer[i] - EMA;
MACDBuffer[i] = ZeroLagEMAp - ZeroLagEMAq;
}
for(i = 0; i < limit; i++)
SignalEMABuffer[i] = iMAOnArray(MACDBuffer, Bars, SignalEMA, 0, MODE_EMA, i);
for(i = 0; i < limit; i++)
{
EMA = iMAOnArray(SignalEMABuffer, Bars, SignalEMA, 0, MODE_EMA, i);
SignalBuffer[i] = SignalEMABuffer[i] + SignalEMABuffer[i] - EMA;
}
return(0);
}
//+------------------------------------------------------------------+

 

The compiler outputs: 'MyValue' - variable not defined

 
doon:

The compiler outputs: 'MyValue' - variable not defined

You must be using an old build of the terminal.

In the 388 build this variable should already compile normally. Please update your version of the terminal.

 
sergeev:

you must be using an old build of the terminal.

In the 388 build this variable should already compile normally. Update your version of the terminal.


How can this be done?

 
doon:

How can this be done?

You need to write an official letter to your brokerage company, indicating your passport details and the account numbers on which you work for this brokerage company.

Within three working days you should receive by registered mail a disk with the update installation file and installation instructions.