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

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

deleted
Author:  fx800 [ Sat Aug 10, 2013 8:48 am ]
Post subject:  Re: HELP WITH ERROR 4107

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
Author:  fx800 [ Mon Aug 12, 2013 3:54 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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.
Author:  fx800 [ Mon Aug 12, 2013 8:57 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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.
Author:  fx800 [ Tue Aug 13, 2013 3:39 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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.
Author:  fx800 [ Wed Aug 14, 2013 12:07 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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.

:?
Author:  ewinner [ Wed Aug 14, 2013 12:10 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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

Mark
Author:  fx800 [ Wed Aug 14, 2013 12:15 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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
Author:  fx800 [ Wed Aug 14, 2013 12:20 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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 ?
Author:  ewinner [ Wed Aug 14, 2013 12:22 pm ]
Post subject:  Re: HELP WITH ERROR 4107

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
All times are UTC Page 3 of 18