The tabs tells you what they do, on init = at EA start (initialisation), on timer = only when the timer event fired (change this in settings), on trade (non mt4 native, so internally goes in on tick) = work with running trades, on chart = many things you see on chart, trades on mt4 are fired from here (in backtest use on tick), on deinit = all actions when removing/stopping EA working (like deleting everything drawn on the chart).
Posts made by jstap
-
RE: Any instructions about the On Trade & On Chart tabs?posted in General Discussions
-
RE: Problem generating Oninit code?posted in Questions & Answers
Ask AI:
Looking at the code, I can spot a few issues:
- static variable won't work in a Custom Block
static ulong last_logged_deal = 0; — Static variables inside FXDreema custom blocks don't persist between calls the way they would in a native MQL5 function. This means last_logged_deal will reset every tick, so the duplicate-deal guard will never actually work.
Fix: Use a Global Variable instead:
mql5ulong last_logged_deal = (ulong)GlobalVariableGet("LastLoggedDeal");
And after updating it:
mql5GlobalVariableSet("LastLoggedDeal", (double)deal_ticket); - No HistorySelect call before accessing history
HistoryDealsTotal() and HistoryDealGetTicket() require history to be loaded first. Without this, you may get 0 deals even when history exists.
Fix: Add before your history calls:
mql5HistorySelect(0, TimeCurrent()); - Missing CSV header row
The file is opened in append mode (SEEK_END) every time, so there's no header written. This makes the CSV harder to work with in Excel etc. You'd want to check if the file is new/empty and conditionally write a header row first. - _Digits used for spread
Spread is typically displayed as points, not price digits. Using _Digits gives you a raw price difference like 0.00010 rather than the more readable 1.0 (in points). Consider:
mql5DoubleToString(spread / SymbolInfoDouble(symbol, SYMBOL_POINT), 1) - FILE_SHARE_WRITE without FILE_SHARE_READ
If anything else tries to read the file while it's open, it'll be blocked. Adding FILE_SHARE_READ is safer:
mql5FILE_READ|FILE_WRITE|FILE_CSV|FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_COMMON
The most critical of these is #2 (missing HistorySelect) and #1 (the static variable not persisting) — both could cause the logger to silently log nothing or log duplicates.
- static variable won't work in a Custom Block
-
RE: [FR] Version Control Historyposted in Bug Reports
I don't know if admin will do this, for now only option is download the ex and import back... this will leave it in your project list.
-
RE: About the Chrome extension to download filesposted in Questions & Answers
Start a new question for this, only ex files created on FX can be used (except indicators, they can be used in a FX EA)
-
RE: heikin ashi bear to bull find low sizeposted in Questions & Answers
You'll have to say if it does/doesn't, not recently I have tried to use HA this way, but didn't show the right candle, why I used ChatGPT and it said:
Why the lines appear on the wrong candle
Your logic is correct, but the visual mismatch happens because of how MT4 handles:- Heikin‑Ashi indexing
- Shift timing
- Bar completion
- Redrawing on every tick
Two things cause the lines to appear on the 3rd candle instead of the 1st:
- Heikin‑Ashi is not aligned with the chart candles
You’re drawing lines on the real chart, but your logic is detecting HA candles, which do not line up 1:1 with the visible candles.
So:
- HA shift 1 ≠ real chart shift 1
- HA shift 2 ≠ real chart shift 2
This alone can move your line forward by 1–2 candles.
- Your code uses Time[1], but the HA candle you detected may actually correspond to Time[2] or Time[3]
Because HA candles are synthetic, the “bullish HA candle at shift 1” might visually appear on the chart two candles later.
So the line is drawn correctly according to your logic, but not where your eyes expect it.
so good luck relying on the standard blocks... as in your picture above it looks like this is the problem you are facing.
-
RE: heikin ashi bear to bull find low sizeposted in Questions & Answers
Add a shared project link rather than mq4. project screen - projects - create project link -open in browser - copy address bar and past here. As for using the standard blocks they cannot amend the candle ID so will have to use custom code regardless.
-
RE: heikin ashi bear to bull find low sizeposted in Questions & Answers
I think the HA problem is how it measures the candles, try this and see if it works correctly: https://fxdreema.com/shared/bIah92CYd
-
RE: My biggest project so farposted in General Discussions
@KLG So you are saying all I said is correct, and you use AI and custom code to make it work better?
-
RE: My biggest project so farposted in General Discussions
Ok, you are right, I have built projects with thousands of blocks,,, but these tend to consume computer power on back test, rather than actually make the bot better. Adding custom code blocks can considerably cut this, and speed things up (especially on backtest).
-
RE: My biggest project so farposted in General Discussions
That doesn't show a lot, but lots of blocks aren't normally needed...
-
RE: Problem generating Oninit code?posted in Questions & Answers
No mate, only the Amazon version, you can get the app to view it on the ipad.
-
RE: Problem generating Oninit code?posted in Questions & Answers
you just need a pass block above it, single blocks don't work on FX
-
RE: And Blockposted in Questions & Answers
bool is simply true/false, so i9t either pass es on to next or not, without seeing inside blocks your conditions may be the bigger problem, once per bar above means it fires first requiring the condition to be true at that point in time, once per bar is generally better under the conditions. The and block is pointless in this case, because condition on top of condition on top of condition without the and means 3 conditions have to be true to work. The and block is expecting the 3 above blocks to be true at the same time, but if the bool is false then only 2 can be, if you connect the yellow bool dot to the and block then the 3rd condition will be skipped and and will work of 2 conditions.
-
RE: Indicator Buffer dataposted in Questions & Answers
Is this the standard indicator? Past that into AI and see what answer you get.
-
RE: Indicator Buffer dataposted in Questions & Answers
mq is a lot easier as all buffers are already in the file, ex works but can be difficult. input all input parameters (I make sure all names are identical, just to eliminate a possible problem), then check if the indicator has relevant buffers, load to your MT terminal and view your data window, this will show you the available buffers, they be be in an order starting with 0, the value shown is what FX can retrieve, put in the buffer list on FX all the relevant buffers, call them what you want. Once loaded onto FX you should see all the indicator can do and the buffers in the my indicators section.
-
RE: WHY OPTIMIZATION IS SO SLOW WHEN I USE "ON TRADE" BLOCKS ?posted in Questions & Answers
You will have to create a block, not really tested much with this though:
https://fxdreema.com/forum/topic/21603/close-all-mt5-trades-quickly

