Entry & Stop Marker

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Entry & Stop Marker

Postby Silverthorn » Sun Nov 17, 2019 11:24 pm

Hi Apprentice.

I have written this simple indicator that will probably be useful to somebody else. It simply marks a position on the chart where you would like to enter a trade and place your stop loss. To place your entry and stop loss you use the right click menu.

The positions are stored in a database so they are displayed across all time frames for the pair.

It currently draws the lines from within the update function so it only updates at the next tick. The problem with that is that there is sometimes a lag waiting for the next tick and you can't plan trades out of trading hours because there are no ticks coming in.

If I understand the documentation correctly it should update instantly if I draw from within the draw function. I can't seem to get this to work and am struggling to debug because there is no right click available in the SDK.

Can you please help or give me an example of how to do this?
Attachments
Entry&Stop Marks.lua
(5.1 KiB) Downloaded 22 times
Last edited by Silverthorn on Sat Nov 23, 2019 10:24 pm, edited 1 time in total.
User avatar
Silverthorn
 
Posts: 64
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia

Re: Entry & Stop Marker

Postby Silverthorn » Tue Nov 19, 2019 2:04 am

Ok reading this about the Draw().

"Also, all context methods works in terms of pixels, not in terms of date/time and price, so every time when the chart is scrolled, zoomed, or the size of the chart window is changed, the position and size of the objects are changed accordingly."

How do I convert the Date/Time position to pixles?
User avatar
Silverthorn
 
Posts: 64
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia


Re: Entry & Stop Marker

Postby Silverthorn » Tue Nov 19, 2019 7:12 pm

Hi Apprentice. Thanks for the help.
After a couple of unsuccessful tries I found it easier to create a new function to draw the lines and call that from the Draw function. Working well now.

Update attached.
Entry&Stop Marks.lua
(5.1 KiB) Downloaded 34 times
User avatar
Silverthorn
 
Posts: 64
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia


Return to Custom Indicators

Who is online

Users browsing this forum: Google [Bot], wuhuilin11 and 9 guests