The user guide for Pair Power Trading
This post is for the EA Pair Power Trading
1. Pair Power Index
It is the difference of the strength of the two currencies,I define this difference as Pair Power Index (PPI)
The greater the PPI is ,the stronger the pair is ,the smaller the PPI is ,the weaker the pair is.
Generally we buy the stronger pairs and sell the weaker pairs.
2. Demonstrate how to open order?
Rule#1: If the PPI is positive EA opens buy order, if the PPI is negative EA opens sell order. The lots in edit box is positive.
Rule#2: Reverse rule. If the lots in edit box is negative,the direction will reverse. (see : Reverese Rule)
Note: the Rule#2 is only for manual OPEN and automatically initial order.
Select the stronger NZDCHF with 0.02 lots and NZDCAD with 0.04 lots.
Select the weaker EURNZD with 0.01 lots and AUDNZD with 0.03 lots.
Click the button OPEN ,EA will open 4 orders for the selected 4 pairs.
sell 0.01 eurnzd, buy 0.02 nzdchf,sell 0.03 audnzd,buy 0.04 nzdcad.
3.Demonstrate how to close order?
Select the paris that you want close its orders,and click the button CLOSE.
The EURNZD,NZDCHF,AUDNZD are selected ,and NZDCAD is not selected.
Click the button CLOSE,EA closed the order of EURNZD,NZDCHF,AUDNZD.
3. How to trade automatically?
AutoInitialBuy -- if checked, EA will automatically open a buy order for the selected pairs when conditions are satisfied.
- Condition#1 -- the selected pair has not active buy order.
- Condition#2 ---the PPI of the pair is positive and larger than the input setting (MinPairPower_InitBuy)
Example: NZDCHF and NZDCAD are selected.
EA opened a buy order for NZDCHF with 0.02 lots. EA did not open order for NZDCAD as it has one active order.
The order of NZDCHF has a speical comment "AI.PPT.1827" which is used to identify the initial order.
AutoGridBuyWin -- if checked, EA will automatically open buy order for the selected pairs when conditions are satisfied.
- Condition#1 --- the selected pair has at least one active buy order.
- Condition#2 --- The absolute vaule of PPI is not less than the input setting (MinPairPower_GridBuyWin)
- Condition#3 --- the market price goes above all buy orders,and the distance from the highest order is larger than the input setting.
AutoGridBuyLoss -- if checked, EA will automatically open buy order for the selected pairs when conditions are satisfied.
- Condition#1 --- the selected pair has at least one active buy order.
- Condition#2 --- The absolute vaule of PPI is not less than the input setting (MinPairPower_GridBuyLoss)
- Condition#3 --- the market price goes below all buy orders,and the distance from the lowest order is larger than the input setting.
- Condition#1 -- the selected pair has not active sell order.
- Condition#2 ---the PPI of the pair is negative and the absolute vaule of PPI is larger than the input setting (MinPairPower_InitSell)
AutoGridSellWin -- if checked, EA will automatically open sell order for the selected pairs when conditions are satisfied.
- Condition#1 --- the selected pair has at least one active sell order.
- Condition#2 --- The absolute vaule of PPI is not less than the input setting (MinPairPower_GridSellWin)
- Condition#3 --- the market price goes below all sell orders,and the distance from the lowest order is larger than the input setting.
AutoGridSellLoss -- if checked, EA will automatically open sell order for the selected pairs when conditions are satisfied.
- Condition#1 --- the selected pair has at least one active sell order.
- Condition#2 --- The absolute vaule of PPI is not less than the input setting (MinPairPower_GridSellLoss)
- Condition#3 --- the market price goes above all sell orders,and the distance from the highest order is larger than the input setting.
AvgPriceCloseBuy --- when the market price(Bid) goes above the average price of buy orders,and the profit reaches the input setting,all buy orders of the selected pair will be closed.
Example: there are 3 EURUSD buy orders, and EURUSD is selected
Order#1 EURUSD open price at 1.13100, 0.3 lots
Order#2 EURUSD open price at 1.13110, 0.2 lots
Order#3 EURUSD open price at 1.13120, 0.1 lots
The average price = (1.13100*0.3 + 1.13110*0.2 + 1.13120*0.1) /(0.3+0.2+0.1)= 0.67864/0.6 = 1.13107
Suppose the input setting is 100 points
When the market price(Bid) goes up at least 100 points above 1.13107, the market price (Bid) is 1.3207, all these 3 buy orders will be closed.
AvgPriceCloseSell --- when the market price(Ask) goes below the average price of sell orders,and the profit reaches the input setting.all sell orders of the selected pair will be closed.
Balance % CloseAll --- when the total profit of all pairs reaches the persent of the balance,all orders of all pairs (including the unchecked pairs) will be closed. The persent is an input, for example , you input 7, it means 7%.
Amount CloseAll --- when the total profit of all pairs reaches the amount,all orders of all pairs (including the unchecked pairs) will be closed. The amount is an input, for example , you input 700, it means 700USD (suppose the account currency is USD).
==========================Inputs Description==========================
Input:
//===EA General Settings
- Magic - The Magic Number of EA
- Select SL/TP Mode - This is a 2-option input for SL/TP mode. Select SL_TP_POINT or SL_TP_ATR
- StopLoss - StopLoss in Point. If it is 0, orders will not be set SL
- TakeProfit - TakeProfit in Point. If it is 0, orders will not be set TP
- SL_ATR_Multiplier - The SL will be ATR * Multiplier.If it is 0, orders will not be set SL
- TP_ATR_Multiplier - The TP will be ATR * Multiplier. If it is 0, orders will not be set TP
- MaxLots - The max. lots. If the lots number is larger than this MaxLots,the lots will be the MaxLots. If it is 0,there is no limitation
- MaxBuyOrders - The max. number of buy orders for every pair. If it is 0,there is no limitation
- MaxSellOrders - The max. number of sell ofders for every pair. If it is 0,there is no limitation
Note:
1.The ATR is the previous day with 20 periods,the ATR parameters are built-in EA.
2.The formula for SL in ATR , the SL = ATR * SL_ATR_Multiplier
3.The formula for TP in ATR,the TP = ATR * TP_ATR_Multiplier
4.MaxLots is used in manual click OPEN and auto trade(initial trade and grid trade).
5.MaxBuyOrders -- it is the buy orders including manual click OPEN and grid buy orders.
6.MaxSellOrders -- it is the sell orders including manual click OPEN and grid sell orders
- MaxCountInitialBuy - The max. count of opening the initial buy order for every pair,if it is 0,EA will not limit the count of opening initial order.
- MaxCountInitialSell - The max. count of opening the initial sell order for every pair,if it is 0,EA will not limit the count of opening initial order.
********Note: EA has automatically close orders function,such as average price to close orders, the balance's persent profit to close orders. so if all orders are closed,the EA will begin to
open the initial order if the conditions are satified,and the trade begin to grid trading cycle.
so we need to control the times of opening the initial order.
EA counts the times of opening the initial order from the time when EA is loaded to the chart.
The time of EA loading to chart shows on the titile bar "Pair Power Traing - 2019.03.13 08:55:02"
Click link:Count The Initial Order Method
- MaxOrders_GridBuyWin - The max. number of grid buy orders in win status. If it is 0,there will no limitation.
- MaxOrders_GridBuyLoss - The max. number of grid buy orders in loss status. If it is 0,there will no limitation.
- MaxOrders_GridSellWin - The max. number of sell orders in win status. If it is 0,there will no limitation.
- MaxOrders_GridSellLoss - The max. number of sell orders in loss status. If it is 0,there will no limitation.
********Note: the grid order has a speical comment ,"B+" for grid buy win,"B-" for grid buy loss, "S+" for grid sell win ,"S-" for grid loss.
EA uses these special comments to count the grid order.
//=========Min Pair Power Setting=========
- MinPairPower_InitBuy - The min. pair power for opening the initial buy order. Only when the absolute value of pair power is not less than this input can EA open order
- MinPairPower_InitSell - The min. pair power for opening the initial sell order. Only when the absolute value of pair power is not less than this input can EA open order
- MinPairPower_GridBuyWin - The min. pair power for opening the grid buy orders in win status. Only when the absolute value of pair power is not less than this input can EA open order
- MinPairPower_GridBuyLoss - The min. pair power for opening the grid buy orders in loss status. Only when the absolute value of pair power is not less than this input can EA open order
- MinPairPower_GridSellWin - The min. pair power for opening the grid sell orders in win status. Only when the absolute value of pair power is not less than this input can EA open order.
- MinPairPower_GridSellLoss - The min. pair power for opening the grid sell orders in loss status. Only when the absolute value of pair power is not less than this input can EA open order.
//=========Grid Distance & Lots Setting=========
---------Buy Win Grid Distance & Lots Setting---------
- DistanceMode_GridBuyWin - It is a 2-option input, DISTANCE_POINT or DISTANCE_ATR. See note.
- Distance_Point_GridBuyWin - If the above distance mode is DISTANCE_POINT, this input will be used as distance, it must be larger than 0,otherwise EA will not open order
- Distance_AtrMultiplier_GridBuyWin - If the above distance mode is DISTANCE_ATR, ATR will be used as distance,it must be larger than 0,otherwise EA will not open order
- LotsMultiplier_GridBuyWin - It is the lots multiplier for grid buy in win status. See note.
- LotsAdjustment_GridBuyWin - It is a adjustment to lots.
********Note:
1.The ATR is the previous day with 20 periods,the ATR parameters are built-in EA.
2. The formula for distance in ATR, the distance = ATR * AtrMulitplier.
3. The formula for lots. the new lots = the last order's lot * LotsMultiplier + LotsAdjustment.
4. for GridBuyWin, the last order is the highest buy order.
---------Buy Loss Grid Distance & Lots Setting---------
- DistanceMode_GridBuyLoss - It is a 2-option input, DISTANCE_POINT or DISTANCE_ATR.
- Distance_Point_GridBuyLoss - If the above distance mode is DISTANCE_POINT, this input will be used as distance, it must be larger than 0,otherwise EA will not open order
- Distance_AtrMultiplier_GridBuyLoss - If the above distance mode is DISTANCE_ATR, ATR will be used as distance,it must be larger than 0,otherwise EA will not open order
- LotsMultiplier_GridBuyLoss - It is the lots multiplier for grid buy in loss status.
- LotsAdjustment_GridBuyLoss - It is a adjustment to lots.
********Note:
The formula for lots. the new lots = the last order's lot * LotsMultiplier + LotsAdjustment.
for GridBuyLoss, the last order is the lowest buy order.
---------Sell Win Grid Distance & Lots Setting---------
- DistanceMode_GridSellWin - It is a 2-option input, DISTANCE_POINT or DISTANCE_ATR.
- Distance_Point_GridSellWin - If the above distance mode is DISTANCE_POINT, this input will be used as distance, it must be larger than 0,otherwise EA will not open order
- Distance_AtrMultiplier_GridSellWin - If the above distance mode is DISTANCE_ATR, ATR will be used as distance,it must be larger than 0,otherwise EA will not open order
- LotsMultiplier_GridSellWin - It is the lots multiplier for grid sell in win status.
- LotsAdjustment_GridSellWin - It is a adjustment to lots.
********Note:
The formula for lots. the new lots = the last order's lot * LotsMultiplier + LotsAdjustment.
for GridBuyLoss, the last order is the lowest sell order.
---------Sell Loss Grid Distance & Lots Setting---------
- DistanceMode_GridSellLoss - It is a 2-option input, DISTANCE_POINT or DISTANCE_ATR.
- Distance_Point_GridSellLoss - If the above distance mode is DISTANCE_POINT, this input will be used as distance, it must be larger than 0,otherwise EA will not open order
- Distance_AtrMultiplier_GridSellLoss - If the above distance mode is DISTANCE_ATR, ATR will be used as distance,it must be larger than 0,otherwise EA will not open order
- LotsMultiplier_GridSellLoss - It is the lots multiplier for grid sell in loss status.
- LotsAdjustment_GridSellLoss - It is a adjustment to lots.
********Note:
The formula for lots. the new lots = the last order's lot * LotsMultiplier + LotsAdjustment.
for GridBuyLoss, the last order is the highest sell order.
//=========Average Profit Close Setting=========
---------Average Profit Close Setting for One buyOrder---------
- AvgProfitCloseMode_OneBuyOrder - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_OneBuyOrder - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_OneBuyOrder - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
******Note:
Example: there are only one EURUSD buy order, Order#1 EURUSD open price at 1.13100, 0.3 lots, and EURUSD is selected
The average price = the open price 1.13100
Suppose the selected mode is AVG_PROFIT_POINT as below:
AvgProfitCloseMode_OneBuyOrder = AVG_PROFIT_POINT
AvgProfitClose_Point_OneBuyOrder = 100
When the market price(Bid) goes up at least 100 points above 1.13100, the price (Bid) is 1.3200, the buy order will be closed.
---------Average Profit Close Setting for two buyOrders---------
- AvgProfitCloseMode_TwoBuyOrders - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_TwoBuyOrders - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_TwoBuyOrders - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
******Note:
Example: If there are two EURUSD buy orders, and EURUSD is selected
Order#1 EURUSD open price at 1.13100, 0.3 lots
Order#2 EURUSD open price at 1.13110, 0.2 lots
The average price = (1.13100*0.3 + 1.13110*0.2 ) /(0.3+0.2) = 1.13104
Suppose the selected mode is AVG_PROFIT_POINT as below:
AvgProfitCloseMode_TwoBuyOrders = AVG_PROFIT_POINT
AvgProfitClose_Point_TwoBuyOrders = 100
When the market price(Bid) goes up at least 100 points above 1.13104, the market price (Bid) is 1.3204, all these 2 buy orders will be closed.
---------Average Profit Close Setting for three buyOrders---------
- AvgProfitCloseMode_ThreeBuyOrders - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_ThreeBuyOrders - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_ThreeBuyOrders - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
Example: If there are 3 EURUSD buy orders, and EURUSD is selected
Order#1 EURUSD open price at 1.13100, 0.3 lots
Order#2 EURUSD open price at 1.13110, 0.2 lots
Order#3 EURUSD open price at 1.13120, 0.1 lots
The average price = (1.13100*0.3 + 1.13110*0.2 + 1.13120*0.1) /(0.3+0.2+0.1) = 0.67864/0.6 = 1.13107
Suppose the selected mode is AVG_PROFIT_ATR as below:
AvgProfitCloseMode_ThreeBuyOrders = AVG_PROFIT_ATR
AvgProfitClose_AtrMultiplier_ThreeBuyOrders = 0.6
Suppose the ATR(the previous day 20 period) = 0.09000, so ATR* AtrMultiplier = 0.0900 * 0.6 = 0.05400
When the market price(Bid) goes up at least 0.05400 above 1.13107, the price (Bid) is 1.31647, all these 3 buy orders will be closed.
---------Average Profit Close Setting for X buyOrders(>=4)---------
- AvgProfitCloseMode_XBuyOrders - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_XBuyOrders - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_XBuyOrders - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
---------Average Profit Close Setting for One sellOrder---------
- AvgProfitCloseMode_OneSellOrder -This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_OneSellOrder - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_OneSellOrder - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
---------Average Profit Close Setting for Two sellOrders---------
- AvgProfitCloseMode_TwoSellOrders - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_TwoSellOrders - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_TwoSellOrders - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
---------Average Profit Close Setting for Three sellOrders---------
- AvgProfitCloseMode_ThreeSellOrders - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_ThreeSellOrders - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_ThreeSellOrders - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
---------Average Profit Close Setting for X sellOrders(>=4)---------
- AvgProfitCloseMode_XSellOrders - This is a 2-option inputs,AVG_PROFIT_POINT or AVG_PROFIT_ATR
- AvgProfitClose_Point_XSellOrders - If the above mode is AVG_PROFIT_POINT,this input point will be used. it must be larger than 0,otherwise EA will not close order
- AvgProfitClose_AtrMultiplier_XSellOrders - If the above mode is AVG_PROFIT_ATR,this input ATR multiplier will be used.it must be larger than 0,otherwise EA will not close order
//=========Balance's Persent and Amount To Close All Orders=========
- BalancePersentToCloseAllOrders - If the total profit of all pairs reaches the persent of balance,all orders will be close. If this input is 0,EA will not close order.
- AmountToCloseAllOrders - If the total profit of all pairs reaches the amout set by this input,all orders will be closed. If this input is 0,EA will not close order.
******Note:
1. EA only manages the 28 pairs listed in the panel "Pair Power Trading". For some pairs such USDCHN,USDRUB,etc.,EA does NOT manage them.
2. EA calculates the total profit of the 28 pairs whether the pair is selected or not.
3. The profit includes the swap and the commission.
Example: suppose we have 4 orders ,and account the balance is 1000.
Pair | Commission | Swap | Profit | |
---|---|---|---|---|
EURUSD | buy | -2.0 | -3.0 | 70 |
EURUSD | sell | -1.1 | 1.2 | -10 |
GBPUSD | buy | -2.1 | -2.2 | 60 |
GBPJPY | buy | -3.1 | 3.2 | 50 |
The total profit = (-2.0-3.0+70) + (-1.1+1.2-10) + (-2.1-2.2+60) +(-3.1+3.2+50) = 160.9
Suppose we set BalancePersentToCloseAllOrders = 16
so the expected profit = the balance * the persent = 1000 * 16% = 160
When the total profit (160.9) reaches the expected profit ( 160 ),all orders will be closed.
Suppose we set AmountToCloseAllOrders = 160
so the expected profit = AmountToCloseAllOrders = 160
When the total profit (160.9) reaches the expected profit ( 160 ),all orders will be closed.
//=========Currency Relative Strength Setting=========
- TimeFrame - The Timeframe of the indicator Currency Relative Strength ,the default is D1.
- BarsToCalculate - The number of bars to calculate strength.
- MaPeriodsToSmoothLines - The moving Average periods for smoothing strength lines.
- Suffix - Symbol suffix
- UpLevel - The default is 20, if the strength value cross the level from the below to the above,then send alert by popup window or email.
- DnLevel - The default is -20, if the strength value cross the level from the above to the below,then send alert by popup window or email.
- IntervalMinutes - The default is 5 minutes, it is the time interval of alert for every pairs.
- Popup - true,alert by popup window.if false ,no alert.
- Email - true,alert by email,if false,no alert.
---END
Regarding the ATR used in the EA, you may download the indicator ATR28 attached in the post: The ATR used in Pari Power Trading.