Virtual Stop Loss / Take Profit - best approach ?

 

Hi,


I would like to have more control over SL/TP for two reasons:

1. I don't want my broker to know my real SL levels for obvious reasons

2. I would like to be more flexible than standard margin of 5pip between current price and SL/TP


With single order open it is quite easy thing to do. Just two variables.


What is your approach in case of multiple open orders? I can see couple of ways to implement it but each of them seems too complex and painful.


I think that the most appropriate would be to have 3 arrays: Tickets, SL, TP. But this kind of arrays may always fall out of sync... how to maintain them?


Any suggestions welcome :)

 

Bad idea. Hidden stealth stoploss and takeprofit will only encourage brokers to search and hunt with wider volatilty.

This means your stoploss will be hunted regarldess.

I wonder why the market is so flat now. Up and down, up and down to get rid of all the hidden stoplosses.

 
ckingher:

Bad idea. Hidden stealth stoploss and takeprofit will only encourage brokers to search and hunt with wider volatilty.

This means your stoploss will be hunted regarldess.

I wonder why the market is so flat now. Up and down, up and down to get rid of all the hidden stoplosses.


I'm sorry, but that is ridiculous. According to you, having SL set at a given point WONT make broker make a small modification to the price just to hit that SL. But not having a SL WILL make broker make large modifications just to see if I close my order? That doesn't make any sense.

 
allerune:


I would like to have more control over SL/TP for two reasons:

1. I don't want my broker to know my real SL levels for obvious reasons

2. I would like to be more flexible than standard margin of 5pip between current price and SL/TP


I think that the most appropriate would be to have 3 arrays: Tickets, SL, TP. But this kind of arrays may always fall out of sync... how to maintain them?

On IBFX MarketInfo( Symbol(), MODE_STOPLEVEL )*Point is 3.0 pips (30 points) where do you get 5pips


You're going to need 3 static arrays plus one temporary and a static count of entries used. You need to mark off triplets you handle in the order select loop and then remove entries no longer open (closed externally)

In addition if the platform is restarted, you'll have open orders but nothing in the arrays, so you'll have to handle that somehow (external files?)

What I'm doing I set the TP to real TP+constant. Then in the order select loop I set TP=orderTakeProfit()-constant;

This way I don't have to remember each order's values and I always have a TP/SL in case of disconnection.

 

I'm not sure i'm tracking exactly what you are talking about, but here's what I do with my orders. Basically, I set a wide sl and tp in case my internet connection fails. My order close operation is how I handle the hidden sl and tp as such:


extern double sl=0.0025;
extern double tp=0.00020;
extern double offlinetp=30;
extern double offlinesl=30;

//placing orders
res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,maxslip,Bid-offlinesl*Point,Ask+offlinetp*Point,"TheFXHub EUR/GBP",MAGICMA,0,Blue);


//order close operations....hidden sl and tp

for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)        break;
      if(OrderMagicNumber()!=MAGICMA || OrderSymbol()!=Symbol()) continue;
      //---- check order type
      if(OrderType()==OP_BUY)
        {
         if(Bid>OrderOpenPrice()+tp) OrderClose(OrderTicket(),OrderLots(),Bid,maxslip,Green);
         if(Ask<OrderOpenPrice()-sl) OrderClose(OrderTicket(),OrderLots(),Bid,maxslip,Red);
         break;
        }
      if(OrderType()==OP_SELL)
        {
         if(Ask<OrderOpenPrice()-tp) OrderClose(OrderTicket(),OrderLots(),Ask,maxslip,Green);
          if(Bid>OrderOpenPrice()+sl) OrderClose(OrderTicket(),OrderLots(),Ask,maxslip,Red);
         break;
        }
     }
//----
  }



I hope this is helpful and makes sense.


EDIT: After reading your post again...I see that i'm probably not helpful at all. Your addressing multiple orders....

 
Just fyi, you will most like loose pips on mql controlled tp,sl. pending orders are more precisious regarding slippage.
 
WHRoeder:


You're going to need 3 static arrays plus one temporary and a static count of entries used. You need to mark off triplets you handle in the order select loop and then remove entries no longer open (closed externally)

In addition if the platform is restarted, you'll have open orders but nothing in the arrays, so you'll have to handle that somehow (external files?)

What I'm doing I set the TP to real TP+constant. Then in the order select loop I set TP=orderTakeProfit()-constant;

This way I don't have to remember each order's values and I always have a TP/SL in case of disconnection.

Thanks. The first approach is something what I wanted to avoid and the second one sounds interesting, thanks for the suggestion.

 
guitarjrb:

I'm not sure i'm tracking exactly what you are talking about, but here's what I do with my orders. Basically, I set a wide sl and tp in case my internet connection fails. My order close operation is how I handle the hidden sl and tp as such:





I hope this is helpful and makes sense.


EDIT: After reading your post again...I see that i'm probably not helpful at all. Your addressing multiple orders....


yeah, that what I was saying, 2 variable approach, but thanks for input anyway

 
fx1.net:
Just fyi, you will most like loose pips on mql controlled tp,sl. pending orders are more precisious regarding slippage.

Actually, someone really experienced advised that I should start a bigger order and gradually close it. I have 2.0 lots and after 10 pips i close 1.0, then after another 20 pips I close 0.5 and so on. In this approach it is necessary to control TP on my own. This is said to be more efficient than opening 3 separate orders.

 
fx1.net:
Just fyi, you will most like loose pips on mql controlled tp,sl. pending orders are more precisious regarding slippage.

All of my ea's use mql controlled sl and tp's I even have massive ping delay on my internet and my ea's still remain profitable. Adding physical stop losses helps to protect in the event of disconnection or quick market movements, with that said, I have only had one order hit the physical stop loss, and that was rain messed up my connection. All of my coding focuses on volatility....so when volatility is up, my code doesn't trade. The key is to ensure that potential slip is accounted for in tp and sl levels. Thanks for the input though.

 
allerune:


I'm sorry, but that is ridiculous. According to you, having SL set at a given point WONT make broker make a small modification to the price just to hit that SL. But not having a SL WILL make broker make large modifications just to see if I close my order? That doesn't make any sense.



Get used to it. If you check, you'll find that pretty much ALL of what ckingher has ever posted on the forum is ridiculous.


CB

Reason: