How to create custom block for a Between checker
-
I very often check if a value is inside a channel.
I use a simple function:
bool isBetween(double needle, double border_a, double border_b, bool includingBorders = FALSE){ double temp; if (border_a > border_b){ temp = border_b; border_b = border_a; border_a = temp; } if (includingBorders){ if ((border_a <= needle) && (needle <= border_b)) {return (TRUE);} else {return (FALSE);} } if ((border_a < needle) && (needle < border_b)) {return (TRUE);} else {return (FALSE);} }How to create a custom block from this?
If you could give a simple sample with some lines of comment how to create custom blocks would be really relly helpful.
** indicator moves within limits** is similiar but not doing the job
-
Custom blocks are functions. Whatever code you write, it will be put into a function. This function does not have real input arguments and should not have. The input parameters from the block are hard-coded into the function, at the top, this happens automatically while generating the EA.
What you have is a function. Instead of custom block, you can try to put this into a function. While you are in the Studio, look at the right side on the bottom. Then click New and paste this code. Then you should be able to use this function in the blocks... but by name, like in MQL
-
Jepp i got this and use it often but there is a way to create custom blocks.
On the uper right side I can define the inputs for the block but how define the red and yellow output?
Is there any description how to do this?
-
Outputs are not defined there. Outputs are defined here with ~next~ and ~inext~ http://i.prntscr.com/925dfd57926e46abb2 ... a47a1e.png