sorry in advance for the grammar :/. My question is, how to rewrite quotes history (via code)? I would like to use MT4 to analyse data from another broker.
Can you tell me please, my candlesticks change colours every few seconds on the chart to coloured and back to black and white. This has never happened before. Is there any way to turn it off?
I wrote code to open two pending orders (BuyStop and SellStop) on conditions a=true and b=true and after some time the EA closes both orders, until a new signal appears, but sometimes the EA opens 2 pending orders in the same direction. Why this happens and how to avoid this "bug"?
if (a=true && b=true) { int OrderCount = OrdersTotal(); if (OrderCount>1) return(0); ticket1=OrderSend(Symbol(), OP_BUYSTOP, getLot(), PriceOpen_Buy, slippage, PriceOpen_Sell,0,0,Green); Sleep(1000);
for (int i=OrdersTotal()-1; i>=0; i--) { if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break; if (OrderType()==OP_BUYSTOP ) OrderDelete(OrderTicket()); if (OrderType()==OP_SELLSTOP ) OrderDelete(OrderTicket()); if (OrderType()==OP_SELL ) OrderClose(OrderTicket(),OrderLots(),Ask,slippage); if (OrderType()==OP_BUY ) OrderClose(OrderTicket(),OrderLots(),Bid,slippage); }
I wrote code to open two pending orders (BuyStop and SellStop) on conditions a=true and b=true and after some time the EA closes both orders, until a new signal appears, but sometimes the EA opens 2 pending orders in the same direction. Why this happens and how to avoid this "bug"?
Please advise.
Thank you in advance.
Maybe here:
if (OrderCount>0) return(0);
Actually so much is not "sleeping" - Sleep(1000*59*TimeFrame); - a new tick came in, your code started, two orders open, then pause for "2 hours" (conditionally), and then you try to close if suddenly one of the orders became marketable at the prices you got 2 hours ago - ORIGINAL!!! WHO TAUGHT YOU THAT?
You can fix in a global variable the time of opening of orders and control the difference between m³ TimeCurrent() and the fixed time.
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.
Like this:
The ZigZag extrema from the current time to Time_Control are collected in an array.
Can you tell me how to count all the zigzags, how many are there?
Hello,
sorry in advance for the grammar :/. My question is, how to rewrite quotes history (via code)? I would like to use MT4 to analyse data from another broker.Can you tell me how to count all the zigzags, how many are there?
Written in the li_IND variable, or like this
count=ArraySize(lda_Extremum);Can you tell me how to count all the zigzags, how many are there?
If we do the following:
- the function will return the number of extrema found since fdt_TimeControl.Thank you
Hello,
Is it possible to enter a schedule with a fixed weight 1:1 in the settings?
If it is possible, please tell me how.
I would like to thank you in advance.
Afternoon.
I wrote code to open two pending orders (BuyStop and SellStop) on conditions a=true and b=true and after some time the EA closes both orders, until a new signal appears, but sometimes the EA opens 2 pending orders in the same direction. Why this happens and how to avoid this "bug"?
if (a=true && b=true)
{
int OrderCount = OrdersTotal();
if (OrderCount>1) return(0);
ticket1=OrderSend(Symbol(), OP_BUYSTOP, getLot(), PriceOpen_Buy, slippage, PriceOpen_Sell,0,0,Green);
Sleep(1000);
ticket2=OrderSend(Symbol(), OP_SELLSTOP, getLot(), PriceOpen_Sell, slippage, PriceOpen_Buy,0,0,Green);
Sleep(1000*59*TimeFrame);
for (int i=OrdersTotal()-1; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderType()==OP_BUYSTOP ) OrderDelete(OrderTicket());
if (OrderType()==OP_SELLSTOP ) OrderDelete(OrderTicket());
if (OrderType()==OP_SELL ) OrderClose(OrderTicket(),OrderLots(),Ask,slippage);
if (OrderType()==OP_BUY ) OrderClose(OrderTicket(),OrderLots(),Bid,slippage);
}
return(0);
}
Please give me a hint.
Thank you in advance.
The values of these variables are stored in the arrays-traceboxes.
I mean, you've got it like this .
Terms and conditions,
Afternoon.
I wrote code to open two pending orders (BuyStop and SellStop) on conditions a=true and b=true and after some time the EA closes both orders, until a new signal appears, but sometimes the EA opens 2 pending orders in the same direction. Why this happens and how to avoid this "bug"?
Please advise.
Thank you in advance.
Maybe here:
Actually so much is not "sleeping" - Sleep(1000*59*TimeFrame); - a new tick came in, your code started, two orders open, then pause for "2 hours" (conditionally), and then you try to close if suddenly one of the orders became marketable at the prices you got 2 hours ago - ORIGINAL!!! WHO TAUGHT YOU THAT?
You can fix in a global variable the time of opening of orders and control the difference between m³ TimeCurrent() and the fixed time.