idh / Publications
Forum
Odd issue getting an open position's Open price
I've had some code that has been working fine on a demo account ever since I wrote it 9 months ago. Using MT5. I recently moved to a funded account (live) and have run into issues. Here a snippet of my original code where I located the issue is occurring, that was working fine on demo okay. I'll
SendNotification in MT5
Hi I have my ow EA that uses the SendNotification function to send me messages that I want to receive, using MT5. I receive these okay. However, I also receive messages about trade transactions, which I do not want to receive (too many, too frequent etc) I seem to remember back in MT4 you could
Partially closing losing positions
Hi I think I've misunderstood how partial closing works. I was hoping to use it to reduce losses on losing positions. Say I have a buy position open with a TP and SL set, I've bought 100 lots. The position starts to go bad and approaches my stop loss. Before it hits the stop loss, my EA uses the
slow Server execution and open price vs take profits - what happens?
Hi I've a bit of hypothetical situation that Id like put out there as I do not know the answer. The broker I am using for my MT4/EA activities is a tad slow at execution sometimes, and you end up with a order open price a few points out of what you expect (slippage). I get that, that's part of doing
iHighest strange result, cant figure out
Can anyone see a problem with this snippet: I first try to determine which bar the trade opened on, then using the result of that I want to use iHighest to locate the highest bar since (and including) the trade opened. But I get a strange result...Let's assume the trade opened on bar 0 (the current
trailing stop loss calculation question - on bar close price or calc and set in real time?
Hi I'm coding up some trailing stop loss functionality for my EA. I was wondering what people's thoughts/opinions are with regards to using Moving averages as basis for stop loss, or something like ATR? But my main question is, assuming I use a moving average, would it be better to recalculate and
Checking whether a order/position has a stoploss set
Hi Is there a way to determine whether a current/open position has an S/L set? e.g. true, false, and then extract what value is set? I cant figure out a way to do it. thanks ian
Quick question about MT4 terminal
Hi In the Account History tab in MT4 terminal client, there is an stop loss (S/L) column, where this field has a number and is shaded red does that mean the position was closed by Stop Loss? I think it does. thanks
MACD, again
Hi again, OK, still having problems on something that should be a piece of cake. please see attached screenshot for a start. All I'm trying to do is code a simple EA to go long on macd cross over and go short when it crosses over the other way. But I seem to be having some really silly trades
if check on negative MACD histogram
Hi All Ignore whether this check is actually a valid way to go short :-) Can any one spot what's up with this code, I cant figure it out: if(dbMACDDivergence_Bar1 <= dbDivergenceShortSetting) { //short conditions met } Where dbDivergenceShortSetting is set to -0.3 the aim of the check is to