Locate price at mouse position

 

Hi guys

 

I want to code an alarm which i can drag from the navigator menu and drop it right on the chart. This "indicator" should place a horizontal line at exactly the price where i dropped it on the chart, giving me an alarm when price rises above (or falls below) that very price.

 

So this is my problem: How can i determine what the price is at the location where i dropped the indicator?

 

Thanks for your help :)

 
ChartPriceOnDropped - Chart Operations - MQL4 Reference
ChartPriceOnDropped - Chart Operations - MQL4 Reference
  • docs.mql4.com
ChartPriceOnDropped - Chart Operations - MQL4 Reference
 
honest_knave:

ChartPriceOnDropped()

It was only for the EA or script.

 
RichPiano:

Hi guys

 

I want to code an alarm which i can drag from the navigator menu and drop it right on the chart. This "indicator" should place a horizontal line at exactly the price where i dropped it on the chart, giving me an alarm when price rises above (or falls below) that very price.

 

So this is my problem: How can i determine what the price is at the location where i dropped the indicator?

 

Thanks for your help :)

Use indicator with OnChartEvent() and then CHARTEVENT_OBJECT_CLICK and then CHART_EVENT_MOUSE_MOVE and then ChartXYToTimePrice and then draw the line. ^_^
 
Roberto Jacobs:

It was only for the EA or script.

Indeed. But the OP also wanted to:

drag from the navigator menu and drop it right on the chart [...] place a horizontal line at exactly the price where i dropped it on the chart

So, there are several options to achieve this... Use a script, use an EA, or use a script in combination with an EA or indicator.

Advantages and shortcomings for all of them.

 
Thanks all, I'll try it out :)