Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 80
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In the tester on a different symbol? Or in demo/real on a different symbol? Or in the tester on this symbol? Or on demo/real on this symbol?
Why do you have to pull everything out of you?
Sorry, I'm very nerdy - I don't really understand it.
Maybe you have the simplest indicator with a code of some, I have an analogy to understand? Because I couldn't find one.
I have a very simple code that puts dots in the middle of the bar. How do I make the text appear when I hover over them, or a box, whatever.
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Black
//---- input parameters
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
//----
for(int i=limit; i>=0; i--)
{
double fabody0 = fabs(Close[i]-Open[i]);
double fabody1 = fabs(Close[i+1]-Open[i+1]);
double fabody2 = fabs(Close[i+2]-Open[i+2]);
double fabody3 = fabs(Close[i+3]-Open[i+3]);
double fabody4 = fabs(Close[i+4]-Open[i+4]);
double fabody5 = fabs(Close[i+5]-Open[i+5]);
double fabody6 = fabs(Close[i+6]-Open[i+6]);
double fabody7 = fabs(Close[i+7]-Open[i+7]);
if((fabody0>fabody1) && (fabody0>fabody2) && (fabody0>fabody3) && (fabody0>fabody4) && (fabody0>fabody5) && (fabody0>fabody6) &&(Volume[i]>Volume[i+1]))
{
if (((Close[i]>Open[i])&&(Low[i]+(High[i]-Low[i])/2>Low[i+1]+(High[i+1]-Low[i+1])*0.9))||((Close[i]<Open[i])&&(Low[i]+(High[i]-Low[i])/2<Low[i+1]+(High[i+1]-Low[i+1])*0.1)))
ExtMapBuffer1[i]=(iHigh(Symbol(),0,i)+iLow(Symbol(),0,i))/2;
}
}
//----
return(0);
}
What's your point? What difference does it make where you tried it? The question is whether Point = 0. And if it can, how should I write correct code so that I don't encounter an error: division by zero?
Suit yourself.
I haven't read the whole dialogue, but I suspect a problem with printing the fifth decimal place.
No, it divides by Point() and gets division by zero.
I haven't read the whole dialogue, but I suspect a problem with printing the fifth decimal point.
Could that be the problem?
Try
Hello.
Please help.
Now the lot of each following order is increasing in 1, 2, 3, 4, 5...
I want to increase lot not each order, but in steps of 3, so 1, 1, 1, 1, 2, 2, 2, 3, 3, 3...
extern double Plus_LotStop = 0.01;
extern double Plus_N_ORD = 3; //каждые N ордеров
void OnTick()
{
//---
for (int i=1; i<=OrdersStop; i++)
{
if((Close[1]<Open[1]&&Close[2]>Open[2]&&NumberOfPositions(Symbol(), -1,_Magic)<1))
{
OPENORDER (OP_BUYSTOP,PriceBS,LOTs,_Magic,i);
numB++;
PriceBS = NormalizeDouble(PriceBS+Step_Stop*Point,Digits);
OPENORDER (OP_SELLSTOP,PriceSS,LOTs,_Magic,i);
numS++;
PriceSS = NormalizeDouble(PriceSS-Step_Stop*Point,Digits);
}
LOTs=LOTs+Plus_LotStop;
}
}