AllPairTradeManager(APTM)

MPTM's new home
Post Reply
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

AllPairTradeManager(APTM)

Post by milanese »

Hi,
feb. 2, 2015
This is the revised second version, adapted to all new build functionalities, more simple (I hope) to use and liberated from not very useful functions. For Basket management you find a separate EA there -->
http://www.stevehopwoodforex.com/phpBB3 ... =21&t=4081
I programmed this APTM for assisting and managing manual- and to trades from other EA's.
It is a multipair trademanager, just set the APTM on one chart and it will manage all open trades ,if you set TradeAllOpenPositions=true, setting this to false, you can enter a list of magic numbers and the APTM will only manage open trades with the specific magic numbers. The APTM can too exclude older trades from managing.
Set doNotManagePositionsOpenedBefore to true for using this functon
enter the date in Format YYYY.MM.DD with doNotDate
It is OOTB set to manage all trades. If you want to use it with with the ticket number setting isManageByTickeNumber=true TicketNumber here you must input your ticketnumber you wish to manage(after partclose the trademanager knows automatic the new one and will use this automatic)
Attention make sure you have set ManageAllOpenTrades to false if you want to use other management options, as ManageAllOpenTrades overwrites all other settings !!
You can too select new ManageByOrderComment and give an OrderComment CommentOfOrder
for orders you want to manage, too in this case the trade-manager will know after part close(s) what order to manage.
You can new as many wished in past, let the APTM manage the only position from the symbol the EA is attached at.
The new build uses the OnTimer function, set with checkSeconds the intervals the APTM uses for checking all open trades, note 0 will mean check every second.
Inputs for the jumping/trail stop function.
Use_SetBEAndJumpset this to true if you want to use the function
BEProfitPips added to OpenPrice for BE
JumpStepPips the SL will be moved with every trail step
SLMinDistanceToPricethis distance must the moved SL have to the actual price
MoveSLOnlyIfWin if set to true the SL will only be moved after the EA has set the BE and the position is in profit(this is OOTB and is same as prior version did use the JS).
PartCloseEnabled, if you set this to true and PartCloseWithBE is set to true and Use_SetBEAndJump is true, the EA will close the % you selected with PartClosePercent when setting the BE.
Too we have PartClose as First TP function. You can select this if you have PartCloseEnabled set to true and PartCloseAsFirstTP set true. PartCloseFirstTpPips set here the pips the order must be in win for the PartClose.
You have the possibility to deactivate all ATR inputs with one input this was asked from users for making the ATR functions more easy to handle DoNeverUseATR set this to true, and the EA will use all your manual inputs, if it is set to false, you can select which calculation you want done by ATR and for which you want to use your manual inputs.
As always ask, if you have problems to understand all functions..
update feb.04,2015
New user input showAlerts, set this to false and you will deactivate most alerts, note essential alerts , like autotrading disactivated ecc.. will be still shown, as they are there to advise you that the APTM will not work as intended..
update feb.05,2015
new input showDisplayBox=true if you set this to false, you see the user-display in the "old" way, without box and transparency, so you have now three possibilities:
-NewBoxDisplay Design
-Old fashion style with transparency UserDisplay
-Display will not be shown
New the alert function will always have included "APTM:", avoiding, if you use to the HiddenPendingEA or other EAs , confusion which EA is alerting and did an operation...
update Feb. 07,2015
as requested from many users, better UserDisplay now showing the selected settings ecc. making the handling much easier, too the userOptions are now more easy to understand, please ask if you are unsure how to use the APTM that it performs what you want.
march 4th,2015
the function that moves the SL if MoveSLOnlyIfWinis set to false, is recoded for avoiding with some settings strange behaviour, thanks to a spot from Over60, in addition, using the HiddenPendingEA. No this function should work under all circumstances perfectly.
march 21th,2015
Added new optional to move SL to BE with the PartClose as firstTP independend of the SLMinDistanceToPrice
To use this optional (OOTB ist is deactivated) set SetBEonPartCloseFirstTP to true. Note you must have enabled PartCloseAsFirstTP and PartClose in general must be enabled..
march 28th,2015
Update with new functions:
UseCloseFriday, if you set this to true the APTM will close all orders opened by this EA at FridayCloseHour you set and FridayCloseMinute (used is the broker time)
UseCloseAllAtDefinedTime, setting this to true the APTM closes at the user defined time all open trades use CloseHour and CloseMinute to set your wished time. Used is broker time.
New Trailing is more flexible as you have the possibility for different SLMinDistance inputs for the BE setting and the JumpingStop function, as always you can let APTM let this calculate with the ATR.
These are the modified inputs:
SLMinDistanceToPriceBE pips NewSL at BE must have distance to price
SLMinDistanceToPriceJS pips NewSL after moving SL must have distance to price
atrMultiplicatorForSLMinDistanceToPriceBE
atrMultiplicatorForSLMinDistanceToPriceJs these are used if you let the APTM automatic second ATR calculate.
apr.19th,2015
Update with new functions:
If you set enableCloseAllButton to true (like it is OOTB) you see new a red "CloseALL" Button, just hit this button and the APTM will close all open positions. ATTENTION there is no confirm asked for this operation it is a one click close all. NotDeletePendingOrdersWithCloseAll setting this to true, theAPTM will not delete the pending orders.
AUDUSDH4.png
apr.22th,2015
Update for better performance if you use ManageOnlyActualSymbol=true, the APTM will no be now faster in most cases in all operations. Note you must too set ManageAllOpenTrades=false, if you want the APTM to use a single-pair TM. Too the problem alerting if you use the CloseALL button is fixed, you will not have for every position to close have an alert, but only one time. (Only if you have the alerts activated)
apr.28th,2015
As many users asked for adding the possibility of using MA as SL I have decided to add this option to the APTM. It is easy to use as setting useMAasSL to true will automatic adapt all other settings to work perfect with this setting. Note: If your trade is against the MA directed the APTM will use an emergeny SL and not close your trade, this is a security feature. The basic MA SL will only be moved if the MA moves in direction of your trade. If you use it with ManageOnlyActualSymbol=true ( remeber to set ManageAllOpenTrades=false) the user display will show you the actual used MA value. You are free to choose the MA-type, period, TF and shift you like.
The new inputs are:

