Pair Power Index Helper

18 September 2019, 08:02
Ziheng Zhuang
0
420


EA Pair Power Index Helper https://www.mql5.com/en/market/product/84074

This EA has the features as below:

  1. It provides a sorted pair power of the major 28 pairs, the term " PPI" is short for " Pair Power Index".
  2. The pair power is calculated with the indicator Currency Relative Strength which is built in EA, the parameters for CRS are D1,90,3.
  3. Manual trading buttons
  4. Automatically grid trading
  5. Automatically manage orders with average profit,breakeven and trailing stop. 
  6. It can trade any symbol or pairs,not limit to the major 28 forex pairs.  

It has 6 tabs on the GUI:  PPI, Manual Trade, Grid Sell, Grid Buy,AutoClose, Breakeven  

1.  PPI   

    This tab shows the pair power of major 28 forex pairs. the power is sorted from the greater to smaller. The greater the number is ,the stronger the strength is .The smaller the number is ,the weaker the strength is. The range  is from -100 to+100.

  • The positive number means the long trend, the greater the number is ,the stronger the long trend is.
  • The negative number means the short trend ,the less the number is ,the stronger the short trend is.
  • The number above 20 means the long trend is begining, if above 30,it means the long trend is more stronger trend. it is possible with a big Reward Risk Ratio
  • The number below -20 means the short trend is begining, if below -30,it means the short trend is more stronger. it is possible with a big Reward Risk Ratio
  • The number is in range of -10 to +10,it means a sideways market, or a initial stage of a trend changing.
  • During a sideways market,it's better to trade only sell or buy under a major trend. Do not expect a big reward, use a small average profit to take profit.
  • Click the pairs to change the chart symbol.

    

2. Manual trade 

    2.1 StopLoss and TakeProfit are in Pips

    2.2 Number -- the max number of orders by clicking  "Open Sell" or "Open Buy".  if it is set to 0, there is no limitation.

        " Open Sell " order has a special comment "S#", EA use it to count sell orders with   "S#" among all orders

         "Open Buy"   order has a special comment "B#", EA use it to count buy oders with  "B#" among all orders

    2.3 All buy orders are grouped into one order, all sell orders are also grouped. The price is average.

  •  Click "Close Buys" to close all buy orders.
  •  Click "Close Sells" to close all sell orders.
  •  Click "Close All"  to close all buy and sell orders.         

     Manual trade


3. Grid  Sell 

 There are a highest open price and a lowest open price in all sell orders.

  Grid Sell(win) : When the market price is below a space from the lowest price, EA will open a sell order.

  Grid Sell(loss):  When the market price is above  a space from the highest price,EA will open a sell order.

 Grid Sell(win) order has a comment  “+S”,EA use it to count the grid sell(win) order.

 Grid Sell(loss) order has a comment  “-S”, EA use it to count the grid sell(loss) order.

      

To execute the Grid Sell function,these 3 conditions must be met:

1. check Grid Sell box,  2. Set Fisrt Space(positive number),  3 Set Next Space(positive number)

3.1  ± Lots, suppose  ± Lots = X

  • The lots of a new grid sell order =  the last sell  lots  +
  • If X=0,the lots of all grid sell order are the same.
  • If X>0,the lots of grid sells is increased 
  • If X<0,the lots of grid sell is decreased. if the result is less or equal ZERO, EA will not open new order.
3.2  First Space / Next Space

  • First Space and Next Space are used for checking the distance between the market price and the last sell order
  • If there is no grid sell order,the First Space will be used for the first grid order 
  • If there are alreay at least one grid orders,the Next Space will be used for other grid order.
  • First Space/Next Space is in Pips

3.2 StopLoss,TakeProfit

  • StopLoss/TakeProfit is in Pips
  • When open a grid order,use these 2 number to set order's SL/TP

3.3 PPI less than

  • Only when PPI is less than the setting number, EA can open grid order.
  • if the PPI is less,it is better to open sell order. So we should not open sell when PPI is greater than a setting number
  • If you do not want to use the  PPI feature, just set it to 111. Here the 111 has speical meaning,it means switch off PPI

