How to make EA for Exchange Stocks, not Forex


I'm learning EA, and tried this article:

tried editing it so it works for "Exchange Stocks" but whatever i do the Buy function doesn't work, seems like it only works for Forex

any help?

Quick Start: Short Guide for Beginners
Quick Start: Short Guide for Beginners
Hello dear reader! In this article, I will try to explain and show you how you can easily and quickly get the hang of the principles of creating Expert Advisors, working with indicators, etc. It is beginner-oriented and will not feature any difficult or abstruse examples.

If you want to trade some symbol (proposed by your broker, because all the symbols to trade and all specifications of the symbols are related to the brokers only) -
so you can look at specification of the symbol (about minimum lot size, about when to trade, and more):

Forum on trading, automated trading systems and testing trading strategies

MQL5 warning

Sergey Golubev, 2022.01.29 09:09

As I posted above - it depends on margin calculation type of the symbol.

1. Example with EURUSD.

EURUSD specification

and margin calculation = forex for EURUSD according to specification proposed by the broker.
It means, this symbol (EURUSD) will be copied.

2. Next examples.
Those symbols will not be copied because calculation for them is not forex according to their specification:


There is script about how to estimate it - look at the post