Advise on this thought.

 
i want a peace of code in an indicator that does the following : search in the history of a currency pair for the open price (bid) that is equal to the current open price (bid). How best can this be done? Thank yu.
 
tafadzwa:
i want a peace of code in an indicator that does the following : search in the history of a currency pair for the open price (bid) that is equal to the current open price (bid). How best can this be done? Thank yu.

If you can't find what you need in the Codebase or the Market, then you can create a request in Jobs Service.
 
angevoyageur:

If you can't find what you need in the Codebase or the Market, then you can create a request in Jobs Service.


If I correctly understand you must search the open prices of each bar, so a straightforward way is to implement a while loop something like:

int maxnumberofbars = 400;

int i = 1;

bool openpricefound = false;

while(i<=maxnumberofbars && openpricefound==false)

{

if (Open[i] == Bid) openpricefound == true

<any other logic you want on the price must be put in the if>

i++;

}

Bye

 

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. if (Open[i] == Bid) openpricefound == true
    Likely will never match. The == operand. - MQL4 forum