3.4 Number

  • The max grid sell(win) order , or the max grid sell(loss)order
  • For the grid sell(win) order,it has a special comment  “+S”,EA use it to count the orders of grid sell(win)
  • For the grid selll(loss) order, it has a special comment “-S”,EA use it to count the orders of grid sell(loss)
  • If you do not want to the limitation, just set it to 0

3.4 Limitation to the entry price

  • Sell,only if the price is above  = XXX,  Only when the market price is above XXX,EA can open order.
  • Sell,only if the price is below = YYY, Only when the market price is belwo  YYY, EA can open order.
  • If you use these two limitations, make sure XXX<YYY,let EA only open order when the market is in the range.
  • If you use these two limitations, but XXX>YYY,it is impossible to open order.

3.5 MaxSpread

  • It is in Pips
  • If the real spread is greater than this setting, EA will not open sell order.  if it is 0,there is no limitation. 

    llustration for  the logic : Grid Sell (win)  https://www.mql5.com/en/blogs/post/729795         

4. Grid Buy  

 There are a highest open price and a lowest open prince in all buy orders, also there is a lowest open price.

  Grid Buy(win) : When the market price is above a space from the highest price, EA will open buy order

  Grid Buy(loss):  When the market price is below a space from the lowest price, EA  will open buy order,

 Grid  Buy(win) order has a comment  “+B”,EA use it to count the grid buy(win) order.

 Grid Buy(loss) order has a comment  “-B”, EA use it to count the grid buy(loss) order.

To execute the Grid Buy function,these 3 conditions must be met:

1. check Grid Sell box,  2. Set Fisrt Space(positive number),  3 Set Next Space(positive number)

 All parameters are the same with Grid Sell, so I do not repeat them except for "PPI larger than" and "MaxSpread"

4.1 PPI larger than

  • Only when PPI is larger than the setting number, EA can open grid buy order.
  • if the PPI is more greater,it is better to open buy order. So we should not open buy when PPI is less than a setting number
  • If you do not want to use the  PPI feature, just set it to 111. Here the  111 has speical meaning,it means switch off PPI

4.2 MaxSpread

  • If the real spread is greater than this setting,EA will not open order. If set it 0,there is no limitation.
  • As opening a buy order includes spread, we can use it to avoid opening order when the spread is big such as economic events release and the beginning of Monday.

llustration for  the logic : Grid Buy (loss)  https://www.mql5.com/en/blogs/post/729838      

5. AutoClose  

     AutoClose is to execute a set of functions to protect profit. When the profit reaches the setting level,EA triggers the protection function.

     Includes:Based on Average Price,Based on Amount of Money,Based on Amount of Money(sell+buy)


To execute the function,these 3 conditions must be met:

 1.Check checkbox,2. Set Level(positive number),3.Set keep percent(positive number)

5.1 Based on Average Price(sell)

   There is an average price from all of sell orders. When the market is going down, the profit pips from the average price reaches the Level(pips),EA triggers the function,and record in real time the maximum profit (pips).As the market is going down,the max profit is updated  to record the maximum number.  When the market rally, if rally to the level of the percent of the max. profit, EA will close all of sell orders.

Example: Level(pips) = 100,Keep Percent= 70,it means keeping 70% of the max. profit.

Based on the average price,when the profit reaches  the Level(pips) 100,EA triggers the function to record in real time the max. profit in pips ,we use the item MaxPips.

  1. when profit reaches 100 pips,the MaxPips =100,keep pips = 100*70% = 70 pips
  2. when profit reaches 140 pips,the MaxPips =140,keep pips = 140*70% = 98 pips
  3. when profit reaches 180 pips,the MaxPips =180,keep pips = 180*70% = 126pips
  4. if the market starts  rally,the profit starts reduce.
  5. when profit reduces to 150 pips,the MaxPips =180,keep pips = 180*70% = 126pips
  6. when profit reduces to 130 pips ,the MaxPips =180,keep pips = 180*70% = 126pips
  7. when profit recudes to 126 pips, it is the percent of the max. profit, EA will close all of sell orders.

