Auftrag beendet
Spezifikation
Looking to create a code with comments on each online that provides me with the following:
- Rule 1: If the market moves upward/downward on daily basis by X%, the EA will buy/sell in the market Y Lots. Both X (X can be a positive or a negative number) and Y are parameters that I will input. The take profit of this order will be placed as per the input. This rule is only applicable if there are no pending trades or trades in the market.
- Rule 2: If a trade is taken, the EA will place stop and limit pending orders away from the opening price by Z, which is inputed by me. When any limit or stop order gets executed, a new order will be placed. The maximum number of open orders will be limited by the number provided in the input. Each order will have a TP based on the closest order to it.
- Rule 3: If the total floating loss reaches the input amount, the EA will close all trades and delete all pending orders. Also, if the TP of the first order placed is hit, all pending orders will be deleted, and rule 1 will be active again.
- Rule 4: if there are no trades available, go back to rule number one.
Example: If the gold price moves from the beginning of the day by 2 percent, from 2000 to 2040, the EA will place a buy order with 1 lot with a TP of 2045, simultaneously it will place a buy limit order and a buy stop order at 2.5 dollars away from the initial order, this means at 2037.5 and 2042.5. The TP of each order is the same as the difference, which is 2.5 dollars, so this means at 2040 and 2045.
If the price reached 2037.5 and the buy limit is executed, the EA will place another buy limit at 2035, which is 2.5 dollars away, with at TP at 2037.5. if the price goes back to 2040 and the TP is executed, the EA will amend the previously placed pending order placed to go back to 2037.5, which is the same price as the last order that had a TP. If the number of active trades has been reached the limit, no pending orders will be placed unless one of the active orders TP, then the limit is no longer reached.