Trew:
Did you call and check To do this I add the following statement inside an IF statement just before the code that executes the order
PositionGetDouble(POSITION_VOLUME)<0.5)
It works fine . . . . . but once the position has closed regardless of it closing from stop loss, take profit or manual close, the EA will then no longer open any other positions.
Is there additional code that I need to add to the EA that will reset it?
PositionSelect(symbol)
before calling PositionGetDouble() ?
No I didn't. Thanks, it works as intended now :)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I started picking up mql5 on the weekend and have started creating a few EAs, none of them based on a strategy I'd use, but just to get used to the language itself.
The EA puts in instant orders on the currency with a lot size of 0.1.
If the trend continues I want the EA to be able to purchase additional lots with a lot size of 0.1.
HOWEVER. . . . .
I have been trying to create the EA so that the maximum number of lots that any position can consist of is 0.5.
To do this I add the following statement inside an IF statement just before the code that executes the order
PositionGetDouble(POSITION_VOLUME)<0.5)
It works fine . . . . . but once the position has closed regardless of it closing from stop loss, take profit or manual close, the EA will then no longer open any other positions.
Is there additional code that I need to add to the EA that will reset it?
Thanks
Also, if any terminology in this is wrong, please feel free to correct me. I've only had my demo account for about a month so I'm still at the bottom of the learning curve.