[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 360

 
Vitya >> :

If you mean locking, you don't understand ---- I don't insist on it, I don't know how to use it.

Close a part of unprofitable positions? ------ I think so, but I have not tried it yet.

I do not know how to use it myself.

https://www.mql5.com/ru/code/9185

 
costy_ >> :

Manually tester the answer can only be found there (or in the demo) here is the link to the simulator

https://www.mql5.com/ru/code/9185

I think the answer can only be found in mathematics or real trading experience. It's too bad that I have neither. Thanks for the link.

 
Vitya >> :

I think the answer can only be found in mathematics or in real trading experience. I think it is too bad that I have none of them. Thanks for the link.

If you don't know anything about maths but you cannot trade, you need to learn and you will eventually succeed!

I advise to start manual trading with CCI(55) and MA(55) at M5 GBPJPY with Fibonacci number and within that number find your period (today mine is 67), good luck!

Yes, I almost forgot, trading time is also very important, namely the opening of the trading session of the region whose currency is major (and america...).

 
Can anyone check if everything is correct in this module:
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// MOVE SL TO BE

if( Mode_Close_Part_Set_BE_1==true   &&   OrdersTotal()>0) {

      for(int cnt_BE=0; cnt_BE<OrdersTotal(); cnt_BE++) {
         OrderSelect( cnt_BE, SELECT_BY_POS);         // the next line will check for ONLY market trades, not entry orders
         Ticket = OrderTicket();

// BUY -----------------------------------------------------------------------------------------
         if(OrderType()==OP_BUY   &&   OrderSymbol()==Symbol()   &&   OrderStopLoss()<OrderOpenPrice()   &&   Ask>=(OrderOpenPrice()+ MathAbs(OrderOpenPrice()-OrderStopLoss())) ) {
                  double SL_Original_Buy   = OrderStopLoss();

                  bool AnsHalfModifySL_Buy = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Green);
                  Sleep( Slippage*3000);

                  if( AnsHalfModifySL_Buy==true) {
                     BreakEvenStatus_Buy   = true;
                     Alert ("SL Buy which was ", SL_Original_Buy, " set to BreakEven at ", OrderStopLoss(), " for ", Symbol());
                  }

                  if( Fun_Error(GetLastError())==1) {       // Обработка ошибок
                     continue;                             // Повторная попытка
                  }

                  return;                                // Выход из start()
         } // if(OrderType() == OP_BUY  &&  OrderSymbol()==Symbol() )
// EO BUY -----------------------------------------------------------------------------------------


// SELL -----------------------------------------------------------------------------------------
         if(OrderType()==OP_SELL  &&  OrderSymbol()==Symbol()   &&   OrderStopLoss()>OrderOpenPrice()   &&   Bid<=(OrderOpenPrice()-MathAbs(OrderStopLoss()-OrderOpenPrice())) ) {
                  double SL_Original_Sell   = OrderStopLoss();

                  bool AnsHalfModifySL_Sell = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Blue);
                  Sleep( Slippage*3000);

                  if( AnsHalfModifySL_Sell==true) {
                     BreakEvenStatus_Sell   = true;
                     Alert ("SL Sell which was ", SL_Original_Sell, " set to BreakEven at ", OrderStopLoss(), " for ", Symbol());
                  }

                  if( Fun_Error(GetLastError())==1) {       // Обработка ошибок
                     continue;                             // Повторная попытка
                  }

                  return;                                // Выход из start()
         } // if(OrderType() == OP_SELL  &&  OrderSymbol()==Symbol() )
// EO SELL -----------------------------------------------------------------------------------------

      } // for(cnt_BE=0; cnt_BE<OrdersTotal(); cnt_BE++)
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


I'm asking because after each call the message "Error 0 has occurred" appears, although everything seems to be working correctly (going to break-even).





 
chief2000 писал(а) >>
Can anyone check if everything is correct in this module:

I'm asking because after each call the following message appears: "Error 0 has occurred", although everything seems to be working correctly (going to breakeven).

Most likely an attempt to modify an order at old prices. We should compare the new and old order parameters. And it should be modified only if necessary.

 

Error 0 occurs when OrderModify does not actually modify anything - it changes the price to the old one.

 

Here is an Example:




An order was opened with SL=1.1596. Then the SL changed to 1.1570, and finally this error.

It cannot go the second round because there is a condition:

... OrderStopLoss()>OrderOpenPrice() ...


- What could it be?





 
chief2000 писал(а) >>

Here is an Example:

An order was opened with SL=1.1596. Then the SL changed to 1.1570, and finally this error.

It cannot go the second round because there is a condition:

- What could it be?

It could. Check the logical conditions again, but only in the morning.

What's in the logic is what allows it to do.

 
Vinin >> :

Maybe. Check the logical conditions again, but only in the morning.

What's built into the logic allows you to do that.

I'll check. >> thank you!

 

Help

int start()  {
//----
Alert(Minute(),Hour());
int Minute( )
Returns current minute (0,1,2,...59) of last known server time at program start (this value does not change during program execution).

Note: in testing, the last known server time is simulated.

But in indicator, when testing, last known server time is not simulated. should it be?

Reason: