Close Market Order when current close price is smaller than the lowest close from the previous 10 bars
First thing I see is that the variable total is not assigned a value in the code.
You are testing the Integer select as a bool.
There is no need for the switch, just don't use Bid or Ask as the closing price. Use OrderClosePrice() which can be applied to both buys and sells
My bad, I assigned OrdersTotal() to the total variable and changed result to integer and assigned 0 to it. I will give it a try.
Best regards and thank you,
codeMolecules
double LowestClose = ( Low[iLowest( NULL, 0, MODE_CLOSE, 10, 0 )] ); if ( Close[0] <= LowestCloseif the if is true it's because iLowest == 0 and Close[0] == Low[0]. If you want "10 past bars" don't look at the current bar.
.
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
Hello forum, good day.
I´m working on a Market Orders EA that may open only one order at a time but there may be several open orders during the day. Up to what I have, several orders remain open, but I´m having a bit of trouble on closing each order separately when certain criteria is met; I need to close an order if the current close price is less than or equal to the lowest close from a series of 10 past bars from which an order was opened. This is what I came up with so far:
Is this the correct way to close a market order, or how would it be a better way to do it? Help will be much appreciated.
Best regards and thank you,
codeMolecules