But I want only one order for one bar, not for every price.
Use a TimeStamp.
static int TimeStamp; if(TimeStamp != Time[0]){ OrderSend(...); TimeStamp=Time[0]; }Something like that.
- "40*point" is 4 pips on a 5 digit broker. You Must adjust TP, SL, AND slippage
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
- On ECN brokers, you must open the order and THEN set the TP, SL
- Always check error codes so you know WHY
if (OrderSend(Symbol(), OP_SELLLIMIT, 0.01, enter, roz*Point, SL, TP, NULL, 0, 0, CLR_NONE) < 0) Alert("OrderSend failed: ", GetLastError());
- What is MarketInfo(Symbol(), MODE_MINLOT)? on a micro account 0.01 may be too small.
- enter=Low[1]-(40*Point)-(Close[1]-Low[1]); What is MarketInfo(Symbol(), MODE_STOPLEVEL)*Point? On IBFX it's 30 points 3 pips. You can't set a pending order any close to market than that.
ubzen:
Thank you for respond, I´ll definetely try it.
But I want only one order for one bar, not for every price.
Use a TimeStamp.
Something like that.WHRoeder:
- "40*point" is 4 pips on a 5 digit broker. You Must adjust TP, SL, AND slippage
- On ECN brokers, you must open the order and THEN set the TP, SL
- Always check error codes so you know WHY
- What is MarketInfo(Symbol(), MODE_MINLOT)? on a micro account 0.01 may be too small.
- enter=Low[1]-(40*Point)-(Close[1]-Low[1]); What is MarketInfo(Symbol(), MODE_STOPLEVEL)*Point? On IBFX it's 30 points 3 pips. You can't set a pending order any close to market than that.
If I good understand to your answer You think that I have problem with opening position but opposite is the true.
Only error I get is:
148 | The amount of open and pending orders has reached the limit set by the broker. |
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Guys,
I need some help with pending orders. For open a pending order I´am using Predefined variables open, close, low and high. When conditions are complete OrderSend start opening pending orders. One for every price change until new bar. But I want only one order for one bar, not for every price.
Can you advice me some function or solution?
small example:
enter=Low[1]-(40*Point)-(Close[1]-Low[1]);
OrderSend(Symbol(), OP_SELLLIMIT, 0.01, enter, roz*Point, SL, TP, NULL, 0, 0, CLR_NONE);
Sorry for my english and thank you for your help.