Arrays...
-
I also often work with arrays and I always encapsulate them in a function with a static array
Its a way of pseudo OOP in MQL4// usage
// index and value both empty gives back the arraysize on int & index
// index empty value set is array push
// index set value empty is get value
// index set value set is set value
double myArray(int &index = EMPTY_VALUE, double value = EMPTY_VALUE){
static double arr[];
// pseudo code from here
if (index is empty) resize array by +1
if (index out of array) resize array
if (value is Empty) return value of arr[index]
else set arr[index] to value and return value
} -
Hi FxDreema,
i'm using some "Custom MQL4 block" working with some arrays that i declared inside the block.
how can i read these arrays in another "Custom MQL4 Code" blocks?Is there a way to globally declare an array?
I tried to declare in the "on Init" panel but doesn't work
and arrays can't be declared in the "Variables" input form...Can you help me?
-
__Hi FxDreema,
i'm using some "Custom MQL4 block" working with some arrays that i declared inside the block.
how can i read these arrays in another "Custom MQL4 Code" blocks?Is there a way to globally declare an array?
I tried to declare in the "on Init" panel but doesn't work
and arrays can't be declared in the "Variables" input form...Can you help me?[/quote:1qh64lv8]
in past I had also working with this and only way was declaring it manually in code using MetaEditor after creating mq4, but admin said, that maybe in future he create something to make this custom codes to define own parts of code in tops, like functions, arrays, etc .. I am waiting for this

-
Thank you Miro1360!
i'm using this software since two years and more and this is the only feature i feel missing..
Hope admin will add it soon
Thanks again!
Dave -
What do you want to do with these arrays? Because working with arrays in MT4/MT5 is not very pleasant. You can try to write some custom functions in the Studio and use them instead. I also use many functions for all these blocks, with many static parameters inside them.
-
Thanks Admin!
i used a custom block to catch some global variables, order them and put in relation with the name of the pair it referring..
then i would like to use blocks to check them and build different actions and different entries..
for the moment i didn't find a workaround..i will try to follow your advice but i didn't understand well what do you mean to "create function" and call them...
Can you build me a very very simple example of what you mean?
i hope it will be helpful also for others..PS. every day i use FxDreema i think is really an amazing software! Thanks again to have created it!
-
https://fxdreema.com/studio/
Look at the right side, on the bottom. Hit "New" and write some function. Then you should be able to use this function in the blocks... if everything works in the Studio, because I don't know many people who use it and bugs are expected
-
i feel stupid...
i read you in other topics suggest "Look at the right side, on the bottom" but i can't find it...
-
oh ok.. i starting to understand...
i never know about Studio..i'm going to do some searching on the forum starting from this..
post/11013