stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

AllPairTradeManager(APTM)
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3482
Page 56 of 65
Author:  dclayw [ Wed Sep 20, 2017 5:34 am ]
Post subject:  AllPairTradeManager(APTM)

dclayw » Tue Aug 15, 2017 11:56 pm wrote: This is all running on demo. I've checked and re-checked the settings. There are no other time closings activated. The CloseFriday function is what is writing the journal entries for these closed trades, i.e.:

Print("APTM:CloseFriday:Close ",IntegerToString(ticket)," Succeeded !");

These are the entries in the journal in my screen shot. They were written on Monday at around 23.45 broker time.

I do not believe it is a problem with the EA or the EA settings. It's as if the time settings on my VPS have gone a little bit haywire, although they "look" right. The VPS was booted just prior to starting the tests at market open on Monday morning.

Just wondering if anyone had come across something similar in the past. The solution will be a simple one I'm sure, I'll come back when I find it.
I never got to the bottom of the problem described above. The behaviour was not consistent. For some reason (and only sometimes) the EA was closing my trades on Monday night, rather then Friday night.

Anyway, in the EA rather then using "if((DayOfWeek()==5)" I changed this to "if((TimeDayOfWeek(TimeCurrent())==5)". I did not do exhaustive testing but I have not seen the problem since.
Author:  milanese [ Wed Sep 20, 2017 6:27 am ]
Post subject:  AllPairTradeManager(APTM)

dclayw » Wed Sep 20, 2017 5:34 am wrote:
I never got to the bottom of the problem described above. The behaviour was not consistent. For some reason (and only sometimes) the EA was closing my trades on Monday night, rather then Friday night.

Anyway, in the EA rather then using "if((DayOfWeek()==5)" I changed this to "if((TimeDayOfWeek(TimeCurrent())==5)". I did not do exhaustive testing but I have not seen the problem since.
this is a tricky solution :clap: :clap:

Cheers :)

Tommaso
Author:  milanese [ Wed Sep 20, 2017 6:38 am ]
Post subject:  [update]AllPairTradeManager(APTM)

update version 2.50 September 20,2017
resolves the "Friday Close Problem" thanks to dclayw :clap: see http://www.stevehopwoodforex.com/phpBB3 ... 81#p156681
go to first post for downloading.

Cheers :)

Tommaso
Author:  sabbah [ Wed Sep 20, 2017 6:15 pm ]
Post subject:  AllPairTradeManager(APTM)

Trying to partial close 50% after 5pips and move the BE & SL then trailstop steps 2. This is the settings I'm using, but nothing is happening. What did I miss?
Author:  milanese [ Wed Sep 20, 2017 6:35 pm ]
Post subject:  AllPairTradeManager(APTM)

sabbah » Wed Sep 20, 2017 6:15 pm wrote:Trying to partial close 50% after 5pips and move the BE & SL then trailstop steps 2. This is the settings I'm using, but nothing is happening. What did I miss?
you should take a look what min distance to price you use and re-read first post and the parts of threads explaining these functions ..

Cheers :)

Tommaso
Author:  dclayw [ Fri Oct 20, 2017 8:04 am ]
Post subject:  [update]AllPairTradeManager(APTM)

milanese » Wed Sep 20, 2017 4:38 pm wrote:update version 2.50 September 20,2017
resolves the "Friday Close Problem" thanks to dclayw :clap: see http://www.stevehopwoodforex.com/phpBB3 ... 81#p156681
go to first post for downloading.

Cheers :)

Tommaso
Hi Tommaso,
I realised a while back that CloseFriday function doesn't delete pendings. The main idea behind closing on Fridays is to avoid weekend gaps, so it makes sense that pendings should be deleted by CloseFriday function.

I could probably add that in myself but I think it should be applied to the production version so that anyone who wants to close on Friday will have the pendings deleted as well.

David
Author:  milanese [ Fri Oct 20, 2017 11:45 am ]
Post subject:  [update]AllPairTradeManager(APTM)

dclayw » Fri Oct 20, 2017 8:04 am wrote: Hi Tommaso,
I realised a while back that CloseFriday function doesn't delete pendings. The main idea behind closing on Fridays is to avoid weekend gaps, so it makes sense that pendings should be deleted by CloseFriday function.

I could probably add that in myself but I think it should be applied to the production version so that anyone who wants to close on Friday will have the pendings deleted as well.

David
update version 2.51 October 20,2017
Close Friday and Defined TimeClose will now delete to all pending orders, as dclayw asked for this function.
As always update can be found on first post.

Cheers :)

Tommaso
Author:  dclayw [ Fri Oct 20, 2017 12:26 pm ]
Post subject:  [update]AllPairTradeManager(APTM)

milanese » Fri Oct 20, 2017 9:45 pm wrote: update version 2.51 October 20,2017
Close Friday and Defined TimeClose will now delete to all pending orders, as dclayw asked for this function.
As always update can be found on first post.

Cheers :)

Tommaso
Tommaso, Thanks for doing it and thanks for getting it done so quickly. :good:
Author:  jedrula [ Fri Oct 20, 2017 5:02 pm ]
Post subject:  [update]AllPairTradeManager(APTM)

milanese » 20 Oct 2017, 13:45 wrote:
dclayw » Fri Oct 20, 2017 8:04 am wrote: Hi Tommaso,
I realised a while back that CloseFriday function doesn't delete pendings. The main idea behind closing on Fridays is to avoid weekend gaps, so it makes sense that pendings should be deleted by CloseFriday function.

I could probably add that in myself but I think it should be applied to the production version so that anyone who wants to close on Friday will have the pendings deleted as well.

David
update version 2.51 October 20,2017
Close Friday and Defined TimeClose will now delete to all pending orders, as dclayw asked for this function.
As always update can be found on first post.

Cheers :)

Tommaso
Thank You :good:
Author:  macman [ Tue Oct 24, 2017 8:30 pm ]
Post subject:  AllPairTradeManager(APTM)

Hi Tommaso,

I recently posted asking if anyone knew of an EA which will zero hedge when a selected margin level is reached. So far no replies so I think maybe it does not exist and now I wonder if you might consider adding it as an option to your APTM.

As I am sure you know, brokers now regularly cut account leverage, often with little warning, so suddenly a 500:1 account can become a 50:1 account. A market movement against your open trades, which would be safe at 500:1, can bring a margin call at 50:1. There are even brokers who lower the leverage for the last hour of the week, making life difficult for any trader who wants to keep trades open during the weekend. I am also sure we will see more of this 'disappearing margin trick' in the future.

To protect against this, the routine would simply zero hedge the total position when account margin drops below the trigger level. This will also protect an account if there is a weekend gap, unlike a stop loss or pending order.

A zero hedge order could be given a 'ZH' comment, which would then allow APTM to control it using the existing managebyordercomment function.

The basic logic is here:
IMG_1568.JPG
Best regards,
macman
All times are UTC Page 56 of 65