You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Mick -
you need to have your EA monitor the current Bid & Ask. When the Ask or Bid goes to or above your strike price, you then throw a Market Order to the server.
I dont like having my pending orders sitting there either. Nor do i like having my stop loss sitting on the brokers server. many brokers will screw you "hunting stops".
Another thing that can happen with Stop Orders is that the spread can stretch wide open. A BUY Stop Order will open on the Ask price. So as soon as the Ask hits your
strike price, YOU ARE BOUGHT. Even if the Bid is 10pips lower. I got Stretched for 7.4 pips this week on the GBPUSD which has a "normal" spread of 1.5p.
The order immediately went South (Touch & Reverse). This has happened too often! Bottom line is, YOU need to decide which price to follow, Bid or Ask.
You could also throw a Limit order at your strike price AFTER Bid gets above your strike, but you could miss a fast mover.
Let me know what you want to do, i may be able to help you with coding.....
thanks hkjonus .
I have already done that, I use the Bid price to Trigger BUY trades, at the Ask price. The thing is that I want the EA to know which direction the current market price is moving toward my trade entry price from.
So if my entry price is below current market price, I want the EA to open a SELL trade when they meet,
and if my entry price is above current market price, I want the EA to open a BUY trade when they meet.
Like Ickyrus said above, I could try and find a way of determining direction, and I was thinking of using Parabolic SAR for this purpose, but I would rather have some way of determining direction just by price action, maybe even on a tick by tick basis or something like that. I am just learning to program, and I am looking through other EA's both to learn and to copy code from.
I have the same reason for wanting to keep my stops from the broker. I would like my EA to trade as "manual" as I can get it to.
I have one question from it you may be able to answer if you could. I understand the for (loop ?) and the counter it contains. I have come across two pieces of code where the integer of the counter in the for loop is also in the first line of the next piece of code.
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
why is the integer cnt included in the order select function ?
Because Orders can be many and are held in an Array starting from 0. If you use OrdersTotal then since the Array starts from 0 you need to use Total-1 to count from zero to get the correct number.