İş tamamlandı
İş Gereklilikleri
I need 2 EAs that runs on 2 MT4s that coordinates with each other to open and close trades. Both MT4s will run on the same VPS or computer.
Let's name the 2 EAs "EA1" and "EA2".
-EA1 runs on one MT4 terminal, let's call it "Term1"
-EA2 runs on a second MT4 terminal on the same VPS or computer, let's call it "Term2"
-EA1 has user defined settings on symbol, direction (buy or sell), lot size, x pips profit, x pips loss, max spread (in 5th digit, so 0.0000x, ie, a value of "6" is spread of 0.6 pips), min duration (in seconds), and max trades
-EA2 has no user settings or buttons, but receives the above settings values from EA1
-EA1 displays a "start" button and a "stop" button on the chart it runs on
-EA1 and EA2 also displays "connected" in their respective terminals when connected to each other, showing that they are operational
-When the user presses "start" button on EA1, a trade is opened ONLY in Term1 with symbol, direction and lot size defined by the user in the settings
-once the trade is opened, EA1 will not do anything for the min duration as defined in the user settings
-once the min duration has elapsed, AND the trade goes in x pips profit or x pips loss as defined in the settings, AND the spread on the defined symbol is equal to or less than the max spread as defined by the settings, EA1 closes the trade and sends a signal to EA2 to open the same trade
-EA2 immediately opens the same trade in Term2 with the same direction and lot size
-once the min duration has elapsed, AND the trade in Term2 goes in x pips profit or x pips loss as defined in the settings, AND the spread is less than the max spread as defined by the settings in EA1, EA2 closes the trade and sends a signal to EA1 to open the same trade
-EA1 immediately opens the same trade in Term1 with the same direction and lot size
-this continues until the total number of closed trades (Term1+Term2) reaches the user defined setting, or until the user presses the "stop" button on EA1, in which case the one trade that is open will close, whether it be on Term1 or Term2
-you can make EA1 and EA2 check the conditions for the trades every 1-2 seconds or more frequently, it doesn't really matter as long as it doesn't use too much CPU
Example1:
-EA1 running on Term1, EA2 running on Term2
-EA1 user settings: symbol = EURUSD, direction = sell, lot size = 1, pips profit = 4, pips loss = 4, max spread = 6, min duration = 200 seconds, max trades = 20
-User presses "start" on Term1, EA1 opens a EURUSD sell order with lot size 1.00
-100 seconds after the order was open, the order goes into profit 4 pips, EA1 IGNORES this, as it hasn't been 200 seconds since the order was opened
-200 seconds after the order was opened, the order goes back to only 2 pips profit, EA1 doesn't close the trade as it needs to be in 4 pips profit or loss to close trade
-300 seconds after the order was opened, the order goes to 4 pips loss, but the spread is 8 (or 0.8 pips). EA1 doesn't close the trade as the spread is too high.
-400 seconds after the order was opened, the order goes to 5 pips loss, the spread drops to 6. Now, as all conditions are satisfied, EA1 closes the trade and sends a signal to EA2 to open the same trade.
-EA2 immediately opens the same trade on Term2 (EURUSD sell order with lot size 1.00), and as before, will wait for all conditions to be satisfied to close the trade and send signal to EA1 to open the same trade
-thus, there is only 1 order opened at any time, and EA1 and EA2 essentially pass the order back and forth until the max number of closed trades is reached as defined in the user settings (in this case it is 20, or 10 for both Term1 and Term2) or until the user presses the "stop" button