I'm super new here - first day, but for me this just doesn't work in MetaTrader5 (on Mac, anyway). I'm a software engineer so have tried to work out why - and I found the symbolInfo.Bid() returns 0.0.
It turns out the correct fix (for me at least) is to use:
MqlTick tick; if (SymbolInfoTick(_Symbol, tick)) { Print("Bid =", tick.bid, "Ask =", tick.ask); }
... which does output the correct bid price, then the code starts working. Full updating working code is here (in case anyone is interested)...
- gist.github.com
I'm super new here - first day, but for me this just doesn't work in MetaTrader5 (on Mac, anyway). I'm a software engineer so have tried to work out why - and I found the symbolInfo.Bid() returns 0.0.
It turns out the correct fix (for me at least) is to use:
... which does output the correct bid price, then the code starts working. Full updating working code is here (in case anyone is interested)...
same probleme for me.
here is my fix :
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dynamic Trailing Stop Loss and Profit Target Management:
This code snippet implements a dynamic risk management strategy for existing trades. It focuses on closing trades based on profit or loss thresholds and employs a trailing stop loss to lock in profits as the trade moves favorably. The strategy helps manage risk and enhance profitability in a streamlined manner.
Author: Ohene Kofi Akuoku Osei