How I set my EA

 

How I set the mode of my EA calculate margin? What´s the code and where I put it (OnTick, OnInit...)?


I need to configure my EA in SYMBOL_CALC_MODE_EXCH_STOCKS (SYMBOL_CALC_MODE), but I can´t program this...  Someone can help me?

 
igorlpmartins: How I set the mode of my EA calculate margin? What´s the code and where I put it (OnTick, OnInit...)? I need to configure my EA in SYMBOL_CALC_MODE_EXCH_STOCKS (SYMBOL_CALC_MODE), but I can´t program this...  Someone can help me?

Your question is unclear and confusing! Could you elaborate more or show the example code that seems to be the problem?

Sorry, but I really don't understand what it is you are asking (and that is probably why no one else has answered yet either)!

 
Fernando Carreiro:

Your question is unclear and confusing! Could you elaborate more or show the example code that seems to be the problem?

Sorry, but I really don't understand what it is you are asking (and that is probably why no one else has answered yet either)!

I tried the following code:

void OnTick()

(...)

for(int i=0;i<total_ativos; i++)

   {

   SymbolSelect(SymbolName(i,true),true);

long modoDeCalMargin = SymbolInfoInteger(SymbolName(i,true),SYMBOL_TRADE_CALC_MODE,SYMBOL_CALC_MODE_EXCH_STOCKS,SYMBOL_CALC_MODE_EXCH_STOCKS);   

And the compile error...

EA Error

I want configure my EA to calculate margins using only SYMBOL_CALC_MODE_EXCH_STOCKS

 
igorlpmartins:

I tried the following code:

void OnTick()

(...)

for(int i=0;i<total_ativos; i++)

   {

   SymbolSelect(SymbolName(i,true),true);

long modoDeCalMargin = SymbolInfoInteger(SymbolName(i,true),SYMBOL_TRADE_CALC_MODE,SYMBOL_CALC_MODE_EXCH_STOCKS,SYMBOL_CALC_MODE_EXCH_STOCKS);   

And the compile error...

You can't set the Mode. It is a read-only property. The Broker sets the Mode.

Please read the documentation thoroughly, especially with regards to the function SymbolInfoInteger() that you are using!

If you have difficulty expressing yourself in English, then please use the Portuguese section of site as there are many Brazilian users there!

Português: Aqui segue o atalho para a documentação em Português: https://www.mql5.com/pt/docs/marketinformation/symbolinfointeger

Documentação sobre MQL5: Informações de Mercado / SymbolInfoInteger
Documentação sobre MQL5: Informações de Mercado / SymbolInfoInteger
  • www.mql5.com
Informações de Mercado / SymbolInfoInteger - Referência sobre algorítimo/automatização de negociação na linguagem para MetaTrader 5
Reason: