Pending orders cancelled (not sure) because of price being to close to the pending order - How to fix?
There is no need to create pending orders in code.
- The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
There is no need to create pending orders in code.
- The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
Well, my strategy is based on a breakout of which the pending orders are placed on a specific time.
Most of the times the pending orders are placed far away from the current price but there are scenario's in which these pending orders are too close to the price which cause them to be invalid.
I really want to figure out if I can still place them or if there is another solution for this.
Well, my strategy is based on a breakout of which the pending orders are placed on a specific time.
Most of the times the pending orders are placed far away from the current price but there are scenario's in which these pending orders are too close to the price which cause them to be invalid.
I really want to figure out if I can still place them or if there is another solution for this.
If you want to place a pending order instead of trade when the price hits your level , you can querry the
SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL);
It will return the minimum distance the broker is willing to let you place an order at from the current price. So you could have a scenario where your system finds the placement price , and , if it is subject to this limit , meaning , it would be "wider" , it presents you with a message where you choose if you want it to be placed or not .
If you want to place a pending order instead of trade when the price hits your level , you can querry the
It will return the minimum distance the broker is willing to let you place an order at from the current price. So you could have a scenario where your system finds the placement price , and , if it is subject to this limit , meaning , it would be "wider" , it presents you with a message where you choose if you want it to be placed or not .
Thanks this is exactly what I was looking for!
You are welcome .
Note , this value is in "how many points" , so to turn it to price multiply by _Point.
Thanks! One more question how do I make it so that it only adds this STOPS_LEVEL value when it is actually true? Can I just do this:
if((entrybuy - SymbolInfoDouble(_Symbol,SYMBOL_ASK)) < (SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)*_Point)){ trade.BuyStop(buylots,entrybuy + (SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)*_Point),_Symbol,stoplossbuy,takeprofitbuy,0,0); } else(trade.BuyStop(buylots,entrybuy,_Symbol,stoplossbuy,takeprofitbuy,0,0));
Thanks! One more question how do I make it so that it only adds this STOPS_LEVEL value when it is actually true? Can I just do this:
I'm going for the price (from Ask/Bid) depending on whether or not i'm above or below . I have not tested with going for the price used for the opening though , which would make more sense.
(I mean sell limits and buy stops , i check the distance vs the Ask price , and , buy limits and sell stops i check the distance vs the Bid price)
So i may be potentially leaving "space" that i'm not utilizing there- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I place pending orders on a certain price level, however sometimes these pending orders are close to the live price which (I think) causes the pending order to be invalid. How can I fix this problem?