Code: Select all

extern string   SLset2="---MA as SL  Settings----";
extern string   SLset3="---this will set the MA as SL----";
extern string   SLset4="---this will disable all incompatible settings----";
extern string   SLset5="---like ATR-SL,SetBEandJump automatic----";
extern bool     useMAasSL=false;
extern int      MaTimeFrame=240;
extern int      MaPeriod = 55;
extern int      MaMethod = MODE_SMA;
extern int      MaAppliedPrice = PRICE_CLOSE;
extern int      MaShift=1;
Too this version is enhaced, if you use ManageOnlyActualSymbol=true ( remember to set ManageAllOpenTrades=false) , the closeALL button will now only close the trades of the trades with the actual symbol the display show only the trades in this pair ecc. Note as single pair TM you can use on every pair a different APTM instance if you want.
update version 2.19
may 2th 2015
fixes problems with some settings and pending orders, that caused the EA to stop working
after hitting the CloseALL button.
update version 2.26
may 27th 2015

This is a major updating presenting new functionalities. New you can enter your SL/TP/BE/JS/SLMinDistance values in AccountCurrency, APTM will this convert into pips for setting SL TP ecc....
For using this setting set useAccountCurrValuesForSL_TP_BE_JS to true note that this will adapt automatic other settings so that incompatible settings will be automatic deactivated (like ATR calculations).
New the APTM has too the possibility to use a basket SL/TP, for using this set UseBasketSLTP to true.
Here all new inputs (OOTB all false):

Code: Select all

