Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Ayumi, howardR), 505 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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