forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


Forex Forum → Expert Advisor Modifications → Portfolio - change the number of strategies which are trading

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

1 (edited by Roughey 2019-01-18 19:55:11)

Topic: Portfolio - change the number of strategies which are trading

Hi,

i want to modify an Portfolio ea with 100 strategies.

Now i have build an enum input.

enum_strategies
{
Full,
Half,
One Fourth
};

and this as input
input ENUM_strategies            numberstrats = Full;                  

Now with this i want to change the number of stratgies which are trading. So if i have 100 stratgies in my portfolio i use "Full" and all strategies work.

If i decide to change into "Half" than the first 50 stratgies only trade .How can i change it easily.

I tried to change the

const int    strategiesCount = 100;

but its not allowed to do if statements in the global scope.

So the only way i know how it is working to put here

   signalList[i++] = GetExitSignal_00();
if(numberstrats==Full)
   signalList[i++] = GetEntrySignal_00();

But when i have 100 strategies and 3 different enumarations its a much to change in code.

So  if someone have a good idea it will be great.

2 (edited by geektrader 2019-01-18 21:32:55)

Re: Portfolio - change the number of strategies which are trading

As far as I can see it, you´d just need to change the strategiesCount variable, as this is being used throughout the code to check the entry and exit signals. So instead of:

const int    strategiesCount = 100;

You´d change it to:

input int    strategiesCount = 100;

And then simply change the number of the strategies you want to trade. However, take note that if you change it while there are open trades, systems > the number you´ve entered, will have their trades going unmanaged from there on, as it will also only check the exits for the number you´ve entered there.

P.S.: You can definitely do if statements on the global scope, I do it all the time. Who says you can´t?

3 (edited by Roughey 2019-01-18 21:56:34)

Re: Portfolio - change the number of strategies which are trading

i try this now

enum ENUM_STRAT
   {
   Full,
   Half,
   OneFourth   
   };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   
static input double Entry_Amount      = 0.01; // Entry lots
static input int    Base_Magic_Number = 100;  // Base Magic Number
input ENUM_STRAT           numberstrategies           = Full;                 // Set Number Strategies used
#define TRADE_RETRY_COUNT 4
#define TRADE_RETRY_WAIT  100
#define OP_FLAT           -1

// Session time is set in seconds from 00:00
const int sessionSundayOpen           = 0;     // 00:00
const int sessionSundayClose          = 86400; // 24:00
const int sessionMondayThursdayOpen   = 0;     // 00:00
const int sessionMondayThursdayClose  = 86400; // 24:00
const int sessionFridayOpen           = 0;     // 00:00
const int sessionFridayClose          = 86400; // 24:00
const bool sessionIgnoreSunday        = true;
const bool sessionCloseAtSessionClose = true;
const bool sessionCloseAtFridayClose  = false;

//const int    strategiesCount = 100;
if(numberstrategies==Full)
{
 int    strategiesCount = 100;
}
if(numberstrategies==Half)
{
 int    strategiesCount = 50;
}
if(numberstrategies==OneFourth)
{
 int    strategiesCount = 25;
}
const double sigma           = 0.000001;

GET THIS ERRORS

'if' - expressions are not allowed on a global scope    Portfolio Expert EURUSD H1 (9).mq4    50    1
'strategiesCount' - undeclared identifier    Portfolio Expert EURUSD H1 (9).mq4    382    18



TRIED ALSO LIKE THIS

int strategiescount = 100;
//const int    strategiesCount = 100;
if(numberstrategies==Full)
{
     strategiescount = 100;
}
if(numberstrategies==Half)
{
     strategiescount = 50;
}
if(numberstrategies==OneFourth)
{
     strategiescount = 25;
}
int strategiesCount = strategiescount;

AND GET NOW ONLY THIS ERROR

'if' - expressions are not allowed on a global scope    Portfolio Expert EURUSD H1 (9).mq4    50    1

Re: Portfolio - change the number of strategies which are trading

Hmm, can you attach the whole MQ4 file? I can then have a look and fix it. There must be some other error that causes the if expression problem, as they can be used fine on the global scope (something with the variables definition most likely).

Re: Portfolio - change the number of strategies which are trading

Just checked to change the strategiescount manually. When ea habe signalList stablished with 100 entries. and i change strategiescount to 100 than ea get out critical error in backtest. so this couldnt be work.

So i think only way to do is really to say on each signalList to add an if statement

Posts: 5

Pages 1

You must login or register to post a reply

Forex Forum → Expert Advisor Modifications → Portfolio - change the number of strategies which are trading

Similar topics in this forum


Generated in 0.014 seconds (69% PHP - 31% DB) with 11 queries