extern string special="---Special AccountCurrency defined SL/TP BE Settings---";
extern string special2="---This deactivates automatic incompatible Settings like ATR---";
extern bool    useAccountCurrValuesForSL_TP_BE_JS=false;
extern double  SLAccountCurr=25;
extern double  TPAccountCurr=75;
extern double  BEProfitAccCurr=4;
extern double  JumpStepAccCurr=15;
extern double  SLMinDistanceToPriceBEAccCurr=20;
extern double  SLMinDistanceToPriceJSAccCurr=25;
extern string special4="---Special Basket TP/SL Option in Account Currency---";
extern bool    UseBasketSLTP=false;
extern double  BasketSL=2500;
extern double  BasketTP=7500;
update version 2.28
june 11th 2015

New Basket SL/TP option, new you can use too an value in pips instead of a value in account currency as it was requested by some users, the new inputs are:
UseBasketSLTPinPips set this to true if you want use pips and not account currency, note you must set UseBasketSLTP to true for using the Basketfunctions in your APTM
BasketSLinPips here you enter you wished pips value for the basket SL
BasketTPinPips same for the TP
update version 2.29
june 24th 2015

new version has now a Reset SL&TP button, if you use this button APTM resets all SL&TP for the manages trades to 0 and if you have set the auto SL&TP calculation for true, APTM will recalculate for all positions the SL& TP, too some little perfections inside the APTM
GBPUSDH1.png
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.
update version 2.31
sep. 2nd 2015

if showAlerts is set to false, now all not really essential alerts are not shown.
update version 2.32
sep. 11th 2015

more detailed informaiton about the ATR tf,period and multipliactor, if you use ATR for automatic dynamic calculations of TP/SL/BE/SLMinDistance ecc...
update version 2.34
sep. 14th 2015

New bigger Display can be selected by user, as some users did request for it, useNewDisplayType=false will use the old display style..
update version 2.36
nov. 25th 2015

new version with the following new settings:

Code: Select all

extern string genmang1="---ManageAllOpenTrades overwrites all others---";
extern bool     ManageAllOpenTrades=true;
extern string genmang1a="---Set excludeMagicNumber to true---";
extern string genmang1b="---for excluding one MagicNumer using---";
extern string genmang1c="---ManageAllOpenTrades=true---";
extern bool   excludeMagicNumber=false;
extern int    MagicNumberToExclude=15;
just set excludeMagicNumber ti true and set MagicNumberToExclude to the MagicNumber you want to exclude, note this works with ManageAllOpenTrades=true
update version 2.38
dic. 7th 2015

New the APTM can too to PendingOrders , if wished set a missing SL or TP, you must set SetInitialSLtoForPendings and SetInitialTPtoForPendings to true and it will too set initial SL/TP if wished to your pending orders (works in combination with all other settings together).
update version 2.40
jan. 1st 2016

New the CloseAll function can use too if wished the FIFO rules just set useFIFOforCloseAll=true. Some minor code changes to make the user inputs easier to use.
update version 2.41
jan. 7, 2016

The CloseAll() function is completely rewritten, as some users notified problems using the FIFO closure on certain brokers, the new function should resolve all this problems.
update version 2.44
feb. 15, 2016

Thanks to mikejagg I spotted a bug causing that manual fix SL/TP where with some pairs calculated totally wrong, this is now fixed, so please all re-download to fix this problem, thanks Mike!
update version 2.48 January 14,2017
Thanks to a request from jedrula you can now exclude one or more symbols in a comma separated list from managing by APTM use for this the new input PairsToExclude in the section Manage Only By Selections
Too this version has some little cosmetic updates, as there is gone some time since the last update...
update version 2.49 January 14,2017
little cosmetic update, APTM shows now in the user display the excluded symbols
GER30H1.png
update version 2.50 September 20,2017
resolves the "Friday Close Problem" thanks to delay see http://www.stevehopwoodforex.com/phpBB3 ... 81#p156681
update version 2.51 October 20,2017
Close Friday and DefinedTimeClose will now delete to all pending orders, as dclayw asked for this function.
update version 2.52 January 9,2018
work around to the "unable to set timer problem" thanks to Global
update version 2.53 January 30,2018
Now you can manage a comma-separated list of magic numbers, not only one like it was in previous versions, when you select ManageByMagicNumber true and ManageAllOpenTrades to false (as this function overrides all settings)..
update version 2.55 January 31,2018
This version has full support, using a comma seperated ticket list, set ManageByTicketNumber to true and ManageAllOpenTrades to false (as this function overrides all settings).
update version 2.56 March 11,2018
Uppon user request I added an input voice, for the user choice to delete with Friday or defined time close pending orders or not.

