Change SL on an old order that is in deep DD... - page 2

 

DayTrader:

What you are saying is that if the StopLoss is too close to the market, or the wrong side of the market, then don't bother setting a stop at all and don't bother even mentioning it! Uh..what do you mean?

Basically it is same as i wrote in these lines

1000 points away from SL but SL >>>> BID ( distant SL from Orderopenprice 100 points) (wrong side of market)

if ((Bid - NewSLprice) > StopLevel * Point)  SLoutsideStopLevel = TRUE;

we have now something like 1.30 - 1.3742 that is < 0 So it is false and there is no modify

<0 is also smaller then StopLevel (( if you trie to modify a trade this way then you would have read an errormessage " invalid stops " ))

Now your SLoutsideStopLevel won't become true ..... and stay false

That means also you don't modify and keep the trade open without setting SL

Signals are only an identication we have good signals but there are also false signals....

If you have done your trading on signals from 3 hours ago then it can be the market is 3 hours later changed... do you then still relie those signals

 

Let's go over this again. You enter an order without a stop. Now you want to set a stop of say 30 pips relative to the order open price. There is a fast market or your terminal died or whatever so now that you look at the market, your position is already underwater (losing) by more than your original stop. You therefore cannot set the stop of 30 pips relative to the order open price. Your code says "I can't set the stop so I am going to not bother and I am not going to tell anyone". Ok, I admit, I invented what your code might say if it were hyper-intelligent :-)

My point is that once you have exceeded the stop position you should not now set a stop below the market, and you should not give up on setting a stop, you should, according to your system, close out the losing position.

 

Have now tried a lot of different things, but still no joy.

I think at the bottom of this problem is THIS Buy trade requirement: Bid - SL > StopLevel

It says in no uncertain terms that market must be a little bit (StopLevel) above your intended SL price. Implies that you MUST get the stops in place BEFORE the market falls too much.

A work-around here MIGHT be to use TP as SL, but I don't think I care to explore that.

This actually means that if you for some reason are delayed, or wait too long, or price moves too fast in your disfavor, then you will not be able to place stops...all you can do is close the order.

IOW any Buy SL can only be hit from above... a condition where a buy SL is hit from below is not allowed.

Do we agree on this ?

 
dabbler:

Let's go over this again. You enter an order without a stop. Now you want to set a stop of say 30 pips relative to the order open price. There is a fast market or your terminal died or whatever so now that you look at the market, your position is already underwater (losing) by more than your original stop. You therefore cannot set the stop of 30 pips relative to the order open price. Your code says "I can't set the stop so I am going to not bother and I am not going to tell anyone". Ok, I admit, I invented what your code might say if it were hyper-intelligent :-)

My point is that once you have exceeded the stop position you should not now set a stop below the market, and you should not give up on setting a stop, you should, according to your system, close out the losing position.



Now I see what you mean. We can not rely entirely on real SL and TP (they are not entirely reliable and can fail as we have demonstrated), we must also do a "soft" SL TP check against intended SL TP values, and close the order ouruself if price is beyond limits.
 

Thanks guys you've been most helpful.

THIS core tester code seems to work ok:

            if (TimeCurrent() - OrderOpenTime() < 3*3600) continue;//return(0);//DEBUG: place stop after a 3hr server disconnect                
            if (OrderType() == OP_BUY)
               {     
               if(OrderStopLoss() == 0)  
                  {                                           
                  NewSLprice = NormalizeDouble(OrderOpenPrice() - (SL * Point), Digits);//SL Refered to entryprice  
                  //if the new SL is sufficiently BELOW current market as determined by stoplevel and freezelevel:                                                                                                                 
                  if ((Bid - NewSLprice) > StopLevel * Point)  Result = OrderModify(OrderTicket(), OrderOpenPrice(), NewSLprice, 0, 0, Aqua);   
                  //In some cases SL could not be placed, we must close the order ourself:   
                  if ((Bid + (StopLevel * Point)) < NewSLprice)   Result = OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), Slippage, Blue);                                                         
                  }                                              
               }
 
DayTrader:


Now I see what you mean.
Reason: