Looking for advice/help in running ObjectFind() on dynamic string arrays

 

hi

I put together this EA using code from this forum (mostly) and am trying to implement my strategy...the strategy is roughly https://www.mql5.com/en/code/7066 but the lines I intend to use are any of the following

string buystop[] = {"d0a5v","d0a4v","d0a3v","d0a2v","d0a1v","d0aK","d0a5t","d0a4t","d0a3t","d0a2t","d0a1t","d0aB","d0a1x","d0a2x","d0a3x","d0a4x","d0a5x",
                    "d0c5v","d0c4v","d0c3v","d0c2v","d0c1v","d0cK","d0c5t","d0c4t","d0c3t","d0c2t","d0c1t","d0cB","d0c1x","d0c2x","d0c3x","d0c4x","d0c5x",
                    "w0a5v","w0a4v","w0a3v","w0a2v","w0a1v","w0aK","w0a5t","w0a4t","w0a3t","w0a2t","w0a1t","w0aB","w0a1x","w0a2x","w0a3x","w0a4x","w0a5x",
                    "w0c5v","w0c4v","w0c3v","w0c2v","w0c1v","w0cK","w0c5t","w0c4t","w0c3t","w0c2t","w0c1t","w0cB","w0c1x","w0c2x","w0c3x","w0c4x","w0c5x",
                    "m0a5v","m0a4v","m0a3v","m0a2v","m0a1v","m0aK","m0a5t","m0a4t","m0a3t","m0a2t","m0a1t","m0aB","m0a1x","m0a2x","m0a3x","m0a4x","m0a5x",
                    "m0c5v","m0c4v","m0c3v","m0c2v","m0c1v","m0cK","m0c5t","m0c4t","m0c3t","m0c2t","m0c1t","m0cB","m0c1x","m0c2x","m0c3x","m0c4x","m0c5x"};

string sellstop[] = {"d1a5v","d1a4v","d1a3v","d1a2v","d1a1v","d1aK","d1a5t","d1a4t","d1a3t","d1a2t","d1a1t","d1aB","d1a1x","d1a2x","d1a3x","d1a4x","d1a5x",
                     "d1c5v","d1c4v","d1c3v","d1c2v","d1c1v","d1cK","d1c5t","d1c4t","d1c3t","d1c2t","d1c1t","d1cB","d1c1x","d1c2x","d1c3x","d1c4x","d1c5x",
                     "w1a5v","w1a4v","w1a3v","w1a2v","w1a1v","w1aK","w1a5t","w1a4t","w1a3t","w1a2t","w1a1t","w1aB","w1a1x","w1a2x","w1a3x","w1a4x","w1a5x",
                     "w1c5v","w1c4v","w1c3v","w1c2v","w1c1v","w1cK","w1c5t","w1c4t","w1c3t","w1c2t","w1c1t","w1cB","w1c1x","w1c2x","w1c3x","w1c4x","w1c5x",
                     "m1a5v","m1a4v","m1a3v","m1a2v","m1a1v","m1aK","m1a5t","m1a4t","m1a3t","m1a2t","m1a1t","m1aB","m1a1x","m1a2x","m1a3x","m1a4x","m1a5x",
                     "m1c5v","m1c4v","m1c3v","m1c2v","m1c1v","m1cK","m1c5t","m1c4t","m1c3t","m1c2t","m1c1t","m1cB","m1c1x","m1c2x","m1c3x","m1c4x","m1c5x"};

...and, what I'm trying to accomplish is, since any number of the objects with the names above can be present on the chart, to Find all objects with 0 as 2nd character in name, place the full object names in an array ordered by proximity to price, and do the same where second character is 1.

ps. I am attaching a copy of my coding "endeavor" please advise, any tips/help/clues/ideas would be of great help, I'm sure, Thank You.

TrendMeLeaveMe
TrendMeLeaveMe
  • www.mql5.com
Just draw Trend Up or Trend Down before the Expert Advisor "TrendMeLeaveMe" start. Set properties, run expert and go to sleep or work. This expert does not work automatically. You must draw trend up, trend down or horizontal trend. Name it buystop or sellstop , set BuyStop_StepUpper, BuyStop_StepLower, SellStop_StepUpper and...
Files:
 
Alex Go: full object names in an array ordered by proximity to price,

For that you are going to need a full, general sorting method:

My insertion sort (non-pointer) method.
          Sort multiple arrays - MQL4 programming forum
          Array or not to array - Trading Positions - MQL4 programming forum - Page 2

Or (object pointer) CList method:
          pass generic class data field - Swing Trades - MQL4 programming forum