Script to switch to horizontal line

 

I have a strategy which involves manually trading the M1.

It's fast moving and it's during the day and I am at work. In order to prep support and resistance lines, i want to create about 20 lines a day in as short a time frame as possible.

it looks like there is no keyboard shortcut for horizontal line mode in mt4 and no script. do i have to write one myself?

if so - it looks from the codebase i might need a dll too. is that right, or can it all be done with an mql4 script?

 
There is no need for a DLL (unless I misunderstood your issue).
 
strontiumDog:

I have a strategy which involves manually trading the M1.

It's fast moving and it's during the day and I am at work. In order to prep support and resistance lines, i want to create about 20 lines a day in as short a time frame as possible.

it looks like there is no keyboard shortcut for horizontal line mode in mt4 and no script. do i have to write one myself?

if so - it looks from the codebase i might need a dll too. is that right, or can it all be done with an mql4 script?

You can write a simple script to place 20 or more Horizontal Lines on your chart . . . but where do these lines go ? do you place them manually ? if so why not simply create one then copy it using Ctrl + click and drag, repeat 18 times ?
 

thanks for the advice. i do literally want a keyboard shortcut which switches me into horizontal drawing mode. and one for rectangle drawing mode. i don't want to have to double click on the line and do a ctrl-click as i find it cumbersome. ctrl-<letter> and click (click-drag for rectangles) is quicker.

if i can do this from a script - ace. How? can you point me to the documentation about this please?

 
strontiumDog:

thanks for the advice. i do literally want a keyboard shortcut which switches me into horizontal drawing mode. and one for rectangle drawing mode. i don't want to have to double click on the line and do a ctrl-click as i find it cumbersome. ctrl-<letter> and click (click-drag for rectangles) is quicker.

if i can do this from a script - ace. How? can you point me to the documentation about this please?

Primarily you will need the Object functions

This might help too . .. https://www.mql5.com/en/forum/112033

 

Thanks for the input. I know how to create and manage horizontal lines in specific places through the code.

What I'm after is a keyboard shortcut which switches my terminal into the horizontal line setting tool. I can them drag and place a line just like I can when I click on the horizontal line tool.

 

This is what's possible, so see if you can mix and match to get what you want:

- If you click and drag a script onto the chart, you can get the x,y coordinates of where you drop with WindowPriceOnDropped( ) and WindowTimeOnDropped( ) .

- You can right click on a script and click Set Hotkey to choose a keyboard shortcut to run it.

So you could have one shortcut to run a script that loads all your lines from file, another shortcut to delete them all, and one script you can drop on the chart to add a line. This is similar to what I do at the moment.

Reason: