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

HELP WITH ERROR 4107
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2914
Page 5 of 18
Author:  fxdaytrader [ Fri Aug 16, 2013 1:06 pm ]
Post subject:  Re: HELP WITH ERROR 4107

hm, I do not have a clue :(

Does the code I posted some posts ago work for you (I assume it is bug-free because it worked for me)?
Does your broker support pendingorder-expiration (as i know some do not allow)?
Maybe some problems with the price (see http://forum.mql4.com/45425#564188 , that is the reason I use normalizeprice-functions) ...

btw - Error 130 is invalid stops:
Stops are too close, or prices are ill-calculated or unnormalized (or in the open price of a pending order). The attempt can be repeated only if the error occurred due to the price obsolescense. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed.
Author:  fxdaytrader [ Fri Aug 16, 2013 2:00 pm ]
Post subject:  Re: HELP WITH ERROR 4107

try this one (search for my username fxdaytrader in the code to see the changes) ...
Are the functions hasbuyfilled/hassellfilled important? They are not used now.
Nevertheless, that should work, I think, hope :mrgreen:
Author:  fx800 [ Fri Aug 16, 2013 2:10 pm ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:try this one (search for my username fxdaytrader in the code to see the changes) ...
Are the functions hasbuyfilled/hassellfilled important? They are not used now.
Nevertheless, that should work, I think, hope :mrgreen:
Many thanks.

The versions I posted later do not use hasbuyfilled/hassellfilled, they are not important.

I will try this one and see.
Author:  fx800 [ Fri Aug 16, 2013 5:57 pm ]
Post subject:  Re: HELP WITH ERROR 4107

fx8000 wrote:
fxdaytrader wrote:try this one (search for my username fxdaytrader in the code to see the changes) ...
Are the functions hasbuyfilled/hassellfilled important? They are not used now.
Nevertheless, that should work, I think, hope :mrgreen:
Many thanks.

The versions I posted later do not use hasbuyfilled/hassellfilled, they are not important.

I will try this one and see.
Hi Fxdaytrader,

So far no trades yet today.

BTW is the pending order code

price = NormalizePrice(iHigh(NULL, NULL, 0) + (Buffer / factor)); //fxdaytrader

rather than price = NormalizePrice(iHigh(NULL, Period_H4, 0) + (Buffer / factor)); //fxdaytrader
Author:  fx800 [ Fri Aug 16, 2013 7:11 pm ]
Post subject:  Re: HELP WITH ERROR 4107

Until the ea pending order code is sorted, I am using a pending order buy/sell script written by Steve to place my live trades manually.

The pending order code is the same as in the ea without the pending order expiry code which is the offending item.

Scripts attached below.
Author:  fx800 [ Fri Aug 16, 2013 8:58 pm ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:try this one (search for my username fxdaytrader in the code to see the changes) ...
Are the functions hasbuyfilled/hassellfilled important? They are not used now.
Nevertheless, that should work, I think, hope :mrgreen:
Still getting error 130 with the attached ea.


2013.08.16 21:55:24 new.Bob and Shelley Again PENDING ORDER 3-8-2013 NZDCHF,M15: NZDCHF new.Bob and Shelley Again PENDING ORDER 3-8-2013 OP_BUYSTOP order send failed with error(130): invalid stops

In the meantime, I am trying out the orignal pending expiry code

Code: Select all

    int expiry = 0;
   if (SendPendingTrades) expiry = TimeCurrent() + (PendingExpiryMinutes * 60); 
The pending order expiry code is very important for the ea to work properly and it should expire after one bar whatever the trading time frame. If the pending price is not triggered at the next bar, then move on.

I have been trading the method manually for the past two weeks, and it is working very well and kept me out of many false entries. I only use a buffer of 3 pips.
Author:  fx800 [ Fri Aug 16, 2013 10:15 pm ]
Post subject:  Re: HELP WITH ERROR 4107

This is completely off topic.

If MaTrend is not up, do I use

if (!MaTrend == up) or if (MaTrend != up)

Thanks in advance.

:D
Author:  fxdaytrader [ Sat Aug 17, 2013 12:48 am ]
Post subject:  Re: HELP WITH ERROR 4107

The first is right.

I think I will take Steves current version of "Bob and Shelley again" and implement the pending-stuff (my plan is to let the user choose e.g. bool UsePendingStopOrders) and then let it run until it fires out some pendings to see if it works.
And if so, then I will post it here, I think within the next days/week (not today, its weekend and that means "go out and have some fun" :mrgreen: ).
Author:  fx800 [ Sat Aug 17, 2013 1:35 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:The first is right.

I think I will take Steves current version of "Bob and Shelley again" and implement the pending-stuff (my plan is to let the user choose e.g. bool UsePendingStopOrders) and then let it run until it fires out some pendings to see if it works.
And if so, then I will post it here, I think within the next days/week (not today, its weekend and that means "go out and have some fun" :mrgreen: ).
"go out and have some fun" sounds like an excellent idea !

Thanks again for your interest. I seem to remember that the embedded pending order expiry code worked on an old template (SwingOne ea to be exact). I will try it on demo next week on the new template of BASA. As I mentioned previously, the same code worked on Gday MK 2 ea that I have running on demo at the moment. Cannot work out why it is not working on the new ea.

Have lots of fun this weekend !

:D
Author:  fxdaytrader [ Sat Aug 17, 2013 3:07 am ]
Post subject:  Re: HELP WITH ERROR 4107

An good idea could be the following for debugging:
Insert something like Print("price: "+price+" take: "+take+" stop: "+stop+" expiry: "+TimeToStr(expiry)); just before the SendSingleTrade-call.

We'll see next week. I am just an amateur-coder, so I may need longer to solve some problems (or to find my mistakes :mrgreen: ), ... ;)
All times are UTC Page 5 of 18