Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (howardR, sleakz), 706 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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