Hello,
In my EA I'm trying to catch the moment when the custom indicator changes its color, would you guys help ?
Thank you!
Source of the indicator below
You can only capture the color change of an indicator if it's somehow transmitted to an indicator buffer as a numeric value, which is highly unlikely. Rather, I think what you want to do is capture WHY the colour changes. Then, you can either modify the indicator to store that info in a buffer or use the same logic in your EA using the iCustom of the indicator to take the appropriate action. Hope that helps! :)
Hello,
In my EA I'm trying to catch the moment when the custom indicator changes its color, would you guys help ?
Thank you!
Source of the indicator below
For EA, it only takes the following code:
//-- int EAFormula() //-example { for(int i=100-1; i>=0; i--) { //-- //SetIndexStyle(4,DRAW_LINE,EMPTY,3,ForexLineColor1); //ForexLine Buffers[4] //SetIndexStyle(5,DRAW_LINE,EMPTY,3,ForexLineColor2); //ForexLine Buffers[5] //-- if(iCustom(_Symbol,0,"ForexLine",4,i)!=0) {bool Buy=true;} if(iCustom(_Symbol,0,"ForexLine",5,i)!=0) {bool Sell=true;} //-- } } //- done!
Thanks 3rjfx !
You are diamond! :)
int start { double icustom_3 = iCustom(Symbol(), 0, "forexline", 4, 1); double icustom_4 = iCustom(Symbol(), 0, "forexline", 5, 1); Alert(icustom_3," ",icustom_4); sleep(1000); }Output:
2147483647 1.0845
Please advice.
Regards
Edit:
I don't get "0" when I call the indicator from EA. It's always some value as output.
Thanks 3rjfx !
You are diamond! :)
EURUSD
Output:2147483647 1.0845
Please advice.
Regards
Edit:
I don't get "0" when I call the indicator from EA. It's always some value as output.
To get the value of a custom indicator, you must perform the iteration. If not done in the iteration, then the value obtained will not be accurate. ^_^
Test the code:
int start() { bool Buy=false; bool Sell=false; for(int i=100-1; i>=0; i--) { //-- //SetIndexStyle(4,DRAW_LINE,EMPTY,3,ForexLineColor1); //ForexLine Buffers[4] //SetIndexStyle(5,DRAW_LINE,EMPTY,3,ForexLineColor2); //ForexLine Buffers[5] //-- if(iCustom(_Symbol,0,"forexline",4,i)!=0) { Buy=true;} if(iCustom(_Symbol,0,"forexline",5,i)!=0) { Sell=true;} //-- } Alert(Buy," ",Sell); Sleep(1000); }
Output:
1 1
^_^
EDIT:
Maybe I'm doing something wrong but I can't make it work ...
Test the code:
Output:
1 1
^_^
EDIT:
Maybe I'm doing something wrong but I can't make it work ...
value of 1, meaning true, and value of 0 means false.
Should you see https://www.mql5.com/en/code/download/12703/forexline__update_02.mq4

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
In my EA I'm trying to catch the moment when the custom indicator changes its color, would you guys help ?
Thank you!
Source of the indicator below