Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
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
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,238 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Trading via MT4 Bridge - Errors #445897
09/29/14 08:54
09/29/14 08:54
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Hello, I am getting some errors in live trading that I don't get in Zorro's backtest. I think it must be something to do with Zorro's interaction with the broker, but I hope that someone can shed some light on what's going on.

I have a strategy that performs reasonably well in backtesting, but when I trade it via Zorro's MT4 bridge, some of the exits are not honoured. I am using a Stop and Trail condition, and I am also using the exitLong and exitShort functions to exit a trade when a crossOver/crossUnder condition is met.

The Stop and Trail functions work fine in both testing and live trading, however the exitLong/Short functions behave differently in testing and trading. I get the following general error in Zorro's message window, and the log file:
[EUR/USD <trade ID>] can't close x@price at time
I also get error messages in MT4's 'Experts' tab.

As a specific example, at time 08:35, I get the following messages in MT4's 'Experts' tab:
Zorro EURUSDpro,H4: Close[EURUSDpro:S87]-0.01@1.2688
Zorro EURUSDpro,H4: invalid lots number for OrderClose function
Zorro EURUSDpro,H4: close@1.2688 failed - invalid function parameter value

Here are the messages from Zorro's log file from the same time:

[Mon 29.09. 08:30] 5124 -302 +7 !
[Mon 29.09. 08:35] 5124 -302 +6 !
[EUR/USD::S0087] Can't close 1@1.2688 at 08:35


This is the code that uses the exitLong/Short condition:


if (NumWinningLong > 0 and crossUnder(SmoothPrice, Decycler))
exitLong();
if (NumWinningShort > 0 and crossOver(SmoothPrice, Decycler))
exitShort();

I'm not sure, but it seems to me that Zorro is trying to exit the trade at a certain price when the exitLong/Short condition is met. My intention is to exit the trade at market when this condition is met, hence the omission of any parameters inside the exitLong/Short function. From the manual:

'Optional parameters can be omitted. F.i. exitLong() exits all long positions with the current asset and algorithm identifier at market."

I get the feeling that I am missing something important here. Can anyone suggest a solution or point me in the right direction?

Thanks in advance.

Re: Trading via MT4 Bridge - Errors [Re: boatman] #445899
09/29/14 10:32
09/29/14 10:32
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You can see the problem in the error message: Your script closes a negative number of lots. Because you can not close negative lots, you'll get an error message.

Negative lots are either caused by a bug in the script or a wrong parameter stored in Assets.dta. For finding out what it is, just run the Tradetest script with the same asset on a demo account - if that works fine, it's something in your script.

Re: Trading via MT4 Bridge - Errors [Re: jcl] #445923
09/30/14 07:39
09/30/14 07:39
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Thanks for that response, jcl. I tried what you suggested and get the same error messages when using the Tradetest script on a demo account. I can't see anything that looks out of place in my Assets.dta file. Also, it updates when I connect to MT4 via the bridge.

Would you mind taking a look at my Assets.dta file? Here is the contents of the file (FYI my strategy trades XAU/USD, EUR/USD and USD/JPY):

Name Price Spread RollLong/Short PIP PIPCost Margin Lot
AUD/USD 0.93521 0.00015 5.9670 -7.6460 0.0001 0.10694 10.000 1000.0
EUR/CHF 1.21409 0.00015 -0.1310 -2.0960 0.0001 0.11912 14.460 1000.0
EUR/USD 1.35232 0.00010 0.0960 -0.1180 0.0001 0.10694 14.460 1000.0
GBP/USD 1.70986 0.00014 1.2510 1.5290 0.0001 0.10694 18.284 1000.0
GER30 9701.50 1.50000 0.0000 0.0000 0.0100 0.50000 140.290 1.0
NAS100 3876.25 4.0000 0.0000 0.0000 0.0100 0.25000 207.260 5.0
SPX500 1951.50 0.50000 0.0000 0.0000 0.0100 0.25000 208.680 10.0
UK100 6567.00 2.0000 -0.0756 0.0000 1.0000 0.11949 6.000 0.1
US30 16916.00 5.0000 0.0000 0.0000 0.1000 1.00000 180.890 1.0
USD/CAD 1.07572 0.00017 -3.2810 2.1480 0.0001 0.09942 10.694 1000.0
USD/CHF 0.89780 0.00012 -0.1310 -1.4410 0.0001 0.11913 10.694 1000.0
USD/JPY 101.404 0.01100 0.2850 -0.8120 0.0100 0.10548 10.694 1000.0
USOil 98.030 0.08000 0.0000 0.0000 0.0100 0.07182 14.000 10.0
XAG/USD 21.130 0.03000 -1.7200 0.1300 0.0100 0.53475 11.299 50.0
XAU/USD 1221.46 0.20000 -1.6100 0.2700 0.0100 0.01070 14.071 1.0

Re: Trading via MT4 Bridge - Errors [Re: boatman] #445928
09/30/14 08:24
09/30/14 08:24
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The Assets.dta file also looks fine to me. Those parameters won't produce a negative lot number. Hmm. Can you contact Support? They'll have to open a demo account with your broker and check MT4 trading.

Re: Trading via MT4 Bridge - Errors [Re: jcl] #445942
09/30/14 13:06
09/30/14 13:06
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
OK, will do. I'll post back here when the issue is resolved.

One thing I neglected to mention is that I get the same behavior using two different brokers - Think Forex and Global Prime (both accounts opened in Australia).


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1