Is the advisor suitable for real life? - page 35

 
borilunad:

1) Normalise all conditions and actions;


You also need to normalise the lot if it changes and/or is calculated. What else is possible?
 
FOReignEXchange:

1) You have to normalise the stops when they are calculated separately. This is written in the help. Why normalize anything else that doesn't need to be normalized? Let it be 150 decimal places. If it does not affect anything, there is no need to normalize it. Here is a code, for instance.

Why should we normalize a and b? I cannot understand it. This is a simplified example, of course. But the point is that if you are dealing with mathematics in your code, why should you normalize everything? Only tops need to be normalized if they are obtained as a result of such mathematics.

2) Checked the conditions a few times. I'm checking it now. Maybe I missed something.

3) Only 2 errors occur in my code. Error 130 - wrong stops, and Invalid parameters when deleting a pending order. Everything is clear with the first one and I've sorted it out. The disabled parameters for pending order removal are also clear.

4) We have no time to open positions without SL and TP, as we set the minimum profit and it may not be set later, as the price moves quickly. To all appearances, the fourth rule has grown from the fact that positions with stops could not be opened using BROKO terminals before. Now you can. So I don't see the point of this rule.


As I see it, you know best...

Go on like this, including the error in stops and removing the pendent, armed to the teeth with SL and TP, despite the importance in the immediate vicinity of the price, and not seeing the point in everything else!

Time will tell and will put everything in its place!

 
FOReignEXchange:

You also need to normalise the lot if it changes and/or is calculated. What else can you do?

Of course! And everything related to calculations concerning fast-changing VC norms in market conditions.
 
borilunad:


As I see it, you know best...

Keep up the good work, including error in stops and removing the pendulum, armed to the teeth with SL and TP, despite the importance in close proximity to the price, and not seeing the point in everything else!

Time will show and will put everything in its place!


The main thing is that the code in real life works and runs smoothly. All the rest is not important.

Fault STOPPING due to price obsolescence. Error 130. Just trying again fixes everything. There is no problem with this. There are no more errors in the log.

We just need to figure out why the conditions for deleting orders are not fulfilled and that is all. The question announced in the title of the topic will be solved.

 

FOReignEXchange:

The question announced in the title of the topic would be over.

It would also mean an increase in the deposit, the same as in the tester)

Well, I would not believe that there is such a point on the chart, where you could confidently set a take 11 and a stop 15 and know that it will go to the take)

Not a monkey, not a locker, you open single positions, as I understand it.

There is no such rule, especially when you enter at the opening of a candle. This is fantasy and fiction. The price does not owe anyone anything. It neither goes back where we have planned, nor forward, because we have decided to. No matter what super-duper indicator shows it to us.

 
FOReignEXchange:


The main thing is that the code should work in real life and run smoothly. Everything else is unimportant.

Error REAL STOP due to price obsolescence. Error 130. Just trying again fixes everything. There is no problem with this. There are no more errors in the log.

We just need to figure out why the conditions for deleting orders are not fulfilled and that is all. The question announced in the title of the thread will be over.


Sorry, one more clarification! All changing parameters should be refreshed from MarketInfo() at the start.

And the slip should be at least 20 on 5 digits(Error 130).

In the tester neither they nor others are changed, so the least I trust is the splendid test results.

 
borilunad:


Sorry, one more clarification! All changing DC parameters should be refreshed from MarketInfo() at the start.

In the tester, neither they nor others are changed, so I least trust the beautiful test results.


What parameters? Only Bid and Ask should be changed, and that's it. Also MODEFREEZELEVEL is the only useful thing I've heard today. Thanks again.

What other DC parameters can change? A minimum step change in price, or

Minimum stop loss/stack profit level in pips
or
Number of digits after the decimal point in the symbol price
or
Pip size in the quote currency

Spread may vary, although I have never noticed it on the Euro. How will it affect it? In my conditions it may affect only the possibility of placing a pending order. If

OrderOpenPrice()=Bid+MODE_SPREAD)= less than the acceptable distance, the order will not be opened. I am aware of that. But we have never had such errors.

 
FOReignEXchange:


What parameters? Only Bid and Ask should be changed, that's all. Also MODEFREEZELEVEL is the only useful thing I've heard today. Thank you again.

What other parameters can the DC change? Is it a minimum step of price change or

Minimum allowable stop loss/stake profit level in pips
or
Number of digits after the decimal point in the instrument price
or
Size of a pip in the quote currency

Spread may vary, although I have never noticed it on the Euro. How will it affect it? In my conditions it may affect only the possibility of placing a pending order. If

OrderOpenPrice()=Bid+MODE_SPREAD)= less than the acceptable distance, the order will not be opened. I am aware of that. But we have never had such errors.


See: https://docs.mql4.com/ru/constants/marketinfo starting with Bid to your "useful" FritzLevel, increasing in times of extreme volatility. Also StopLevel etc.

Bid+Spread=Ask So, it is better to use Ask right away in this case, of course, if Ask is also tried out by MarketInfo() at the beginning of the start.

 

Sorry, have to go away for a bit!

I have, for example, at the start and after refining the lot, according to the MM:

  RefreshRates();
  ASK = NormalizeDouble(MarketInfo(Symbol(),MODE_ASK),Digits);
  BID = NormalizeDouble(MarketInfo(Symbol(),MODE_BID),Digits);
  double spread = NormalizeDouble(ASK-BID,Digits);
  StopLevel = NormalizeDouble(MarketInfo(Symbol(),MODE_STOPLEVEL),Digits);
  double step = NormalizeDouble(Step*Point,Digits);
  if(step < StopLevel) step = StopLevel;
And then everything else...
 

On this code I put out the following

if (//Условие//)
   {
   if (OrderSelect(ticket_sell,SELECT_BY_TICKET)==true)
      if (OrderType()==OP_SELLSTOP) 
         {
         Print ("Заморозка: ",MarketInfo (Symbol(), MODE_FREEZELEVEL),", Bid: ",Bid,", Open=",OrderOpenPrice());
         if (Bid<=(OrderOpenPrice()+4*Point)) 
            {
            Comment ("1");                         
            i=0;
            while (i<10)
               {
               if (i>0) Sleep(500);      
               RefreshRates(); OrderDelete(ticket_sell); 
               err=GetLastError();
               if (err==0)
                  {
                  ticket_sell=0; return;
                  }
               i++;
               }
            }
         }
   }

18:34:14 $505,000 EURUSD,M1: Freeze: 0, Bid: 1.3436, Open=1.3436
18:34:14 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:14 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:15 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:15 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:16 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
1834:16 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:17 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:17 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:18 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted
18:34:19 505 000 $ EURUSD,M1: market order #26398219 cannot be deleted

It has failed 10 times. As many times as the i-cycle. In this case, it just did not have time to delete, because the Bid price was already equal to the opening price of the order. This is the first time I noticed such a case. I will try to find another one. This one worked on the plus side. The deviation from the signal by fractions of a second is not horrible. I think there is another case, I will wait for it. There are times when there is no reaction for 10-15 seconds.