I want to delete pending horizontal lines if their level has been broken by the current price. Another way to put it: if the level has been exceeded or "renegotiated" already after OBJ_HLINE has been created.
Thanks to Roll for the help. Could you please tell me how to correctly track the condition of keeping the level at a known period?
//----------------------------------------------------------------------+ // Удаление OBJ_HLINE при пробитии его уровня /Red-Up/Blue-Down| |//----------------------------------------------------------------------+ void DelHLine( string nm="")
{
int obj_total=ObjectsTotal();
for(int i=1;i<obj_total;i++)
{
nm=ObjectName(i);
if(nm==ObjectName(i)&&ObjectType(nm)==OBJ_HLINE)
{
color cl = ObjectGet(nm,OBJPROP_COLOR);
double pl = ObjectGet(nm,OBJPROP_PRICE1);
datetime timeSet= ObjectGet(nm,OBJPROP_TIME1);
int shift = iBarShift(NULL,0,timeSet);
if((cl==Red && pl<High[iHighest(NULL,0,MODE_HIGH,shift,1)])||
(cl==Blue && pl>Low [iLowest (NULL,0,MODE_LOW, shift,1)]) ) ObjectDelete(nm);
}
}
return(0);
}
//+------------------------------------------------------------------+
I'm starting with programming, so a lot of questions arise, thank you in advance for your attention!
I wrote a script called NewScript, which performs a simple function - display OHLC prices by bars on a chart...
My question is - if BARS is exactly the number of bars on the current chart, then why in my EA log displays the number of bars on the screen (about 200), but in my log more than 2000?
double Hi (int pos=0) //создали Hi, зависящую от pos
{
int i=pos; //присваиваем "i" значение от "pos", то есть i равно pos
double H=0;
while (i<=pos+10) //как она может быть меньше, если она равна?
{
if (H<iMACD (NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i)) //это мне вообще не понятно... то есть если значение "Н" будет меньше, то присваиваем...
H=iMACD (NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i); //то есть он определит мне наинизший, но не наивысший бар
i++; //ну тут мы добавляем к "i" плюс 1
}
return(H); //возвращаем Hi в самое начало
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Good day to all!
I'm writing my first bot, and at the same time I'm getting acquainted with MQL. I have the following problem during testing:
Order OP_BUYSTOP is executed right after the order is placed, although judging by the chart, the price does not reach the target value (see below)
USDJPY,M5 (visual)
Date 2011.09.19
Time 02:15
Open 76.903
High 76.909
Low 76.890
Close 76.890
Volume 66
I am testing all ticks.
Maybe I do not understand OP_BUYSTOP order correctly? To buy if the price exceeds a certain value, right?
Here is a bit of source code that places an order
int ticket=OrderSend(Symb, OP_BUYSTOP, Lot, Price, 0, SL, TP);
On the candlestick chart, all prices are Bid and any buy order is executed at Ask price.
Thank you!
Hello! Please help me.
I can't understand why this script doesn't display the data in excel as columns.
When running it in excel, there is only a table header, no data.
Help me to understand why delimiter is not perceived by excel.
I'm starting with programming, so a lot of questions arise, thank you in advance for your attention!
I wrote a script called NewScript, which performs a simple function - display OHLC prices by bars on a chart...
My question is - if BARS is exactly the number of bars on the current chart, then why in my EA log displays the number of bars on the screen (about 200), but in my log more than 2000?
Thank you!
Small correction
sorry, can't understand the function...
The easiest option
Hello!
Can you help me write code to stop the EA for a while?
I wrote the code like this.
int init() {string OrderStop="OrderStop "+ Symbol();
OrderSig =GlobalVariableGet(OrderStop);
// Print (OrderSig);
return (0);
}
int deinit() {
return (0);
}
int start() {
string OrderStop="OrderStop "+ Symbol();
OrderSig = GlobalVariableGet(OrderStop);
if (OrderSig==1)return(0);
else {
EA body(code)
}
return(0);
}
In the trailer this code works, but when I compile or rerun Terminal,
EA starts to work (opens position) and does not trade again.
What can it be?
Or tell me another option.
Or suggest another option.
Use a f: