Coding EA on iPad? - page 2

 
dQxTrades: Excellent, one last question.if I use a vps will I see what is going on when  I look at the account on the iPad app or will it interfere with the bot. so I use a terminal to interact with my bot and the regular app to see it in action but only as a spectator?

Yes you will be able to monitor trades on you mobile app, or web terminal or any other desktop terminal without fear of interference with the EA.

Your EA should also be properly coded to filter based on Symbol and Magic number, so that you can continue to trade manually or with other EAs, without interference between them.

You should also not close or modify existing trades placed by EAs, unless it is to correct a problem cause by a bug in your EA code.

 
Fernando Carreiro:

Yes you will be able to monitor trades on you mobile app, or web terminal or any other desktop terminal without fear of interference with the EA.

Your EA should also be properly coded to filter based on Symbol and Magic number, so that you can continue to trade manually or with other EAs, without interference between them.

You should also not close or modify existing trades placed by EAs, unless it is to correct a problem cause by a bug in your EA code.

This is great advice.

For my own education what is a magic number.

I have an MT4 account which I’ll use for EAs.


manual tradings will be done on a different account.


I might get different accounts for different EAs as I don’t want bots competing for margin without knowing what the other bot is doing or likely to do.


But I will monitor it all to make it all efficient.

 
dQxTrades: This is great advice. For my own education what is a magic number. I have an MT4 account which I’ll use for EAs. manual tradings will be done on a different account.

I might get different accounts for different EAs as I don’t want bots competing for margin without knowing what the other bot is doing or likely to do. But I will monitor it all to make it all efficient.

If you don't know what a Magic Number is, then I can only assume that you have never coded an EA before. It is a identifier used when placing orders so as to classify them by EA or sub-strategy.

Your strategy's risk calculations should not be based solely on Margin/Leverage. It should be based on proper stops' risk and proper money management. If done properly you can easily run multiple EAs on a single account.

Forum on trading, automated trading systems and testing trading strategies

Calculate Real Maximum Lot

William Roeder, 2021.07.10 14:01

Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin and leverage. No SL means you have infinite risk. Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.

  1. You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.

  2. AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)

  3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
              MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum 2017.10.10
              Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum 2018.02.11
              Lot value calculation off by a factor of 100 - MQL5 programming forum 2019.07.19

  4. You must normalize lots properly and check against min and max.

  5. You must also check FreeMargin to avoid stop out

Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.


 
Fernando Carreiro:

If you don't know what a Magic Number is, then I can only assume that you have never coded an EA before. It is a identifier used when placing orders so as to classify them by EA or sub-strategy.

Your strategy's risk calculations should not be based solely on Margin/Leverage. It should be based on proper stops' risk and proper money management. If done properly you can easily run multiple EAs on a single account.


Yes you are correct I have never coded an EA before.

I just saw a simple youtube video but I’m quite eager to learn more of course.

Its a journey.

Where can I find some simple codes / resources to get started.

Start simple and build on that, is the plan.
 
dQxTrades: Its a journey. Where can I find some simple codes / resources to get started. Start simple and build on that, is the plan.

CodeBase, Articles, and books ...

Forum on trading, automated trading systems and testing trading strategies

Something Interesting to Read

Sergey Golubev, 2017.09.16 05:40

Expert Advisor Programming for MetaTrader 4


This book will teach you the following concepts:

  • The basic of the MLQ4 language, including variables and data types, operations, conditional and loop operators, functions, classes and objects, event handlers and more.
  • Place, modify and close market and pending orders.
  • Add a stop loss and/or take profit price to an individual order, or to multiple orders.
  • Close orders individually or by order type.
  • Get a total of all currently opened orders.
  • Work with OHLC bar data and locate basic candlestick patterns.
  • Find the highest high and lowest low of recent bars.
  • Work with MetaTrader’s built-in indicators, as well as custom indicators.
  • Add a trailing stop or break even stop feature to an expert advisor.
  • Use money management and lot size verification techniques.
  • Add a flexible trading timer to an expert advisor.
  • Construct several types of trading systems, including trend, counter-trend and breakout systems.
  • Add alert, emails, sounds and other notifications.
  • Add and manipulate chart objects.
  • Read and write to CSV files.
  • Construct basic indicators, scripts and libraries.
  • Learn how to effective debug your programs, and use the Strategy Tester to test your strategies.

All of the source code in this book is available for download, including an expert advisor framework that allows you to build robust and fully-featured expert advisors with minimal effort.

Forum on trading, automated trading systems and testing trading strategies

Something Interesting to Read

Sergey Golubev, 2017.09.16 05:48

Expert Advisor Programming for MetaTrader 5


This book will teach you the following concepts:

  • Learn the basics of MQL5, including variables and data types, operators, functions, event handlers, and object-oriented programming.
  • Place, modify and close market and pending orders.
  • Calculate, verify and add stop loss and take profit prices to an open position.
  • Add a flexible trailing stop and/or break even stop to your strategy.
  • Manage your trade risk with money management.
  • Use pending orders to scale in and out of positions.
  • Use price, time and indicator data in your expert advisors.
  • Control program execution by trading on new bar open, and add flexible trade timers to your strategies.
  • Walk through the creation of several basic trading strategies from start to finish.
  • Inform the user with dialog boxes, email alerts, mobile notifications and sounds.
  • Draw trend lines, arrows and text labels on the chart.
  • Read and write data to CSV files.
  • Learn the basics of creating indicators, scripts and libraries in MetaEditor.
  • Debug, test and optimize your trading strategy.
  • And much more!

Whether you’re an experienced programmer moving from MQL4, or a novice just starting with MQL5, this book will give you the foundation to quickly program fully-featured and robust trading systems.

 
Fernando Carreiro:

CodeBase, Articles, and books ...

Brilliant.

For a vps or rather for good EA operation on MT4 how much RAM would you suggest. Hard drive memory probably only needs a small amount?

Not looking at a second by second EA.

Trades might be 4 minutes and upwards probably built around riding mini to long trends, quick take profits etc. So ultra fast orders is not necessary but still need MT4 running nicely.

Any advice on VPS specs to run MT4 properly?

Thanks 

 
dQxTrades: Brilliant. For a vps or rather for good EA operation on MT4 how much RAM would you suggest. Hard drive memory probably only needs a small amount? Not looking at a second by second EA. Trades might be 4 minutes and upwards probably built around riding mini to long trends, quick take profits etc. So ultra fast orders is not necessary but still need MT4 running nicely. Any advice on VPS specs to run MT4 properly?

I would suggest the following. Don't worry about VPS and required resources for now. Concentrate first about coding your EA. You are still a long way away from achieving a properly functioning EA, so worry about the live execution of it for later.

Also, if you are just starting out, go for MT/MQL v5 instead of v4, as it has stopped being developed. Place your efforts on something with a future instead of something that is stagnant.

There are plenty of good, regulated, UK brokers that offer both platforms. So choose one that offers MT5 and go with that.

 
Fernando Carreiro:

I would suggest the following. Don't worry about VPS and required resources for now. Concentrate first about coding your EA. You are still a long way away from achieving a properly functioning EA, so worry about the live execution of it for later.

Also, if you are just starting out, go for MT/MQL v5 instead of v4, as it has stopped being developed. Place your efforts on something with a future instead of something that is stagnant.

There are plenty of good, regulated, UK brokers that offer both platforms. So choose one that offers MT5 and go with that.

Ok but I have started with Oando quite like them and 0.6 of a pip on EURUSD.

I guess the MT4 account will work on MT5.

Is that the case?
 
dQxTrades:
Ok but I have started with Oando quite like them and 0.6 of a pip on EURUSD.

I guess the MT4 account will work on MT5.

Is that the case?
Also at the moment I don’t have a laptop, it got stolen, so all I have is an a iPad and vps at $1 -15 / mth is quite attractive compared to $1000 for a new laptop.


 
dQxTrades: I guess the MT4 account will work on MT5. Is that the case?
No! MT4 accounts and MT5 accounts are very different.
Reason: