Adviser Ivan - the best of ilan - page 9

 

So you can safely remove the check for the mode of margin calculation ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE), the Expert Advisor will work for all three modes of margin calculation.

ACCOUNT_MARGIN_MODE_RETAIL_HEDGING: Used for OTC market with independent position accounting ("hedging", there can be multiple positions on one symbol).
ACCOUNT_MARGIN_MODE_RETAIL_NETTING: Used for OTC market when accounting positions in "netting" mode (one symbol can be only one position).
ACCOUNT_MARGIN_MODE_EXCHANGE : Used for MOEX exchange market.

However, for the exchange market you will need to add rounding to the whole number of lots, because fractional lots do not work there.

 
Eugene Myzrov:

So let him add it, as long as the advisor closes the position in one direction first before opening it in the opposite direction.


:) It's hard when both people are very nimble and push the keys :)

There is a forum on trading, automated trading systems and trading strategies testing

Expert Advisor Ivan - the best of ilan

Vladimir Karputov, 2017.03.28 15:47


Set "Use averaging" == false and "Ivan" EA will not add position.


Although... Even if it will add a position afterwards (when the signal reverses) it will close completely. You may try it.


 
Eugene Myzrov:

So you can safely remove the check for the margin calculation mode ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE), the Expert Advisor will work for all three modes of margin calculation.

ACCOUNT_MARGIN_MODE_RETAIL_HEDGING: Used for OTC market with independent position accounting ("hedging", there can be multiple positions on one symbol).
ACCOUNT_MARGIN_MODE_RETAIL_NETTING: Used for OTC market when accounting positions in "netting" mode (one symbol can be only one position).
ACCOUNT_MARGIN_MODE_EXCHANGE : Used for MOEX exchange market.

However, for the stock market, you will need to add rounding to the whole number of lots, i.e. fractional lots do not work there.


I'm not going to remove it yet - I've got netting undigestibility for some time. But lot calculation is automatic (void OpenBuy() and void OpenSell()). Now I'll check it on RTS futures...


Added. Lot is calculated correctly, but you need to manually correct the risk percentage (increase) - otherwise it may turn out that the calculated lot is equal to zero.

 

version "1.010".

Added parameter "Break-even": Break-even ("0" - do not use Break-even).

  • If you set it to "0", this setting will be skipped.
  • If "Break-even" is more than zero and the position has a profit of more than "Break-even" pips - then move Stop Loss to the opening price.

Files:
Ivan.mq5  56 kb
 
Please tell me where I can find or buy a trading robot,

Example: I set him a task, when a certain price is reached, to make a buy/sell-Set a stop/stop/stack. At a certain bounce/pierce, move stop/stack to a given level


 
103060:
Please tell me where I can find or buy a trading robot,

Example: I set him a task, when a certain price is reached, to make a buy/sell-Set a stop/stop/stack. On a certain bounce/pierce, move stop/stack to a given level



 
Vladimir Karputov:


Search in CodeBase ?
 
Vladimir Karputov #:

version "1.010".

Added parameter "Break-even": Break-even ("0" - do not use Break-even).

  • If you set it to "0", this setting will be skipped.
  • If "Break-even" is more than zero and the position has a profit of more than "Break-even" pips - then move Stop Loss to the opening price.

Compile errors. EA probably not combining with newest MT5 version


 
timmytrade # :

Compile errors


You quoted a post from 2017. A lot has changed since then. This is old code.

 
Vladimir Karputov #:

You quoted a post from 2017. A lot has changed since then. This is old code.

Alright :)

Reason: