Making an EA based off of a custom indicator

To add comments, please log in or register
Pierce Daly
350
Pierce Daly  

So I'm trying to turn an indicator I wrote into an EA. I coded the logic into the indicator so the buffers draw a line where my SLs should be, as well as drawing arrows where my entries and exits are. How would i phrase it using iCustom so that it places my trades based on those buffers? Would it just be:


if (iCustom(buy arrow buffer)

{

OrderSend(......);

}

Also, how do i make it so that my SL is the value of the line drawn on the chart? Do I just make an array that holds the values of the lines drawn and then in the OrderSend method say something like line[0]?


Thanks in advance for any help

lippmaje
857
lippmaje  

You need to consult the reference manual about iCustom. MQL4 or 5, it's a different usage.

To get the SL value you could set up an additional indicator buffer so your EA reads that out instead of looking at chart objects.

Pierce Daly
350
Pierce Daly  
lippmaje:

You need to consult the reference manual about iCustom. MQL4 or 5, it's a different usage.

To get the SL value you could set up an additional indicator buffer so your EA reads that out instead of looking at chart objects.

The SL line is a buffer, so it would work to just call that buffer using icustom? its MQL4 btw

lippmaje
857
lippmaje  
Pierce Daly:

The SL line is a buffer, so it would work to just call that buffer using icustom? its MQL4 btw

Yes, call iCustom to read that buffer. See here for a code sample (MQL4) with explanations: https://www.mql5.com/en/forum/317466#comment_12381978
i need help in writing icustom function for this indicator for sell and buy signal
i need help in writing icustom function for this indicator for sell and buy signal
  • 2019.07.08
  • www.mql5.com
Need help in writing icustom function for this indicator to produce sell and buy signal...
William Roeder
19849
William Roeder  
Pierce Daly: So I'm trying to turn an indicator I wrote into an EA.
Don't try do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into the EA (using iCustom) and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
          Detailed explanation of iCustom - MQL4 programming forum
To add comments, please log in or register