FTS Toolkit - Sticky Trends - Draw trend lines easier by holding Ctrl

Peter O

Special Consultant to the FPA
Messages
4,766
Fellow Squad Members,


Another code I'd like to share with you is a quite special one. I used to spend some time with 'convenience codes' and not only with EAs and indicators or market data analysis. This kind of tools mostly makes**trading platform*more handy by providing common function with fewer clicks or shinier display. I just refurbished this code that simply helps drawing trend lines. If your trading and chart handling habits work with trend lines you can find it quite convenient. And it is a quite good source of mql tricks.


Installation and starting:

Download source code from here:


This is an EA code so you need to copy it to {MetaTrader4 folder}/experts/ folder and then start the trading platform (or close and restart if it had been open). The tool will appear on Navigator panel (open from View menu) among Expert Advisors as FPA=StickyTrends so just drag over your chart.


Enable Expert Advisors:

To use it don't forget to enable Expert Advisors in terminal's Options (menu: Tools/Options - Expert Advisors tab first checkbox). This shows a smiley face on the upper right corner next to the EA's name (otherwise there is an x).










Settings and Parameters:

By technical reasons you can open Inputs tab only right after starting EA when Properties come up. Switch from Common tab to Inputs.


Parameter: Show_Proximity_Circle
Possible values: true, false

Parameter: Proximity_Distance_Pixels
Possible values: positive integer

Stickiness helps you selecting highs and lows on the chart. This tool simply starts drawing trend lines from the closest high or low in a circle around the mouse cursor. First parameter tells the EA that you want to see that circle and the second one defines the radius of that circle.


Operation:

Everything works as normal on the chart but as soon as you hold down the Control key trend line drawing starts. First you can select the starting point:





---––– After this step –––---
Release Ctrl: quit drawing - removes all objects
Single left mouse click: start selecting endpoint





---––– After this step –––---
Release Ctrl: stop drawing - trend line remains
Single left mouse click: start adjusting line length





---––– After this step –––---
Release Ctrl: stop drawing - trend line remains
Single left mouse click: start placing parallel line





---––– After this step –––---
Release Ctrl: finish drawing - trend lines channel remains
Single left mouse click: finish drawing - trend lines channel remains


---––– Whenever you've drawn a trend line –––---
Press Esc: delete last line (works for several seconds)​


You can participate:

Tell me and your Squad Members how you like it.
Tell me and your Squad Members how could it be better.
Tell me and your Squad Members if you have any problem while installing or using it.


Who wants to enter the Laboratory:

Right click on Navigator panel/Expert Advisors/FPA=StickyTrends and select Modify. MetaEditor opens up showing the full source code I've written for you.


On the first screen you can find some hidden parameters like colors and styles (from line "color proximity_circle_color = ..." to "double horiz_vertic_sticky_angle = ...". You can change the values after the equal sign (you can use these color names just write them without spaces and be aware of case sensitivity) and even the default setting "true" and "39" above them for the input parameter "extern bool Show_Proximity_Circle = ..." and "extern int Proximity_Distance_Pixels".


After modifying the code press F5 or Compile button on the top. If it writes "0 error(s),..." on the bottom, you have your own new version and you can start using it after going back to MT4 terminal.


Looking forward to hearing your feedback,

Peter
 
Last edited by a moderator:
Hi Peter

This tool looks great, but I cannot attach it to any charts. I even tried 3 different MT4 platforms, but same thing.
Shows up under expert advisors and I can right click and modify, but nothing appears when attaching it to the chart.

Thansk
 
Hi Peter

This tool looks great, but I cannot attach it to any charts. I even tried 3 different MT4 platforms, but same thing.
Shows up under expert advisors and I can right click and modify, but nothing appears when attaching it to the chart.

Thansk


Does the EA's name appear in the upper right corner together with the smiley face? I know that even if it does the terminal must be online otherwise MT4 doesn't start any EA even if it could. For example if your platform is offline ('No connection' in the lower right corner) you can't use this tool even on an offline chart but as soon as it gets online EA starts working.

I just tried it on two different MT4s and it started working at the moment I held down the control key.
 
I tested all source code links and eventually I replaced all of them because I saw downloading issue in Firefox.

Now I've tested new links and all worked fine for me in Firefox and Chrome as well.

Peter
 
... Just spent 30 minutes on rewriting the code because I couldn't attach it to a chart in built 670 MT4.

It said Expert FPA=StickyTrends is not expert and cannot be executed.

The last and only thing I would have had to change was the 3rd line of code:

#property show_inputs

change to

//#property show_inputs

and it can be attached. At least in my 670.

Thank you and best regards,
Florian
 
Hi Florian, I commented out the code line on the server so that to avoid problems with 670. Thanks! Peter
 
sign mismatch FPA=StickyTrends.mq4 319 94
sign mismatch FPA=StickyTrends.mq4 338 65
not all control paths return a value FPA=StickyTrends.mq4 525 3
not all control paths return a value FPA=StickyTrends.mq4 533 3
declaration of 'cursor_candle_index_prior' hides global declaration at line 77 FPA=StickyTrends.mq4 631 8
declaration of 'cursor_price_prior' hides global declaration at line 79 FPA=StickyTrends.mq4 632 11


Its showing these 6 warnings and this cannot be attached with any of my charts. Please help me with this.
 
Back
Top