You're working exclusively with bool variables... true / false (yes / no). Their values can only be 1 or 0. You need to be using some doubles.
I modified the code and no errors but still does not work.
Help please?
bool c1 = Open[1+i] < Close [1+i] && MathAbs(Close[1+i]-Open[1+i]) > 2 * myPoint; //Candela Verde double c2 = MathAbs (High [1+i] - Close[1+i]); //shadow up double c3 = MathAbs (Open [1+i] - Low [1+i]); //shadow donw double c4 = MathAbs (High [1+i] - Low [1+i]); //total escursion double c5 = MathAbs (c2+c3); //sum shadow double c6 = MathAbs (100*c5)/c4; //result as a percentage bool c7 = c6 < 3.9;
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- Print out your variables, and find out
why.
- Drop the c1 as you don't use it. Rename your variables to meaningful names. Your code should be able to be read out loud and make sense.
- Drop your MathAbs as those are unnecessary (except c1 lline.)
- Your indicator for loop computes the value of bar "i," drop those "1+".
You are assuming that all candles have Close > Open. Also, use variable names that are more meaningful and self documenting.
// Attention - uncompiled/untested! int BarShift = i + 1; // Depends on what you are doing (as "WHRoeder" pointed out) double CandleOpen = Open[ BarShift ], CandleClose = Close[ BarShift ], CandleHigh = High[ BarShift ], CandleLow = Low[ BarShift ], CandleRange = CandleHigh - CandleLow, BodyHigh = fmax( CandleOpen, CandleClose ), BodyLow = fmin( CandleOpen, CandleClose ), WickUpperRange = CandleHigh - BodyHigh, WickLowerRange = BodyLow - CandleLow, WickRange = WickUpperRange + WickLowerRange, WickRatio = ( CandleRange != 0.0 ) ? WickRange / CandleRange : 0.0, // Prevent "divide by zero" error WickPercentage = WickRatio * 100.0;
Thanks to everyone for the great suggestions and lines of code that occasionally posted for us beginners!
I was able to integrate your code to mine, it all works.
Thanks again
I was able to integrate your code to mine, it all works.
Thanks again
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
example:
Total excursion Body candle = 36 tenthsTotal excursion shadows = 11 tenths
mathematical expression (100 * 11) / 36 = 30.55%
Can you help me?
Thank you