Reply

[HELP!] What do i need to add into the mql4 code of SQ to limit the Pending Order’s Spread?

5 replies

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

8 years ago #114857

What do i need to add into the mql4 code of SQ to limit the Pending Order’s Spread?

 

what i mean is, what and where should i add a code to prevent the pending order to trigger a market order when the spread is too high and delete the pending order..

 

what i want to do is for example:

 

if the price is equal to the pending order’s price then before entering a market order by the pending order the EA will check first if the spread is not above 2 PIPS (20points),

if the spread is above this high spread amount then the pending order will be deleted and not be triggered (*only that pending order NOT ALL OF THEM*),

if the spread is ok then the pending order will trigger a market order like it suppose to do.

 

can someone help me with it?, im sure the rest of SQ users would love to have that protection against high spread,

this function will help those who set a fixed spread when building strategies, so if the strategy built on 1.5 PIPS spread and then tested in montecarlo and if the montecarlo shows that spread over 1.5 PIPS will cause the strategy to lose, then you know that your strategy is sensitive to spread higher then 1.5 PIPS and you can actually limit the spread amount in the strategy’s EA parameters inside MT4 🙂

 

 

please help if you can, it is not only for me as you already notice.

thank you for your time.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #135727

it is not simple to make this kind of change, because pending orders are placed atthe broker and you don’t have control on when they are triggered.

The EA would have to keep the orders only in memory (without sending them to broker) and manually check when the price crossed pending order level. But when sending market order there will be soem time delay and slippage and this could amount to more than spread with pending order.

 

You could use limit orders instead of stop orders if you want to enter at exact price.

 

Or use broker who doesn’t widen the spreads that much.

Mark
StrategyQuant architect

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

8 years ago #135730

Got it, i thought about if SQ4 will include Hidden orders,

so if you’ll use hidden pending orders then you’ll have the control of the spread, because the pending order exist only in the EA side of things and not at server’s side of things,

the way to do a hidden pending order is to set an Object Line and when the price (Ask/Bid) will cross that line it will enter a Market Order,

that way it is another protection against the broker, because if you have an original MT4’s pending order, the broker can see that order..

and by making it hidden the broker cannot see it, only you can see it as an Object Line inside your MT4’s chart.

 

would love to see hidden pending orders in SQ4!, ohh and if you going to implement hidden pending orders i suggested already not so long ago and i’ll suggest again that SQ4 will include not only hidden pending orders but hidden stoploss/takeprofit/trailingstop/breakeven.

 

that way we have a full protection from the broker :), *when you implement hidden stoploss/takeprofit/trailingstop/breakeven so do it like this:

example:

if we have a hidden stoploss and we want our stoploss to be 50 PIPs then the the original stoploss should be just in case of MT4 losing connection or VPS problems but the original stop loss should be more or less 2~10 PIPs above our stoploss value, so if the hidden stoploss is 50 PIPs then the original stoploss will be 55 PIPs.

same example with takeprofit/trailingstop/breakeven….

 

thank you for your time Mark, could you confirm please if hidden orders would be added to SQ4?.., thank you again.!

0

clonex / Ivan Hudec

Customer, bbp_participant, community, sq-ultimate, contributor, author, editor, 271 replies.

Visit profile

8 years ago #135733

Hidden orders +1

0

geektrader

Customer, bbp_participant, community, 522 replies.

Visit profile

8 years ago #135862

Please make it optional only if this is being added. I work with honest brokers where I can pull trade-tickets, they play no tricks like the market makers. I would feel VERY unsafe to not have the stop order / stop loss / tp etc at the brokers server already like it is now. Because should MT4 crash for whatever reason, you are left without a SL etc. Also remember that avoiding high spread will not necessarily help. Once the entry gets valid and should be executed but spread is to high, it will wait until spread comes down, yes, but price, one spread is OK again, might have moved MUCH more against you for your entry that you get then, than if you´d have taken the higher spread instead.


🚀 Unlock Your Edge in Automated Forex Strategy Development 🚀

Historical Forex Data Starting From 1987, 28 Pairs, M1, 99% Error-Free, Lifetime Free Updates

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

8 years ago #135863

geektrader, yes i meant that to be optional, and there is a way to to delete the order when the spread is too high OR make a function that when the price is not equal to the price that you wanted the order to be executed then delete the order, that way you wont get in when the price is way above/below your requested entry point..

 

plus about the MT4 crash, i already wrote about this, the hidden order’s TP+SL will be lets say TP=30 + SL=60, but for safety the ORIGINAL SHOW-ABLE ORDERS will be TP=32 + SL=62 or something like that, the user could change this gap between the HIDDEN TP+SL and the ORIGINAL SHOW-ABLE ORDERS between 1~5 PIPs will be good.

0

Viewing 5 replies - 1 through 5 (of 5 total)