I order for us to help you, you need to provide the source code so we can indicate the problem.
Matija14:
I order for us to help you, you need to provide the source code so we can indicate the problem.
I order for us to help you, you need to provide the source code so we can indicate the problem.
This the function that chesk the Pin bars
void CheckPinBarForTrade() { double NoseLength, NoseBody, LeftEyeBody, LeftEyeLength; // Left Eye and Nose bars's paramaters NoseLength = High[1] - Low[1]; if (NoseLength == 0) NoseLength = Point; LeftEyeLength = High[2] - Low[2]; if (LeftEyeLength == 0) LeftEyeLength = Point; NoseBody = MathAbs(Open[1] - Close[1]); if (NoseBody == 0) NoseBody = Point; LeftEyeBody = MathAbs(Open[2] - Close[2]); if (LeftEyeBody == 0) LeftEyeBody = Point; // Bearish Pinbar if (TrendDirection() == 1) // Down Trend ??? { if (High[1] - High[2] >= NoseLength * NoseProtruding) // Nose protrusion { if (NoseBody / NoseLength <= MaxNoseBodySize) // Nose body to candle length ratio { if (1 - (High[1] - MathMax(Open[1], Close[1])) / NoseLength < NoseBodyPosition) // Nose body position in bottom part of the bar { if ((!LeftEyeOppositeDirection) || (Close[2] > Open[2])) // Left Eye bullish if required { if (LeftEyeBody / LeftEyeLength >= LeftEyeMinBodySize) // Left eye body to candle length ratio { if (Low[1] - Low[2] >= LeftEyeLength * LeftEyeDepth) // Left Eye low is low enough { if (MathMax( Open[1], Close[1] )<iMA( Symbol(), 240, 50,0,0,0,1 )) // Is the Pin bar body below the Ma ? { OrderEntry(1,High[1],NoseLength); // Sell Order with 5 pips stoploss above the Pin bar high and NoseLength*3 takeprofit } } } } } } } } // Bullish Pinbar if(TrendDirection() == 0) // Up trend ??? { if (Low[2] - Low[1] >= NoseLength * NoseProtruding) // Nose protrusion { if (NoseBody / NoseLength <= MaxNoseBodySize) // Nose body to candle length ratio { if (1 - (MathMin(Open[1], Close[1]) - Low[1]) / NoseLength < NoseBodyPosition) // Nose body position in top part of the bar { if ((!LeftEyeOppositeDirection) || (Close[2] < Open[2])) // Left Eye bearish if required { if (LeftEyeBody / LeftEyeLength >= LeftEyeMinBodySize) // Left eye body to candle length ratio { if (High[2] - High[1] >= LeftEyeLength * LeftEyeDepth) // Left Eye high is high enough { if (MathMin( Open[1], Close[1] )>iMA( Symbol(), 0, 50,0,0,0,1 )) // Is the Pin bar body above the Ma ? { OrderEntry(0,Low[1],NoseLength); // Buy Order with 5 pips stoploss below the Pin bar Low and NoseLength*3 takeprofit } } } } } } } } }
IMHO, neither of those examples would be valid pin bars in a naked price action strategy. The first bearish pin occurs in a down trend (not valid), the second bullish pin occurs in a sideways/upward market (not valid). I haven't gone through your code in depth but I can see it attempts to define a trend direction and bullish/bearish pin so it is probably following the same (correct) logic.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
help please .