Ragazzi buonasera,
ho trovato un listato in rete e lo modificato per le mie esigenze però mi riconosce solo le pin - bar rialziste non riesco a capire dov'è l'errore, qualcuno mi puoi aiutare, questo è il codice:
ho trovato un listato in rete e lo modificato per le mie esigenze però mi riconosce solo le pin - bar rialziste non riesco a capire dov'è l'errore, qualcuno mi puoi aiutare, questo è il codice:
PHP Code:
int start()
{
int NeedBarsCounted, LastBars = 0,CountBars=0;
double NoseLength, NoseBody, LeftEyeBody, LeftEyeLength;
if (LastBars == Bars) return(0);
NeedBarsCounted = Bars - LastBars;
if ((CountBars > 0) && (NeedBarsCounted > CountBars)) NeedBarsCounted = CountBars;
LastBars = Bars;
if (NeedBarsCounted == Bars) NeedBarsCounted--;
for (int i = NeedBarsCounted; i >= 1; i--)
{
// Won't have Left Eye for the left-most bar
if (i == Bars - 1) continue;
Pinbar(i);
}
}
void Pinbar(int i, double MaxNoseBodySize = 0.33, double NoseBodyPosition = 0.4, bool LeftEyeOppositeDirection = true, bool NoseSameDirection = false, bool NoseBodyInsideLeftEyeBody = false, double LeftEyeMinBodySize = 0.1, double NoseProtruding = 0.5,
double NoseBodyToLeftEyeBody = 1, double NoseLengthToLeftEyeLength = 0, double LeftEyeDepth = 0.2)
{
double NoseLength, NoseBody, LeftEyeBody, LeftEyeLength;
// Left Eye and Nose bars's paramaters
NoseLength = High[i] - Low[i];
if (NoseLength == 0) NoseLength = Point;
LeftEyeLength = High[i + 1] - Low[i + 1];
if (LeftEyeLength == 0) LeftEyeLength = Point;
NoseBody = MathAbs(Open[i] - Close[i]);
if (NoseBody == 0) NoseBody = Point;
LeftEyeBody = MathAbs(Open[i + 1] - Close[i + 1]);
if (LeftEyeBody == 0) LeftEyeBody = Point;
if (Open[i]>Close[i])//Bearish_arrow_Down
{
if (High[i] - High[i + 1] >= NoseLength * NoseProtruding) // Nose protrusion
{
if (NoseBody / NoseLength <= MaxNoseBodySize) // Nose body to candle length ratio
{
if (1 - (High[i] - MathMax(Open[i], Close[i])) / NoseLength < NoseBodyPosition) // Nose body position in bottom part of the bar
{
if ((!LeftEyeOppositeDirection) || (Close[i + 1] > Open[i + 1])) // Left Eye bullish if required
{
if ((!NoseSameDirection) || (Close[i] < Open[i])) // Nose bearish if required
{
if (LeftEyeBody / LeftEyeLength >= LeftEyeMinBodySize) // Left eye body to candle length ratio
{
if ((MathMax(Open[i], Close[i]) <= High[i + 1]) && (MathMin(Open[i], Close[i]) >= Low[i + 1])) // Nose body inside Left Eye bar
{
if (NoseBody / LeftEyeBody <= NoseBodyToLeftEyeBody) // Nose body to Left Eye body ratio
{
if (NoseLength / LeftEyeLength >= NoseLengthToLeftEyeLength) // Nose length to Left Eye length ratio
{
if (Low[i] - Low[i + 1] >= LeftEyeLength * LeftEyeDepth) // Left Eye low is low enough
{
if ((!NoseBodyInsideLeftEyeBody) || ((MathMax(Open[i], Close[i]) <= MathMax(Open[i + 1], Close[i + 1])) && (MathMin(Open[i], Close[i]) >= MathMin(Open[i + 1], Close[i + 1])))) // Nose body inside Left Eye body if required
{
High[i] + 5 * Point + NoseLength / 5;
if (i == 1) ObjArrowDown("freccia sell"+TimeToString(Time[1],TIME_DATE|TIME_MINUTES), Time[1], (High[1] + 6 *(Point*10))); //SendAlert("Bearish"); // Send alerts only for the latest fully formed bar
}
}
}
}
}
}
}
}
}
}
}
}
if (Open[i]<Close[i])//Bullish_arrow_Up
{
if (Low[i + 1] - Low[i] >= NoseLength * NoseProtruding) // Nose protrusion
{
if (NoseBody / NoseLength <= MaxNoseBodySize) // Nose body to candle length ratio
{
if (1 - (MathMin(Open[i], Close[i]) - Low[i]) / NoseLength < NoseBodyPosition) // Nose body position in top part of the bar
{
if ((!LeftEyeOppositeDirection) || (Close[i + 1] < Open[i + 1])) // Left Eye bearish if required
{
if ((!NoseSameDirection) || (Close[i] > Open[i])) // Nose bullish if required
{
if (LeftEyeBody / LeftEyeLength >= LeftEyeMinBodySize) // Left eye body to candle length ratio
{
if ((MathMax(Open[i], Close[i]) <= High[i + 1]) && (MathMin(Open[i], Close[i]) >= Low[i + 1])) // Nose body inside Left Eye bar
{
if (NoseBody / LeftEyeBody <= NoseBodyToLeftEyeBody) // Nose body to Left Eye body ratio
{
if (NoseLength / LeftEyeLength >= NoseLengthToLeftEyeLength) // Nose length to Left Eye length ratio
{
if (High[i + 1] - High[i] >= LeftEyeLength * LeftEyeDepth) // Left Eye high is high enough
{
if ((!NoseBodyInsideLeftEyeBody) || ((MathMax(Open[i], Close[i]) <= MathMax(Open[i + 1], Close[i + 1])) && (MathMin(Open[i], Close[i]) >= MathMin(Open[i + 1], Close[i + 1])))) // Nose body inside Left Eye body if required
{
Low[i] - 5 * Point - NoseLength / 5;
if (i == 1)ObjArrowUp("freccia up"+TimeToString(Time[1],TIME_DATE|TIME_MINUTES), Time[1], (Low[1] - 6 *(Point*10)));// SendAlert("Bullish"); // Send alerts only for the latest fully formed bar
}
}
}
}
}
}
}
}
}
}
}
}
return(0);
}