Note: If users uncheck the checkbox during process, EA will stop the protect function and the record MaxPips is set to zero.EA will not restart the function untill users check the checkbox again,in this case the MaxPips will record again.

5.2 Based on Amount of Money(sell)

   When the total profit in amount of all sell orders reaches Level(amount),EA trigger the function to protect profit, and record in real time the maximum profit (MaxAmount).As the market is going down,the max profit is updated  to record the maximum number.  When the market rally, if rally to the level of the percent of the max. profit, EA will close all of sell orders.

Example: Level(amount) = 200,Keep Percent = 80

  1. when profit reaches 200 dollars, the MaxAmount =200, keep profit = 200*80% = 160 dollars
  2. when profit reaches 220 dollars, the MaxAmount =220, keep profit = 120*80% = 176 dollars
  3. when profit reaches 240 dollars, the MaxAmount =240,keep proift  = 240*80% = 192 dollars
  4. if the market starts rally,the profit starts reduce.
  5. when profit reduces to 210 dollars,the MaxAmount =240,keep profit = 192
  6. when profit reduces to 200 dollars,the MaxAmount =240,keep profit = 192
  7. when profit reduces to 192 dollars,it is the percent of the max. profit, EA will close all of sell orders.

6. Breakeven  

     This tab includes breakeven and trailing stop functions.

     The trailing stop has two modes : (1)Trailing stop (2)Trailing stop with step


Breakeven Setting:

To execute the breakeven function,these 3 condition must be met:

 1.Check checkbox,2. Level(pips)(positive number),3.Plus pips(positive number or zero)

 6.1 Breakeven(sell)

   Example: Level(pips) = 60, Plus pips = 1

   if any sell order has a profit more than 60 pips, EA will modify its SL to 1 pips below its open price.

6.2 (1)Trailing Stop(sell)

To execute the trailing function, these 3 condition must be met:

 1.Check checkbox,2. Level(pips)(positive number),3.Stop pips(positive number)

   Example: Level(pips) = 80,  Stop pips = 15

  •  if any sell order has a profit more than 80 pips, EA will modify its SL to 15 pips above the lowest market price.
  •  if the market is going down, EA continue modifying the SL to make sure that the SL is always 15 pips away from the lowest current market price.
  •  in short, for every new profit of 1 point, EA move SL 1 point every time.

6.2 (2)Trail Stop(sell)

To execute the trailing function, these 3 condition must be met:

 1.Check checkbox,2. Level(pips)(positive number),3.Step pips(positive number)

 Example:Level(pips) = 120,  Step pips  = 20

  • if any sell order has a profit of more than 120 pips,EA will modify its SL to 20 pips above the lowest market price.
  • if the market is goning down, for every new profit of 20 pips,EA modify the SL down 20 pips.
  • in short, for every new profit of 20 pips, EA move SL one time, down 20 pips.

7. GUI Data Save/Load    

      All numbers entered by users will be saved automatically.

      When users load the EA on chart, the GUI will be filled autotomatically.

  • The data file of GUI is saved in MQL4\Files.  (Menu:File-->Open Data Foler-->MQL4\Files)
  • File name, such as: PPI-Helper-USDJPY-M826-A  
  • USJDPY - the  chart's symbol which EA is running on
  • M826 -  the magic number is 826
  • A -- it is entered by user for the input File Name's suffix = A, if multi-EAs are runing, please set different magic number and the suffix.

8.  EA Inputs    

ppi-inputs1

  • Magic Number:  The magic number of EA
  • TimeFrame: The inputs of the indicator Currency Relative Strength
  • BarsToCalculate:  The inputs of the indicator Currency Relative Strength
  • MaPeriodsToSmoothLies:  The inputs of the indicator Currency Relative Strength
  • SendEmail:    EA will send an email after EA closes all orders with the average strategy.
  • SendNotice:  EA will send a notice to your phone after EA closes all orders with the average strategy.
  • File Name's suffix:  EA saves the GUI settings in a file,set an unique suffix to distinguish different settings on different charts.