Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 1 invisible), 643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Spread value conditional #469531
11/20/17 07:25
11/20/17 07:25
Joined: Nov 2017
Posts: 2
E
ech87 Offline OP
Guest
ech87  Offline OP
Guest
E

Joined: Nov 2017
Posts: 2
Hi There,

Im totally new to zorro and pretty bad at programming in general.

How can I create an on tick trade conditional that takes into account the spread.

For example i've tried:

function tick(){
if(Spread < 5){
[trading code goes here];
}
}

But when I try that with a simple long order, linked with and Mt4 account my orders go berserk and don't take into account the spread conditional at all?

Thanks!

Re: Spread value conditional [Re: ech87] #469534
11/20/17 07:42
11/20/17 07:42
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Look good, the spread condition look ok to me and certainly not like beginner.

But I know no stock where spread is 5, spread is normally 0.01 or 0.0005 or so. Maybe you mean 5 pips? Also you should have another condition aside from spread, or else your code will open 1000 trades very quick.

Re: Spread value conditional [Re: Spirit] #469536
11/20/17 07:58
11/20/17 07:58
Joined: Nov 2017
Posts: 2
E
ech87 Offline OP
Guest
ech87  Offline OP
Guest
E

Joined: Nov 2017
Posts: 2
Thanks Spirit, I had some basic JavaScript expxerience in the past blush

The code still buys like crazy on tick if I set the value to < 0

e.g:

function tick(){
if(Spread = 0){
enterLong();
}
}

I think it's buying on tick, because it seems irregular in it's buying - but still atleast 1 order a second which makes me think it's ignoring the Spread conditional?

Nvm, i figured it out! You were right, I was being dumb eek


Last edited by ech87; 11/20/17 08:40.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1