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
Thanks Raptor UK and Lema for your assistance, I changed the cylce "for" as per the code attached but only 1 pending order is comming through rather then 3 pending orders .I would like to have 3 pending orders each incremented by 20pips and as 1pending order goes to market another pending order opens maintaining a minimum of 3 pending orders until all orders are closed.
I have tried changing in the cycle "for" ipend<=5 to 1 or and even to 10. But still I only recevie 1 pending order. Is anyone aware how I can acheive this ?
Thanks for the link to look at , I am trying to open pending trades. I would like to have 3 pending trades pending at any time even though there is only 1 open trade to begin with.
I would then like to have each pending orders entry price to be 20pips greater then the preceeding pending order.
When I looked at the link #758066 is that only suitable for closing open and Pending orders, or is it also suitable for opening Pending orders ?, as I am trying to open Pending orders ?
I tried that code ( "for(int ipend=OrdersTotal()-1 ; ipend>=0; ipend--) ") and it continued to generate pending orders but didn't stop. So I wondered if it is suitable for opening pending orders ?
Yes, I will change the orderselect you mentioned ,
Thanks
Thanks for the link to look at , I am trying to open pending trades. I would like to have 3 pending trades pending at any time even though there is only 1 open trade to begin with.
I would then like to have each pending orders entry price to be 20pips greater then the preceeding pending order.
When I looked at the link #758066 is that only suitable for closing open and Pending orders, or is it also suitable for opening Pending orders ?, as I am trying to open Pending orders ?
I tried that code ( "for(int ipend=OrdersTotal()-1 ; ipend>=0; ipend--) ") and it continued to generate pending orders but didn't stop. So I wondered if it is suitable for opening pending orders ?
barnacle7:
I tried that code ( "for(int ipend=OrdersTotal()-1 ; ipend>=0; ipend--) ") and it continued to generate pending orders but didn't stop. So I wondered if it is suitable for opening pending orders ?
Look to what i wrote before ......
deVries:
It goes wrong when you open new trades while you still checking the open trades....
First checking trades has to be done with checking OrdersTotal() //can't do it with OrderType
If there is one buy open and not right pending buy amount trades open then after you have done the loop you can place them not inside the loop
Also for sell trades .....
Check your open trades and then look if it is needed to open new pending or manage the trades you have....
You said "I was trying to have 3 pending trades open Short/ Long each Entry price incremented by 25pips."
and "I would like to have 3 pending orders each incremented by 20pips and as 1pending order goes to market another pending order opens maintaining a minimum of 3 pending orders until all orders are closed."
all orders will never be closed because as soon as one pending order becomes a trade another pending order is opened.
I'm not clear what you are trying to do, are you ?
Thanks, devries this block of code is outside the loop for the open trades and RaptorUK for your assitance ,
This is the structure I am trying to achieve and the updated code below,
(without this block of code the EA Opens ,closes trades and activates trailing stops without issue)
What I am trying to do is have pending orders participate in the EA;
eg: Buy order triggered :Buy EURUSD @1.03250 (Market order)
" " 2: Buystop, Buy Eurusd @ 1.03650
" " 3.BuyStop, Buy Eurusd @ 1.03850
When a pending order is triggered and becomes a open trade then another pending order is opened and it Stop loss is added.
Maintaining a max of 3pending orders at any time.
Current issues: 1/ Pending orders don't open at 20pip increment of the previous prending orders open Price. (Only the 1st pending order is opening 20pips from the Buy order submited at market and the susequent pending orders are the same as the 1st pending order ).
2/ Modified Stop loss for each of the pending orders is only calculating from the Buy order submitted at markets "OpenPrice" ?
3/ The pending orders continue to come through even though no pending orders have been triggered, I have in my "order Accounting" Total 8 trades. This stops the pending orders but as it keeps cycling I get the "Alert" which is Alerting more then 8 orders are opened and it is continuing to try and open more.
Any assistance is appreciated. Thanks