Andrei01: Is there any way to know the price limits on the vertical scale of the chart to calculate the scale (not the price of the instrument, found by F8)?
Top2n: Hello, I am running the Expert Advisor in the Strategy Tester but it is not opening a position. In the magazine says EURUSD,M5: OrderSend error 131. I don't know how many times I've seen this EA open and it did not open one position anymore. Please advise if someone has had such problems. Thanks in advance
Maybe you don't have normalized lot, try to bring it back to normal by using:
zhuki: You probably don't have a normalized lot, normalize it with:
double NormalizeDouble(
double value, int digits)
Actually, if memory serves me correctly, he has a ready function for lot normalization... Taking into account all possible DT limitations... Except if he's not using it... then - Ouch... :)
Konichiua to all! How do I make my EA open three orders with different takeovers and only once on a candlestick in a buy or sell condition. Arigato in advance!
Maniac: Konichiua to all! How do I make my EA open three orders with different takeovers and only once on a candlestick in a buy or sell condition. Arigato in advance!
How do I make 3 Send orders with different Take Points or loop this function up to 3 (for or while), at each iteration a different Take Point
externdouble TakeProfit = 35;
externdouble StopLoss = 25;
externdouble Lots = 0.1;
int NumberOfBarOpenLastPos(string sym="", int tf=0, int op=-1, int mn=-1) {
datetime oot;
int i, k=OrdersTotal();
if (sym=="") sym=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sym) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (oot<OrderOpenTime()) oot=OrderOpenTime();
}
}
}
}
}
}
return(iBarShift(sym, tf, oot, True));
}
int NumberOfBarCloseLastPos(string sy="0", int tf=0, int op=-1, int mn=-1) {
datetime t;
int i, k=OrdersHistoryTotal();
if (sy=="" || sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol()==sy) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderCloseTime()) t=OrderCloseTime();
}
}
}
}
}
}
return(iBarShift(sy, tf, t, True));
}
int start()
{
int ticket;
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0);
}
if ((NumberOfBarOpenLastPos()>0||NumberOfBarOpenLastPos()==-1)&&(NumberOfBarCloseLastPos()>0||NumberOfBarCloseLastPos()==-1))
{
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if(Bid>High[1])
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"test",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
elsePrint("Error opening BUY order : ",GetLastError());
return(0);
}
if(Bid<Low[1])
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"test",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
elsePrint("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
}
Here is the code of an EA. You need to:
1) he opened not one, but three deals at once with stops of 25 and takeovers of 15, 35, 50
2) after the second order was closed at take (35), the last position (at take 50) was passed to the breakeven level
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.
Is there any way to know the price limits on the vertical scale of the chart to calculate the scale (not the price of the instrument, found by F8)?
Hello, I am running the Expert Advisor in the Strategy Tester but it is not opening a position. In the magazine says EURUSD,M5: OrderSend error 131. I don't know how many times I've seen this EA open and it did not open one position anymore. Please advise if someone has had such problems. Thanks in advance
You probably don't have a normalized lot, normalize it with:
Taking into account all possible DT limitations...
Except if he's not using it... then - Ouch... :)
Hello forum people.
My grandparents told me it's Honeymoon Day. Happy holiday to all.
And me with my... Drknn says it's possible to process indicator readings.
Is it possible to sum A / D for a given period and the same amount OBV, and then divide them between themselves (OBV in the numerator)
The denominator is A/D + coefficient with output to the settings.
Zero in the middle, borders are floating.
Sum-NO TOTAL. Each movement by absolute value.
And I'll give you a reversal on the Jew
Konichiua to all! How do I make my EA open three orders with different takeovers and only once on a candlestick in a buy or sell condition. Arigato in advance!
Make a 3 order send with different targets or loop this function up to 3 (for or while), at each iteration different target
Make 3 Send orders with different points - opens the first order three times :(
loop this function to 3(for or while), each iteration has a different take - opens a bunch of first orders :(
If not hard to show how to do it?
Make a 3 order send with different targets - opens the first order three times :(
loop this function to 3(for or while), each iteration has a different take - opens a bunch of first orders :(
If not too complicated, can you show me how to do it?
Are the open orders counted?
Here is the code of an EA. You need to:
1) he opened not one, but three deals at once with stops of 25 and takeovers of 15, 35, 50
2) after the second order was closed at take (35), the last position (at take 50) was passed to the breakeven level