Hi!
I'm a newcomer programmer and something is really complicate at the time.
I am trying to develope a function that
- in case of orders that are closed with a loss bigger than XX pips or
- orders that are still opened but loosing more than XX pips
doesn't allow to send other orders for 30 minutes.
I tried but with no result..
Here there is the code where order are sent:
and here where are closed:
the code after // Set the restart time after big loss doesn't work..... sigh.
And I have no idea how to check if between open orders there are ones loosing more than XX pips.
Please, can anyone help me?
Andrea
It is not a good idea to use OrderClosePrice() for trades that is still.
Your OrderSelect function looks in the pool of trades that are open or pending (MODE_TRADES). Try using (MODE_HISTORY) to look at trades that are closed and then use OrderProfit() to determine the number of pips lost or gained.
When you are looking at the open trades do not use the MathAbs function as this will remove the plus or minus (profit or loss) value of your calculation. Look at the difference between OrderOpenPrice and Ask/Bid and do the calculation seperately beteen OP_BUY or OP_SELL
Use temporary Print() or Comment() functions is the code to debug.
Good Luck
whocares

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
I'm a newcomer programmer and something is really complicate at the time.
I am trying to develope a function that
- in case of orders that are closed with a loss bigger than XX pips or
- orders that are still opened but loosing more than XX pips
doesn't allow to send other orders for 30 minutes.
I tried but with no result..
Here there is the code where order are sent:
and here where are closed:
the code after // Set the restart time after big loss doesn't work..... sigh.
And I have no idea how to check if between open orders there are ones loosing more than XX pips.
Please, can anyone help me?
Andrea