@gooseman
Block 18. Try:
Set variable to Text (you have set it to numeric)
Unsolved How to do I build a multi timeframe\symbol portfolio?
-
@roar sorry I forgot to note that block 25 is still on the on init tab, I just copied the block over for the purpose to show all blocks.
-
-
@roar Heres the error
and heres the latest project
https://fxdreema.com/shared/C9f0bjrG
I have cleaned up the constant and variables. Still receiving this error. I have the symbol activated in MT5.
-
@gooseman
Block 18. Try:
Set variable to Text (you have set it to numeric) -
@sktsec that was it! now its trading now. thanks! lets see how it handles all symbols now.
-
So the mistake was in my own example. Eh, sorry
I usually do that step in the quick adjust, no need to select datatype
-
@roar It's all good! no worries. I am just glad you guys are helping.
The system backtest zero issues now which is great. unfortunately putting the system live returns error code 4806. I don't get it. MT5 client is using < 2% of RAM (total 16GB). Nothing else intensive is going on. Could it be the fact that the MT5 is reading the MA block before the Once Per Bar? I'm thinking since 4 ticks are being delivered per second, then MT5 is attempting to read the MA block 4 times a second. Could it be the custom MQL code block? Is there a more efficient way to structure the code? I am just thinking out loud here.
-
@gooseman
Probably due to retrieval of data from some symbols, as it takes time, in particular if those symbols and TFs were not opened in any other chart window.
Are you reading multiple symbols? Have you tried with only one symbol first and does error still persist?
BTW, CPU speed seems more important nowaday as RAM is often adequate. -
To "wake up" your symbols before getting indicator data on them, you can use CopyTime function:
https://www.mql5.com/en/docs/series/copytimeCopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr)
This prepares 100 days of history data, for example
-
@sktsec yes, many symbols. check out the first page for more details. The system works on a single TF, symbol, and RSI level. but when you have over 200 iterations or even just half, that's when ill get the error code 4806
-
-
I've make some modification to your shared link by adding a time interval just after switching to any other symbol/TF :
https://fxdreema.com/shared/C9f0bjrG
NB: After appending to your own project, you have to check to confirm the item in 27 should still the same as the one in 26. (sure you can change it to any other number) -
@sktsec Ive been reading up on it to understand the CopyTime function and understand it but implementing it in fxdreema is a whole other story. I am not a mql5 programmer...yet. But I have tried adding CopyTime Function using chatGPT but that did not end well haha.
bool CopyTime( const string EURUSD, // Symbol name const ENUM_TIMEFRAMES PERIOD_D1, // Period const uint start_pos, // Start position const uint 100, // Data count to copy datetime& time_array[] // Array of time values );
Does this look right? I take it I have to create a time_array[] variable as well?
Also, I am not seeing the modification you made to the project. I imported the project and found no changes.
So close! thanks guys.
-
@gooseman you need a time array, yes.
If you use custom mql code block, you can put this inside it:
datetime time_arr[1]; // Creates an array sized 1 CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr);
Thats it. This code doesnt need any constants or variables from your list. You will however need to replace "EURUSD" in some loop.
-
@gooseman
I think the code by @roar have solved your problem.Anyway, if you are interested you can try inserting the following blocks above the block "No position"
https://fxdreema.com/shared/htWDZuxqc -
@roar will this block go under onInit? Also, Will this be for for each symbol\TF combo I have? for ex
datetime time_arr[2]; // Creates an array sized 1 CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr); CopyTime("EURUSD", PERIOD_H1, 100, 1, time_arr);
But since were looking to retrieve just history, would this be more appropriate?
datetime time_arr[4]; // Creates an array sized 1 CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr); CopyTime("AUDUSD", PERIOD_D1, 100, 1, time_arr); CopyTime("CADCHF", PERIOD_D1, 100, 1, time_arr); CopyTime("GBPJPY", PERIOD_D1, 100, 1, time_arr);
-
@sktsec Ive tried adding the blocks, but it seems to only limit to one symbol.
-
@gooseman MT5 data handling is sometimes a mystery, but I would assume getting only D1 time is enough to refresh all timeframes.
Also, you can keep the time array sized 1. It will just be written over again and again, and its not a problem because we dont actually use the time value.
I use this method On Tick, but On Init should work fine.
-
@roar alright! making lots of progress here. Adding the CopyTime function looks to have solved the error! however, the system is not taking all trades. I have tested 1 year of historical data between my original build and this new build. I have tracked down the missing pairs in backtest to: EURAUD, GBPJPY, NZDJPY
Ive tried changing the No Position block to
No difference, so I went back to default.Heres the code for the missing symbols in the backtest
The missing symbols are there but don't seem to take trades. any ideas?
-
@roar I am looking at the previous post, I have to apologize, that's just bad practice\troubleshooting. To try and figure out why the system is not taking all trades is not on you. I should have known better as I am in the IT industry lol. I think I've figured it out though. What I did is start with 1 symbol and tested it. the system was able to take all trades. no problems and is working as intended. I added another, but different symbol. the backtest results show the correct amount of trades. it works. great! let's try 2 of the same symbol this time with different parameters.
Ah ha! found the issue! historically, H1 CADCHF LV1 has a total of 142 trades. H12 CADCHF LV2 has a total of 32 trades. when combined, the backtest should have a total of 174. but what Im getting is only 32 trades. Meaning the system is ignoring the H1 version and just trading the H12. so I tried this (don't laugh)
When backtested, Im getting 32 trades still. (H12 lv2 only) I believe adding pipes (or) will be used here. just not sure where.
with this, it'll trade the H1\LV1 (174 trades) but ignore the H12\LV2 (32 trades)
with this, it'll trade the first set of curly brackets and ignore the 2nd set.