stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3175
Page 1 of 5
Author:  fx800 [ Sat Sep 28, 2013 11:16 am ]
Post subject:  HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

Trend appears to be returning to the market, and MrLong's Multi 10.4 Trader sprang back to life yesterday.

Fxdaytrader has very kindly added a daily pivot filter to it recently : buy only if price is > DP, and opposite for sell. Hopefully, this will cut out some of the losers from buying/selling on the wrong side of the DP.

If someone could add an ATR stop loss option to the ea, then everything would be complete.

Many thanks in advance.

peter
Author:  kwanann [ Sat Sep 28, 2013 2:21 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

Erm, use mptm? It already has built in atr sl
Author:  fxdaytrader [ Sat Sep 28, 2013 2:53 pm ]
Post subject:  Nanningbob MULTI 10.4 TRADER with pivotfilter / atr for TP/S

not tested, pls. check (I have also added an adequate header) ;)

btw: This expert advisor requires some files:
mt4gui.mqh, mt4gui.dll and cSSLib.mqh

you can find mt4gui.mqh and mt4gui.dll at http://www.mt4gui.com/download/
Download the cSSLib.mqh at http://www.stevehopwoodforex.com/phpBB3 ... 035#p65035 or the latest version at http://www.stevehopwoodforex.com/phpBB3 ... =45&t=2905

cSSLib-stuff: copyright by Mr. Paul Geirnaerdt, "Baluda"

Copy the .mqh-files to Empty4-folder/experts/include/ and the .dll-file to Empty4-folder/experts/libraries/

