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

Nanningbob 10.2 Autotrader's new home
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=781
Page 1 of 38
Author:  al3xx [ Sun Aug 26, 2012 9:51 pm ]
Post subject:  Nanningbob 10.2 Autotrader's new home

Steve originally created and generously (as usual...) posted in these forums an EA for trading Nanningbob's 10.2 system that he later abandoned because it didn't look promising for him.

But as it turns out, some of us reported having various degree of success trading the EA and I have developed a healthy interest on the EA and I will be trying to make it better by fixing and improving it. If nothing else, you will like the fact that it will pick those Nanning 10.2 entries very well.

The original thread is http://www.stevehopwoodforex.com/phpBB3 ... f=44&t=552. You may want to go there if you want to follow the previous talk. It will be closed in due time and futher discussions and development will continue here.

To begin with, I am going to change a few things. The name of the EA will change slightly to Nanningbob 10.2 autotrader. This will help to distinguish it from the previous version since I expect we will have some major changes ahead.

The versioning also changes. There has been some confusion so here we will begin with 'Version 1.0'. This is the last version I posted on the original EA's home.

With that, here is the page one from the original.

SERIOUS WARNING

Most Forex traders lose all their money.
Using the robot posted here in trading Forex does not guarantee success.
Trading this robot could lead to serious financial loss.
Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
This is not a set-and-forget ea. There is no such thing and anyone who tells you there is, is either a liar or an idiot. This EA will need manual intervention.
At best, a trading robot is only 90% as good as the manual strategy it trades. At best. At worst, it can be much less effective. If the strategy is rubbish, so is the robot.
To trade this robot, you have to understand:
How to use EA's.
Trend trading and retracement, Range trading and Counter Trend trading. You will get all of this from http://www.forexfactory.com/showthread. ... ost4846473


This EA is an attempt to trade the system Bob describes at http://www.forexfactory.com/showthread. ... ost4846473 You must understand the system to know how the EA will work. If you cannot be bothered to work out the system, then go away now and do not attempt to use the EA. You will kill your account. Quickly.

DO NOT USE THIS EA ON A LIVE ACCOUNT. IT IS EXPERIMENTAL.

To run the EA, you will need the attached 10.2 indi's in your Indicators folder. You do not need them on your chart.

verb's codex
What follows is informed by verb's codes, attached. verb has provided a superb summary of trading requirements. You must not regard this as a rescue from needing to read and understand Bob's trading system. You can use this as a 'check list' before pulling the trigger on a trade.

So, to business
Currently, NB trades:

- D1 chart:
- go long when:
- Slope is >= 0.4
- Woh is green (i.e. > 0)
- there is a cross upwards of either the blue ma line or the monthly pivot
- price is above monthly pivot
- price is above weekly pivot
- go short when:
- D1 Slope is <= -0.4
- D1 Woh is orange (i.e. < 0)
- there is a cross downwards of either the blue ma line or the monthly pivot
- price is below monthly pivot
- price is below weekly pivot


- H4 chart:
- go long when:
- H4 Slope is >= 0.4
- H4 Woh is green (i.e. > 0)
- there is a cross upwards of either the blue ma line or the weekly pivot
- price is above monthly pivot
- price is above weekly pivot
- go short when:
- H4 Slope is <= -0.4
- H4 Woh is orange (i.e. < 0)
- there is a cross downwards of either the blue ma line or the weekly pivot
- price is below monthly pivot
- price is below weekly pivot- for all the above, you can turn the price above/below monthly and weekly pivots filter off by setting EnforcePricePivotIntegrity to 'false'



- Range trading. Turning TradeRange to 'false' disables Range trading. Currently, there are two types of Range trades:

Bollinger Bands triggered trades. UseBollingerBands must be set to true to allow this. NB trades back towards the weekly pivot.
- go long when:
- D1 Slope shows an upward bias i.e. >= 0.4
- H4 Slope is < 0.4
- market is below the weekly pivot by MinimumRangeTakeProfit.
- market has moved back above the lower BB line from below.
- go short when:
- D1 Slope shows an downward bias i.e. <= -0.4
- H4 Slope is > -0.4
- market is above the weekly pivot by MinimumRangeTakeProfit.
- market has moved back below the upper BB line from sabove
- the inputs section allows you to play with the settings. BbTimeFrame is the input that controls the time frame NB consults for range trading, and defaults to the H1 chart.
- range trade the weekly cross. TradeWeeklyPivotCross must be set to true to allow this. I came across this gem from Bob at:
viewtopic.php?p=13188#p13188. "Range trades will be SRFs and crossing main pivot lines as range prices go back and forth. In other words price just keeps ranging between S1/R1 on non volatile pairs and S2/R2 on more volatile pairs. This causes it to cross the pivot line and you get to use tight SL there if you want or try a 2nd level recovery at S/R 1 lines. I got to see these in April while I was testing and the system worked very well. May was great for trending. You will love
the system because it does work both ways. You just haven't been able to see it yet.

