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 »

deleted
Last edited by Anonymous on Sat Aug 10, 2013 12:53 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 »

Many thanks to Ewinner and Phil_Trade for helping out.

We all want to get the best out of a very good ea, so everyone can benefit.

Any possibility must be explored.

If we get the pending oder code sorted, then we will put ea on demo, and we will get our answer.

Sure, a pending order will cost a few extra pips, but I am convinced it can save you many more pips from premature entries.

In my manual trading, I always use a pending order a few pips above/below previous bar high/low and it keeps me out of false entries and always pays dividends.

Those of you who have downloaded the ea in a previous post and managed to fix the bug, please share your solution with the forum.

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

Re: HELP WITH ERROR 4107

Post by fx800 »

No trades entered by the original ea as well as the modified ea with pending order.

Wait and see what happens in the next 24 hrs.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

One of my other ea's with a pending order traded today.

I have therefore amended the code for Bob and Shelley again mod accordingly.

The pending bars expiry code has been moved to

Code: Select all

bool SendSingleTrade(string symbol, int type, string comment, double lotsize, double price, double stop, double take) 
{
   //pah (Paul) contributed the code to get around the trade context busy error. Many thanks, Paul.
   
   double slippage = MaxSlippagePips * MathPow(10, Digits) / PFactor(Symbol());

   
   
   color col = Red;
   if (type == OP_BUY || type == OP_BUYSTOP) col = Green;
   
   int expiry = 0;
   if (SendPendingTrades) expiry = TimeCurrent() + (PendingBarsTF * BarsToKeepPendings);//Dietcoke modification
   //if (SendPendingTrades) expiry = TimeCurrent() + (PendingExpiryMinutes * 60); 
If the pending order code works, you will be pleasantly surprised that it will keep you out of false entries.

I have set default of bufferpips = 5, in practice I find that even 2 to 3 pips is more than adequate. I have been using pending orders for donkey years and that is my experience.
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 »

Like yesterday, no trades sent by the original ea and the mod with PO.

However, one of my ea's with the revised code shown in the previous post has sent two pending order trades.

Thanks to Ewinner for spotting the bug.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

fx8000 wrote:Like yesterday, no trades sent by the original ea and the mod with PO.

However, one of my ea's with the revised code shown in the previous post has sent two pending order trades.

Thanks to Ewinner for spotting the bug.
I cannot work out why. The ea is sending error 130 this mroning.

I am using NormalizeDouble for CalculateStopLoss and CalculateTakePofits and SL and TP are in price, not pips.

I am using the same pending order code for Gday mk2 ea, and it is working fine.

Very puzzled.

:?
ewinner
Trader
Posts: 36
Joined: Wed Nov 16, 2011 9:36 am
Location: South West Ireland

Re: HELP WITH ERROR 4107

Post by ewinner »

Sounds like the STOP order your trying to send is to close to price resulting in a 130 error

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

Re: HELP WITH ERROR 4107

Post by fx800 »

ewinner wrote:Sounds like the STOP order your trying to send is to close to price resulting in a 130 error

Mark
Thanks, Mark.

Will wait for the next trade entry.

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

Re: HELP WITH ERROR 4107

Post by fx800 »

ewinner wrote:Sounds like the STOP order your trying to send is to close to price resulting in a 130 error

Mark
Are you saying a buffer of 5 pips is too small ?
ewinner
Trader
Posts: 36
Joined: Wed Nov 16, 2011 9:36 am
Location: South West Ireland

Re: HELP WITH ERROR 4107

Post by ewinner »

Yeah, try increasing it to 10 pips, see if that works.... at least then you can rule that out if it still doesn't behave!!

Mark
Post Reply

Return to “Coders Hangout”