How can I detect Arrow up and Arrow down in chart?Arrows are objects.

 

Hi everybody,

I have an indicator that draw arrow up and arrow down as object on chart,

I want to program an EA that trades by these arrows,

I have two questions:

1-How can I find when these objects drawn?(how can I detect these objects?)

2-How can I find out difference between arrow up and arrow down?(all of arrows are objects)


BR

 
  1. Arrows may be objects - figure out the naming pattern and scan for them.
  2. Arrows may also be buffers of type arrow - iCustom.
 
William Roeder:
  1. Arrows may be objects - figure out the naming pattern and scan for them.
  2. Arrows may also be buffers of type arrow - iCustom.

1.How can I find naming pattern of these arrows? I think about this indicator naming patterns, I guess that name of arrows includes times of candles that convert to seconds.

2.How can I scan name of objects? objects names includes fixed string characters + numbers.

3.How can I call arrow codes in these objects? I saw that these up and down arrows have different codes.


BR

 
Mohammad Hasan Mosaddeqi:

1.How can I find naming pattern of these arrows? I think about this indicator naming patterns, I guess that name of arrows includes times of candles that convert to seconds.

2.How can I scan name of objects? objects names includes fixed string characters + numbers.

3.How can I call arrow codes in these objects? I saw that these up and down arrows have different codes.

  1. Open the object list (Charts → Objects → Objects list / Control+B) and look at the names with your eyes and think with your Brain. If you see up1, up2, etc., that is a pattern.

  2. Open the object list (Charts → Objects → Objects list / Control+B) and look at the names with your eyes.

  3. Perhaps you should read the manual, starting with MQL4 Reference → Object Functions. But I doubt you need the code as the object name will probably be enough.

  4. Did you open the data window (View → Data Window / Control+D) and see if the indicator is using buffers? This is what most indicators do. Buffers can display many types including arrows.
 
William Roeder:
  1. Open the object list (Charts → Objects → Objects list/Control+B) and look at the names with your eyes and think with your Brain. If you see up1, up2, etc., that is a pattern.


  2. Open the object list (Charts → Objects → Objects list/Control+B) and look.

  3. Perhaps you should read the manual, starting with MQL4 Reference → Object Functions. But I doubt you need the code as the object name will probably be enough.

  4. Did you open the data window and see if the indicator is using buffers?

Dear William,

Indicator has no buffers.I checked it by open data window on mt4.

I found that all objects have index.Can I call last object by index?

 
William Roeder:
  1. Open the object list (Charts → Objects → Objects list / Control+B) and look at the names with your eyes and think with your Brain. If you see up1, up2, etc., that is a pattern.

  2. Open the object list (Charts → Objects → Objects list / Control+B) and look at the names with your eyes.

  3. Perhaps you should read the manual, starting with MQL4 Reference → Object Functions. But I doubt you need the code as the object name will probably be enough.

  4. Did you open the data window (View → Data Window / Control+D) and see if the indicator is using buffers? This is what most indicators do. Buffers can display many types including arrows.

This is Object List of this indicator:

Did You see any patterns?!

 
Mohammad Hasan Mosaddeqi: Did You see any patterns?!

I see a prefix of "arrows:" followed by a timestamp 157599360 = Tue, 10 Dec 2019 16:00:00 GMT
          Online Conversion - Unix time conversion

And I see other prefix of "Label_" followed by a number.

Mohammad Hasan Mosaddeqi: I found that all objects have index.Can I call last object by index?

If you don't know an object's name, that is how you can find it. Of course the index will change as objects are added and deleted.

 
William Roeder:

I see a prefix of "arrows:" followed by a timestamp 157599360 = Tue, 10 Dec 2019 16:00:00 GMT
          Online Conversion - Unix time conversion

And I see other prefix of "Label_" followed by a number.

If you don't know an object's name, that is how you can find it. Of course the index will change as objects are added and deleted.

1.How can I convert this timestamp in mql4?

2.Can I find last object by index or by timestamp in mql4?if yes,How? (my purpose is to trade by last arrow that appears on chart. for example, when arrow appear on last candle,EA open position base on arrow cede (buy or sell)).


BR  

 
  1. Cast your int to a datetime.
  2. Of course you can. Go through the list and find the largest datetime.
 
William Roeder:
  1. Cast your int to a datetime.
  2. Of course you can. Go through the list and find the largest datetime.

Dear William,

Thank you very much for your support,

I have a question,

1.Objects names includes "arrows: " + "NUMBERS",I want to cast integer part ("NUMBERS") of objects name to date-time and specify last of all objects. How can I separate this two part of objects name? 

 
Mohammad Hasan Mosaddeqi:

How can I separate this two part of objects name? 

Hi Mohammad.

either use https://docs.mql4.com/strings/stringsubstr

or https://docs.mql4.com/strings/stringsplit

StringSubstr - String Functions - MQL4 Reference
StringSubstr - String Functions - MQL4 Reference
  • docs.mql4.com
StringSubstr - String Functions - MQL4 Reference