Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Ayumi, AndrewAMD, Quad), 1,014 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
plot multiple assets #467915
09/07/17 17:15
09/07/17 17:15
Joined: Aug 2017
Posts: 3
F
fz5 Offline OP
Guest
fz5  Offline OP
Guest
F

Joined: Aug 2017
Posts: 3

// plot price series for each asset in a separate chart

function run()
{
BarPeriod = 1440;
NumYears = 1;

int N=0;
while(asset(loop("AUD/USD","EUR/USD","GBP/USD"))) {
vars Price = series(price());
plot(strf("price_%i",N), Price, NEW, BLACK);
N++;
}
}

Re: plot multiple assets [Re: fz5] #467916
09/07/17 17:22
09/07/17 17:22
Joined: Aug 2017
Posts: 3
F
fz5 Offline OP
Guest
fz5  Offline OP
Guest
F

Joined: Aug 2017
Posts: 3
Sorry, I submitted the above code accidentally before I typed my question. I'm testing the simple code to plot the price series for each asset in a separate chart. Somehow it only plots for the first asset. Can anyone point out what's wrong with the code? Thanks a lot!

Re: plot multiple assets [Re: fz5] #467919
09/07/17 20:42
09/07/17 20:42
Joined: Feb 2017
Posts: 1,726
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,726
Chicago
Probably because you're sending "plot" inside the asset loop.

This works, though.
Code:
// plot price series for each asset in a separate chart 

function run()
{
    set(PLOTNOW);

    BarPeriod = 1440;	
    NumYears = 1;

    vars Price[3];
    int N=0;
    string names[3];
    while(asset(loop("AUD/USD","EUR/USD","GBP/USD"))) 
    {	
        names[N] = Asset;
        Price[N] = series(price());	
        N++;	
    }

    for(N=0; N<3; N++)
    {
        plot(strf("price_%s",names[N]), Price[N], NEW, BLACK);
    }

}


Re: plot multiple assets [Re: AndrewAMD] #467921
09/07/17 21:21
09/07/17 21:21
Joined: Aug 2017
Posts: 3
F
fz5 Offline OP
Guest
fz5  Offline OP
Guest
F

Joined: Aug 2017
Posts: 3
That works! Thank you very much!


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1