EA that opens orders on both Forex and Indexes

To add comments, please log in or register
footfairy11
13
footfairy11  

Hey guys, first post here.

I am building an EA that needs to work on both Forex and Stock Indexes.

For some reason, my StopLoss (pips) and my Lot Size calculation messes up when it comes to the stock indexes.

Does anyone have experience building an EA that can handle both Forex and Stock Index?

Mohamad Zulhairi Baba
16047
Mohamad Zulhairi Baba  
footfairy11:

Hey guys, first post here.

I am building an EA that needs to work on both Forex and Stock Indexes.

For some reason, my StopLoss (pips) and my Lot Size calculation messes up when it comes to the stock indexes.

Does anyone have experience building an EA that can handle both Forex and Stock Index?

my guess (without you showing the code), your code should consider MODE_PROFITCALCMODE

https://docs.mql4.com/constants/environment_state/marketinfoconstants

Symbol Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
Symbol Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. In the second case, GetLastError() can return error 130, because MODE_STOPLEVEL...
Keith Watford
Moderator
14033
Keith Watford  
For non-forex instruments, you may have to define the value of 1 pip or simply use Point for all calculations.
To add comments, please log in or register