I am getting Warning 505, Division by Zero when tried to add Market profile as an indicator

Division%20By%20Zero

Warning 505. Division by zero.

range_x=lastVisBar-firstVisBar;
spread = Param("X Space", 112, 1, 200, 1);
tpl = Param("Time Per Letter (mins)", 30, 1, 360, 1);
Intervalmin=Interval()/60;
flt =Param("First Letter (Bars)", 1, 1, 60, 1);
teb=ParamToggle("To Each Bar","No|Yes");
Color=Param("Color Threshold",20,1,50,1);
stopg=0;
stopr=0;
new=0;

Voloumeunit=Vol[i]/LastValue(BarsInDay); -

Warning 505. Division by zero.

if (EnMP2 == "Letters") {
for (j=0; j<= relTodayRange; j++) {
if (L[i] <= baseY+jDen AND H[i] >= baseY+jDen) {

The best advice that many old member stress on it is to search the forum before creating thread , that would save time for you and others

take a look at these threads ...



1 Like

Dear friend, modify your denominator by adding some very little number like the following

nonzero=10^-20;
Voloumeunit=Vol[i]/(LastValue(BarsInDay)+nonzero);

Good luck,

1 Like