작업 종료됨
명시
Explanation:
When the EA is opened, the A order (buy order at $1.12300, 0.02 lot) is opened immediately, and the TP of the A order is set to 80. If the price drops by 100 points, the B order (buy order at $1.12200, lot0.01) is opened, and the order TP is set to 100 .If the price drops by 150 points, the B order will be opened (sell order at $1.12150, lot0.01). When both orders of the B order are opened, the C order will be opened. If the price falls by 200 points, the C order will be opened. (sell order at $1.11950, lot0.04), C order TP is set to 40.
Case 1
Assuming that there is currently 1 order, according to the above settings, the 1st order is 0.02 lot buy in $1.12300, TP=80, TP is $1.12380. If the profit is made, the Expert Advisor will be initialized.
Case 2
Suppose there are currently 3 orders, according to the above settings, A order is 0.02 lot buy in $1.12300, B order 1 is 0.01 lot sell# in $1.12150, B order 2 is 0.01 lot buy# in $1.12200.
There will be 4 TP situations.
Case 2.1
If the price reaches $1.12000, only the B order 1 of 0.01 lot sell# will make a profit. If it returns to $1.12150 and then open the B order 1 of 0.01 lot sell#, if the price is $1.12000, only the B order 1 of 0.01 lot sell# will make a profit.
Case 2.2
After that, if the price keeps going back and forth between 1.12000 and 1.12150, open B order 1 of 0.01 sell# for many times, and continue to make profits.
Case 2.3
If the price is 1.12300, 0.01 lot buy# B order 2 will make a profit. If it keeps going back and forth between 1.12200 and 1.12300, the B order 1 of 0.01 lot buy# will continue to profit.
Case 2.4
If the price reaches 1.12610, all orders will be closed, because TP_Steps1=80, please see the calculation method below
buy#r and sell#r do not count in buy/sell direction of lot
buy/sell direction of lot = 0.02
(TP price- stepA buy pirce)*stepA lot*100000+(stepB sell# price-TP price)*stepB lot*100000 = buy/sell direction of lot * pip
(1.12610-1.12300)*0.02*100000+(1.12150-1.12610)*0.01= 0.02*80
Case 3
If the price reaches 1.10960, all orders will be closed, because TP_Steps1=40, please see the calculation method below
buy#r and sell#r do not count in buy/sell direction of lot
buy#r and sell#r do not count in buy/sell direction of lot
buy/sell direction of lot = sell - buy = 0.04 - 0.02 = 0.02
(TP price- step1 buy price)*step1 lot*100000+(TP price- step2 buy# price)*step2 lot*100000+(step3 sell price- TP price)*step3 lot*100000 = buy/sell direction of lot * pip
(1.10960-1.12300)*0.02*100000+(1.10960-1.12200)*0.01+(1.11950-1.10960)*0.04=(0.04-0.01-0.02)*40
2. buy
buy mean that open buy order, if it has been opened, then close the order, no need to open another order. For example, if you open at $1680, make a profit at $1685, and then return to $1680, it will not open until the transaction is initialized. The TP of buy is For all order calculations, please refer to Case 1 of Transaction Example 1 and Case 3 of Transaction Example 1.
3. sell#
sell# mean that open sell order, if it has been opened, then close the order, if it returns to the price, it will open again, for example, open at $1680, make a profit at $1685, and then return to $1680 to open again, and repeat this action , until the transaction is initialized. The TP of sell# is calculated per order, please refer to cases 2.1 to 2.2 of transaction example 1.
4. buy#
buy# means that open sell order, if it has been opened, then close the order, if it returns to the price, then open it again, for example, open at $1680, make a profit at $1685, and then open again at $1680, repeating this action , until the transaction is initialized. The TP of buy# is calculated for each order, please see Case 2.3 of Transaction Example 1
5. sell#r
sell#r mean that open sell order, if it has been opened, then close the order, if it comes back to the price, then open it again, for example, open it at $1680, make a profit at $1685, then open it again at $1680, repeating this Action, until all trade profit conditions are met, all orders are closed, and then the trade is reset. Please see the case 2.2, 2.4, 2.5 of the transaction example 2
Transaction Example 2:
Input interface in MQL programming:
Name_Steps=1;2;3
Direction_Steps=buy;sell#r&buy#r;sell
Lot_Steps=0.02;0.01&0.01;0.04
Points_Steps=0;-150&-100;-200
TP_Steps=80;150&100;40
Goto_Steps=2;3
To make "Input interface in MQL programming" easier to explain, I split it into a grid.
Case 1
Assuming that there is currently 1 order, according to the above settings, the 1st order is 0.02 lot buy in $1.12300, TP=80, TP is $1.12380. If the profit is made, the Expert Advisor will be initialized.
Case 2
Suppose there are currently 3 orders, according to the above settings, 1 order is 0.02 lot buy in $1.12300, 2 order 1 is 0.01 lot sell#r in $1.12150, 2 order 2 is 0.01 lot buy#r in $1.12200.
If the price reaches $1.12000, only 0.01 sell#r is profitable. If it goes back to $1.12150 and then opens again for 0.01 sell#r, if the price is $1.12000 after that, only 0.01 sell#r is profitable.
If it keeps going back and forth between 1.12000 and 1.12150, open 0.01 sell#r multiple times and continue to make profits until the profit conditions of all orders are met.
Example of a take profit condition that meets all orders
For example, the account currently has 3 orders, the first one is 0.02 buy at $1.12300, TP=80, the second one is 0.01 buy#r at 1.12200, TP=100, the third one is 0.01 sell#r at 1.12150, TP= 150
If the price is at $1.12000, 0.02 buy $1.12300 floating equity is -$6, 0.01 buy#r $1.12200 floating equity is -$2, 0.01 sell#r $1.12150 profit is $1.5,
buy#r and sell#r do not count in buy/sell direction of lot
Profit Condition 1 for all orders: buy/sell direction of lot * pip=0.02*80=1.6
Profit Condition 2 for all orders: -$6-$2+$1.5=-$6.5
(Profit condition 2 for all orders+Profit condition 1 for orders)/1.5=(-6.5-1.6)/1.5=-5.4
Calculating the answer is 5.4 times. And rounding up 1 is 6 times. Why 6? If 5.01 to 5.99 is +1, the answer is 5+1. If 4.01 to 4.99 is 0, the answer is 5, not rounding.
That is, the profit condition of all orders is satisfied when sell#r takes profit 6 times back and forth, after which all orders are closed and the transaction is reset.
Case 3
If it is 1.12300, 0.01 buy# will make a profit. If it keeps going back and forth between 1.12200 and 1.12300, it will continue to make profits by 0.01 buy#r until the profit conditions of all orders are met.
Example of a take profit condition that meets all orders
For example, there are currently 3 orders in the account according to the above settings, namely 1 order is 0.02 buy in $1.12300 TP=80, 2 order 1 is 0.01 buy#r in $1.12200 TP=100, 2 order 2 is 0.01 sell#r in $1.12150 TP =150,
If the price is at $1.12300, 1 order floating equity is $0, 2 order 1 profit is $1, 2 order 2 floating equity is -$1.5
buy#r and sell#r do not count in buy/sell direction of lot
Profit condition 1 for all orders is buy/sell direction of lot * pip=0.02*80=1.6
All orders take profit condition 2 is $0+$1-$1.5=-$0.5
(Profit condition 2 for all orders + Profit condition 1 for orders)/1=(-0.5-1.6)/1=-2.1
Calculated the answer is 3 times. And advancing 1 is 3 times. Why 3? If 2.01 to 2.99 is 2+1. If 1.01 to 1.99 is 1+1, not rounded up.
That is, buy#r takes profit 3 times back and forth to meet the profit conditions of all orders, after which all orders are closed and the transaction is reset.
Case 4
If the price is 1.12300, 0.01 buy# will make a profit. If the price is constantly going back and forth between 1.12000 and 1.12300, open 0.01 lot buy#r and 0.01 lot sell#r multiple times, and the two orders will be profitable many times until all orders are satisfied. profit conditions.
Example of a take profit condition that meets all orders
For example, there are currently 3 orders in the account, the first order is 0.02 buy $1.12300 TP=80, the second order is 0.01 buy#r $1.12200 TP=100 The third order is 0.01 sell#r $1.12150 TP=150,
For your convenience, I have arranged each grid of the chart, each grid represents the process of each order transaction, please read from left to right
buy#r and sell#r do not count in buy/sell direction of lot
Profit condition 1 for all orders: buy/sell direction of lot * pip=0.02*80=1.6
Profit Target = +1.6
3.5-0.5=3
3 is greater than 1.6, all orders are closed and re-initialized
Case 5
Suppose there are currently 4 orders, according to the above settings, 1 order is 0.02 lot buy in $1.12300, 2 order 1 is 0.01 lot sell#r in $1.12150, 2 order 2 is 0.01 lot buy#r in $1.12200, 3 order is 0.04 lot sell in $1.11950
For example, at 1.12000, 0.01 sell#r takes profit, then at 1.11950, 0.04 sell#r is opened.
If it rises back and forth between 1.12300 and 1.12200, it is buy#r and sell#r multiple profits.
For your convenience, I have arranged each grid of the chart, each grid represents the process of each order transaction, please read from left to right
buy#r and sell#r do not count in buy/sell direction of lot
Profit condition 1 for all orders is buy/sell direction of lot * pip=0.02*40=0.8
Profit Target = +0.8
8.5-6.5=2
2 is greater than 0.8, all orders are withdrawn and re-initialized
4. buy#
buy# mean that open sell order, if it has been opened, then close the order, if it returns to the price, it will be opened again, for example, if it is opened at $1680, it will be profitable at $1685, and then it will be opened again at $1680, and this action will be repeated. , until the transaction is initialized. And the TP of buy# is calculated for each order, please see the case 2.3, 2.4, 2.5 of the transaction example 2