Experts: Dynamic Trailing Stop Loss and Profit Target Management

simoncveracity  

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)...

Update to training stop mql5 file to make it work
Update to training stop mql5 file to make it work
  • gist.github.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
hlaaraj  
simoncveracity #:

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);
Reason: