Discussing the article: "Developing a multi-currency Expert Advisor (Part 2): Transition to virtual positions of trading strategies" - page 6

 

Forum on trading, automated trading systems and testing trading strategies

Discussion of the article "Developing a multicurrency Expert Advisor (Part 2): Moving to virtual positions trading strategies"

fxsaber, 2024.02.12 17:33

Your architecture is somewhat different from mine

//+------------------------------------------------------------------+
//| Конструктор                                                      |
//+------------------------------------------------------------------+
CSimpleVolumesStrategy::CSimpleVolumesStrategy( const string sInputs ) : CStrategy(sInputs)
{
   this.Input = sInputs;

   ArrayResize(m_orders, this.Input.maxCountOfOrders);

   // Загружаем индикатор для получения тиковых объемов
   iVolumesHandle = iVolumes(this.InputStrategy.symbol, this.InputStrategy.timeframe, VOLUME_TICK);

// Устанавливаем размер массива-приемника тиковых объемов и нужную адресацию
   ArrayResize(volumes, this.Input.signalPeriod);
   ArraySetAsSeries(volumes, true);
}

I don't use inputs from the parent class. All my inputs are private and therefore can have the same name. This results in strong universalisation: the same code, which is hidden in one common macro. But that's how it is for me.

 
Yuriy Bykov #:

I think that this is not the final version either, as you have focused on those scenarios of use in parameters in code that have already been published. When it comes to assembling parameters into sets, and even more so to automatic assembling into sets, you will probably find that you can improve/simplify as well.

You're right. Did it this way.
expert.Add(new CSimpleVolumesStrategy(inInputsAll));
It's a global string-variable, into which all input variables are automatically (and created). I.e. whatever objects are created, this variable is always input.
 
fxsaber #:
You're right. Did it this way. This is a global string-variable into which all input variables are automatically (and created). That is, no matter what objects are created, this variable is always input.

Just in case I remind you that string inputs are cut by 63 characters by the optimiser.

 
Stanislav Korotky #:

Just in case, I remind you that string inputs are cut by 63 characters by the optimiser.

Thank you. It is not an input, so the length is not limited.

string inInputsAll = NULL;
 

Forum on trading, automated trading systems and testing trading strategies

Discussion of the article "Developing a multicurrency Expert Advisor (Part 2): Moving to virtual positions trading strategies"

fxsaber, 2024.02.14 11:36 AM

You are right. Did it this way.
expert.Add(new CSimpleVolumesStrategy(inInputsAll));
This is a global string-variable into which all input variables are automatically (and created). I.e. whatever objects are not created, this variable is always fed to the input.

Attached.

Files: