Nanningbob 10.2 auto-trading EA

Share your 10.x automated traders here.
Locked
phil_trade

Re: 10.2; the auto-trading EA is born.

Post by phil_trade »

SteveHopwood wrote:Re the rapid opening/closing of trades thingy, no guarantee that what I am about to write is accurate but I have been involved with Empty4 long enough to be reasonably sure that it is.

Between them, Matt and Phil have provided industrial-strength code to overcome the more criminally-programmed aspects of this bloody platform.

Users of EA's must ensure that they run Matt's ForceHistorical script thingy, linked in the first post of every one of my threads since Matt first published it, before running the EA on a new platform. Not many people bother to read my post 1 properly, and have only themselves to blame for ignoring the information contained within it.

This is not to say definitively that there is no bug in the EA code, but until it manifests itself on my platform, there is nothing I can do about it. These days, I am far more inclined to blame Empty4 than once I was.

:D
Hello Steve

I suggest to include this check module to avoid all bad surprise in future :

Code: Select all

// Try to avoid rapid open/close trades
bool CheckIfBadTrade()
{

int NbHistoTrade = OrdersHistoryTotal();
if (NbHistoTrade == 0) return(false);

// check  max last 10 trades
int NbTradeToAnalyse = MathMin(10, NbHistoTrade);
   for (int i=NbHistoTrade; i > NbHistoTrade-NbTradeToAnalyse; i--)
   {
   if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) continue;
   if (OrderSymbol() != Symbol()) continue;   
   if (TimeCurrent() - OrderOpenTime() < 60) return(true);
   }
return(false);
}  //bool CheckIfBadTrade()
and to adapt START() with

Code: Select all

   if (!StopTrading && CheckIfBadTrade()==false)
   {      
      LookForTradingOpportunities();
   }//if (!StopTrading)
This will check if no trade within 60 last seconds...

Philippe
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: 10.2; the auto-trading EA is born.

Post by SteveHopwood »

phil_trade wrote:This will check if no trade within 60 last seconds...

Philippe
Nice one Phil.

V 1w is in post 1 incorporating Phil's latest. This will not solve the problem if it is caused by a bug in the EA code; it will help if it is a Empty4 thingy.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
phil_trade

Re: 10.2; the auto-trading EA is born.

Post by phil_trade »

Steve

New bug found in InserStopLoss :o

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_SELL);
should be

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_BUY);
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: 10.2; the auto-trading EA is born.

Post by SteveHopwood »

phil_trade wrote:Steve

New bug found in InserStopLoss :o

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_SELL);
should be

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_BUY);
Oh crap. I cannot believe even me can make a mistake that basic.

V 1x in post 1, for those of you who have not yet lost the will to live.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
mackaozy
Trader
Posts: 190
Joined: Sat Mar 17, 2012 1:22 pm

Re: 10.2; the auto-trading EA is born.

Post by mackaozy »

SteveHopwood wrote:
mackaozy wrote:Hi

If anyone has been getting good results with this EA any chance you could please post your setfile? My results have not been too good. :cry:

I also got like 15 EUR/GBP trades in one go that all opened then closed immediately. I would post however I'm not at home - trades are on myfxbook.



:)

Cheers

Steve
Remember that Bob designed and developed this system using Cowboy IBFX. Different crims with different timescales etc could easily lead to radically different results.

:D
Cheers Steve. I'm running it on Alpari. I'll fire up my Vantage fx account and run it side by side with fresh demos with your updated version and give it a go. :D Thanks for all your efforts by the way :D
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: 10.2; the auto-trading EA is born.

Post by SteveHopwood »

mackaozy wrote:Cheers Steve. I'm running it on Alpari. I'll fire up my Vantage fx account and run it side by side with fresh demos with your updated version and give it a go. :D Thanks for all your efforts by the way :D
Hehe. You might be better off thanking Phil for his correcting my best efforts. :lol:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
mackaozy
Trader
Posts: 190
Joined: Sat Mar 17, 2012 1:22 pm

Re: 10.2; the auto-trading EA is born.

Post by mackaozy »

phil_trade wrote:Steve

New bug found in InserStopLoss :o

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_SELL);
should be

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_BUY);
Thanks again Phil!! Appreciate the effort :D
phil_trade

Re: 10.2; the auto-trading EA is born.

Post by phil_trade »

mackaozy wrote:
phil_trade wrote:Steve

New bug found in InserStopLoss :o

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_SELL);
should be

Code: Select all

   if (OrderType() == OP_BUY)
   {
      stop = CalculateStopLoss(OP_BUY);
Thanks again Phil!! Appreciate the effort :D

I suspect Steve to leave a few bugs so I can be useful. Steve very charitable. :lol:

More seriously, above a level of technical difficulty, four eyes are essential! :idea:
phil_trade

Re: 10.2; the auto-trading EA is born.

Post by phil_trade »

Steve

I found an incorrect code that could do some strange things

in modules LookForD1H4TrendTrade and LookForD1TrendTrade, you define double Target in If Buy...so if it's a SELL, MQL found a no declared variable target = xxxx

You always have to declare variables at top of module to avoid this... of course...if you're kind enough :lol:
phil_trade

Re: 10.2; the auto-trading EA is born.

Post by phil_trade »

Steve

a friend has an Empty4 on Alpari which generates the Open/close bug.

I have add a Print in LookForTradeClosure() to see value

as you can see TP is 0.77782 but take read from line is 80.65200 so for a sell BID < take and LookForTradeClosure() close the trade !

Now we have to find why line is set to 80.652 :mrgreen:

2012.05.29 10:37:11 Nanningbob 10.2 auto-trading EA EURGBP,H4: open #1800554604 sell 0.60 EURGBP at 0.79938 sl: 0.83496 tp: 0.77782 ok
2012.05.29 10:37:13 Nanningbob 10.2 auto-trading EA EURGBP,H4: close #1800554604 sell 0.60 EURGBP at 0.79938 sl: 0.83496 tp: 0.77782 at price 0.79949
2012.05.29 10:37:13 Nanningbob 10.2 auto-trading EA EURGBP,H4: EURGBP Close By LookForTradeClosure() : Bid = 0.79937 take = 80.65200 stop = 0.00000
Locked

Return to “10.x EA forum”