Posted By: Bolle
Calculating with price series - 10/21/19 13:39
Hello all,
I have got a, probably, simple problem to solve. I have to detemine the upper- as well as lower round figure to the actual price (rounded to 100 PIPS). Example: price = 1.12701; Upper round figure = 1.13000; Lower round figure = 1.12000.
This script is exactely doing that:
function main()
{
var Price = 1.12701;
var U_price= (ceil(Price*100)/100);
var L_price= (floor(Price*100)/100);
printf("Price: %.5f",Price);
printf("\nUpper Price: %.5f",U_price);
printf("\nLower Price: %.5f",L_price);
}
I get an error message with script below though:
function run()
{
vars Price = series(price());
var U_price= (ceil(Price*100)/100);
var L_price= (floor(Price*100)/100);
printf("Price: %.5f",Price);
printf("\nUpper Price: %.5f",U_price);
printf("\nLower Price: %.5f",L_price);
}
The error message says: Wrong type P_MUL:POINTER:LONG:POINTER
I have tried nopw everything I got out of the manual and GOOGLE, hope one of you guys can help me.
Many thanks in Advance.
I have got a, probably, simple problem to solve. I have to detemine the upper- as well as lower round figure to the actual price (rounded to 100 PIPS). Example: price = 1.12701; Upper round figure = 1.13000; Lower round figure = 1.12000.
This script is exactely doing that:
function main()
{
var Price = 1.12701;
var U_price= (ceil(Price*100)/100);
var L_price= (floor(Price*100)/100);
printf("Price: %.5f",Price);
printf("\nUpper Price: %.5f",U_price);
printf("\nLower Price: %.5f",L_price);
}
I get an error message with script below though:
function run()
{
vars Price = series(price());
var U_price= (ceil(Price*100)/100);
var L_price= (floor(Price*100)/100);
printf("Price: %.5f",Price);
printf("\nUpper Price: %.5f",U_price);
printf("\nLower Price: %.5f",L_price);
}
The error message says: Wrong type P_MUL:POINTER:LONG:POINTER
I have tried nopw everything I got out of the manual and GOOGLE, hope one of you guys can help me.
Many thanks in Advance.