AllPairTradeManager(APTM)

MPTM's new home
Post Reply
global
Trader
Posts: 67
Joined: Wed Aug 15, 2012 2:16 am

AllPairTradeManager(APTM)

Post by global »

Hi Milanese,

I didn't visit this thread for awhile until today and I'm amazed at all the improvements to APTM. I like how efficiently it manages all pairs. APTM is awesome, it looks like it has almost everything a trader needs for trade management.

However, I hope you can consider adding one more feature. Here it is: I always set an initial stop loss and take profit with a separate order entry script so that if I lose connection or my computer crashes I would still have a SL and TP on my broker's trading server. I see that APTM doesn't interfere with a TP that is already set but I would like keep my TP in place ONLY until the price reaches x amount of pips from my TP, then remove my TP and let my profits run with a trailing or jumping stop of y number of pips. Doesn't make sense leaving pips on the table with a fixed TP. If you have the time, can you add this feature? Thanks for making APTM available to us.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

AllPairTradeManager(APTM)

Post by milanese »

global » Tue Aug 04, 2015 7:34 pm wrote:Hi Milanese,

I didn't visit this thread for awhile until today and I'm amazed at all the improvements to APTM. I like how efficiently it manages all pairs. APTM is awesome, it looks like it has almost everything a trader needs for trade management.

However, I hope you can consider adding one more feature. Here it is: I always set an initial stop loss and take profit with a separate order entry script so that if I lose connection or my computer crashes I would still have a SL and TP on my broker's trading server. I see that APTM doesn't interfere with a TP that is already set but I would like keep my TP in place ONLY until the price reaches x amount of pips from my TP, then remove my TP and let my profits run with a trailing or jumping stop of y number of pips. Doesn't make sense leaving pips on the table with a fixed TP. If you have the time, can you add this feature? Thanks for making APTM available to us.
I will, when I find some spare time add this feature, as it sounds interesting.., my problem is always only to find some time..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
global
Trader
Posts: 67
Joined: Wed Aug 15, 2012 2:16 am

AllPairTradeManager(APTM)

Post by global »

I'm glad that you find the idea interesting. Actually I was trying to implement it to my MPTM_Global but when the price reaches x number of pips from the TP and the TP is removed, I had to find a way for the EA not to try to reinstate the missing TP even if the Add missing TP feature was turned on. Also, after the TP is removed, even if Empty4 is restarted automatically to re-establish a connection, for example by FX Blue's Auto-Restart app, or if the EA is for any reason removed and restarted, then it should still not try to reinstate the missing TP once it was already removed by the price reaching x number of pips from the TP, even though the Add missing TP feature is turned on. One way to do that is for the EA to use a trader selected fixed pip value or an ATR% value for the "Add missing TP" value and check the OrderOpenPrice() against that value to see if the missing TP should be added or if the price has already reached x pips from the selected TP value that is now missing, then the "Let Profits Run" feature will take over. I was trying to work all this out with MPTM_Global but like you, I just didn't find the extra time to finish it.

So since you like the "Let Profits Run" idea, here is the full description. I haven't spent much time fully understanding your APTM so maybe it already has some of what I'm about to describe. If it does, then forgive me for that. Nevertheless, here is the full description of that feature. It should allow a trader to enter a fixed number of pips for a Trailing/Jumping stop that s/he has the option to activate as soon as the trade is in profit or only after Breakeven, with or without some added Breakeven Profit pips. The Breakeven can be set based on a percentage of the TP or ATR. Then what I described in my previous message applies, i.e., when the price reaches x pips before the TP, then the TP is removed and the trailing/jumping stop continues to let the profits run as far as it goes until it is stopped out by a price reversal. Now, it would be nice to have the option to use a different trailing/jumping stop value than the initial value once the TP has been removed.

Here is another feature that can be added: The ability to close trades based on the cross of two Moving Averages. For example, just suppose you want to close all Buy trades when the 2 period MA crosses below the 5 period MA and to close a Sell trade when the 2 period MA crosses above the 5 period MA, then it would be nice if the trader can have the option to set all the parameters, including the time frame, on these two MAs to whatever s/he wants so that it will make sense depending on whether he or she is trading the higher or lower time frames.

I hope you can find the time some day to add these features. Well that's all for now and thanks again for making APTM available. I'm convinced that with all these features, APTM will soon be the best Trade Manager on this planet. :)
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

[update]AllPairTradeManager(APTM)

Post by milanese »

update version 2.30
aug 5th 2015

Global asked for a new function, that will remove the TP, if the trade is x pips distante from TP and the SL is already set in win. You will find this new settings:

Code: Select all

extern string bejsSet2="---Note Tp will only be removed if SL is in win----";
extern bool    useRemoveTPifPriceIsNearTP=false;//set this to true to use the new function
extern double  RemoveTPdistanceToTPpips=25;// here enter your wished distance that will delete the TP
Note APTM will recognize that it has removed the TP and will not oevveride the deleted TP, if SetInitialTakeProfit is set to true.
Note you can use them too for only one pair or only one magicnumber or only a specific order comment, if you have preselected that APTM should not manage all open trades on the account.
Note: It is not allowed to publish this EA outside of this SHF board!!

As always go to the first post to download the new version, newbee's here, please read the entire first post, before asking questions, try to test out different setting on a demo account to get familar with the functions, if you have after that all some questions, you are welcome to do them here in the thread.

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

AllPairTradeManager(APTM)

Post by taipan »

Milanese,

I have experienced these errors when tried to load the latest APTM in my expert log:

3 19:15:56.055 Cannot load 'C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\5012C1436437569D68E4E14CFBDAFCB0\MQL4\Libraries\user32.dll' [193]
1 19:15:56.055 Cannot call 'user32.dll::GetAncestor', 'user32.dll' is not loaded
1 19:15:56.055 unresolved import function call
3 19:15:56.055 milaneseAPTM_230 AUDNZD,H1: not initialized
0 19:15:56.055 milaneseAPTM_230 AUDNZD,H1: uninit reason 8
0 19:15:56.056 Expert milaneseAPTM_230 AUDNZD,H1: removed


I have checked my libraries folder and confirmed that user32.dll is available. I am using GP Empty4 build 840 platform.

Thanks for the great effort for writing this EA for free.
global
Trader
Posts: 67
Joined: Wed Aug 15, 2012 2:16 am

AllPairTradeManager(APTM)

Post by global »

Oh Wow Tommaso :) Thanks for adding the new feature, that was really fast. I'll test it today.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

AllPairTradeManager(APTM)

Post by milanese »

taipan » Wed Aug 05, 2015 11:20 am wrote:Milanese,

I have experienced these errors when tried to load the latest APTM in my expert log:

3 19:15:56.055 Cannot load 'C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\5012C1436437569D68E4E14CFBDAFCB0\MQL4\Libraries\user32.dll' [193]
1 19:15:56.055 Cannot call 'user32.dll::GetAncestor', 'user32.dll' is not loaded
1 19:15:56.055 unresolved import function call
3 19:15:56.055 milaneseAPTM_230 AUDNZD,H1: not initialized
0 19:15:56.055 milaneseAPTM_230 AUDNZD,H1: uninit reason 8
0 19:15:56.056 Expert milaneseAPTM_230 AUDNZD,H1: removed


I have checked my libraries folder and confirmed that user32.dll is available. I am using GP Empty4 build 840 platform.

Thanks for the great effort for writing this EA for free.
try to restart the platform, normaly this should resolve the problem, if you have the user32.dll disponible..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

AllPairTradeManager(APTM)

Post by taipan »

milanese » Wed Aug 05, 2015 10:05 pm wrote: try to restart the platform, normaly this should resolve the problem, if you have the user32.dll disponible..

Cheers :)

Tommaso
I have restarted the platform several times and also copy other user32.dll to replace existing and still did not work.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

AllPairTradeManager(APTM)

Post by milanese »

taipan » Wed Aug 05, 2015 3:59 pm wrote:
milanese » Wed Aug 05, 2015 10:05 pm wrote: try to restart the platform, normaly this should resolve the problem, if you have the user32.dll disponible..

Cheers :)

Tommaso
I have restarted the platform several times and also copy other user32.dll to replace existing and still did not work.
I can only say here it works, as all previous versions without any problems, btw in this part of the code there are no changes made..
The ex4 is made with build840.

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
global
Trader
Posts: 67
Joined: Wed Aug 15, 2012 2:16 am

AllPairTradeManager(APTM)

Post by global »

Hi Milanese,

I tested APTM today and everything works perfectly. Thanks.

I hope you don't mind but I added the option to change the SLMinDistanceToPriceJS after the TP is removed because I like to reduce that distance when I'm letting my profits run. I added the option for the regular SL, ATR SL and the AccCurr SL. Below is the code I added to the remove TP options section.

AfterRTP means after Removing the TP.

Code: Select all

extern string bejsSet2="---Note Tp will only be removed if SL is in win----";
extern bool    useRemoveTPifPriceIsNearTP=true;
extern double  RemoveTPdistanceToTPpips=25;
extern double  SLMinDistanceToPriceJSafterRTP=20;
extern double  SLMinDistanceToPriceJSAccCurrAfterRTP=20;
extern double  atrMultiplicatorForSLMinDistanceToPriceJSafterRTP=1;
I also added the code below to the if(useRemoveTPifPriceIsNearTP==true) block of code for the options to work.

Code: Select all

      if(useRemoveTPifPriceIsNearTP==true)
        {
         if(OrderType()==OP_BUY && OrderStopLoss()>OrderOpenPrice() && ask>(OrderTakeProfit()-RemoveTPdistanceToTPpips/factor) && NormalizeDouble(OrderTakeProfit(),eDigits)!=0)
           {
            bool result=OrderModify(TicketNo,OrderOpenPrice(),OrderStopLoss(),0,OrderExpiration(),CLR_NONE);
            SLMinDistanceToPriceJS=SLMinDistanceToPriceJSafterRTP;
            SLMinDistanceToPriceJSAccCurr=SLMinDistanceToPriceJSAccCurrAfterRTP;
            atrMultiplicatorForSLMinDistanceToPriceJS=atrMultiplicatorForSLMinDistanceToPriceJSafterRTP;
           }
         if(OrderType()==OP_SELL && OrderStopLoss()<OrderOpenPrice() && bid<(OrderTakeProfit()+RemoveTPdistanceToTPpips/factor) && NormalizeDouble(OrderTakeProfit(),eDigits)!=0)
           {
            bool result=OrderModify(TicketNo,OrderOpenPrice(),OrderStopLoss(),0,OrderExpiration(),CLR_NONE);
            SLMinDistanceToPriceJS=SLMinDistanceToPriceJSafterRTP;
            SLMinDistanceToPriceJSAccCurr=SLMinDistanceToPriceJSAccCurrAfterRTP;
            atrMultiplicatorForSLMinDistanceToPriceJS=atrMultiplicatorForSLMinDistanceToPriceJSafterRTP;
           }
        }
I saw that you deactivate the UseMarginCalculatedSLTPBEJSValues option so I didn't interfere with that. I think I coded everything right, but if I didn't then could you please fix it. Also, if you like it and think it's useful, maybe you can add it to the program for everyone's benefit. Thanks again for a great trade manager. :good:
Post Reply

Return to “Utilities Indicators and Scripts”