Download MetaTrader 5

RSI Trendline

To add comments, please log in or register
Kenneth Jenney
270
Kenneth Jenney  

I'm trading a system manually that generates exit signals via RSI as seen in the image below. How can I code an EA/Indicator to calculate a break in a trend line like this?



RSI Trend Lines

blogzr3
506
blogzr3  

Believe me, coding is the easy part once you have defined precisely what is a trendline.


For eg, like where does it start, where should it stop, does little bleeps that cross the trendline momentarily and then cross back count, how steep must it be before it becomes a trend, how many points must it touch the straight line before it counts as a trend, given points 1,2,3, joining 1 & 2 could form a trend, and joining 2 & 3 could form another trend - which one do you take? etc etc.


Give a more complex picture to 10 different people, ask them to draw trendlines following your examples, would they all draw exactly the same trendlines in exactly the same places? Probably not.

Brian Dee - Random Trader
1760
Brian Dee - Random Trader  

MM

I spent a great deal of time on this... and decided to change the problem!
Best way by far to do this is apply two moving averages to the RSI

These will approximate very well to the crossing points you require

See the SFX_MA_On_RSI indi on this free page of indi's to download http://www.selectfx.net/free_stuff_ind.htm

Good Luck

-BB-

Kenneth Jenney
270
Kenneth Jenney  

Thanks for the help BB. I'll play with this indicator and incorporate into my EA to see how it does.


Blogzr - I know exactly how to draw the trendlines...two points connecting an entry and a recent high/low. My qestion is - How do I program this? I know I can, because it's in the doc, but I'm not sure how to calculate the high/low to make the connection.

blogzr3
506
blogzr3  

Blogzr - I know exactly how to draw the trendlines...two points connecting an entry and a recent high/low. My qestion is - How do I program this? I know I can, because it's in the doc, but I'm not sure how to calculate the high/low to make the connection.

I have no doubt that you know how to draw the trendlines - that was never in question. The point is you now need to translate what you know into coding requirements unambiguously - that is the tricky part.


How to translate what you have drawn into code? I have no idea. I only have questions. But if I were to tackle the problem, I would do exactly what BB has done - change the problem into a programmable one.

Do Hung
151
Do Hung  
mixtermind:

Thanks for the help BB. I'll play with this indicator and incorporate into my EA to see how it does.


Blogzr - I know exactly how to draw the trendlines...two points connecting an entry and a recent high/low. My qestion is - How do I program this? I know I can, because it's in the doc, but I'm not sure how to calculate the high/low to make the connection.

Hi mixtermind,

I have not done it but I have idea to do that.

You need three step


1. Find at least two tops (or bottoms) with EA

you should use "For..." to look back and search for these points


2. Make regression equation y = ax + b.

you can compute "a" and "b" by replace two tops (or bottoms) value of RSI at step 1.


3. Use line "y= ax +b" to find if it cut RSI or not --> then trade.


Hope it bring you a way.

Kenneth Jenney
270
Kenneth Jenney  

I like this code, taken from a Trendline indicator:


int counted_bars=IndicatorCounted();

ObjectCreate(TLineName, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);
ObjectSet(TLineName, OBJPROP_STYLE, LineStyle);
ObjectSet(TLineName, OBJPROP_COLOR, LineColor);

double val=ObjectGetValueByShift(TLineName, 0);

if (Bid-AlertPipRange*Point <= val && Bid+AlertPipRange*Point >= val) PlaySound(AlertWav);


All I'd have to do is to calculate recent peaks along the RSI. Calculating a recent High is not difficult, the difficulty is in calculating the nearest peak - where the price diverges from a consistent downward/upward movement.

Bui Ngoc Giang
128
Bui Ngoc Giang  
mixtermind:

I like this code, taken from a Trendline indicator:


int counted_bars=IndicatorCounted();

ObjectCreate(TLineName, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);
ObjectSet(TLineName, OBJPROP_STYLE, LineStyle);
ObjectSet(TLineName, OBJPROP_COLOR, LineColor);

double val=ObjectGetValueByShift(TLineName, 0);

if (Bid-AlertPipRange*Point <= val && Bid+AlertPipRange*Point >= val) PlaySound(AlertWav);


All I'd have to do is to calculate recent peaks along the RSI. Calculating a recent High is not difficult, the difficulty is in calculating the nearest peak - where the price diverges from a consistent downward/upward movement.

could you please give me this code (trendline of RSI breakout)

My mail : broker.fm88@gmail.com

Thanks

manish71
3
manish71  
how can get this indicator
To add comments, please log in or register