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

Multi 10:4 Trader EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1619
Page 8 of 160
Author:  Dewey McG [ Fri Mar 15, 2013 6:06 am ]
Post subject:  Re: Multi 10:4 Trader EA

Same problem here
Author:  slipshod [ Fri Mar 15, 2013 6:09 am ]
Post subject:  Re: Multi 10:4 Trader EA

Hi Andy, great work - I'm going to try this out on demo simply because it looks so awesome :)

One thing I noticed immediately was a continual stream of the following error:-
Multi_10_4_EAv1.06 USDJPY_H4: invalid price for OrderSend function

Might I suggest adding the following three lines of code early in the SendSingleTrade function? The error went away once I inserted these & a slew of pending trades were created.

Code: Select all

Edit: fxdaytrader's solution below is much better
Also, what timeframe should this be run on, or does it not matter?
Author:  Sojourner [ Fri Mar 15, 2013 6:25 am ]
Post subject:  Re: Multi 10:4 Trader EA

This is so frikken awesome! Great work! :D
Author:  Bader [ Fri Mar 15, 2013 6:37 am ]
Post subject:  Re: Multi 10:4 Trader EA

Thanks Andy - fantastic work
Author:  danny_pip [ Fri Mar 15, 2013 6:50 am ]
Post subject:  Re: Multi 10:4 Trader EA

Mr Long, this looks really great; I'm going to test it right now !
I'm really surprised by the interface. Great work !!!!

Thanks and god bless you !
Author:  fxdaytrader [ Fri Mar 15, 2013 6:54 am ]
Post subject:  Re: Multi 10:4 Trader EA

slipshod wrote: Might I suggest adding the following three lines of code early in the SendSingleTrade function? The error went away once I inserted these & a slew of pending trades were created.

Code: Select all

	price = NormalizeDouble(price, Digits);
	stop = NormalizeDouble(stop, Digits);
	take = NormalizeDouble(take, Digits);
No, instead of using NormalizeDouble you should use the following (see HERE for further explanation):

Code: Select all

//Open price for pending order must be adjusted to be a multiple of ticksize, not point, and on metals they are not the same.
//see also http://forum.mql4.com/45425#564188
double NormalizePrice(double p){
  double ts = MarketInfo(Symbol(), MODE_TICKSIZE);
 return(MathRound(p/ts)*ts );
}
;)
Author:  slipshod [ Fri Mar 15, 2013 6:59 am ]
Post subject:  Re: Multi 10:4 Trader EA

fxdaytrader wrote:No, instead of using NormalizeDouble you should use the following (see HERE for further explanation):

Code: Select all

//Open price for pending order must be adjusted to be a multiple of ticksize, not point, and on metals they are not the same.
//see also http://forum.mql4.com/45425#564188
double NormalizePrice(double p){
  double ts = MarketInfo(Symbol(), MODE_TICKSIZE);
 return(MathRound(p/ts)*ts );
}
;)
Even better ... thanks! Actually my "solution" would have been wrong anyway, as the "Digits" would have related to whatever pair you're running the EA from rather than the pair being traded.

Edit: The EA needs the symbol passed into it, hence the function would need to be...

Code: Select all

double NormalizePrice(string symbol, double p)
{
   double ts = MarketInfo(symbol, MODE_TICKSIZE);
   return(MathRound(p/ts)*ts );
}
and therefore its calls from SendSingleTrade() ...

Code: Select all

price = NormalizePrice(symbol, price);
stop = NormalizePrice(symbol, stop);
take = NormalizePrice(symbol, take);
Disclaimer: I'm too busy right now to see if this actually works.
Author:  MrLong [ Fri Mar 15, 2013 7:48 am ]
Post subject:  Re: Multi 10:4 Trader EA

allisonmagic wrote:ok so, the MM on this thing is kinda buggy.. price hit the 240 and never closed my trade.. that was my SL..
I can only think the trade was taken with strealth turned on and then switched off while the trade had been sent. The stealth switch needs to be on to manage the trades.
Author:  MrLong [ Fri Mar 15, 2013 7:56 am ]
Post subject:  Re: Multi 10:4 Trader EA

philcs65 wrote:I am having the same problem with OrderSend function.

"2013.03.14 22:18:31 Multi_10_4_EAv1.06 AUDCAD,H4: invalid price for OrderSend function"

Running on a Cowboy IBFX (us) demo account. I have tried std and micro account without success.

Using OTB settings except changing magic number from "0".
Likely a broker problem.
Author:  slipshod [ Fri Mar 15, 2013 7:59 am ]
Post subject:  Re: Multi 10:4 Trader EA

MrLong, in case you missed them, the posts by myself and fxdaytrader provide code snippets that fix the "invalid price for OrderSend" error.
All times are UTC Page 8 of 160