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

Nanningbob 10.2 auto-trading EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=552
Page 14 of 54
Author:  SteveHopwood [ Fri May 18, 2012 9:55 am ]
Post subject:  Re: suggession control parameters

phil_trade wrote:Hi Steve

may I suggest adding the following controls codes in INIT() to automaticaly adjust LOT and PartCloseEnabled parameters to fit criminal and instrument requirement :

Philippe
Many thanks Philippe. I do not usually include this kind of idiot check, because I figure that anyone too dim to work out their crim's minimum lot size is safest not trading. You have done the work for me, so to refuse it would be churlish and I have added it to the EA, along with an appreciation for you. I shall add it to my shells as well. The check will show up in the next release.

Cheers.

:D
Author:  SteveHopwood [ Fri May 18, 2012 10:21 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Version 1j is in post 1, incorporating Philippe's lot-size idiot check.

I was not going to post the update so soon, but spotthedespot has done an outstanding bit of investigateve bloop-spotting that explains why some of you have not been seeing trades taken. If you know how to set your lot sizes and NB has been taking trades, then you do not need the update.

I have copied Dave's pm for the coders, at the end of this post. Translated into non-geek, the problem was caused by the OnlyTradeCurrencyTwice function.

Those of you who can, make these changes:
Find
bool CanTradeThisPair;
and change it to
bool CanTradeThisPair = true;

Then go to bool IsTradingAllowed() and find this code block, second block down:

Code: Select all

   if (OnlyTradeCurrencyTwice && OpenTrades == 0)
   {
      IsThisPairTradable();      
   }//if (OnlyTradeCurrencyTwice)
   if (!CanTradeThisPair) return(false);
and place this line ahead of the block:

CanTradeThisPair = true;

so that the block is:

Code: Select all

CanTradeThisPair = true;
   if (OnlyTradeCurrencyTwice && OpenTrades == 0)
   {
      IsThisPairTradable();      
   }//if (OnlyTradeCurrencyTwice)
   if (!CanTradeThisPair) return(false);
Setting the variable to 'true' twice is probably overkill, but may as well make sure.

:D

For the coders, here is the explanation (Dave, if you prefer not to have this quoted, sing out and I will remove it):
spotdespot wrote:Hi Steve,

I haven't had the EA trading on my account at all and although I am very capable of doing stupid things (I have many badges) I didn't think I had done anything in this case!

I checked the code (I am not familiar with MQL but code is code) and it seems I may have found the issue why some people are getting trades and some not. If you set OnlyTradeCurrencyTwice to TRUE then, as you know, in the IsTradingAllowed function it calls the IsThisPairTradable function if the conditional is met. In the IsThisPairTradable function it initializes the boolean CanTradeThisPair and checks whether to trade that pair, returning a boolean (from the IsThisPairTradable function). CanTradeThisPair is then checked:

Code: Select all

if (!CanTradeThisPair) return(false);
The issue arises (I think :? ) if you have OnlyTradeCurrencyTwice set to false as then IsThisPairTradable() is never called and CanTradeThisPair is never initialized. Now I have no idea how MQL deals with uninitialized variables but I have known the outcome to be pretty random using other languages - which might explain why some people are getting trades and others not (it could also just be those that have OnlyTradeCurrencyTwice = False that have the issue).

I set CanTradeThisPair to true when declared and now I am getting trades.

Hopefully this makes sense - I haven't posted this for others that have the issue just in case I am completely FOS!!

Cheers,
Dave.
Author:  jjasper7 [ Fri May 18, 2012 2:10 pm ]
Post subject:  Re: 10.2 updates

Steve,

Does this blog have an option to show what/when new files have been uploaded (as in ff)?

Unless you have a reason not to do so, it seems it would be helpful for us greenies if the page 1 Empty4 download would include its version number or date, so we could see when we are 'out of date' with the program we have downloaded.
Author:  verb [ Fri May 18, 2012 2:44 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

[spotdespot]
Hi verb - your points are valid if this is for buying in a dip/selling rallies BUT if that was the intention then I think you should only be buying in a dip and selling rallies if D1 TMA slope is >=0.8/<=-0.8?

Bob's booklets clearly state (as I originally quoted) that BOTH H4 Weekly Open Histogram 2x1 and 1x0 should be in agreement for buying/selling with the trend as S/R or MA's are crossed - so perhaps this should be reflected in the H4 Trend Trade "Basic Trade"?

It's your document obviously but I thought it was going to reflect a codified version of Bob's rules and, although I think it is very useful, I don't think that is the case at the moment. Perhaps Bob will have a chance to read your document and tell me I am wrong :lol:

Anyway - please don't take any offense - there is certainly none intended.
Thanks for staying patient, I believe I finally understand. I have made the adjustments to the H4 Trend and Pivot Retrace Trade Types hopefully reflecting your analysis.

Let me know if this meets your understanding. I take no offense here, that's why I posted it so we could all work together.

:)
Author:  spotdespot [ Fri May 18, 2012 3:32 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Looks good to me - thanks again for all your work.
Author:  SteveHopwood [ Fri May 18, 2012 4:23 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Thanks verb. I have uploaded this to post 1.

:D
Author:  SteveHopwood [ Fri May 18, 2012 6:26 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Version 1k is available from post 1, for the weekend backtesters to play with. I have added a weekly pivot cross function for when the market is ranging. Details in the range trade section of post 1.

Knowing which trade has been sent is not easy any more, so I have set up separate trade comments for each trading style. As yet, there is no idiot checking, so make sure each comment has something in it; blank trade comments will stop NB from trading.

:D
Author:  SteveHopwood [ Fri May 18, 2012 8:43 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

There have been a few posts here tonight that have demonstrated that:
  • 1) The poster has not read post 1 properly.
    2) The poster is not reading my posts.
I have deleted them and will continue to do so. If said posters continue to annoy me, I shall remove their registration from this forum.

Members should not expect to have any idea what is going on here if they cannot even be bothered to read my posts. I am, um, kind of, err, a teensy tad central to what is going on in this thread.
Author:  TallCoolOne [ Sat May 19, 2012 12:39 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Hi Steve,

Great work on this EA and thanks Verb your codex. Great contributions for this system. I work full time and I'm in the U.S. so it is hard for me to manually trade this system, so I really appreciate you creating this auto-trader.

The only thing I would ask for is an automated feature to close trades that are losers based on last swing hi/lo. I see many of the guys over in the FF thread are using that as a way of closing losers and are still doing very well. I have been using the auto-trader and closing trades manually, but would like to see how the EA performs with an automated close feature. Thanks for your consideration. Thanks for all your hard work

This EA may become my only auto-trader if it keeps performing as it has been.
Author:  phil_trade [ Sat May 19, 2012 12:53 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

TallCoolOne wrote:Hi Steve,

Great work on this EA and thanks Verb your codex. Great contributions for this system. I work full time and I'm in the U.S. so it is hard for me to manually trade this system, so I really appreciate you creating this auto-trader.

The only thing I would ask for is an automated feature to close trades that are losers based on last swing hi/lo. I see many of the guys over in the FF thread are using that as a way of closing losers and are still doing very well. I have been using the auto-trader and closing trades manually, but would like to see how the EA performs with an automated close feature. Thanks for your consideration. Thanks for all your hard work

This EA may become my only auto-trader if it keeps performing as it has been.
Could you described more technically "to close trades that are losers based on last swing hi/lo"
All times are UTC Page 14 of 54