edit: If you are looking for the original EA by MrLong visit http://www.stevehopwoodforex.com/phpBB3 ... =37&t=1619 :idea:
Author:  fxdaytrader [ Sat Sep 28, 2013 3:35 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

Hm, I do not like the mt4gui-stuff.
So attached is a "NoGui"-version which does not use it.

Further I have added the contents of cSSLib.mqh (copyright by Mr. Paul Geirnaerdt, "Baluda"), so the expert advisor does not require any additional files or libraries.
Author:  fx800 [ Sat Sep 28, 2013 4:42 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

fxdaytrader wrote:Hm, I do not like the mt4gui-stuff.
So attached is a "NoGui"-version which does not use it.

Further I have added the contents of cSSLib.mqh (copyright by Mr. Paul Geirnaerdt, "Baluda"), so the expert advisor does not require any additional files or libraries.

Hi Marc,

Thanks for your help again.

I didn't want to disturb you over the weekend, hence I post my request here. But, you came to the rescue nevertheless.

The reason for my request is that the hard stop does not seem to be working. I normally use a hard stop of 200 pips, and often gets stopped out for less than 100 pips. Looking at the hard stop code, it looked perfectly fine, that is why I never raised the issue in MrLong's thread because I did not want to waste his time.

Anyway, you have solved my problems now because using ATR stop loss is my favourite option, need to give my trades enough room to play out. Since, most of the ea's I use are trend ea's, unless the trend changes, there is a good chance the trade will go into profit eventually.

Your weekends are previous to you, so enjoy it.

Best regards,
peter.
Author:  fx800 [ Sat Sep 28, 2013 4:45 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

kwanann wrote:Erm, use mptm? It already has built in atr sl
BTW, the Multitrader is a basket trader, so MPTM would not be of any help.

Thanks for your idea anyway.

peter
Author:  fxdaytrader [ Sat Sep 28, 2013 4:56 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

fx8000 wrote: The reason for my request is that the hard stop does not seem to be working. I normally use a hard stop of 200 pips, and often gets stopped out for less than 100 pips. Looking at the hard stop code, it looked perfectly fine
oha, ok, what does the ea do? Does it set a wrong stoploss or no stoploss?
If it sets a wrong or no SL, then I assume the problem is that there is the stoploss-input an integer (but should/must be double imho).

edit: I updated the two EAs (TP/SL is converted to double, one external parameter removed because it was not addressed) ...
Author:  fx800 [ Sat Sep 28, 2013 6:50 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

fxdaytrader wrote:
fx8000 wrote: The reason for my request is that the hard stop does not seem to be working. I normally use a hard stop of 200 pips, and often gets stopped out for less than 100 pips. Looking at the hard stop code, it looked perfectly fine
oha, ok, what does the ea do? Does it set a wrong stoploss or no stoploss?
If it sets a wrong or no SL, then I assume the problem is that there is the stoploss-input an integer (but should/must be double imho).

edit: I updated the two EAs (TP/SL is converted to double, one external parameter removed because it was not addressed) ...
The problem was the stop loss was always less than 100 pips when my hard stop was set at 200. As I said, I did not want to waste anyone's time, and just use the alternative by setting everything to false and allow the ea to set stop loss one pivot above/below. Because I trade the daily pivots instead of weekly pivots, the stop loss is a bit tight.
Author:  fxdaytrader [ Sat Sep 28, 2013 10:47 pm ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

fx800 came up with the idea to use shelleys ma-filter (see BASA-thread for details) also (buy: lwma60 > lwma240, sell: lwma60 < lwma240 (and price > for buy, vice versa for sell), so I have implemented this.

Further I changed some variable-types (from int to double).

I do not know if this addition makes it possible to backtest the ea with the crapperquotes backtester, but I implemented this:
When 'CurrentPairWhenBacktesting'=TRUE then it will be checked if we are backtesting, and if so then the var 'symbolsToTrade' will be filled with the current symbol (added the filter 'if (!IsTesting())' in the extractpairs-function also because we do not need to append the suffix in that case) ....

Attached the nogui-version. I will update the mt4gui-version within the next days/week when everything is working and finished.
Author:  fx800 [ Sun Sep 29, 2013 12:13 am ]
Post subject:  Re: HELP TO ADD ATR STOP LOSS TO MULTI 10.4 TRADER

fxdaytrader wrote:fx800 came up with the idea to use shelleys ma-filter (see BASA-thread for details) also (buy: lwma60 > lwma240, sell: lwma60 < lwma240 (and price > for buy, vice versa for sell), so I have implemented this.

Further I changed some variable-types (from int to double).

I do not know if this addition makes it possible to backtest the ea with the crapperquotes backtester, but I implemented this:
When 'CurrentPairWhenBacktesting'=TRUE then it will be checked if we are backtesting, and if so then the var 'symbolsToTrade' will be filled with the current symbol (added the filter 'if (!IsTesting())' in the extractpairs-function also because we do not need to append the suffix in that case) ....

Attached the nogui-version. I will update the mt4gui-version within the next days/week when everything is working and finished.
I think you meant to change double LWMA60 and double LWMA240 in the following lines to double ma1 and ma2

Code: Select all

       //ShelleysMaFilter, fxdaytrader
        double LWMA60    = GetMa(CurrentPair, ShelleysMaFilterTF, ShelleysMaFilterPeriodMa1, ShelleysMaFilterShift, ShelleysMaFilterMethod, ShelleysMaFilterAppliedPrice, 0);
        double LWMA240   = GetMa(CurrentPair, ShelleysMaFilterTF, ShelleysMaFilterPeriodMa2, ShelleysMaFilterShift, ShelleysMaFilterMethod, ShelleysMaFilterAppliedPrice, 0);
        // 

Code: Select all

        //ShelleysMaFilter, fxdaytrader
        double ma1   = GetMa(CurrentPair, ShelleysMaFilterTF, ShelleysMaFilterPeriodMa1, ShelleysMaFilterShift, ShelleysMaFilterMethod, ShelleysMaFilterAppliedPrice, 0);
        double ma2   = GetMa(CurrentPair, ShelleysMaFilterTF, ShelleysMaFilterPeriodMa2, ShelleysMaFilterShift, ShelleysMaFilterMethod, ShelleysMaFilterAppliedPrice, 0);
        

Code: Select all

             if (UseShelleysMaFilter && !ShelleysMaFilter(type,askPrice,ma1,ma2)) //fx800
             continue; 

Code: Select all

            if (UseShelleysMaFilter && !ShelleysMaFilter(type,bidPrice,ma1,ma2)) //fx800
             continue;
Others may prefer other two ma trends.
All times are UTC Page 1 of 5