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

HELP WITH ERROR 4107
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2914
Page 8 of 18
Author:  fx800 [ Tue Aug 20, 2013 10:37 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:Regarding your 130-error try the following please:

In the CountOpenTrades()-function look for that line (must be line number ~2507):

Code: Select all

if (MaxTradesAllowed > 1)
That code replace with this:

Code: Select all

if (OrderComment()==StackTradeComment && MaxTradesAllowed > 1 && (OrderType()==OP_BUY || OrderType()==OP_SELL)) //fxdaytrader
I am not 100% sure if it helps, but I think it is worth a try. 8-)

In your logfile I found another error:
cannot open file 'C:\FOREX Empty4\E-GLOBAL\experts\Bob and Shelley Again.v1o.PendingOrders.fxdaytrader 19-8-2013 2.ex4', expert was not reloaded


The way I try to solve that kind of problems when I download a new mq4-file: Copy the mq4-file in the desired directory (e.g. experts/). Then load another file from your Empty4 (rightclick - edit) in the editor, press F5 key to compile (it seems that all files will be compiled, or at least the files where no .ex4 exists) ...
Done, thanks.
Author:  fx800 [ Tue Aug 20, 2013 10:41 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:Regarding your 130-error try the following please:

In the CountOpenTrades()-function look for that line (must be line number ~2507):

Code: Select all

if (MaxTradesAllowed > 1)
That code replace with this:

Code: Select all

if (OrderComment()==StackTradeComment && MaxTradesAllowed > 1 && (OrderType()==OP_BUY || OrderType()==OP_SELL)) //fxdaytrader
I am not 100% sure if it helps, but I think it is worth a try. 8-)

In your logfile I found another error:
cannot open file 'C:\FOREX Empty4\E-GLOBAL\experts\Bob and Shelley Again.v1o.PendingOrders.fxdaytrader 19-8-2013 2.ex4', expert was not reloaded


The way I try to solve that kind of problems when I download a new mq4-file: Copy the mq4-file in the desired directory (e.g. experts/). Then load another file from your Empty4 (rightclick - edit) in the editor, press F5 key to compile (it seems that all files will be re-compiled, or at least the files where no .ex4 exists) ...
What do you mean by " Then load another file from your Empty4 " ?

Do you mean re-load the file by compiling it again.

I have checked the experts folder and the .ex4 file is there.
Author:  fx800 [ Tue Aug 20, 2013 11:07 am ]
Post subject:  Re: HELP WITH ERROR 4107

I have set stop loss to ATR PERI0OD = 20, ATR TIME FRAME =1440, SLATRMULTIPLIER =1.

PO HAS SL = 0.00000

2013.08.20 12:00:01 Bob and Shelley Again.v1o.PendingOrders.fxdaytrader 19-8-2013 2 NZDUSD,H1: stoporder debug: OP_SELLSTOP order entry: 0.7972 | stop: 0.0000 | take: 0.7672 | expiration: 2013.08.20 14:00

2013.08.20 12:00:09 Bob and Shelley Again.v1o.PendingOrders.fxdaytrader 19-8-2013 2 NZDUSD,H1: modify #142638458 sell stop 0.20 NZDUSD at 0.7972 sl: 0.0000 tp: 0.7672 ok

I have now set the ea to use hard sl =100.
Author:  fxdaytrader [ Tue Aug 20, 2013 11:31 am ]
Post subject:  Re: HELP WITH ERROR 4107

Did you set the external variable StopLossPips to 0?
Set it back to 100, ... It is because of the logics in the calculatestoploss()-function.
Author:  MrLong [ Tue Aug 20, 2013 11:31 am ]
Post subject:  Re: HELP WITH ERROR 4107

Hi,

I had the same problems with Multi 10_4 EA.

Code: Select all

 double stopLevel = (MarketInfo(Symbol(), MODE_SPREAD) + MarketInfo(Symbol(), MODE_STOPLEVEL)) * MarketInfo(Symbol(), MODE_POINT);
Then check before sending the long order.

Code: Select all

 if ((Ask + stopLevel) >= price ) return;
Then check before sending the short order.

Code: Select all

if (price >= (Bid - stopLevel)) return;
Andy
Author:  fx800 [ Tue Aug 20, 2013 11:53 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:Did you set the external variable StopLossPips to 0?
Set it back to 100, ... It is because of the logics in the calculatestoploss()-function.
StopLossPips has been re-set to 100.

I was using atr sl previously but seems it is causing problems.
Author:  fx800 [ Tue Aug 20, 2013 11:54 am ]
Post subject:  Re: HELP WITH ERROR 4107

MrLong wrote:Hi,

I had the same problems with Multi 10_4 EA.

Code: Select all

 double stopLevel = (MarketInfo(Symbol(), MODE_SPREAD) + MarketInfo(Symbol(), MODE_STOPLEVEL)) * MarketInfo(Symbol(), MODE_POINT);
Then check before sending the long order.

Code: Select all

 if ((Ask + stopLevel) >= price ) return;
Then check before sending the short order.

Code: Select all

if (price >= (Bid - stopLevel)) return;
Andy
Many thanks for your input.

peter
Author:  fxdaytrader [ Tue Aug 20, 2013 12:07 pm ]
Post subject:  Re: HELP WITH ERROR 4107

fx8000 wrote:
fxdaytrader wrote:Did you set the external variable StopLossPips to 0?
Set it back to 100, ... It is because of the logics in the calculatestoploss()-function.
StopLossPips has been re-set to 100.

I was using atr sl previously but seems it is causing problems.
yes, it is because of the logics, simplified it looks like that:

Code: Select all

    if (stoploss NOT 0) 
      THEN check  if (AtrPeriod GREATER THAN 0) 
         THEN calculate atr-stoploss
I can change that somewhen later ...

Thanks Mr. Long for the stoplevel-hint, I will implement it (within the next update).

fx8000 what do you think about using ATR for SL for stacking trades? Or any other ideas what could be missing?
Author:  fx800 [ Tue Aug 20, 2013 12:49 pm ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:
fx8000 wrote:
fxdaytrader wrote:Did you set the external variable StopLossPips to 0?
Set it back to 100, ... It is because of the logics in the calculatestoploss()-function.
StopLossPips has been re-set to 100.

I was using atr sl previously but seems it is causing problems.
yes, it is because of the logics, simplified it looks like that:

Code: Select all

    if (stoploss NOT 0) 
      THEN check  if (AtrPeriod GREATER THAN 0) 
         THEN calculate atr-stoploss
I can change that somewhen later ...

Thanks Mr. Long for the stoplevel-hint, I will implement it (within the next update).

fx8000 what do you think about using ATR for SL for stacking trades? Or any other ideas what could be missing?
using ATR for SL for stacking trades?

Great idea.

peter
Author:  fxdaytrader [ Tue Aug 20, 2013 1:29 pm ]
Post subject:  Bob Shelley again ea pending orders

See latest version attached, I think the sl-stuff works now. Set the new external variables as you need them (sl-section).

I think there was one bloop in the tp-section:

Code: Select all

if (OpenTrades > 0) take = lp;
in the original version it should be > 1, but as we have the option to open multiple trades now (maintrade, reentry, stacks) I changed that to

Code: Select all

 if (TradeComment==StackTradeComment) take = lp;
Do not forget to set LoadCustomMASettings=false, otherwise you load differen ma-settings (as I use them on one account for testing) ...
Bob and Shelley Again.v1o.PendingOrders.fxdaytrader.mq4
All times are UTC Page 8 of 18