Gamestudio Links
Zorro Links
Newest Posts
'AssetFrameZone' undeclared identifier
by AndrewAMD. 12/09/22 13:40
How to combile shader FX?
by NicolaB. 12/08/22 08:18
Function refresh?
by Quad. 12/07/22 20:56
AUM Magazine
Latest Screens
DEAD TASTE
Tactics of World War I
Hecknex World
Scheherazade's Journey
Who's Online Now
3 registered members (NexusP47, PeroPero, Grant), 627 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
pythno, rxs, wezcam, juliastratos, DavidK
18872 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: 6
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 6
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,916
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,916
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: 6
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 6
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: 6
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 6
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: 231
Netherlands
G
Grant Online
Member
Grant  Online
Member
G

Joined: Aug 2017
Posts: 231
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,916
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,916
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: 6
Hout Bay
J
jacqu Offline OP
Newbie
jacqu  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 6
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