Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1954
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
Hi
Need to know why My Order (TP) was Not Executed as Price has gone below my Set Target i.e. 0.99600 where as Price gone to 0.99517 on EURUSD.
Also, note that Bear Candle Wick is Crossing my TP Line as shown below in attached Snap.
Regards
Shahzad
Your order was placed 2022.08.12 but you are looking at the price chart for 2022.07.14 which is one month earlier than your order.
Your order was placed 2022.08.12 but you are looking at the price chart for 2022.07.14 which is one month earlier than your order.
Thanks Fernando Carreiro for the Explanation !!!
Being a New Bee in FX I forgot this :-)
That symbol is not an "i", it is a a vertical bar or pipe "|".
A single bar "|" has the meaning of a Bitwise OR Operation, while a double bar "||" has the meaning of a Logical OR Operation.
By the way, you may find it helpful to learn C or C++ as well because MQL is based on it and there are many more source of educational information out there for C/C++ than there are for MQL.
PZ Parabolic SAR EA - expert for MetaTrader 4
https://www.mql5.com/en/code/10957
I hope someone can help me on this. I ran this on tester and it worked fine but when I used it in live it keeps closing deals even when signals isnt done. Hope someone can help. Thanks!
The amount of balance I have is $200
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
GetLotSize doesn't compute correctly.
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 (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.
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.
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.)
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)
Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
Lot value calculation off by a factor of 100 - MQL5 programming forum (2019)
You must normalize lots properly and check against min and max.
You must also check Free Margin to avoid stop out
For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)
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.
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
GetLotSize doesn't compute correctly.
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 (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.
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.
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.)
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)
Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
Lot value calculation off by a factor of 100 - MQL5 programming forum (2019)
You must normalize lots properly and check against min and max.
You must also check Free Margin to avoid stop out
For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)
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.
You can only trade what your account offers. So choose a broker and a type of account that offers the symbols you want to trade.