Experts: Sprut - page 3

 

This is an excellent ea for those who like grid strategies, and it can be customised easily. However, in this version for the Portuguese MQL5 site there are a few bugs that need to be fixed in order to avoid recotes and/or execution errors. These are:


On line 148, from "for(int i=0;i<CountOrders;i++)" to "for(int i=1;i<CountOrders;i++)" , i.e. it changes the count from the number "0" to "1".

On line 185, from "price=price_sell_limit-(double)i*ExtStepLimit;" to "price=price_sell_limit+(double)i*ExtStepLimit;" In other words, the negative "-" sign is inverted to a positive "+" sign.

 

Good morning.

Could you clarify if the positions that are closed when profit/loss is reached are only of the symbol traded? Or all positions on the account?

Thank you.

 
psrs55 :

Good morning.

Could you clarify if the positions that are closed when profit/loss is reached are only of the symbol traded? Or all positions in the account?

Thank you.

Closed by symbol and magic number:

//+------------------------------------------------------------------+
//| Close all positions|
//+------------------------------------------------------------------+
void CloseAllPositions()
  {
   for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of current positions
      if(m_position.SelectByIndex(i))     // selects the position by index for further access to its properties
         if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)
            m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol
  }
 
Joao Raimundo Alexandre Neto i.e. change the count from the number "0" to "1".

On line 185, from "price=price_sell_limit-(double)i*ExtStepLimit;" to "price=price_sell_limit+(double)i*ExtStepLimit;" In other words, the negative "-" sign is inverted to a positive "+" sign.

New correction line 148, from "for(int i=0;i<CountOrders;i++)" to "for(int i=1;i<=CountOrders;i++)" , i .e. change the count from the number "0" to "1" and then add the "<" sign.

 

The Expert Advisor was tested for my tasks as an assistant in manual trading. The Expert Advisor is excellent, stable. As for me, the settings are a bit excessive, but everything works..., you can adapt. Martingale was not tested, as I don't need it now, so I can't say anything about it.

SOME FEATURES.... The number of orders ByStop, SellStop, ByLimit is set according to the settings. SellLimit order sets only one, regardless of the number of orders set in the settings. The pending order lifetime of 60 minutes should be considered as a zero countdown, i.e. to set the pending order lifetime of 1 hour in the settings it is necessary to write 120 minutes, 2 hours - 180 minutes, etc....

 
I'd like to ask for an update: when the FirstOrder is stopped, could it put it back in the defined place again?
 
unworkable