|Gorraf ||Sep 15, 2016 1:21am | Post# 18 |
I did not want to interfere, since Alberto_Jazz already mentioned in post #13, that he is already working on an EA, but, since I have gotten a friendly pm to give this EA a try, I have coded it, which you can find attached.
A few remarks:
- Since, according to post #17 the EA does not have a solid entry point. Due to this, I have added two buttons to the bottom left corner of the chart, which start a buy, or sell cycle.
- Because of the above mentioned reason, the EA wouldn't work in the strategy tester, so I have added two input selectors to the EA , which can bypass the buttons.
- According to my (fairly short) testing cycle, the EA works, however, I guess, the author of the idea didn't calculated with spreads. Usually, it isn't a big issue, but with such small pip targets it is, as you will see it in the results.
The two red lines in post #1 are calculated with (Ask+Buy)/2, which is the actual price line you can see on the chart.
Now, if you initiate a buy or sell order the order will be sent out with a spread on ask or on spread price, which is, on a lot of currency pairs equal or more than the target pip value, and above that, the threshold of hedge is, visibly also higher, since even, if the difference between the two red lines is the wanted 2 pips, the actual difference between the buy orders will be "spread for buy orders"+"Hedge threshold"+"spread for sell orders". (You can correct this, if you have a broker with fixed spreads, by lowering the hedge threshold.)
The closing values will also be bit off, since if the midline ((Ask+Bid)/2) reaches the target value, (which is in the EA, by buy orders Ask price+the target profit, and by sell orders Bid price+the target profit), the EA will close the Buy orders at Bid price and will close the Sell orders at Ask price.
- Additionally, in volatile chases, where there is higher difference between two ticks, since you have so low targets even for the hedge and even for profit taking, the EA might have issues if the tick contains higher price increment, decrement, than the targeted stop loss and it could easily miss opening a hedge trade by jumping it through above/below the close range.