Reading an indicator to use in an EA

Post Reply
Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

Reading an indicator to use in an EA

Post by Dewey McG »

I am just learning to code and have a long ways to go. I do know how to do backtesting and optimization to see if a strategy is worth pursuing further though. Right now I am trying to design a few simple EA's to test out some ideas I have.

I am stuck on something that is probably basic for everyone else. I have attached an RSI divergence indicator. All I am trying to do is be able to read the output of the indicator into the EA to tell it whether or not there is divergence, bullish or bearish. If I put the indicator on the chart I can see the arrows of course, but I don't see what value to look for or what value indicates the divergence is there. The data window shows Values 2, 3 and 4. It's probably something as simple as when a certain value is over a certain number it is bullish and below a certain number it is bearish, but I don't understand the code in the indicator to know what to look for.

Can someone tell me what I am looking for? If you have a better divergence indicator let me know.

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Reading an indicator to use in an EA

Post by gaheitman »

Dewey McG wrote:I am just learning to code and have a long ways to go. I do know how to do backtesting and optimization to see if a strategy is worth pursuing further though. Right now I am trying to design a few simple EA's to test out some ideas I have.

I am stuck on something that is probably basic for everyone else. I have attached an RSI divergence indicator. All I am trying to do is be able to read the output of the indicator into the EA to tell it whether or not there is divergence, bullish or bearish. If I put the indicator on the chart I can see the arrows of course, but I don't see what value to look for or what value indicates the divergence is there. The data window shows Values 2, 3 and 4. It's probably something as simple as when a certain value is over a certain number it is bullish and below a certain number it is bearish, but I don't understand the code in the indicator to know what to look for.

Can someone tell me what I am looking for? If you have a better divergence indicator let me know.

Thanks
It looks like you need to look at the named value for Bullish Divergence (mode 0 in iCustom) and Value 2 (mode 1) for Bearish. It also identifies the divergence two bars in the past, so you will never see it update bar 0. When you check iCustom(), you need to shift two bars in the past to see if there is a trigger.

George
Post Reply

Return to “Coders Hangout”