for loop comes with 3 parameters like this
for (int i = x; i >= x; i++ )
for loop comes with 3 parameters like this
Yea i think i have that as it is? how do i make it selective of (i) using D1 timeframe only, with the code i have posted
Yea i think i have that as it is? how do i make it selective of (i) using D1 timeframe only, with the code i have posted
can you fix the code?
what do u trying to accomplish with the MathMax() function ?
c more about MathMax() & IndicatorCounted()
here is the rest of the code.. Close (i) each is getting the value from current timeframe. I want it to read the values of close (i) on the daily timeframe all the time....
if(Close[i] >= ema && ema2 >= ema )
{
SetEmaColor(1,i); // BLUE
}
Here is a small piece of code in an Indicator i am working on. I have become stuck with an issue. The following code relates to bars on current timeframe. I need (i) to be selective of the D1 timeframe only, reguardless of with timeframe is opened on the chart. Can anyone fix the issue for me. Thanks..
Your indicator needs to update every bar. And do the loop properly.
//---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int shift= limit-1; shift >=0; shift--){ int D1_bar = iBarShift(NULL, PERIOD_D1, Time[shift]); double EMA_D1=iMA(0, PERIOD_D1,0, MODE_EMA,PRICE_MEDIAN,D1_bar);
Your indicator needs to update every bar. And do the loop properly.
Thanks alot. I will get this in my code as see how i go. Cheers.
Thanks alot. I will get this in my code as see how i go. Cheers.
Is this correct WhRoeder. Defining what counted bars is and Int limit...??
int counted_bars = (Bars-1-IndicatorCounted(),1);
int limit;
no
what is this (the red) int counted_bars = (Bars-1-IndicatorCounted(),1);
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Here is a small piece of code in an Indicator i am working on. I have become stuck with an issue. The following code relates to bars on current timeframe. I need (i) to be selective of the D1 timeframe only, reguardless of with timeframe is opened on the chart. Can anyone fix the issue for me. Thanks..
for(int i = MathMax(Bars-1-IndicatorCounted(),1);
i>=1; i--)
{
double ema = EMA(i);