Henka Combs / Publications
Forum
CDealInfo -> Magic() not returning magic number on profitable deal
Greets, This has been working for a while now, but today I noticed it's not working as expected. Not sure what's changed (maybe nothing has changed and this has never worked). I basically want to trigger some code when a deal is in profit/loss. It works when the deal is in loss (ie, hits the SL)
AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) always returns 0.0
Greets, I'd like to check the margin level percentage before placing a trade, but AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) always returns 0.0. I've read the article here https://www.mql5.com/en/forum/228052 but it doesn't solve my problem. As a test, whether I'm calling in OnInit() or OnTick()
Backtesting and margin level %
Greetings, When performing backtesting mt5, in the results tab you are given the lowest margin level % it reaches. My broker does a margin call at 50%, so I’m trying to get clarity: given a leverage of 1:100 or 1:500 or whatever, is that margin level % in the backtest results a good guide wrt the
Margin level % in MT5 backtest results - what would constitute a margin call?
Greetings, Trying to understand the meaning behind the number in the backtest results for Margin Level %. At what level would it be considered a 'bad thing", ie, being margin called in possible future live trading? For example, some of my backtests show this level at 419%, other times it is 1765%. I
Detecting the last profit/loss in transaction history reliably for a given magic number
Hi all, I'm trying to detect the last profit/loss in the transaction history (which I think I've got right), but something unexpected is happening, hopefully someone will have an idea. Here's the snippet: void OnTradeTransaction ( const MqlTradeTransaction & trans, const MqlTradeRequest &
Strategy tester using EA on Daily bars - always "market closed"
Greets, I've been trying my hand at writing MQL5 EAs for a while now and everything works as expected. I've always used the strategy tester on intra-day timeframes, but recently decided to give the Daily TF a try. Problem is the strategy tester always fails to place any test trades because the
CopyBuffer() on iVolume() handle fails with 4807 error (invalid handle)
Greets, I've been googling around for a solution to this to no avail. Hopefully someone else has experienced this and knows what the solution is. So CopyBuffer() expects an int handle as the first argument. This works fine for most indicators, except iVolume() which returns a long. Typecasting
Grid trading idea - comments sought
Greets, Here's a quick implementation of a grid trading idea showcased here I'm not sure if I've made a mistake, or if the concept simply doesn't work, but it always results in a loss in backtesting. Maybe someone can have a look, play with it, and possibly give ideas. Since the strategy apparently
Detecting SL & TP
Greetings, I'd like to detect when the SL or TP level is hit and take appropriate action. Is the following snippet correct? void OnTradeTransaction ( const MqlTradeTransaction & trans, const MqlTradeRequest & request, const MqlTradeResult & result) { if ( HistoryDealSelect (trans.deal)) {
Duplicating PineScript's bgcolor() function in MQL5
Greetings, I'm trying to duplicate PineScript's bgcolor() function call in MQL5 - so far I've come up with: color canvasColor = clrLightGreen ; // Choose the color you want for the canvas ObjectCreate ( 0 , "BackgroundCanvas" , OBJ_RECTANGLE_LABEL , 0 , 0 , 0 ); ObjectSetInteger ( 0