The slope stays inside the 8 lines showing that there is only one real trade available so go the other way when price crosses the pivot line. You wont believe how many times it will work. The buy/sell bias of the slope will tell you which way you have a better chance of getting to the next S/R line for your TP. It is a thing of beauty."

- Trading conditions are:
- D1 Slope must have a clear buy or sell bias. H4 must be ranging.
- trades are taken at the cross of WP, in the direction of the D1 Slope.
-- tp and sl are the relevant resistance and support levels i.e. weekly R1/S1 for trading groups 1, 2, 3, and R2/S2 for the rest.


Cross verification
For this, we have Alex (al3xx) to thank. What this does is to avoid situations when you load the EA on the chart and it picks a cross that happened 50 or more pips ago as a valid entry. I don't want this... I want to catch the cross at the moment it happens. So we check the distance between price and the crossed line and if it is more than a set number of pips it is not valid.

Correlation
Thanks to hopfi2k who sent me the following changes. When applying the EA to many (most) available pairs, it often happens that pairs moving into the same direction have open trades (correlation). I added a correlation filter that checks before a new position is opened against all open trades if there already is a high correlation (adjustable, default to 80) and doesn't open that position.
This usually greatly helps to avoid situations where all correlated pairs go south in case a trend changes or news have an major impact.

Adaptive take profit exits
I have started work on these. NB has the breakeven/trailing/jumping/candlestick_trail features adapted from mptm that come will all my bots these days. I have added the part-close feature, so read how to use it in the mptm user guide.

I have coded NB to override any TakeProfit value if the D1 Slope is >= 0.8 or <= -0.8. Instead NB will use the Breakeven and Jumping stop features to manage the trade. You will see on your chart that these are enforced, so make sure their default values are those you want. By default, the bot uses the 25/10 breakeven that is becoming the norm, and a jump of 50 pips. When the trade closes, the settings return to your choice.

Where the D1 Slope is not in the buy/sell-and-hold areas, NB looks for the next full Support or Resistance level (monthly pivot, R1, R2 or R3 for a buy or monthly pivot, S1, S2, S3 for a sell) that is at least MinD1TrendTradeTpPips away from the order open price. If the trade was triggered by the H4 chart, the tp is the next appropriate S/R: weekly R1/S1 for sub group 4 pairss; weekly R2/S2 for group 4 and 5 pairs.

Adaptive stop loss exits

ATR Stop loss calculation. Described in page 25 http://www.stevehopwoodforex.com/phpBB3 ... &start=240

UseATRStopLoss setting enables the feature. The rest of the settings that follow are pretty straight forward and just allow flexibility on ATR calculation.

If StopLoss is zero and UseATRStopLoss is false, NB adopts these strategies for setting a stop loss:

- D1 trend trade:
- buy: MS2 for groups 4 and 5, MS1 for groups 1 - 3.
- sell: MR2 for groups 4 and 5, MR1 for groups 1 - 3.
- D1/H4 trend trade:
- buy: WS2 for groups 4 and 5, WS1 for groups 1 - 3.
- sell: WR2 for groups 4 and 5, WR1 for groups 1 - 3.
- Bollinger Band range trades:
- buy: top BB line.
- sell: bottom BB line.- weekly pivot cross range trades:
- buy: WS2 for groups 4 and 5, WS1 for groups 1 - 3.
- sell: WR2 for groups 4 and 5, WR1 for groups 1 - 3.


Take profit and stop loss line
Where the trade has stops, then NB draws lines that represent the sl/tp +- HiddenPips. If you manually move the lines, NB should adjust the stops to reflect the new line values. Each line consists of a prefix ('Tp' or 'Sl') followed by the trade's ticket number. Hover the mouse over a line to see which trade 'owns' it, if you have multiple trades open on the chart.

Time frames
You have no choice about using D1 for overall direction finding. Trading strictly according to the system, the lower time frame should be the H4, but I have included the LowerTimeFrame input so that inveterate tinkerers can tinker inveterately. This also means that you can switch from one tf to another on your chart without mucking up the bot's calculations.

Magic numbers
These are how NB knows which trade was triggered by which trigger - D1 trend, D1 trend/H4 trigger etc. Hover the mouse over the ticket number of an open trade and you will see the trade's ticket number and magic number displayed.
Thanks to hopfi2k you can now set majic number to zero and it will be generated automajically. The explanation from hopfi2k:
Concerning the problems of rapidly new trades of the same pair that some users report, I think its a problem of the magic numbers. Attaching the robot to multiple pairs without changing all magic number to unique values can led to unexpected results ;-) I added an automatic unique magic number generator that will generate a unique number for each pair (independent of TF so nothing happens if users change TF of while the EA is running) and all trade modes (D1, D1H4, Bb, Wpc). This should circumvent some problems when users attach the EA to multiple pairs.

Balance, margin and swap filters
Read how these work in the attached Shell User Guide. Much that is in the guide is not relevant here, so ignore it. Watch the swap filters especially; I loathe seeing my profits eaten by the criminal negative swap on the Cad, Aud, Nzd pairs, and these are always set to buy only.

Sunday candle
NB will not trade the Sunday candle.

Exceptionally useful summary posts
viewtopic.php?p=14036#p14036
viewtopic.php?p=14042#p14042

In conclusion
There is no way in the world that an EA can come better than within hailing distance of Bob's skill as a trader. What it does do brilliantly is: monitor the markets all day round; remove the human emotion element from trading. Let's see how close we can drag NB to being as good as its system designer.

:D

Matters of general interest

Read this post:
http://www.forexfactory.com/showthread. ... ost4923611 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration. There is a thread devoted to Sam's trading method at http://www.forexfactory.com/showthre...25#post5118825

Masterly summary of hedging: http://www.forexfactory.com/showthread. ... ost4977179

EA coding
I receive may requests to code EA's. Traders, if I code your EA for free, then I will share it here. If you want me to code your EA without sharing, then my fee is $100 payable into my paypal account. I explain why at http://www.forexfactory.com/showthread. ... ost4431794, at the bottom of the post.

Useful utilities/EA's/scripts
Matt's chart-population script at viewtopic.php?p=5733#p5733. Use this every time you start a fresh platform.
MaryJane has posted a fabulous utility to allow us to resize EA input windows: http://www.forexfactory.com/showthread.php?t=299017
Multi purpose trade manager: http://www.forexfactory.com/showthread.php?t=89371
Account equity analyser: http://www.forexfactory.com/showthread. ... ost4693716 Also at http://www.forexfactory.com/showthread. ... ost4709098, which includes a template for both USD and the Euro.
Past-trades display indi by squalou; shows a graphical display of the success/failure of trades in your History tab. Breathtaking piece of work. http://www.forexfactory.com/showthread. ... ost3830610
My shell EA – the code I use to produce EA's so quickly. viewtopic.php?f=5&t=15
Author:  SteveHopwood [ Sun Aug 26, 2012 9:56 pm ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

Fantastic. Thanks for taking this over. Link in my original thread is about to appear.

:D
Author:  al3xx [ Sun Aug 26, 2012 10:09 pm ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

Hi People,

From the original thread, I understand many are experiencing the rapid opening of trades problem. I have tried as much as I could in this short while to see where this could be coming from. I have not experienced this myself apart from in the EA's earlier days where there was a bug related to Stacking Trades and Pips vs Pippetes.

I have a hypothesis related to Empty4 being crappy (It is, right?) and I have included in this EA some code that could allow us to catch it before it craps out on us.

Basically, for the coders, the only way I have found that we could open a trade is if SendTrade is set to true. SendTrade is a local variable in the LookForTrading... function. According to MQL docs, all local variabless are initialized to zero (false) automajically if not done explicitly. But if that is crap, then SendTrade could just as well be non-zero and we could send a trade. I added code at the start to check if SendTrade is not zero, report to the user and reset to false so that you can use it safely still.

I have to say that this is a hypothesis and could be right or wrong but in the circumstances, we are going to try everything to get rid of that problem. Again, it is all I could think of now. It could be also that the rapid opening and closing is a bug in the code that we cannot see but time will tell.

As I said, I have not experienced this myself and I would like as many people as possible trying out this version and report the results.

Kind Regards,

Alex
Author:  al3xx [ Sun Aug 26, 2012 10:10 pm ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

SteveHopwood wrote:Fantastic. Thanks for taking this over. Link in my original thread is about to appear.

:D
Yeah, thanks. Good to go :)
Author:  AnotherBrian [ Sun Aug 26, 2012 10:35 pm ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

al3xx wrote: To run the EA, you will need the attached 10.2 indi's in your Indicators folder. You do not need them on your chart.
Indi's aren't posted. Where you referring to a link? I could always get them from the other threads....

Looking forward the using this, but I have a question. My strategy is manual S/D using a trading tool TT2P but I also run some bots using low lot sizes to supplement the account balance (I don't use bots as a main source of trading trades).
How safe is this bot to use considering I'll use 0.01 lots on an account of 10k and checking trades at least daily?
Is it safe to manually close a trade without negatively impacting the operation of the bot?
Author:  cuzgeorge [ Sun Aug 26, 2012 11:11 pm ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

Hi All,
all loaded well, running OOTB for now, no errors, used my indis from before.
Thank you Alex for jumping in here. Really appreciated. :D
cuzgeorge
Author:  blahn [ Sun Aug 26, 2012 11:36 pm ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

If i had known someone was gonna take over the ea to continue it i would have commented my own fixes i did a couple weeks ago to solve some of the rapid close problems. :) anyways, I haven't programmed in 10 years but was bored a couple weeks ago. these are the areas i noticed problems in strategy tester.
Breakeven - even tho I had break even set to false in user settings, my stop kept getting modifed after the initial order. drove me crazy for a while until i found somewhere in the code that breakeven was being set to true no matter what the user choose.. i can't remember where tho at the moment. :)
Hidden pips- after fixing the stop being modifed after initial order, i noticed the tp was also being modifed and getting orders cancelled right away. i had a 50pip tp and noticed that my tp would be sent correctly initially then 50 pips would subtract off in the modify and the order would close. taking hiddenpips down to 0 fixed it i believe. i don't remember finding exactly where the error was.
CalculateTakeProfit - i also noticed my manual tp being overidden somewhere. encapsulating all the trend/range filters with a if (TakeProfit == 0) { d1 trend/range/etc } will protect it from getting overridden like the similar statement does in CalculateStopLoss
Author:  Lifesys [ Mon Aug 27, 2012 4:58 am ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

Hi Alex
Maybe the rapid Open/close is not 'SendTrade' but a Close (time) problem. If a trade is closed prematurely and the conditions are still right, it will reopen, hence the cycling.
My EA (based on Steve's Barebones Shell) for my own conditions, first run it did just that, opened 2 pair trades and then shut them, losing spread - 20 times. I found the problem was in the Close time conditions. BJS basket did similar.
Also removed all the hidden SL, TP line stuff as it seemed unreliable. Our internet is prone to disconnect so we use firm TP, SL anyway, set at open time by MPTM. They are not often used as the EA has other close conditions and EasyOrder lines work very well.
A major problem occurs for the unfortunate who do not have NY close synched data. This "Sunday candle" stuff seems nonsense to those of us whose Forex week starts Mon 00H and closes 5pm NY time (GMT+3) - leaving a neat 48 hour weekend - divisible by H4.
A major point is to ensure trading times are correct and any open & close times are actually on the correct day - if not - rapid open & closes.
Open & close trade times cannot just be based on hours as trading overlaps days.
We laugh at the sheer chaos negotiated by those juggling non-GMT+3 (NY close synched) sources.
This is a major cause of market time setting & H4 histogram errors.
Author:  forex.rapheal [ Mon Aug 27, 2012 5:51 am ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

Hi Al3xx,
thank you for your effort. can we enter fx pairs into the EA so it can trade them as a basket rather attach it to all fx tab? will it be accurate to back test using this EA as TMA 'repaint' in this case?
regards,
Author:  The_Snowman [ Mon Aug 27, 2012 6:12 am ]
Post subject:  Re: Nanningbob 10.2 Autotrader's new home

forex.rapheal wrote:Hi Al3xx,
thank you for your effort. can we enter fx pairs into the EA so it can trade them as a basket rather attach it to all fx tab? will it be accurate to back test using this EA as TMA 'repaint' in this case?
regards,
Yes, this is my question also; does it need to be open on a chart of each pair to be traded or only one base chart for all?

I notice even I set the ECN to False, on the chart it shows as True?

Many thanks, John
All times are UTC Page 1 of 38