hi guys
im trying to create a simple code with volume profile since 2 days ago
i used a average of volume for m1 (m1 volume / pips), but i still have a persistent error, 'strongvolume' always return Open[0]+10000 points
i looked at the code a hundred times and dont find the error, if someone can help with this, or know a better method to do a volume profile i will be very grateful
-----------------------------------------------
extern int
numberofcandles=6000;
extern double
lots=0.01,
takeprofit=50,
stoploss=50;
extern bool
candleinterval=false;
extern int
interval=10;
long
volume[1000000],
vwap[200000],
strongvolume=0;
long ab=0;
void OnTick(){
long bc=Open[0]*100000;
if(ab>bc || ab<bc ){ //key to execute in every open candle, because ontimer dont work in strategy tester
int a=numberofcandles;
int b=(Open[0]*100000)-10000;
int c=(Open[0]*100000)+10000;
int d=(Open[0]*100000)-15000;
int f=(Open[0]*100000)+15000;
for(int m=d; m<f; m++){ //cleaning vwap 15000 points below and above actual price
vwap[m]=0;
}
for(int i=0; i<a; i++){ // m1 volume
volume[i]= iVolume(Symbol(),1,i);
int pip = (High[i]*100000) - (Low[i]*100000); // calc of candle points to do a volume average, i dont know a method to do volume profile ontick
if(pip>0){ // application of volume average in every candle point
long vpip=volume[i]/pip;
for(int j=0; j<pip; j++){
int price=(Low[i]*100000)+j;
vwap[price]+=vpip;
}
}else{ // application of volume if candle dont move
int price0 = Low[i]*100000;
vwap[price0]+=volume[i];
}}
for( int l=b ; l<c; l++){ //selecting the strong volume
int m=l+1;
if(vwap[l] > vwap[m]){
strongvolume=l;
}else{
strongvolume=m;
}}
ab=Open[0]*100000; //second part of the key to start "if" again
}