1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FTS Toolkit - Trailing Stop EA - Minimize risk even further with trailing stop and BE

Discussion in 'Forex Tactical Squad' started by Peter O, Sep 28, 2013.

  1. Peter O

    Peter O Special Consultant to the FPA

    Joined:
    Jan 14, 2013
    Messages:
    3,244
    Likes Received:
    1,397
    Fellow Squad Members,


    For those who use VPS or who are not at the PC all day this EA, in addition to our Break Even EA, can lower risk significantly as it manages trailing stop on a currency pair together with break even.

    By default the EA drags stop level at 20 pips distance from market price. However, you can combine trailing stop with setting break even level. First, you can wait with trailing stop until break even triggers: if you set 'Trail_before_break_even' to false no modification will take place before stop gets to BE level.


    Installation and starting:

    Download source code from here:



    This is an expert advisor code so you need to copy it to {MetaTrader4 folder}/experts folder and then start the trading platform (or close and restart if it was open). The tool will appear on Navigator panel (open from View menu) among Expert Advisors as FPA=TrailingStop so just drag over your chart.

    [​IMG]


    Enable Expert Advisors:

    To use it don't forget to enable Expert Advisors in terminal's Options (menu: Tools/Options - Expert Advisors tab first checkbox). This shows a smiley face on the upper right corner next to the EA's name (otherwise there is an x).

    [​IMG]
    [​IMG] [​IMG]

    Settings and Parameters:

    You can open Inputs tab right after starting EA when Properties come up or by pressing F7 if you switch from Common tab to Inputs.

    [​IMG]

    Parameter: Break_Even_Trigger_in_Pips
    Possible values: decimal numbers
    Function: It tells the EA how far the market price should go in positive before break even gets set (default value is 30.0 pips). You can turn off break even if you set it to zero or negative.

    Parameter: Break_Even_in_Pips
    Possible values: decimal numbers
    Function: This is break even level itself as you might want to calculate with spread and commission so break even would be in positive a bit (default value is 1.0 pip).

    Parameter: Trailing_Stop_in_Pips
    Possible values: decimal numbers
    Function: The distance how far the stop level should follow market price in pips (default is 20.0 pips). If 'Trail_before_break_even' is set to false it waits until break even triggers.

    Parameter: Trail_before_break_even
    Possible values: true or false
    Function: It hangs trailing until stop moves to break even. If BE is off (you've set 'Break_Even_Trigger_in_Pips' to zero or negative) you first need to set stop level to BE or to more profitable level. (Default is false.)

    Parameter: Apply_to_all_symbols
    Possible values: true or false
    Function: Set it to true if you want to get all your trades managed by a single chart and EA. (Default is false.)



    Operation:

    Stop level follows market price by a certain distance ('Trailing_Stop_in_Pips') moving always in profitable direction. This is combined with setting break even levels that is triggered by 'Break_Even_Trigger_in_Pips' and set at 'Break_Even_in_Pips'.

    If you prefer to set break even first you can get the EA wait until it triggers by setting 'Trail_before_break_even' to false (this is the default anyway).

    Possibly you want to use the EA for trailing all your trades on all currency pairs, then you only need to set 'Apply_to_all_symbols' to true.


    You can participate:

    Tell me and your fellow Squad Members how you like it.
    Tell me and your fellow Squad Members how could it be better.
    Tell me and your fellow Squad Members if you have any problem while installing or using it.


    Who wants to enter the Laboratory:

    Right click on Navigator panel/Expert Advisors/FPA=TrailingStop and select Modify. MetaEditor opens up showing the full source code I've written for you.

    [​IMG]

    On the first screen you find input parameters and you can change default values if you wish.

    [​IMG]

    After modifying the code press F5 or Compile button on the top. If it writes "0 error(s),..." on the bottom, you have your own new version and you can start using it after going back to MT4 terminal.

    [​IMG]

    Looking forward to hearing your feedback,

    Peter
     
    Castro Elgar and Rajib like this.
  2. fmlbfx

    fmlbfx Recruit

    Joined:
    Sep 30, 2013
    Messages:
    2
    Likes Received:
    0
    Help !!!!

    Hi
    I want trail using parabolic sar
    Regards
     
  3. suban

    suban Recruit

    Joined:
    Nov 25, 2013
    Messages:
    1
    Likes Received:
    0
    How can i use this EA in STP brokers ?
     
  4. Peter O

    Peter O Special Consultant to the FPA

    Joined:
    Jan 14, 2013
    Messages:
    3,244
    Likes Received:
    1,397
    As far as I know it should work correctly also with STP brokers. It calculates pips independently of digits and it doesn't deal with lot size. So if you see any specific problem please let me know.

    Peter
     
  5. Refan37

    Refan37 Recruit

    Joined:
    Dec 29, 2013
    Messages:
    10
    Likes Received:
    0
    It calculates pips independently of digits and it doesn't deal with lot size . So if you see any specific problem please let me know.
     
  6. Boozelou

    Boozelou Recruit

    Joined:
    Jan 8, 2014
    Messages:
    1
    Likes Received:
    0
    How can I download this EA, the link at the top gives me a .php file
     
  7. Peter O

    Peter O Special Consultant to the FPA

    Joined:
    Jan 14, 2013
    Messages:
    3,244
    Likes Received:
    1,397
  8. Mizan Sharif

    Mizan Sharif Recruit

    Joined:
    Feb 9, 2013
    Messages:
    3
    Likes Received:
    0
    How many pairs I can use at a time?
    Regards,

    Mizan Sharif
     
  9. Peter O

    Peter O Special Consultant to the FPA

    Joined:
    Jan 14, 2013
    Messages:
    3,244
    Likes Received:
    1,397
    Hi,

    You can set 'Apply_to_all_symbols' external variable to true and then it will manage all trades in the account. However, I prefer to use this EA on each currency pair I trade with 'Apply_to_all_symbols' set to false - that is on separate charts with many EA instances. I say it because evaluation takes place when a new tick comes in, that is if you trade AUDJPY and the EA runs on EURGBP then it will check AUDJPY prices (frequent ticks) quite rarely (when new EURGBP tick arrives in the European night). And the other thing is that if you have separate EAs on more charts you can set break even and trailing stop levels on each pair.

    Peter
     
  10. Florian P

    Florian P Recruit

    Joined:
    Jul 29, 2014
    Messages:
    5
    Likes Received:
    1
    Hi,

    one thing you could add that I like to use is to set the SL to the previous candles high or low (dependent on buy or sell). It's one of the easiest and safest trendwalking methods that basically implements the definition of trend (ie. higher lows, lower highs). The advantage is that your SL is dynamic based on price not on constant values like fixed trailing stop. It exits very early when trend is broken, so potential losses are low but also potential profits are much lower because retracements after low volatility movement exit the trades. I programmed an EA for that but I guess it's so simple you could add it yourself to this one.

    Best regards,
    Florian
     
    mntiwana likes this.

Share This Page