Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 13:53
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (Quad), 6,361 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
error wrong type; sub pointer #452509
06/15/15 05:23
06/15/15 05:23
Joined: Jun 2015
Posts: 1
Adelaide, Australia
S
screentrader Offline OP
Guest
screentrader  Offline OP
Guest
S

Joined: Jun 2015
Posts: 1
Adelaide, Australia
Hi folks after many many hours and days of reading and trying i'm asking for some help. this is my first attempt at a code so go easy.
I get the error wrong type message. i have ceaselessly tried what am i missing
in line 19, i cannot get past it. range= ( Trendhigh - Trendlow);
if it seems poor, remember i'm trying hard this end.
I appreciate your constructive input.

function run()
{
BarPeriod = 60;
Weekend = 0;
Lots = 10;
set(LOGFILE);

vars Price = series(price());
vars Pricelow = series(priceLow());
vars Trendlow = series(LowPass(priceLow,8));
vars Pricehigh = series(priceHigh());
vars Trendhigh = series(LowPass(priceHigh,8));

vars range(vars Trendhigh,vars Trendlow) ;

range =(Trendhigh - Trendlow);


var breakout = ((range * 10)/100);


//printf("Result = %.f",range);

if(Price< (Trendlow - breakout))
enterShort();
else Stop = 2*ATR(20);
exitShort(Price < (Trendlow - range));


if(Price > Trendhigh + breakout )
enterLong();
else Stop = 2*ATR(20);
exitLong( Price > Trendhigh + range);

}

Re: error wrong type; sub pointer [Re: screentrader] #452513
06/15/15 07:56
06/15/15 07:56
Joined: Jul 2000
Posts: 28,051
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,051
Frankfurt
I have marked red what's wrong in the code - like confusing a variable with a series, a line that makes no sense, and missing brackets after the else keyword.

function run()
{
BarPeriod = 60;
Weekend = 0;
Lots = 10;
set(LOGFILE);

vars Price = series(price());
vars Pricelow = series(priceLow());
vars Trendlow = series(LowPass(priceLow,8));
vars Pricehigh = series(priceHigh());
vars Trendhigh = series(LowPass(priceHigh,8));

vars range(vars Trendhigh,vars Trendlow) ;

range =(Trendhigh - Trendlow);


var breakout = ((range * 10)/100);


//printf("Result = %.f",range);

if(Price< (Trendlow - breakout))
enterShort();
else Stop = 2*ATR(20);
exitShort(Price < (Trendlow - range));


if(Price > Trendhigh + breakout )
enterLong();
else Stop = 2*ATR(20);
exitLong( Price > Trendhigh + range);

}


Moderated by  Petra 

Gamestudio download | 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