Math Function: log base10 (x)

 

to code natural logarithm ln (x) is MathLog (x)

I need help on how to code log base 10 (x) fuction?

Thanks in advance

 

Try this . . .

double TestValue = 34;


Math10Log(TestValue);


double Math10Log(double value)
   {
   return(MathLog(value) / MathLog(10));
   }
 
RaptorUK:

Try this . . .


what if value of Math10Log is not fixed?
 
kkambone:

what if value of Math10Log is not fixed?

Sorry, I don't understand your question.

Did you try the function ?

 
RaptorUK:

Sorry, I don't understand your question.

Did you try the function ?

I need to change A & B to log base 10. Just changing A to A=Math10Log(H); does not work

for(i=limit - 1; i>=0; i--)
{
dayi=iBarShift(Symbol(), myPeriod, Time[i], false);
H=iHigh(Symbol(), myPeriod,dayi +1);
L=iLow(Symbol(), myPeriod,dayi +1);

A=MathLog(H);

B=MathLog(L);

Q=(A-B);
C=A-(Q*0.5);
D=(H-L);


P1Buffer[i]=MathPow(2.718,C);

 
kkambone:

I need to change A & B to log base 10. Just changing A to A=Math10Log(H); does not work

So do this . . .

A = Math10Log(H);

B = Math10Log(L);
 

Picture from here

b= base e

a=base 10

x the value your after.

Just to be clear

 
RaptorUK:

So do this . . .


says Math10Log-fuction is not defined
 
But RapterUK Gave you the code to make Math10log function!
 
Ickyrus:

Picture from here

b= base e

a=base 10

x the value your after.

Just to be clear


Thank you so much!
 
RaptorUK:

Try this . . .


now it makes sense.

thank you so much