MT4 Auto SL code to get me started ??

Discussion in 'Automated Trading' started by Turveyd, Mar 27, 2019.

  1. Turveyd


    I'm a programmer, but not done MT4 in years, plan is.......

    Leave my PC running MT4 when it sees a trade which I'll place manually but sometimes there, sometimes a tablet far far away, it'll set a SL and trail via my SL rules.

    Stops me being lazy, removes some fear and time to enter SL on the tablet is slow.

    Anyone ?? I can modify to suite!!

  2. Fire away your questions. I have many years of experience in MQL4.
  3. Turveyd


    Just need to nick some code to get me started, been about 10years since I messed with MT4.

    I need Syntax for ....................

    What Contract ( DAX, GBPUSD, US500, US30, AUS200 ) so I can use the right Decimals.

    Value Low and High of Envelope 20ema 0.03% for SL placement ( Max 10 away, Min 6 ) ( just EMA +/- 0.03% if no envelope available )

    If no SL set, then Set SL.

    Move SL up as Envelope goes up.

    Working this week, Coding at clients, get on it Monday next week, 1 way of stopping me, let trades run against me and force good trades, bad trades SL 6 when made.

    20min task :)
  4. These things are pretty basic. Sample codes are available online.

    You should try to come up with some codes. If it's not working then I will be able to help.
  5. Turveyd


    Found most of the commands in a quick google yesterday, knock it up sunday night when markets are open, make sure it moves the SL right on a demo account.

    30ema based, unless 10ema is X above / below for fast markets, then it’ll track that.

    As long as PC is on, instant ass protection:)
  6. Turveyd


    Basic Version written, Just SL 10pts but works on all markets, test then improve Sunday night when things start moving, need demo account :(

    15mins so far, likely another hour to put some brains behind it maybe 2.