Gamestudio Links
Zorro Links
Newest Posts
Comment Out
by danatrader. 03/29/20 22:03
How can I create a folder?
by danatrader. 03/29/20 21:57
History download
by danatrader. 03/29/20 21:49
Alice1a look back
by AndrewAMD. 03/29/20 16:01
Running banchmark test with FxPro on MT4
by Cobus. 03/29/20 13:38
Performance report - external trades
by Petra. 03/29/20 10:12
Multiple Zorro (free versions) instances
by Lozoteva. 03/29/20 10:09
Random Functions?
by gamers. 03/29/20 07:59
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
9 registered members (danatrader, AndrewAMD, kvm, alibaba, 3run, hast29, Jerome8911, painkiller, kerplunk1899), 669 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
HF_Psy, jj02520024, heitorfr, Art__, bmmtrader
18407 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Calculating with price series #478434
10/21/19 13:39
10/21/19 13:39
Joined: Oct 2019
Posts: 2
B
Bolle Offline OP
Guest
Bolle  Offline OP
Guest
B

Joined: Oct 2019
Posts: 2
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.

Re: Calculating with price series [Re: Bolle] #478435
10/21/19 14:12
10/21/19 14:12
Joined: Feb 2017
Posts: 892
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 892
Chicago
In the bottom snippet, use Price[0] instead of Price to retrieve a particular element of your price series, where 0 is the element number.

Re: Calculating with price series [Re: Bolle] #478436
10/21/19 14:27
10/21/19 14:27
Joined: Oct 2019
Posts: 2
B
Bolle Offline OP
Guest
Bolle  Offline OP
Guest
B

Joined: Oct 2019
Posts: 2
Hi Andrew,

many thanks for the quick reply, it has worked ! Just that I got it right, the series function goes thru history bar by bar. The [0] index is the lates element of "Price", hence it would always use the current bar to claculate the rest right ?

Again Thanks !

Re: Calculating with price series [Re: Bolle] #478437
10/21/19 14:31
10/21/19 14:31
Joined: Feb 2017
Posts: 892
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 892
Chicago


Powered by UBB.threads™ PHP Forum Software 7.7.1