And if you want to get the value of the spread
double valuePerLot = (Ask - Bid) * MarketInfo(_Symbol,MODE_TICKVALUE) / MarketInfo(_Symbol,MODE_TICKSIZE);Do NOT use TickValue by itself:
- 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.
- Account Balance * percent = RISK = |OrderOpenPrice - OrderStopLoss| * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
- Do NOT use TickValue by itself - DeltaPerlot
- You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello there.
Im trying to create a function that calculates the value in the deposit currency of the spread of each trade open and this function should be calculated differently in each broker, because they have different characteristics.
So I downloaded a blank mt4 terminal from www.metaquotes.com and I introduced external data there. I use this terminal in offline mode and the data is at Default Folder then data comes with a spread of 1. So what it happens is that in this terminal when I run:
MarketInfo(Symbol(),MODE_TICKVALUE));
It retusn the value 0. Anybody knows why it is?
Also have anybody done this function before?
What I ideally im looking for is something like this: