From here on, all suggestions to improve this EA are gratefully received.
Please visit http://www.forexfactory.com/showthread. ... ost1974715 for details of Eval's system.
The attached ea is intended to help with trade entry, management and exit of SAFT trades. It is a semi-auto trader, in that it responds to trendlines that you draw on your chart and OBV indi window.
In order to work with the trenlines, the ea has to know what they are called. The input that you use for your chart trendline is:
- - ChartTrendLineName, defaults to 'ctrend' ( i.e. chart trend. The trendline you draw on your chart must have the same name.
The OBV indi needs a 21 lwma and OBV has to break this in the direction of the trade. NeoTrader has produced a nifty indi that does the job for you. Download it from http://www.stevehopwoodforex.com/phpBB3 ... 048#p22048.
I have coded colour as the ea's method of reading the trade direction, so your trendlines must be the appropriate colour:- - BuyLineColour for the downward sloping lines whose break you are trading long.
- SellLineColour for the upward sloping lines whose break you are trading short.
So, imagine you want to trade long:- - drag a trendline onto your chart and name it 'ctrend', then colour it green (or whatever you have as your ea inputs).
Initial stop loss is the previous fractal; tp is the stop loss * 2. I have not added a minimum stop level check yet; we shall have to see if this causes a problem. To make sure the take profit is exactly correct, the ea first sends the trade without sl/to, then first inserts the sl, calculates the tp and inserts it.
Whether you use Stealth or not, the ea draws dotted tp/sl lines at the appropriate level. Select these and move them, and the tp/sl will move with the line.
use EmailTradeNotification to receive an email alert when the ea sends a trade. Use SendAlertNotTrade to tell the ea to let you know of a setup, but not actually do the trade. If you enter the trade manually, the ea will manage it for you so long as the trade has the correct magic number.
I have the ea running an eu trade and everything appears to run smoothly. No doubt bugs will emerge.
The three exit strategies
Eval has described this in his thread. You have to take care with your combination of inputs:- - Conservative
- - set Conservative to true. The ea will send a tp with the trade, and a tp line coloured as you choose.
- you need to manually set your breakeven/jumping/trailing stop inputs
- - set Moderate to true. The ea will draw the tp line at the correct point, but there will be no 'hard' tp..
- manually set your breakeven point in the Breakeven inputs. At breakeven, the ea will close half the trade, so make sure your Lot size is divisible by 2. Moderate disallows RiskPercent generated lot sizing.
- make your choice of jumping/trailing stop functions, but make sure the xxxTargetPips input is zero, so the ea can set this as equal to the stop loss.
- - set Conservative to true. The ea will send a tp with the trade, and a tp line coloured as you choose.
- - BuyLineColour for the downward sloping lines whose break you are trading long.
Have fun.