Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
7 registered members (EternallyCurious, 7th_zorro, Ayumi, Quad, AndrewAMD, ricky_k, 1 invisible), 497 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with plotbar #459202
04/26/16 17:04
04/26/16 17:04
Joined: Mar 2015
Posts: 336
Rogaland
N
nanotir Offline OP
Senior Member
nanotir  Offline OP
Senior Member
N

Joined: Mar 2015
Posts: 336
Rogaland
Hi

I cannot find out why this script works for XAGUSD but not for GBPUSD

Some ideas?

Quote:
//#define GBP
#define XAG


function run()
{
set(PLOTNOW+TESTNOW);
set(TICKS);


BarPeriod = 1440;

StartDate = 2010;
EndDate = 2016;

PlotScale = 40;

PlotWidth = 800;
PlotHeight1 = 320;

vars PriceC = series(priceClose());
static var High, Low;
static var ArrayPrice[1000];
int i;

#ifdef XAG
asset("XAG/USD");
var Low = 14.0;
var high = 50;
var grid = 1;
#endif

#ifdef GBP
asset("GBP/USD");
var Low = 1.000;
var high = 1.800;
var grid = 0.010;
#endif


int divi = (high-Low)/grid;


ArrayPrice[0]=Low;
for(i=1;i<divi;i++)
{
ArrayPrice[i]=ArrayPrice[i-1]+grid;
plot(strf("#NT%i",i),ArrayPrice[i],0,BLUE);
}

int c;
var a;
static var Counter[1000];

for(i=0;i<divi;i++)
{
if(PriceC[0]>=ArrayPrice[i] and PriceC[0]<ArrayPrice[i+1])
{
Counter[i]=Counter[i]+1;
c = Counter[i];
a = ArrayPrice[i];
plotBar("Spectrum",a,a,c,BARS+AVG+LBL2,RED);
}
}



}

Last edited by Nanitek; 04/26/16 17:04.
Re: Problem with plotbar [Re: nanotir] #459208
04/27/16 08:43
04/27/16 08:43
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
You're plotting all GBP prices to the same bar number 1. Multiply the bar number, the first "a" in your call, with 100 to distribute the histogram on 100 different bars.

Re: Problem with plotbar [Re: jcl] #459214
04/27/16 11:18
04/27/16 11:18
Joined: Mar 2015
Posts: 336
Rogaland
N
nanotir Offline OP
Senior Member
nanotir  Offline OP
Senior Member
N

Joined: Mar 2015
Posts: 336
Rogaland
Thanks!
I see now that tt worked for XAG because a>1 in that case.

Btw...I am trying to export the counter array of the script using the print function with the TO_CSV option but I cant make it to work. Some ideas? Thanks

Re: Problem with plotbar [Re: nanotir] #459229
04/29/16 11:58
04/29/16 11:58
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Any print(TO_CSV,..) call just prints the resulting string in the CSV file. So you just have to pass a format string containing the counter number in the proper .csv format that you need.


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