Mql4: How close is close enough

Jan 13, 2017 at 23:36
787 개의 뷰
8 Replies
Jun 07, 2015 부터 멤버   게시물90
Jan 13, 2017 at 23:36
I am programming on MT4 with Mql4

I want to have a limit order placed, and have had issues in the past with setting limits to close to the market and having it rejected with a error code that meant it was to close to market to be a limit order.

Lets say I have the price I want to enter, the current close of the market, and all the other variables. What would I use to see if the desired price is close enough ( or not ) to be a market order versus a limit? Would it be if price was with in the spread, and/or would I also include slippage in that as well?


Any ideas would be greatly appreciated
Everything in the market is like a fart, if you have to force it, it is probably shit
Aug 20, 2009 부터 멤버   게시물266
Jan 14, 2017 at 13:15
Check the stop level using MarketInfo(Symbol(),MODE_STOPLEVEL)

Remember to convert it to points.

In my experience, even this can produce an error on exotics that have a large volatile spread. In cases like this i will use something like fmax(spead, Stoplevel).
Wealth Creation Through Technology
Jun 07, 2015 부터 멤버   게시물90
Jan 20, 2017 at 15:37
MODE_STOPLEVEL only returns zero on my broker (oanda) . I am just using Spread for now. No errors yet
Everything in the market is like a fart, if you have to force it, it is probably shit
forex_trader_25447
Dec 21, 2010 부터 멤버   게시물131
Jan 20, 2017 at 21:39
If You have STOPLEVEL=0 , probably this is Real NDD broker.
Orders have to be sent without TP or SL (must be 0.0)
The SPREAD still exist, but You have to be able
to set TP or SL even inside SPREAD, after order is send.
Jun 07, 2015 부터 멤버   게시물90
Jan 20, 2017 at 22:03
From the mql4 site:

A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. In the second case, GetLastError() can return error 130, because MODE_STOPLEVEL is actually 'floating' here.

I am not having a issue with setting sl/tp . I was trying to find a way to detect when placing a limit would be to close to the actual price, resulting in the need for a market order.

I setup a function to detect with in range, using the appropriate ask/bid + Spread depending on direction. I was just curious if there was anything else I should be looking out for.


Anyways, Thank You :)
Everything in the market is like a fart, if you have to force it, it is probably shit
benchmarkpro
forex_trader_367321
Oct 08, 2016 부터 멤버   게시물58
Jan 23, 2017 at 03:52 (편집됨 Jan 23, 2017 at 04:07)
My opinion is that limit orders are a crutch for NON-API traders that allows them to place a request with their broker to open or execute a trade at a specific price, etc..

this is a band-aid for non-api traders.

Api traders, on the other hand, do not need limit orders...

Api traders write custom code that will wait patiently for the market price to reach a specific price and then it will open the trade on the fly in real time...

thank you.

Edit: i personally do not set takeprofit and/or stoploss while opening a trade, instead i first open the trade and then i set any desired stop loss or takeprofit...

Jun 07, 2015 부터 멤버   게시물90
Jan 23, 2017 at 06:01
Why would it be a crutch if you are doing essentially the same thing anyways.

Sure, noted: I could just set a condition to see when the price gets to my supposed limit order and execute it at market. I have never heard the term 'Api traders' . I am not using any application interfaces, so it can't be that you are talking about. Googling it only brings up the usual suspects ( brokers that offer a api, etc,.... ) .

Also, I don't set stops with the order at the same time either, the broker doesn't allow it,.... why is it worth mentioning this?

Anyways, thanks for the suggestion, even though it isn't related to the topic
Everything in the market is like a fart, if you have to force it, it is probably shit
benchmarkpro
forex_trader_367321
Oct 08, 2016 부터 멤버   게시물58
Jan 23, 2017 at 06:07
Nice.
Aug 20, 2009 부터 멤버   게시물266
Jan 23, 2017 at 13:40
benchmarkpro posted:
My opinion is that limit orders are a crutch for NON-API traders that allows them to place a request with their broker to open or execute a trade at a specific price, etc..

this is a band-aid for non-api traders.

Api traders, on the other hand, do not need limit orders...

Api traders write custom code that will wait patiently for the market price to reach a specific price and then it will open the trade on the fly in real time...

thank you.

Edit: i personally do not set takeprofit and/or stoploss while opening a trade, instead i first open the trade and then i set any desired stop loss or takeprofit...


You need to tell me what broker you use......I have been looking for a broker that gives me the price I execute my trade at.....irrespective of how fast the market is moving, or that beats the Limit Order pricing already sitting on their server.
Wealth Creation Through Technology
로그인 / 가입하기 to comment
You must be connected to Myfxbook in order to leave a comment
*상업적 사용 및 스팸은 허용되지 않으며 계정이 해지될 수 있습니다.
팁: 이미지/유튜브 URL을 게시하면 게시물에 자동으로 삽입됩니다!
팁: @기호를 입력하여 이 토론에 참여하는 사용자 이름을 자동으로 완성합니다.