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

AllPairTradeManager(APTM)
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3482
Page 57 of 65
Author:  SteveHopwood [ Tue Oct 24, 2017 11:41 pm ]
Post subject:  AllPairTradeManager(APTM)

macman » Tue Oct 24, 2017 8:30 pm wrote: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:



Best regards,
macman
macman, you were once a highly respected member here. Your silence for these last years means that few others will remember you.

We saw your initial post about this. We ignored it. Now you see fit to post it a second time. We shall continue to ignore it.

People earn the right to make requests of SHF coders by contributing in the first place. You are not a contributor and so do not have the right to make coding requests. Feel free to contact coders privately with an offer to pay for their services. That is entirely between you and them.

In this public forum, stop now, or I will stop you permanently.
Author:  hochiphu [ Mon Dec 04, 2017 10:08 pm ]
Post subject:  AllPairTradeManager(APTM)

Hi Milanese,
Firstly, I want to say "thank you" to what you dedicated to our forum by coding this impressive EA.
I have concept that will move stop loss to Break Even every 10pips but my broker I am using they limit stop loss must be bigger than spread (EX: >spread 20) ----- I tried APTM EA and every time price reach 10pips profit and move stop loss (alarm appear) . So except change new broker, how we automatically move BE ???

Thanks a lot.
Author:  SteveHopwood [ Tue Dec 05, 2017 12:31 am ]
Post subject:  AllPairTradeManager(APTM)

hochiphu » Mon Dec 04, 2017 10:08 pm wrote:Hi Milanese,
Firstly, I want to say "thank you" to what you dedicated to our forum by coding this impressive EA.
I have concept that will move stop loss to Break Even every 10pips but my broker I am using they limit stop loss must be bigger than spread (EX: >spread 20) ----- I tried APTM EA and every time price reach 10pips profit and move stop loss (alarm appear) . So except change new broker, how we automatically move BE ???

Thanks a lot.
milanese is busy for a couple of days and may not be able to reply immediately. I will step in temporarily.

Change your broker. Move to Global Prime if you possibly can. If not, find a criminal that will at least not hit you with such ludicrously large threads.

Do not expect coders here at SHF to try to accommodate members being ripped off by the more ridiculous of the criminals out there; it will not happen.

:xm:
Author:  hochiphu [ Tue Dec 05, 2017 4:56 am ]
Post subject:  AllPairTradeManager(APTM)

Thanks Steve, maybe after withdrawing next month I will head to Global Prime as a new choice
:good:
Author:  dclayw [ Tue Jan 09, 2018 12:06 am ]
Post subject:  AllPairTradeManager(APTM)

Happy new year to all :party:

After restarting my tests after xmas break I noticed (after a couple of days) that APTM wasn't working on one of my tests. The timers on APTM status display weren't updating and it didn't pick up any of the open trades.

Journal showed this:
untitled.PNG
Anyone seen that before? Not a major issue because it appeared to happen at startup, just had to reload the EA. Would be more of a problem if it happened randomly.
Author:  global [ Tue Jan 09, 2018 12:59 am ]
Post subject:  AllPairTradeManager(APTM)

Here is what I did to work around the unable to set timer problem. Just add the code below to the end of the int OnInit() initialization section of the APTM code just before the return(INIT_SUCCEEDED) line, then recompile:

Code: Select all

//Add this to solve the "cannot set millisecond timer" error
//as explained here:
//https://www.mql5.com/ru/forum/166358/page3
//Translation here: 
//https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=https%3A%2F%2Fwww.mql5.com%2Fru%2Fforum%2F166358%2Fpage4%23comment_4064647&edit-text=&act=url
//and here:
//https://www.mql5.com/ru/forum/167394
//Translation here: 
//https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=https%3A%2F%2Fwww.mql5.com%2Fru%2Fforum%2F167394&edit-text=&act=url

//EventSetMillisecondTimer(checkMilliSeconds);
//EventSetTimer(1);
   int error=-1;
   int counter=1;
   int maxattempts=15;
   do
     {
      ResetLastError();
      EventSetMillisecondTimer(checkMilliSeconds);
      error=GetLastError();
      Print(" EventSetMillisecondTimer . Attempt: ",counter," Error: ",error);
      if(error!=0) Sleep(1000);
      counter++;
     }
   while(error!=0 && !IsStopped() && counter<=maxattempts);

   if(counter>maxattempts) Alert("APTM"+": Exceeded max attempts to set millisecond timer. EA cannot run properly. Please try again!");
   OnTimer();
This code will try to set the timer up to 15 times until it succeeds, otherwise it will display an alert message. In my experience it usually succeed before 4 attempts.
Author:  milanese [ Tue Jan 09, 2018 6:25 am ]
Post subject:  [update]AllPairTradeManager(APTM)

update version 2.52 January 9th,2018
work around to the "unable to set timer problem" thanks to Global :clap:, to be found at first post attached like always a big thanks to Global

Cheers :)

Tommaso
Author:  dclayw [ Tue Jan 09, 2018 6:43 am ]
Post subject:  AllPairTradeManager(APTM)

Thanks milanese for incorporating that work around into APTM, and thanks to Global for supplying it :hi:
Author:  dclayw [ Wed Jan 24, 2018 2:35 am ]
Post subject:  AllPairTradeManager(APTM)

Hi @milanese,
I've a question in relation to trading baskets with APTM.

In some situations when a basket closes I may want to immediately re-open some trades that were just closed. Is it possible that these new trades could actually be captured by the basket? I think not because OrdersTotal () should pick up just those trades that were in the basket.

I thought about introducing a delay before re-opening those trades, e.g. MinMinutesBetweenTrades=1, but I don't think really necessary.

Thanks
Author:  milanese [ Wed Jan 24, 2018 8:52 am ]
Post subject:  AllPairTradeManager(APTM)

dclayw » Wed Jan 24, 2018 2:35 am wrote:Hi @milanese,
I've a question in relation to trading baskets with APTM.

In some situations when a basket closes I may want to immediately re-open some trades that were just closed. Is it possible that these new trades could actually be captured by the basket? I think not because OrdersTotal () should pick up just those trades that were in the basket.

I thought about introducing a delay before re-opening those trades, e.g. MinMinutesBetweenTrades=1, but I don't think really necessary.

Thanks
Your EA should have such a feature, as there are often delays in closing and APTM has so itself some waiting time to make sure that really all is closed, fast reopening is not supported.

Cheers :)

Tommaso
All times are UTC Page 57 of 65