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

 
ArgentumZ:
I've read it, I know about freezing distances etc., but I don't understand how a zero stop loss relates to all these restrictions! If you see a mistake - tell me. I read the manuals carefully before writing here. I would not do it if I didn't have to.
Some brokerage companies allow you to set SL and TP when you place an order, some do not. You have to try it manually. The same applies to Freeze and minimum distance to stop (TP is also a stop).
 
snail09:
Some DCs allow SL and TP to be set when placing an order, some do not. Try it with your hands. The same applies to Freeze and minimum distance to stop (TP is also a stop).
The thing is, I don't need to put with stops at the moment - I want to put zero TakeProfit and StopLoss. What is interesting, BuyStop is set, SellStop & SellLimit are not set and I get the above error.
 
Solved the problem with zero stops. However, I didn't understand how: what I commented, copied, put explicit 0 instead of variables, etc. Anyway, at some point everything worked))) Thanks to everyone who responded and left comments.
 
ArgentumZ:
Solved the problem with zero stops. However, I didn't understand how: what I commented, copied, put explicit 0 instead of variables, etc. Anyway, at some point everything worked))) Thanks to everyone who responded and left comments.
Ask the MarketInfo function before your trades, I think it will help. Do a priming and look at the error codes, there is a description of them in the ...
 
ArgentumZ:
I've read them, I know about freezing distances and so on, but I don't understand how a zero stop loss relates to all of these limitations! If you see a mistake - tell me. I read the manuals carefully before writing here. I wouldn't write them if I didn't have to.

I saw the error in the fact that your BUY_STOP and SELL_STOP are set at the same price. If you have set TP and SL to zero, but error 130 remains, it must not be about them!

Only BUY_STOP and SELL_LIMIT, or conversely (depending on the specific case) BUY_LIMIT and SELL_STOP can be set at the same price. But not at all BUY_STOP and SELL_STOP! :)))

But you didn't read the manuals very well...

 
Zzumer:

I.e. the tester contains an incomplete history when it starts?

Now, by the way, the expert is working correctly.

It's a shame, but that's the way it is. If you need more bars to test the EA, you either have to go into the quote files (lazy and long...) or skip some of the test time (easy and simple).
 

A homemade function removes, in the case of a level breach, horizontal TREDLINE objects. Works correctly but is very costly.

With a large number of objects (more than 5000), it completely suspends the MT. Two days of CPU load without any results.

What options are more optimal to replace the condition?

 if( PrLevel<High[iHighest(NULL,0,MODE_HIGH,shift,1)]) {ObjectDelete(nm);return(0);} }
Files:
 
Operr:

A homemade function removes, in the case of a level breach, horizontal TREDLINE objects. Works correctly but is very costly.

With a large number of objects (more than 5000), it completely suspends the MT. Two days of CPU load without results.

How can the condition be more optimally replaced?

Calculate iHighest() at the very beginning of the code (at startup), save bar index into a variable. When opening a new bar, increment this variable and check if the previous bar is not the new "Highest". Also don't forget to check if variable > number of bars searched, then iHighest() function must be started again. This algorithm will work much faster, but it's still far from optimal! :))

 
MaxZ:

I saw the error in the fact that your BUY_STOP and SELL_STOP are set at the same price. If you have set TP and SL to zero, but error 130 remains, it must not be about them!

Only BUY_STOP and SELL_LIMIT, or conversely (depending on the specific case) BUY_LIMIT and SELL_STOP can be set at the same price. But not at all BUY_STOP and SELL_STOP! :)))

You didn't read the manuals very well...

I have! Now I've looked at what I've posted on the forum. But "reading the manuals" has nothing to do with it - I just copied the list of parameters and then corrected the right ones. And I forgot to correct the price in Sell Stop. It's buyPrice in both orders and sellPrice in Sell. If you had told me at once, it would have been very helpful, but it took me a lot of time to find an error due to my inattention.
 
ArgentumZ:
I do! Now I've looked at what I posted on the forum. But "reading manuals" has nothing to do with it - I just copied the parameter list and then corrected the right ones. And I forgot to correct the price in Sell Stop. It's buyPrice in both orders and sellPrice in Sell. If you had told me at once, it would have been very helpful, but it took me a lot of time to find an error due to my inattention.

Sorry I'm not a telepath... If I had known it was an oversight, I would have pointed it out straight away. I thought you didn't understand the theory.

However, your inattention was a long one... :D

Reason: