Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (wandaluciaia, AndrewAMD, 1 invisible), 765 guests, and 6 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
Page 1 of 2 1 2
Delay in script execution #475043
11/20/18 11:20
11/20/18 11:20
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
i have an issue i would like to be clarified with, i have for example a script on SMA but whenever a cross happens between the MAs Zorro delays to enter or close trade with several hours, im using mt4 platform so i can clearly monitor when the crosses happen. How can i solve this such that zorro responds immediately as per trading script when trading rules are met.

Re: Delay in script execution [Re: MINER] #475049
11/20/18 12:45
11/20/18 12:45
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Do you mean **before** you have a fully-formed bar? If so, you can use tick() instead of run(). You will need to calculate the unfinished indicator outputs.

I should note: MQL's first fully formed bar is bar [1], whereas Zorro's first fully formed bar is bar [0].

Quote:
Zorro delays to enter or close trade with several hours
Just to confirm, what bar period are you using?

Re: Delay in script execution [Re: AndrewAMD] #475054
11/20/18 16:20
11/20/18 16:20
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
Post code 😀

Re: Delay in script execution [Re: Dalla] #475063
11/21/18 08:48
11/21/18 08:48
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
This is the code and below is an attachment of mt4 chart indicating the recent trades executed by the same script, Note that the recent trades were not triggered by a cross of the SMAs but something else im not sure of. Kindly assist me perfect this.....
function run()
{


StartDate = 2005;
BarPeriod = 60;
Lots = 30;
MaxLong = 1;
MaxShort = 1;
//EntryTime =

vars Close = series(priceClose());
vars SMAFast = series(SMA(Close, 5));
vars SMASlow = series(SMA(Close, 15));


if(crossOver(SMAFast, SMASlow))
enterLong();

else if(crossUnder(SMAFast, SMASlow))
enterShort();

Stop = 5 * ATR(100);
Trail = 4*ATR(100);

for(open_trades)
if(TradeIsOpen && !TradeIsPool && TradeProfit > 0) {
TradeTrailLock = 0.80; // 80% profit (minus trade costs)
if(TradeIsShort)
TradeTrailLimit = max(TradeTrailLimit,TradePriceClose);
else
TradeTrailLimit = min(TradeTrailLimit,TradePriceClose);
}



}

Re: Delay in script execution [Re: MINER] #475064
11/21/18 09:23
11/21/18 09:23
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
The below attachment is the exact mt4 chart the script is trading on, the white lines cutting across the chart indicate entry and closure of trades which is not happening as soon as the crossovers and crossunders happen, the most recent trades entered by the script are the blue dotted line which indicates a buy trade and ended up losing, what triggered this trade......the next red dotted line indicates a sell trade and still ended up losing, again what triggered this trade? ....after 050:00 there was another buy trade entered by the script and so far is a losing trade as you can see in the chart & still i can't figure out what triggered it since no cross happened....help me solve this please.

Attached Files chart 2.PNG
Re: Delay in script execution [Re: MINER] #475066
11/21/18 10:06
11/21/18 10:06
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Hi,
in order to investigate this I recommend to print the value of the 2 sma right before entering the trade.
On top of this I guess you have to set Stop and Trail before entering the trade if you want set them in the proper way. HtH
Ciao

Re: Delay in script execution [Re: MatPed] #475067
11/21/18 10:33
11/21/18 10:33
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
Thank you Matped, do you mean the price values?....if not please kindly elaborate on printing the values of 2 sma right before entering the trade ......

Re: Delay in script execution [Re: MINER] #475068
11/21/18 10:42
11/21/18 10:42
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Yes value of price, and of the 2 before enterLong and enterShort command

Re: Delay in script execution [Re: MatPed] #475069
11/21/18 10:52
11/21/18 10:52
Joined: Apr 2018
Posts: 46
M
MINER Offline OP
Newbie
MINER  Offline OP
Newbie
M

Joined: Apr 2018
Posts: 46
Thank you again MatPed.....then im going to wait and capture the values on next trade.....or is there a way i can do this in the script?

Re: Delay in script execution [Re: MINER] #475070
11/21/18 11:05
11/21/18 11:05
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
use printf in the script. you need to capture it from the Zorro script and compare it with the value you see in MT4.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1