[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 100

 

why no sell entry?

entry conditions

f2=iForce(NULL, 0, 13,MODE_SMA,PRICE_CLOSE,1);
if (f2>0) // buy

{

Opn_B=true; // Критерий откр. Buy
}

if (f2<0) // sell

{

Opn_S=true; // Критерий откр. Sell }

if you set

rsi >50 buy

rsi<50 sell

it works as it should, so there are both sell and buy

 
Dimka-novitsek:
The Expert Advisor started working when I removed the stops 20 pips away from the price, no closer!!! Was wondering where error 130 is coming from, from the brokerage server?

Yes, servers... fixed size is good, but it's better to look at MarketInfo, it just has the level of stops at the moment, it can change. https://docs.mql4.com/ru/constants/marketinfo

MODE_STOPLEVEL14Minimum stop loss/stake profit level in pips
 
I'll remember that! (probably)
 

Guys tell me please .... The problem is that I have a 5 decimal place in the terminal and I have 5 open trades, I use a loop to close all the orders

The problem is that this loop closes orders at different prices! If I have 5 orders then only 3 or 2 of them are closed at one price and the others at different prices ... How to make all orders close at one price?????

if (сумма по профиту всех сделок >= заданная сумма)

{

for (цикл перебора ордеров)

{

if (проверка на символ)

{

if (ордертип==бай)

{

закрыть ордера по БИД цене 

} 

if (ордертип==сел)

{

закрыть ордера по Аск цене 

}  

} 

} 

} 
 
SeALALex:

Thanks a lot, I told you I'm just learning, may I ask a question LotsInitial - for what purpose? because it builds orders correctly, I do not understand what principle opens an order with such a lot size?

A dictionary will answer your question. And have you looked into the code at all? For how long? If it's your code, it won't take you long to understand the meaning of the 10 added lines.


vilard:

why isn't there a sell login?

entry conditions

f2=iForce(NULL, 0, 13,MODE_SMA,PRICE_CLOSE,1);
if (f2>0) // buy

{

Opn_B=true; // Критерий откр. Buy
}

if (f2<0) // sell

{

Opn_B=true; // Критерий откр. Buy
}

if you set

rsi >50 buy

rsi<50 sell

it works as it should, so there is both sell and buy

Where do you see SELL? :((


VOLDEMAR:

Guys, please tell me .... i have a problem with 5 decimal places in my client terminal. 5 trades open on one pair and i use a loop to close all orders

The problem is that this loop closes orders at different prices! If I have 5 orders then only 3 or 2 of them are closed at one price and the others at different prices ... How to make all orders close at one price?????

It takes time to close an order. During this time, the price can easily change. The answer is obvious.


People, a question:

There is a terminal running on two computers with the same account. Suppose if you try to close two different orders from different computers at the same time, what will be the reaction of the terminal? :)) "Trading then busy."?

Although it seems to me it's the same if you open two terminals on one computer and connect to one account, but you can't close orders synchronously...

 

I apologise if I repeat the question, as I didn't find it in the thread history.

I need the Expert Advisor to record order profit data all the time.

It would be better in a table.

For starters, here's the code:

int h=FileOpen("test.txt",FILE_BIN|FILE_WRITE);
   for (int j=0; j<OrdersTotal(); j++)         // По всем ордерам
  {
   if(OrderSelect(j,SELECT_BY_POS)==true)  // Если есть следующ.
     {                                     
      double ТР =    OrderTakeProfit();     // TakeProfit ордера
      double Profit= OrderProfit();         // Прибыль по ордеру
      double Lots  = OrderLots();           // Количество лотов
      //......Использование значений ТР и Profit в программе..... 
      FileWriteInteger(h,Profit,LONG_VALUE);
      FileWrite(h,"\n");
      FileClose(h);
     }
  }     
Вопрос, а где создать файл? как лучше это все реализовать?
 
Max7, I am interested in why the indicator does not work as it should, those by crossing "0", I repeat once again, that with the criteria rsi<>50 all works fine!
 
nuan:

I apologize if I repeat the question, as I did not find it in the history of the topic.

I need it to record the order profit data all the time.

It would be better in a table.

For starters, here's the code:

Create a file before you want to write anything to it.

Close the file after everything is written into it.

In your case functions init() and deinit() will work.


vilard:
Max7, I am interested in why the indicator does not work as it should, those by crossing "0", I repeat once again that with the criteria rsi<>50 everything works fine!

Max7... Funny! :DD


Force Index indicator works fine. You'd better check your code written earlier.

 
I've been there, can you give me an example or a function.
 
nuan:
I've been there, can you give me an example or a function.

Yes I did not read your question carefully! :)) The answer is above...

According to your code, the file will be created once, but it will be closed as many times as the number of orders the loop finds.

And if this code is in the function start(), then this trouble will happen every tick! And every time after FileOpen is executed, your file will be cleared...

You would also do well to write OrderSymbol(), OrderTicket(), OrderType() and other optional information to the file. Otherwise how can you distinguish OrderProfit() from each other? For this purpose it would be better to enter in a file in the form of a table(FILE_CSV), which is easily opened in Excel.

Reason: