Download MetaTrader 5
To add comments, please log in or register
Sell products via the Market and track your sales statistics
tafadzwa
117
tafadzwa 2014.03.24 10:51 
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.
Alain Verleyen
Moderator
28518
Alain Verleyen 2014.03.24 19:05  
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.
Emiliano Graziosi
40
Emiliano Graziosi 2014.03.24 19:25  
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

whroeder1
13593
whroeder1 2014.03.24 20:45  

  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
/
To add comments, please log in or register