- Read custom indicator with different time frame
- coding problem
- Create an Auto EA
- We can't know what is wrong either because you haven't stated a problem. "Does not work as I want" requires a mind-reader.
- Only MT4 has a predefined array High.
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the MQL4 section,
(bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - High[1] < High[0] is the test for what your images shows (circled part.) State your problem.
- This image also has a higher high. Are you sure you still want to sell?
int breakIn() { //double HighPrec= High[1], HighCurr= High[0], LowPrec= Low[1], LowCurr= Low[0]; if(High[1]<High[0])// Sell { AllertoPerIlRibasso(); return - 1; } else if(Low[1] < Low[0])//buy { return + 1; } return 0; }
I'm sorry, I realized I posted half a service, basically:
Sell
when the upper shadow of the candle in formation exceeds the maximum of the previous candle therefore "high[0] > high[1] " must return -1;
Buy
the opposite situation
if(High[1]<High[0])// Sell
do you want to sell when bulls are burgeoning ?
I think what the OP is referring to is a retraction from the previous close, indicating a price contraction.
I'd formulate it as this:
if(High[1]<High[0] && Close[1]>Close[0])// Sell { AllertoPerIlRibasso(); }
This means, if the current high topped the previous high, but the Bid (which is denoted in Close[0]) fell below the previous close, then sell.
Be aware that such a premise might right away burn your position.
Attached explanatory image
però mi succede che richiama le funzioni "AllertoPerIlRibasso() e AllertoPerIlRialzo()(che creano delle linee verticali rosse e verdi"per ogni candela anziché solo quanto è verificata la condizione
{ if(Bid>High[1]) AllertoPerIlRibasso(); if(Bid<Low[1]) AllertoPerIlRialzo(); }
Guys then I made a change to the code since it must work at each tick and not at candle closure, in fact I changed using the value of the price;
but it happens to me that it calls the functions "AllertoPerIlRibasso() and AllertoPerIlRialzo() (which create vertical lines red and green "for each candle instead of only when the condition is verified)as a solution?
thanks
Did you try this:
if(High[1]<High[0] && Close[1]>Bid)// Sell { AllertoPerIlRibasso(); }
It works on every tick not just candle closure, just give it a go.
thanks in advance
void OnTick() { // 1 candela verde | ombra superiore | if ((Close[2] > Open[2]) && (High[2] > Close [2])){ // candle rossa Ombra sup if ((Close[1] < Open[1]) && (High[1] >Open[1])) //sell if (High[1] > High[2]) AllertoPerIlRibasso(); } // 1 candela rossa |Ombra inferiore | | 2 candle verde | condizione buy if (((Close[2] < Open[2]) && (Low[2] < Close[2]))&& ((Close[1] > Open[1]) &&((Low[1]<Open[1]) && (Low[1] < Low[2])))) AllertoPerIlRialzo(); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use