HELP WITH ERROR 4107

Post Reply
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 »

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.
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 »

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:
You do not have the required permissions to view the files attached to this post.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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

Re: HELP WITH ERROR 4107

Post by fx800 »

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

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
You do not have the required permissions to view the files attached to this post.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
Last edited by Anonymous on Fri Aug 16, 2013 11:45 pm, edited 2 times in total.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

This is completely off topic.

If MaTrend is not up, do I use

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

Thanks in advance.

:D
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 »

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

Re: HELP WITH ERROR 4107

Post by fx800 »

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
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 »

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: ), ... ;)
Post Reply

Return to “Coders Hangout”