Page 1 of 2

Help with special order entry in MQL4

Posted: Thu Sep 15, 2011 3:09 am
by RunnrX
Hi everyone,

I'm hoping someone on here with some MT4 / MQL4 experience can help me out with an answer to this:

I'm trying to make an EA that opens a position when price breaks above the previous bar's high, but I don't want to use market orders because of the massive slippage you can get at times

I was hoping to program my EA to set Buy Limit entries at 2 pips above the high of the bar, while the Ask of the pair is still below that entry level, so that I would get instant entry like a market order but my price would be no higher than what I specify, like in a limit order.

In other trading platforms like MB Dekstop Pro putting a limit entry at above ask will get you this result, but MT4 just rejects the order if you do a limit above ask --- so is anyone aware of a way to use MQL4 to program an order with such a result?

Thanks!

Posted: Fri Sep 16, 2011 10:38 pm
by forexjake80
there are differences when you use mbt mt4 did you check those?

Posted: Sat Sep 17, 2011 9:20 am
by MrPip
Most MT4 brokers require stop and limit orders to be a minimum distance from the current bid or ask. I suspect that is why your orders are being rejected. Try using a larger value for the breakout.

Posted: Sat Sep 17, 2011 9:26 am
by forexjake80
well, mbt doesnt!

Posted: Sat Sep 17, 2011 9:39 am
by MrPip
Then try using BUY_STOP instead of BUY_LIMIT.
I have written scripts to scale in to trades that work just fine, placing an initial order and up to 5 more using different pip intervals above for buy or below for sell.

Robert

Posted: Mon Sep 19, 2011 4:13 pm
by RunnrX
The buy stop is ok for half of what I want to do, but it's still missing the aspect that says "I'll pay this much for it and no more". The buy stop still gets me market price instead of what I say I'll get in at, so I slip a few pips each time.

I just liked how in MBT Desktop Pro you could make a limit order above ask, so you'd get filled as fast as a market but never higher than you say you'll pay. I would love to get that going in MT4 but it isn't lookingl likely

Posted: Mon Sep 19, 2011 5:03 pm
by forexjake80
runnr, please answer my question: did you read the mb trading faq´s concerning their mt4 platform?

Posted: Tue Sep 20, 2011 1:47 pm
by RunnrX
forexjake80 wrote:runnr, please answer my question: did you read the mb trading faq´s concerning their mt4 platform?


I didn't read their FAQ but I did talk to a chat representative from MBT/mt4 and they confirmed that while MB Desktop Pro lets you enter buy limits at above the Ask so you get instant fill but at a limited price, MT4 doesn't have any order type like that. They told me that it might be possible to program it in MQL4 and to ask their forum users, and so I posted the question on the MB forum and on the Kreslik ones because I know a lot of experienced users are on here.

Thanks

Posted: Tue Sep 20, 2011 2:26 pm
by forexjake80
You do not need experienced users! You only need to read the faq´s !

Posted: Tue Sep 20, 2011 2:35 pm
by RunnrX
forexjake80 wrote:You do not need experienced users! You only need to read the faq´s !


Well, thanks for stepping up to offer all that help


anyway, to anyone else who can offer anything constructive, I've read through all the MQL4 documentation to get familiar with it so I'm able to code just about anything now, but I wrote on this forum to see if anyone could help contribute any tips toward the coding logic required to execute orders like I mentioned above.

lol and instead of getting that I have a guy named jake telling me to read faqs -- when the MBT chat representative themselves told me that it wasn't a part of MT4 and I should consult the forums for MQL4 coding advice

good night everybody! I'm done with this thread - thanks Jake