Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,029 guests, and 6 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
andrew oliveira - supertrend #456421
11/22/15 11:41
11/22/15 11:41
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 dont know if some of you is familiar with that indicador.
Does it work for you?
Can you post the script here?

I dont want to spend time coding it or playing with it if someone already tried to and it is workless.

Re: andrew oliveira - supertrend [Re: nanotir] #456956
12/17/15 03:10
12/17/15 03:10
Joined: Mar 2015
Posts: 336
Rogaland
N
nanotir Offline OP
Senior Member
nanotir  Offline OP
Senior Member
N

Joined: Mar 2015
Posts: 336
Rogaland
well... here is the code for it

Quote:
function run()
{
set(PLOTNOW);

StartDate = 20150101;
LookBack = 500;
BarPeriod = 30;
NumYears = 1;


PlotBars = 1000;

vars Price= series(price());

int factor =3;
int Period = 10;

TimeFrame = 1;

vars UpBand = series();
vars DnBand = series();
UpBand[0] = (priceHigh()+priceLow())/2 + factor*ATR(Period);
DnBand[0] = (priceHigh()+priceLow())/2 - factor*ATR(Period);

vars ST = series();
ST[0] = 0;

vars Direction = series();
Direction[0] = 1;//just to initialize

vars PriceC = series(priceClose());

// Begin Direction calculation
if ( PriceC[0] > UpBand[1] )
Direction[0] = 1;
else
if ( PriceC[0] < DnBand[1] )
Direction[0] = -1;
else
Direction[0] = Direction[1];
// End Direction calculation

// Begin SuperTrend calculation
if ( Direction[0] == 1 )
{
if ( DnBand[1] > DnBand[0] )
DnBand[0] = DnBand[1];

ST[0] = DnBand[0];
plot("ST",ST[0],0,GREEN);

}
else
if ( Direction[0] == -1 )
{
if ( UpBand[1] < UpBand[0] )
UpBand[0] = UpBand[1];

ST[0] = UpBand[0];
plot("ST2",ST[0],0,RED);
}
// End SuperTrend calculation


plot("ST3",ST[0],0,DARKGREEN);


}

Re: andrew oliveira - supertrend [Re: nanotir] #463625
12/18/16 01:10
12/18/16 01:10
Joined: Nov 2016
Posts: 5
M
mey Offline
Newbie
mey  Offline
Newbie
M

Joined: Nov 2016
Posts: 5
Hi Nanitek,

thanks a lot for sharing this code.
I would like to use it in function run() by call-by reference function call and also plot it from here.
But I fail miserably to declare the function.
The handing-over parameters from new function “Supertrend” should be “ST and color flag”.
In function run() I only receive the data by the call and I don’t know how the statement should like like, I always receive pointer errors.

function definition:
var Supertrend (vars ST, vars color)

call function in function run():
vars Super = series();
vars ST = series();
vars Color = series();
ST = series(Supertrend(Super[0]),Color());


Trading conditions (simplified):
if (priceClose() > ST)
enterLong();
else
enterShort();

Can you or somebody else help me as lite-C beginner?

Thanks again in advance.


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