EA: Forex PZ Harmonics Indicator

This expert advisor uses the PZ Harmonics Indicator.


  • Wait for a Pattern
  • Start a Buy/Sell Order
  • Set TP1 to 38.2% and TP2 to 61.8% of the C and D line
  • Set SL so that there is a 1:3 Risk Reward Ratio
  • When price reaches TP1 close 1/2 order and move Stop Loss to Breakeven
  • When price reaches TP2 close the other 1/2 order


  • Copy Abiroid_Forex_Common.mq4 and ex4 to Libraries
  • Copy PZ_Harmonic.ex4 to Indicators
  • Copy Abiroid_PZ_Harmonic_EA.mq4 and ex4 to Experts
  • Drag and Drop Abiroid_PZ_Harmonic_EA into your chart.

I would recommend higher timeframes like at least H1.


You can change these settings either directly in the mql4 code or in EA Settings:

  • minPipsDistance:

  • Sometimes the Pattern is very small and there is not enough distance between Points C and D for a successful trade. So set this to minimum Pipettes distance. You can set it to a smaller value for smaller timeframes and slightly larger for higher Timeframes. If you don’t want any limitations with this setting then set it to 0. Note that this value will be multiplied by Points to give pipettes and not pips.

  • doRetest:

  • After a pattern is drawn, sometimes the D point extends and the pattern gets re-drawn. If this var is set to true, it will only open a BUY/SELL Limit order and wait for the price to be re-tested at that point. This will prevent it from opening multiple orders. Because PZ Harmonics does re-draw the patterns. So, if this value is set to false, every time a pattern is re-drawn, it will keep closing previous order and opening a new one.

  • RetestPipsDistance:

  • If doRetest is true, then the BUY/SELL Limit will be drawn a little inside from the actual D price. Because when price is re-tested it rarely goes all the way back to D.

  • OrderExpiryBars:

  • It will wait for these number of Bars for the order to re-test the D point if doRetest is true. This is the expiry time for the BUY/SELL Limit order.

  • tradePatternOnlyOnce:

  • If false, then when pattern is re-drawn it will keep closing the previous order and re-opening a new one. PZ Harmonics can re-draw several times even in higher timeframes, so you might want to set this to true. But if true, and pattern redraws to a better pattern then previous order will hit StopLoss and you might miss out on the newer better pattern.

  • useOnlyPerfectPatterns:

  • It will draw only perfect harmonic patterns if true. If in a Chart you find that the pattern is re-drawn too frequently, then using only perfect patterns might be better.

  • maxStopLossPips:

  • The StopLoss is set to 4:1 Reward:Risk ratio as compared to TakeProfit. But if a pattern grows too big then StopLoss can be large too. Use this var to limit the max value of your StopLoss.
    To have a fixed StopLoss change code on these lines:

    // Fixed StopLoss
    //SL1 = price_d - 100 * Point;
    // StopLoss Based on Take Profit for 4:1 Reward:Risk Ratio
    SL1 = NormalizeDouble(price_d - (TP1-price_d)/4, Digits);

    Uncomment the Fixed StopLoss line and comment the variable SL line.


Abiroid_PZ_Harmonic_EA_v1.0.rar (1006 downloads)

This Strategy works best for Gartley patterns. If you have any suggestions to improve the strategy please write to me in the comments below.
I have only spent a few days on this EA, so there might be some bugs. So please use on Demo accounts only!
Let me know of your testing results in the comments.

Hope this helps. Happy trading!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 5 MB.
You can upload: image, text, archive.
Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded.

%d bloggers like this: