Simple support and resistance trading

 

My idea is to build an EA that will take a user input for a resistance and a support trendline by either inserting 2 price & time points for each line or by simply drawing on the chart (if possible that would be absolutely awesome). If slopes are negative the algorithm would automatically go short when at or near resistance (user chooses actual number of pips or a percentage of the pip distance between resistance & support lines) and close that position at/near support, etc for uptrending/lateral markets.

I've been trading this strategy manually on the daily EUR/USD chart and have been quite satisfied with the results. The pain is having to be watching closely when close to those levels, so an algorithm would be a greatest hand. I'm a complete beginner with respect to coding, so I totally welcome your help.

I can see that the resistance/support inputting is going to be my greatest challenge, so if you have an idea of how to do that please let me know!

As soon as I have something coded I'll make sure to post it! (code included..!)

 

wrong thread title

sorry for my incorrect nomenclature (and perhaps incompetence in being able to change a thread title) but the title should have actually been

"SIMPLE SUPPORT AND RESISTANCE TRENDLINE TRADING"

If an admin could do that I would appreciate it!

 

The problem with methods is that the trendlines will always be subjective, unless you choose particular trend lines of certain distances from current Time[0]

If you want to even start this project, I suggest you extensively define your definition of trendlines, not just the most recent high high and low low or high low, and low high.

 

renegado

It may be possible to just draw the line on the chart at the points you like them and have the EA act upon it. The trick is to name the line to a name that the EA will look for and if it exist will then act upon it as you would like (that is, programed it to act).

Keit

renegado:
My idea is to build an EA that will take a user input for a resistance and a support line by either inserting 2 price & time points for each line or by simply drawing on the chart (if possible that would be absolutely awesome). If slopes are negative the algorithm would automatically go short when at or near resistance (user chooses actual number of pips or a percentage of the pip distance between resistance & support lines) and close that position at/near support, etc for uptrending/lateral markets.

I've been trading this strategy manually on the daily EUR/USD chart and have been quite satisfied with the results. The pain is having to be watching closely when close to those levels, so an algorithm would be a greatest hand. I'm a complete beginner with respect to coding, so I totally welcome your help.

I can see that the resistance/support inputting is going to be my greatest challenge, so if you have an idea of how to do that please let me know!

As soon as I have something coded I'll make sure to post it! (code included..!)
 

Sure thing

Walander:
The problem with methods is that the trendlines will always be subjective, unless you choose particular trend lines of certain distances from current Time[0] If you want to even start this project, I suggest you extensively define your definition of trendlines, not just the most recent high high and low low or high low, and low high.

But I don't want the trendline picking to be a mechanical process because I especially enjoy doing that part! I understand that it becomes a bit more complicated to be able to backtest, but I'm ok with that. :

Would you know anything about how the algorithm accesses the names of the the lines we draw and the values associated with it?

 
cockeyedcowboy:
renegado

It may be possible to just draw the line on the chart at the points you like them and have the EA act upon it. The trick is to name the line to a name that the EA will look for and if it exist will then act upon it as you would like (that is, programed it to act).

Keit

Would you happen to have any code examples or suggest some EAs? I'll go after them!

Otherwise, I would like to ask you the same I asked Walander: "Would you know anything about how the algorithm accesses the names of the the lines we draw and the values associated with it?"

Many thanks for the help, guys!

 

Thank you bunches!

cockeyedcowboy:
renegado

start by learning goto the dictionary and read about object funtions and pay mind to the object find function.. when you draw a line on the chart just call it by a name that your ea will be looking for. any ways read and you'll get the idea of what needs done.

CockeyedCowboy

Keit, I've actually JUST found some related code and am really excited about devouring it (I'll do it after reading about objectfind) tonight.

When I end my research can/should I cite my sources (I don't wanna get banned!) or just post the original EA codes?

Thank you once again for the help!

 

Research results

I ended up finding a ton of material (see attachment!), but also quit this project for now as I have become more interested in learning other systems.

Included are:

Scorpion's TrendlineOrder - emmits alert only.mq4

Trendcapture.mq4

trendlineAlerter1.0.mq4

TrendMeLeaveMe.mq4

Manual Trendline Trader.mq4

Trendline Trader.mq4 (and 2 different versions of it!)

If you don't know how those EAs operate, simply google their file names and you'll find the relevant documentation.

Many thanks to all for the support in the thread, and may the probability gods of trading be on your side!

Renegado

Files:
 

Instead of posting content I am posting the URL of the source that clarify your doubts about the Supports and Resistance Trading..

Using Support and Resistance in Forex Trading

Happy Trading

 

renegado

also check out page three of this thread it has some other interesting indicators https://www.mql5.com/en/forum/172989

Keit

renegado:
I ended up finding a ton of material (see attachment!), but also quit this project for now as I have become more interested in learning other systems.

Included are:

Scorpion's TrendlineOrder - emmits alert only.mq4

Trendcapture.mq4

trendlineAlerter1.0.mq4

TrendMeLeaveMe.mq4

Manual Trendline Trader.mq4

Trendline Trader.mq4 (and 2 different versions of it!)

If you don't know how those EAs operate, simply google their file names and you'll find the relevant documentation.

Many thanks to all for the support in the thread, and may the probability gods of trading be on your side!

Renegado
 

Done!

After realizing I don't like trading with indicators I finally got round to working on the code for this EA, and I must say it was pretty darn easy once I got to use the "ObjectGetValueByShift" function I found as a result of Keit's hint related to "Object functions" (so thank you bunches!).

Thus, it is ready, and instructions for the EA are within the code, and besides, the code is pretty straightforward and self-explanatory! :P

Safe pips to you all, and happy shorting the GBPUSD 'till it's 1.36!

Renegado