HELP WITH ERROR 4107

Post Reply
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: HELP WITH ERROR 4107

Post by fxdaytrader »

Did you set the external variable StopLossPips to 0?
Set it back to 100, ... It is because of the logics in the calculatestoploss()-function.
MrLong

Re: HELP WITH ERROR 4107

Post by MrLong »

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
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
Last edited by Anonymous on Tue Aug 20, 2013 12:00 pm, edited 1 time in total.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: HELP WITH ERROR 4107

Post by fxdaytrader »

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?
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Bob Shelley again ea pending orders

Post by fxdaytrader »

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
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Coders Hangout”