forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Portfolio Expert → MT5 Portfolio - how to change code for opening only BUY or SELL trades

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

Topic: MT5 Portfolio - how to change code for opening only BUY or SELL trades

Good afternoon EA Studio community,

waiting eventually for having this option inside the Portfolio settings, in the meanwhile does anyone Know how to change the MT5 Portoflio code downloaded by Portoflio Summary in Ea Studio, in order to let only BUY trades or SELL trades to be opened by all the strategies inside the portfolio?

Thanks a lot for the tip!

Re: MT5 Portfolio - how to change code for opening only BUY or SELL trades

poteree wrote:

Good afternoon EA Studio community,

waiting eventually for having this option inside the Portfolio settings, in the meanwhile does anyone Know how to change the MT5 Portoflio code downloaded by Portoflio Summary in Ea Studio, in order to let only BUY trades or SELL trades to be opened by all the strategies inside the portfolio?

Thanks a lot for the tip!


put in this inputs

input bool                 OnlyBuys                   = false;                 //Allow only Buy orders
input bool                 OnlySells                  = false;                 //Allow only Sell orders

and in

void ManageSignal(Signal &signal)

add this lines at the end

         if(OnlyBuys && signal.Direction == ORDER_DIRECTION_SELL)
           {          
            return;
           }
         if(OnlySells && signal.Direction == ORDER_DIRECTION_BUY)
           {          
            return;
           }                       
//---        
      if (signal.Direction == ORDER_DIRECTION_BUY || signal.Direction == ORDER_DIRECTION_SELL)
         OpenPosition(signal);

3 (edited by poteree 2024-07-15 12:47:09)

Re: MT5 Portfolio - how to change code for opening only BUY or SELL trades

Many thanks Roughey, it works! As from image attached, the 2 new inputs appear now in the Portfolio Box on MT5.

I believe you can support Mr Popov in adding new functionalities to the Portfolio :-D another small change (I hope) having a even higher positive impact is this one:
https://forexsb.com/forum/topic/9767/ho … en-trades/

Post's attachments

open only buy or sell.png
open only buy or sell.png 17.53 kb, 3 downloads since 2024-07-15 

You don't have the permssions to download the attachments of this post.

Re: MT5 Portfolio - how to change code for opening only BUY or SELL trades

poteree wrote:

Many thanks Roughey, it works! As from image attached, the 2 new inputs appear now in the Portfolio Box on MT5.

I believe you can support Mr Popov in adding new functionalities to the Portfolio :-D another small change (I hope) having a even higher positive impact is this one:
https://forexsb.com/forum/topic/9767/ho … en-trades/

there are some things we can do and add with bool.

this are small kind of codes i think popov can do it also.. in my opinion it is possible to use such code snippets to add automatically.
i dont know how popovs basic mql code can be changed. but for example when we want to use only buys only sells..there must be an option in EAS to set this on true and it will be added automatically in code..

5 (edited by poteree 2024-07-16 19:48:07)

Re: MT5 Portfolio - how to change code for opening only BUY or SELL trades

=for example when we want to use only buys only sells..there must be an option in EAS to set this on true and it will be added automatically in code..

for what I know, at EA level there's the Long or Short Entry Rule Indicator for opening only BUY or SELL; but you can't apply it to the entire portfolio. I want the same EA is generated both with BUY and SELLS trades, and eventually apply the BUY/SELL filter at Portfolio level in strong trends only.

Manually adding the BUY/SELL condition to every EA is a very long process if you have dozens of strategies in the portfolio (it meas doubling the strategies for having the same EA counted twice: one version opens BUY only, the other version opens SELL only).

Posts: 5

Pages 1

You must login or register to post a reply

Forex Software → Portfolio Expert → MT5 Portfolio - how to change code for opening only BUY or SELL trades

Similar topics in this forum