Stealth StopLosses?
Page 1 of 842 12 LastLast
Results 1 to 10 of 16

Thread: Stealth StopLosses?

  1. #1
    I understand how to code a standard stealth stoploss. That's not difficult in any way.

    Imagine if I needed to put in a trailing stop? How can I make that stealth and still maintain recoverability if the EA shuts down, power outage, system reset etc.. Further, how can I place that so it works for multiple orders?

  2. #2
    You cant.

    Should you dont have some connection to a broker (plus they dont understand where you want your SL - monitoring or otherwise) then no SL will exist.

    Best fit would be to code your monitoring SL logic into your 'EA' in a recoverable manner, and monitor if your EA is still attached. If not then it ought to warn you (by SMS / email etc)

    A recoverable manner ....

    Shop all transaction information in arrays (or structures if language aside from MQL)

    E.G. unique Magic, available price, kind (buy/Sell), H/L price, pip count, SL size, SL price etc and save all these arrays at regular intervals to a file.

    You'll also have to code patterns to load these values on EA initialisation - in cases where your EA/PC crashes.

    And patterns to 'understand' when you have returned from a temporary connection a crash so you can examine the current state of play verses the previous period before the outage.

    I would advise you set a fixed SL together with the broker that is further from price compared to actual stealth cease but not so far as to be non existant

    IE if your Stealth stop is currently 30 pips from price then set a broker cease 100 pips off so That You have some astrophe coverage

  3. #3
    Use GlobalVariables for the StopLoss, Current Trailing Stop, Etc.. - They dont expire after use for 4 months. Http://book.mql4.com/variables/globals - Of course your PC needs to be on and running however, the PC can be restarted and you pick up where you left off.

  4. #4
    Factors work for a single commerce, hard to apply to multiple.

    It seems like I will have to write to a file a log of ticks. (to exchange management of SL)

  5. #5
    Best way to set up globals for multi would be to use special identifiers:

    AccountNumber_TradeTicket_[StopLoss]
    23875443_19283_[60]

    Then its simple to parse it using the stringsearch and conversion purposes. After that its simple to make works CreateGlobalStop() and GetGlobalStop()

  6. #6
    Simple, not any dif than a real path
    just use rules to close a transaction, rather than transfer a sl

    heres a couple of lines of code only for you, u want have orders chosen

    Inserted Code if (! HideTakeProfitOrderType()==OP_SELLOrderTakeProfit( )! =OrderOpenPrice()-TakeProfit*my_point) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice()-TakeProfit*my_point,OrderTakeProfit(),0,CLR_NONE); if (! HideTakeProfitOrderType()==OP_BUYOrderTakeProfit() ! =OrderOpenPrice() TakeProfit*my_point) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice() TakeProfit*my_point,OrderTakeProfit(),0,CLR_NONE); if (HideTakeProfitOrderType()==OP_SELLMarketInfo(Orde rSymbol(),MODE_BID)lt;=OrderOpenPrice()-TakeProfit*my_point) OrderClose(OrderTicket(),OrderLots(),MarketInfo(Or derSymbol(),MODE_BID),Slippage,CLR_NONE); if (HideTakeProfitOrderType()==OP_BUYMarketInfo(Order Symbol(),MODE_ASK)gt;=OrderOpenPrice() TakeProfit*my_point) OrderClose(OrderTicket(),OrderLots(),MarketInfo(Or derSymbol(),MODE_ASK),Slippage,CLR_NONE);

  7. #7
    I realised this is ur thread ronald, following all the ea's iv seen u code, how couldn't know that this

  8. #8
    I just realised I posted the wrong code, here's stealth trail


    Inserted Code void trail() int totalorders = OrdersTotal(); for(int I=totalorders-1;igt;=0;I--)

  9. #9
    Not only is it stealth, itl draw lines on the chart so u can see the sl, I examined on ibfx, whilst online, if offline, the marketinfo dont operate

  10. #10
    I was just hit on by RR a much better idea. Add 1000 pips to your SL/TP and store it right in the order as normal. Simpy possess your exit routine subtract 1000 pips in the in-order SL or TP. Makes it effortless to store and easy to read.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.