Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
Deeplearning Script
by wolfi. 02/26/24 12:46
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/22/24 16:22
AssetAdd() vs. modern asset list?
by jcl. 02/21/24 15:01
How many still using A8
by Aku_Aku. 02/20/24 12:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 526 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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

Chief Engineer
jcl  Offline

Chief Engineer

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