[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 389
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
Good afternoon, I'm trying to count the volume of bullish and bearish minute candles in an hour:
if (iTime(NULL,60,1)!=TS)
{
int TotalBars = 59; // Total number of candlesticks to search
int Vupbars;
int Vdnbars;
int V=iVolume(NULL,IndPeriod,1);
for(int p=0; p<TotalBars; p++)
{
if(Close[1]>Open[1]) Vupbars=Vupbars+iVolume(NULL,0,1); else
if(Close[1]<Open[1]) Vdnbars=Vdnbars+iVolume(NULL,0,1);
}
}
TS=iTime(NULL,60,1);
What's wrong, why doesn't it work ?
Afternoon, trying to calculate the volume of bullish and bearish minute candles in an hour:
if (iTime(NULL,60,1)!=TS)
{
int TotalBars = 59; // Total number of candlesticks to search for
int Vupbars;
int Vdnbars;
int V=iVolume(NULL,IndPeriod,1);
for(int p=0; p<TotalBars; p++)
{
if(Close[1]>Open[1]) Vupbars=Vupbars+iVolume(NULL,0,1); else
if(Close[1]<Open[1]) Vdnbars=Vdnbars+iVolume(NULL,0,1);
}
}
TS=iTime(NULL,60,1);
what's wrong, why doesn't it work ?
if(iTime(NULL,60,1)!=TS)
{
int TotalBars = 59; // Total number of candlesticks to search
int Vupbars;
int Vdnbars;
int V=iVolume(NULL,60,1);
for(int p=0; p<TotalBars; p++)
{
if(Close[p]>Open[p]) Vupbars=Vupbars+iVolume(NULL,0,p); else
if(Close[p]<Open[p]) Vdnbars=Vdnbars+iVolume(NULL,0,p);
}
}
TS=iTime(NULL,60,1);
this works, but the values of Vupbars and Vdnbars blink and reset -- this one I removed, the second one not yet ?
and also their sum is not equal to V why ?
and also their sum is not equal to V why?
because you are comparing the volume of the 59 last minute candles (including the one that just started) to the last closed hour candle
No, the numbers don't match by an order of magnitude.
For example, the watch has a volume of 40.
the sum of the minutes is 320
Something like this, in my mind
Nope, it doesn't work like that, they're never equal. And in fact, for some reason I have a visual signal one that is clearly lower than the main one, for example, but the values say otherwise. I don't get it, what's the trick?
No, the numbers don't match us by an order of magnitude.
For example, the watch has a volume of 40.
the sum of minutes is 320
Are you throwing the indicator on the M1?
Give full code and use the SRC button when inserting
are you throwing an indicator on the M1?
give full code and use the SRC button when inserting
this advisor
on m1
this is an EA
on m1
in any case, give a bit more code - for example where Vupbars and Vdnbars are used that you find out that they are zeroed
and it would also be desirable to zero them before the cycle:
int Vupbars = 0;
int Vdnbars = 0;
I have done so:
int Vupbars; - this is put in the volumetric variables
int Vdnbars; - this is put in the volumetric variables
int V=iVolume(NULL,60,1);
if(iTime(NULL,60,1)!=TS)
{
int TotalBars = 61; // Total number of candlesticks to search for
Vupbars=0;
Vdnbars=0;
for(int p=1; p<TotalBars; p++)
{
if(Close[p]>Open[p]) Vupbars=Vupbars+iVolume(NULL,0,p); else
if(Close[p]<Open[p]) Vdnbars=Vdnbars+iVolume(NULL,0,p);
}
}
TS=iTime(NULL,60,1);