Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (7th_zorro, Aku_Aku, VoroneTZ, 11honza11, ricky_k, Nymphodora), 427 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Manual intervention on MT5 #486768
10/04/22 07:16
10/04/22 07:16
Joined: Sep 2022
Posts: 8
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 8
Hout Bay
Hi

I use Zorro code to help with discretionary trading on a MT5 platform. It enters a trade under certain conditions and places a stop after which I manage the trade manually in MT5.
If I close the trade myself in MT5 Zorro states 'can't close at attempt x'. The MT5 experts log states 'Trade x not found..'.

It is a NON NFA compliant account, TICKS is set and Hedge=1. Using Zorro S.

It seems I must use cancelTrade() ?. The manual states ‘useful for removing an externally closed position that was not transmitted to Zorro..’

Must cancelTrade() be used in an enumeration loop within a TMF?
What condition/code is used to establish whether the trade has been closed externally?

Zorro does also not recognize if I move the stop myself in MT5. How does one code this?

Thanks..



Last edited by jacqu; 10/04/22 07:47.
Re: Manual intervention on MT5 [Re: jacqu] #486769
10/04/22 12:53
10/04/22 12:53
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
If you move the stop in MT5, Zorro should not manage it at all. Otherwise both stops will interfere.

MT4 reports back to Zorro when a trade was manually closed, but not MT5. If Zorro is only used for opening the trade, but not for managing it, simply call cancelTrade directly after opening it.

TRADE* Trade = enterLong();
if(Trade) cancelTrade(Trade);

Re: Manual intervention on MT5 [Re: jacqu] #486771
10/04/22 14:11
10/04/22 14:11
Joined: Sep 2022
Posts: 8
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 8
Hout Bay
Many thanks JCL...

Re: Manual intervention on MT5 [Re: jacqu] #486778
10/06/22 06:16
10/06/22 06:16
Joined: Sep 2022
Posts: 8
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 8
Hout Bay

I still need Zorro to manage trades up to the point that I decide to close a trade.

If MT5 does not report back to Zorro about a closed trade is there some functionality or condition/code that can be used in Zorro to establish this?

Thanks..

Re: Manual intervention on MT5 [Re: jacqu] #486780
10/06/22 08:59
10/06/22 08:59
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
You can use for(closed_trades) or one of the other loops, see https://zorro-project.com/manual/en/fortrades.htm (examples below)

Re: Manual intervention on MT5 [Re: jacqu] #486783
10/06/22 14:53
10/06/22 14:53
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
You could theoretically evaluate some trade variable, like the TradeProfit, and if it does not change over a certain time during market hours, assume that the trade was closed. But that would be a wobbly solution and I do not recommend it.

It is possible to let MT5 report a closed trade. But it requires more complex code than with MT4, which is one of the many reasons why all prefer MT4 over MT5. We had not implemented this because the demand did not come up yet. But I'll see if we can implement it in one of the next Zorro versions. Until then, your best solution is probably a script function that callis cancelTrade on a button click with a user panel.

Re: Manual intervention on MT5 [Re: jacqu] #486788
10/07/22 08:55
10/07/22 08:55
Joined: Sep 2022
Posts: 8
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 8
Hout Bay
Thanks Grant & JCL for the feedback, much appreciated.

The main reason for using MT4 vs MT5 are the different timeframes outside of the 1H and 4H which MT5 offer; they work better as triggers under certain conditions/indicators and from a semi automated/discretionary trading perspective one needs the 'visual confirmation' on a similar timeframe as your code to know that things are going according to plan.

I see there are ways to implement alternative timeframes in MT4, don't know how successful they are; will look into it and if OK will then rather use MT4.

JCL if I understand you correctly a 'for(closed_trades) loop or for that matter no existing Zorro conditional code will work without having received the external trigger of a manually closed trade from MT5?

Look forward to having the functionality in MT5.

Thanks again..


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1