Рейтинг: Empty Star Empty Star Empty Star Empty Star Empty Star
Mql4: How close is close enough
dkilmer

Пользователь с Jun 07, 2015  90 сообщений FSM (dkilmer) 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
compuforexpamm

Пользователь с Aug 20, 2009  240 сообщений kennyhubbard (compuforexpamm) 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
dkilmer

Пользователь с Jun 07, 2015  90 сообщений FSM (dkilmer) 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
StoneHeart

Пользователь с Dec 21, 2010  131 сообщений Ivan (StoneHeart) 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.

Small GAIN, big WIN
dkilmer

Пользователь с Jun 07, 2015  90 сообщений FSM (dkilmer) 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

Пользователь с Oct 08, 2016  58 сообщений edward (benchmarkpro) 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...


dkilmer

Пользователь с Jun 07, 2015  90 сообщений FSM (dkilmer) 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

Пользователь с Oct 08, 2016  58 сообщений edward (benchmarkpro) Jan 23 2017 at 06:07
Nice.

compuforexpamm

Пользователь с Aug 20, 2009  240 сообщений kennyhubbard (compuforexpamm) 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
Чтобы оставить комментарий, необходимо войти в систему.
Unemployment Rate (6 min)
ЦБ отозвал лицензию у Южного регионально...(34 seconds ago)
EURUSD 1.16488 GBPUSD 1.3013
USDJPY 112.453 USDCAD 1.32495

Tools

Сообщество

Обзоры

Брокеры

Платформа

Поддержка


Твиттер |  Facebook |  Карта сайта  |  Условия  |   Политика конфиденциальности
©2018 Myfxbook Ltd. All Rights Reserved.
HIGH RISK WARNING: Foreign exchange trading carries a high level of risk that may not be suitable for all investors. Leverage creates additional risk and loss exposure. Before you decide to trade foreign exchange, carefully consider your investment objectives, experience level, and risk tolerance. You could lose some or all of your initial investment; do not invest money that you cannot afford to lose. Educate yourself on the risks associated with foreign exchange trading, and seek advice from an independent financial or tax advisor if you have any questions. Any data and information is provided 'as is' solely for informational purposes, and is not intended for trading purposes or advice.