工作已完成
指定
Good afternoon. I would like to have a pinbar ea, which trades automatically when it detects that the previous bar was a pinbar. I am also going to attach an indicator, which could help you get ideas in coding this EA.
This is a high level view:
1) Basic function is it looks at the current bar right when it finishes, and makes a decision on whether it is a pinbar or not. For example, a simple rule could be 72% of whole candle is wick, and rest 28% is actual body. So anything >= 72% wick is classified as pinbar.
2) If it deems at the close of the current bar that it is a pinbar, it immediately opens an order in the direction of that pinbar. The important part here is that it immediately acts and takes an order, if the previous bar was indeed a pinbar.
3) It can do that for every open chart in your MT4.
4) Basic requirement is that it can do that for range bars, tick bars etc. For example, for a 50 pip range bar chart, it detects again when the bar will close and classifies it.
5) Based on #4, it is very important to see whether there is a mechanism in MT4 to detect if the current bar has changed. I don't know if MT4 gives this possibility. But this is a requirement because for example on a 4 hour chart, sure you know the bar will change after 4 hours. But in a 50 (or 100, or 200) pip bar, the bar will change whenever the whole range of pips has been covered.
It would be easier if this EA just recognizes when there has been a bar change, and immediately makes a decision on the previous bar based on point 1.
A simple algorithm approach I am thinking of is this:
1) Detect when the current bar has changed.
2) Immediately go to previous bar, subtract low from high to get the whole candle length.
3)Subtract close from open to see whether candle was bullish or bearish. If bullish, we are looking to buy. If bearish, we want to sell.
4)For example in the case that the close was higher than the open (bullish), subtract the open from the low so that we know how big the wick is.
5) Compare the length of the wick to the length of the whole body (wick length divided by whole candle length perhaps). If the wick is 72% or more of the body, we immediately take a bullish trade.
Similar for bearish trade. I ncase of time charts, we might also want to take a look if there is a wick above the close for a bullish trade, or below the close for a bearish trade.
It would be great to do some statistical analysis of the famous pinbar through this EA. If you take a look at it, I will be very thankful!