Forum

Avoid not enough money when working with pending orders

Hello everyone, I'm wrinting an EA which has a strategy which open a lot of pending orders. Before sending the command to open, I'm checking if there is enough money. The problem is when some pending orders are triggered there is not enough money , so the strategy tester delete them and close all

EA not close all open psition with magic number

Hi, I note a strange behavior with my EA. Sometimes it closes the opened positions but without magic number. I tried to figure out why but I can't find the reason I'm using the following code to open trade trade.SetExpertMagicNumber(magic); // .... if (trade.PositionOpen( Symbol