The "trendMediemmobili ()" should increase the variable "on" when the candle "n-1" (the previous candle) closes below the moving average 9 times and the candle "n" (current candle) closes above the moving average 9 periods and vice versa should increase the variable "down" when the candle "n-1" (the previous candle) closes above the moving average 9 times and the candle "n" (current candle) closes below the moving average of 9 periods.
But it does not work sempree .... you know how to help me fix it?
- Questions from Beginners MQL4 MT4 MetaTrader 4
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
- Indicator to compare candle close and give signals , help please
texcs: closes below the moving average 9 times and the candle "n" (current candle) closes above the moving average 9 periods
if((Close[1]< mmoblie_9)&& (Close[0]>mmoblie_9)){
TrendMediemmobili tests if the previous candle (Close[1]) closed below and the current Bid (Close[0]) is above the moving average.
Calling it 9 times changes nothing except how many times the variable is incremented.
I care that is compared with each new candle with the previous one, like I change?
So it seems that it works well as you test it
int trendMedia9(){ double mmoblie_9; mmoblie_9= iMA(Symbol(),Period(),9,0,MODE_EMA,PRICE_CLOSE,1); if((Close[2]< mmoblie_9)&& (Close[1]>mmoblie_9)) { su++; ObjectCreate(ChartID(),IntegerToString(Time[0],0,0),OBJ_VLINE,0,Time[0],0); ObjectSetInteger(ChartID(),IntegerToString(Time[0],0,0),OBJPROP_COLOR,Green); } else if((Close[2] > mmoblie_9)&& (Close[1]< mmoblie_9)) { giu++; ObjectCreate(ChartID(),IntegerToString(Time[0],0,0),OBJ_VLINE,0,Time[0],0); ObjectSetInteger(ChartID(),IntegerToString(Time[0],0,0),OBJPROP_COLOR,clrDarkRed); } return 0; }
But I think too many signals you tips to reduce and rendeere + reliable signals?
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