Code: Select all

extern string ForCLStes=" ---- Delete Pending yes or no ---- ";                     // ---------------------------------------------------------------------------
extern bool DeletePendingsWithClose=true;
update version 2.57 January 23,2019
update making the lg-file more legible please read http://www.stevehopwoodforex.com/phpBB3 ... 13#p165813 ff
milaneseAPTM_257.mq4
milaneseAPTM_257.ex4
--------------------------------------------------------------------------------------------------------------------------------
Note you can use them too for only one pair or only one magic number 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!!

----------------------------------------------------------------------------------------------------------------------------------
Donations are welcome pay-pal [email protected]


Usefull ATR indicator from Mopthehop, helping you to understand better the ATR settings
ATR in Pips+MA.mq4

Cheers :)

Tommaso
You do not have the required permissions to view the files attached to this post.
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
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

an other AllPairTradeManager

Post by mobthehop »

thanks - will give it a whirl on Monday.... have a great weekend / Mop
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

an other AllPairTradeManager

Post by milanese »

mobthehop » Sat Mar 08, 2014 12:47 am wrote:thanks - will give it a whirl on Monday.... have a great weekend / Mop
you too and let me know if you find some issues, or have ideas to embed more functionality ..

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
User avatar
putusernamehere
Trader
Posts: 107
Joined: Fri Nov 15, 2013 8:56 pm

an other AllPairTradeManager

Post by putusernamehere »

thanks Tommaso for your work. :hi: next week I will test it and write you the result. :good:
cheers Gunter
User avatar
putusernamehere
Trader
Posts: 107
Joined: Fri Nov 15, 2013 8:56 pm

an other AllPairTradeManager

Post by putusernamehere »

hi Tommaso
I put it live now appears on the screen waiting for initializing .... is this normal?
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

an other AllPairTradeManager

Post by milanese »

putusernamehere » Sun Mar 09, 2014 9:27 pm wrote:hi Tommaso
I put it live now appears on the screen waiting for initializing .... is this normal?
was a cosmetic error, here is the fixed one, the first is working, but shows this message too, after the coorect initializing.., the fixed one is too in the first post attached..
Edit there was again a bloop so see first post or my lateest one
Cheers and thank you for the spot!!

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
User avatar
putusernamehere
Trader
Posts: 107
Joined: Fri Nov 15, 2013 8:56 pm

an other AllPairTradeManager

Post by putusernamehere »

milanese » Sun Mar 09, 2014 10:30 pm wrote:
putusernamehere » Sun Mar 09, 2014 9:27 pm wrote:hi Tommaso
I put it live now appears on the screen waiting for initializing .... is this normal?
was a cosmetic error, here is the fixed one, the first is working, but shows this message too, after the coorect initializing..

Cheers and thank you for the spot!!

Tommaso
thanks :good:
it is perfectly :clap: you're really fast :hi: has made a partclose of an open winning postion with setting be perfect, and sets for new opened positions perfect sl
Gunter
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

an other AllPairTradeManager

Post by milanese »

There was a bug in the movingSL function that caused that the SL after setting the BE was not moved, now fixed and looks that all now works as intented..., the fix is attached in the first post

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
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

an other AllPairTradeManager

Post by milanese »

Post 1 updated with a new version. Now more jumping functionallity embedded, please read the updated first post again, and download the updated file.

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
User avatar
putusernamehere
Trader
Posts: 107
Joined: Fri Nov 15, 2013 8:56 pm

an other AllPairTradeManager

Post by putusernamehere »

Tommaso :hi:
you you're doing a lot of work. I would like to thank for it. :good:now you should only embed a function finding the best trades to open :smile: :smile:
Post Reply

Return to “Utilities Indicators and Scripts”